Created
March 16, 2024 08:36
-
-
Save aborruso/2599f282a4f122f6cd292f9ed913228d to your computer and use it in GitHub Desktop.
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
### requisiti ### | |
# | |
# yq https://github.com/kislyuk/yq | |
# scrape-cli https://github.com/aborruso/scrape-cli | |
# mlr https://github.com/johnkerl/miller | |
# | |
### requisiti ### | |
# scarica la lista dei film a Palermo | |
curl -kL "https://www.mymovies.it/cinema/palermo/" | \ | |
# estrai il div che contiene il voto medio e il successivo | |
scrape -be '//span[contains(@class, "mm-text-white")] | //div[div[span[contains(@class, "mm-text-white")]]]/following::div[1]' | \ | |
# converti in JSON e estrai voto, titolo e URL | |
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]}' | \ | |
# converti in CSV e ordina per voto decrescente | |
mlr --j2c put '$voto=fmtnum(float($voto), "%.2f")' then sort -nr voto |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment