Skip to content

Instantly share code, notes, and snippets.

@rcastellotti
Created January 27, 2024 13:05
Show Gist options
  • Save rcastellotti/9355c00d55f4c747f3b173fbbd8661b5 to your computer and use it in GitHub Desktop.
Save rcastellotti/9355c00d55f4c747f3b173fbbd8661b5 to your computer and use it in GitHub Desktop.
curl | pup | jq script to fetch recipes from https://giallozafferano.it
#!/usr/bin/env sh
usage() {
cat "Usage: $(basename "$0") <giallozafferano.it URL>"
exit 0
}
[ -z "$1" ] && { usage; }
if ! command -v pup > /dev/null
then
echo "pup could not be found: https://github.com/ericchiang/pup"
exit 1
fi
if ! command -v jq > /dev/null
then
echo "jq could not be found"
exit 1
fi
curl -s "$1" \
| pup 'script[type="application/ld+json"] text{}' \
| jq -s first \
| jq 'del(.video, .aggregateRating, .interactionStatistic, .keywords, .author, .datePublished, .dateModified, ."@context", ."@type", .image)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment