Created
December 5, 2024 08:13
-
-
Save aborruso/729e1599677aab465f29a6a0d2e92828 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
# Requirements: | |
# - scrape-cli: https://pypi.org/project/scrape-cli/ | |
# - yq: https://github.com/kislyuk/yq | |
# - miller: https://github.com/johnkerl/miller | |
# Script to scrape movie ratings and details from "https://www.mymovies.it/cinema/palermo/" | |
curl -kL "https://www.mymovies.it/cinema/palermo/" | | |
scrape -be '//span[contains(@class, "mm-text-white")] | //div[div[span[contains(@class, "mm-text-white")]]]/following::div[1]' | | |
xq -c ' | |
[ | |
[.html.body.span[].span.strong], | |
[.html.body.div[].div[1].a["#text"]], | |
[.html.body.div[].div[1].a["@href"]] | |
] | |
| transpose[] | |
| {voto: .[0], titolo: .[1], URL: .[2]} | |
' | | |
mlr --j2c put ' | |
$voto = fmtnum(float($voto), "%.2f") | |
' then sort -nr voto | | |
mlr --c2p --barred cat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment