Usage: sh -c 1.sh > 1.html
Open 1.html in a browser and it shows whether each "great movie" is available as Prime Video or whether it is only available in some other format, such as Blu-ray, DVD, Multi-format, Hardcover. A link to the item on Amazon is provided. #!/bin/sh
curl -HUser-Agent: -H'Accept: application/json' --compressed 'https://www.rogerebert.com/great-movies/page/[1-16]?utf8=%E2%9C%93&filters%5Btitle%5D=&sort%5Border%5D=newest&filters%5Byears%5D%5B%5D=1914&filters%5Byears%5D%5B%5D=2020&filters%5Bstar_rating%5D%5B%5D=0.0&filters%5Bstar_rating%5D%5B%5D=4.0&filters%5Bno_stars%5D=1'|grep -o "/reviews/great-movie-[^\\]*"|sed 's/.reviews.great-movie-//'|sort|uniq|while read x;do y=$(echo $x|sed 's/-/+/g');echo $x;curl -s --compressed -HUser-Agent: https://www.amazon.com/s/?k=$y 2>/dev/null|grep -m1 -C4 a-link-normal.a-text-bold;sleep 87;done|sed '/^[^< ]/s/.*/@&,/;1s|.*|<base href=https://www.amazon.com />&|;s/ *//;/^$/d;/^[@<]/!s|$|</a>|;1s/@//;s/@/<br>/' #/bin/sh
test -s max-PMID||echo 32449615 > max-PMID;read x < max-PMID;h=pubmed.ncbi.nlm.nih.gov;
test ${#x} -eq 8||rm max-PMID;sed -i "s/[0-9]\{8\}/$x/" $0;
case $1 in update) mkfifo 1.fifo 2>/dev/null;test -p 1.fifo||exec echo need 1.fifo;
(grep "<title>PMID .* is not available" < 1.fifo|sed 1q|sed -n 's/<title>PMID //;s/ *//;s/ .*//;wmax-PMID')&
y=$((x+10000));seq $x $y|sed '$!s|.*|GET /&/ HTTP/1.1\r\nHost: '"$h"'\r\nConnection: keep-alive\r\n\r\n|;
$s|.*|GET /&/ HTTP/1.1\r\nHost: '"$h"'\r\nConnection: close\r\n\r\n|'|socat - ssl:$h:443 2>/dev/null|grep -o '<title>[^<]*' >1.fifo;
;;"")awk -v min=1 -v max=$((x-1)) 'BEGIN{srand();printf "https://'$h'/" int(min+rand()*(max-min+1)) "/\n"}';esac #!/bin/sh
test -s max-PMID||echo 32446294 > max-PMID;read x < max-PMID;x=$((x-1));h=pubmed.ncbi.nlm.nih.gov;
test ${#x} -eq 8||exec echo weird max-PMID;sed -i "/test/s/echo [0-9]\{8\} /echo $x /" $0;
case $1 in update) mkfifo 1.fifo 2>/dev/null;test -p 1.fifo||exec echo need 1.fifo;
(grep "<title>PMID .* is not available" < 1.fifo|sed 1q|sed 's/<title>PMID //;s/ *//;s/ .*//;' >max-PMID)&
y=$((x+10000));seq $x $y|sed '$!s|.*|GET /&/ HTTP/1.1\r\nHost: '"$h"'\r\nConnection: keep-alive\r\n\r\n|;
$s|.*|GET /&/ HTTP/1.1\r\nHost: '"$h"'\r\nConnection: close\r\n\r\n|'|socat - ssl:$h:443 >1.fifo 2>/dev/null;
;;"")awk -v min=1 -v max=$x 'BEGIN{srand();printf "https://'$h'/" int(min+rand()*(max-min+1)) "/\n"}';esac nyt tr |sed 's/ *//;/</!d'|uniq > travel.html
This will produce a simple web page of titles and URLs for each article page. curl -O `grep -o https://[^\"]*mp4 article.html` #! /bin/sh
case $1 in
world |w*) x=world # shortcut: w
;;us |u*) x=us # shortcut: u
;;politics |p*) x=politics # shortcut: p
;;nyregion |n*) x=nyregion # shortcut: n
;;business |bu*) x=business # shortcut: bu
;;opinion |o*) x=opinion # shortcut: o
;;technology |te*) x=technology # shortcut: te
;;science |sc*) x=science # shortcut: sc
;;health |h*) x=health # shortcut: h
;;sports |sp*) x=sports # shortcut: sp
;;arts |a*) x=arts # shortcut: a
;;books |bo*) x=books # shortcut: bo
;;style |st*) x=style # shortcut: st
;;food |f*) x=food # shortcut: f
;;travel |tr*) x=travel # shortcut: tr
;;magazine |m*) x=magazine # shortcut: m
;;t-magazine |t-*) x=t-magazine # shortcut: t-
;;realestate |r*) x=realestate # shortcut: r
;;*)
echo usage: $0 section
exec sed -n '/x=/!d;s/.*x=//;/sed/!p' $0
esac
curl -s https://static01.nyt.com/services/json/sectionfronts/$x/index.jsonp
Example: Make simple page of titles, article urls and captions, where above script is named "nyt".
nyt tr | sed '/\"headline\": \"/{s//<p>/;s/\".*/<\/p>/;p};/\"full\": \"/{s//<p>/;s/..$/<\/p>/;p};/\"link\": \"/{s///;s/ *//;s/\".*//;s|.*|<a href=&>&</a>|;p}' > travel.html
firefox ./travel.html
Source: https://news.ycombinator.com/item?id=22125882
I could be wrong, I am not a Prime Video user, but the result I got was that there are 217 movies in Prime Video from Ebert's great movies.
Instructions on how to generate 1.html are here: https://news.ycombinator.com/item?id=23508182