commit 2cd54406606c037c974415a77d16264070356d72 Author: CactiChameleon9 <51231053+CactiChameleon9@users.noreply.github.com> Date: Tue Sep 19 14:43:42 2023 +0100 Add basic single URL scraping diff --git a/scrape-all.sh b/scrape-all.sh new file mode 100644 index 0000000..8a8a9d6 --- /dev/null +++ b/scrape-all.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +update_cache() { + cache=$(curl "$1" -s) +} + +get_main_ingredients() { + if [[ -z "$1" ]]; then + local data=$cache + else + local data=$1 + fi + + echo "$data" | htmlq -p | grep '.*' | sed 's/^.*//' | sed 's/<\/a>.*//' + echo "$data" | htmlq -p | grep '.*' | sed 's//@/g' | awk -F@ '{print $2}' +} + +get_json() { + if [[ -z "$1" ]]; then + local data=$cache + else + local data=$1 + fi + + echo "$data" | htmlq -p | grep '