Skip to content

Instantly share code, notes, and snippets.

@gwennlbh
Created February 7, 2021 18:26
Show Gist options
  • Save gwennlbh/85dace13d9a270fcc3335df73efec343 to your computer and use it in GitHub Desktop.
Save gwennlbh/85dace13d9a270fcc3335df73efec343 to your computer and use it in GitHub Desktop.
Image collection from 4chan.org using jq, curl, echo and a $BROWSER
# Replace CHAN with desired 4chan.org/CHAN (eg 'c') and OUTFILE with a .html file to output the gallery to
# Be sure that you have defined a $BROWSER
curl https://a.4cdn.org/CHAN/catalog.json | jq "[.[].threads[] | {title: .sub?, post: (.last_replies[]? | { img: ((.tim? | tostring) + .ext?), comment: .com? })}]" | jq '[.[] | "<h2>\(.title)</h2><img src=https://i.4cdn.org/CHAN/\(.post.img) />"] | join("<hr>")' > OUTFILE && echo "<style>img{max-width:100vw}</style>" >> OUTFILE && $BROWSER OUTFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment