Created
January 27, 2024 13:05
-
-
Save rcastellotti/9355c00d55f4c747f3b173fbbd8661b5 to your computer and use it in GitHub Desktop.
curl | pup | jq script to fetch recipes from https://giallozafferano.it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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