Jow Forums Download Script

this thread is peak nu/g/

I made shit.

#!/usr/bin/env bash

[ $# -ge 1 -a -f "$1" ] && input="$1" || input="-"

while IFS= read -r url; do
if [ -z "$url" ]; then
continue
fi

board="$(printf -- '%s' "${url:?}" | cut -d '/' -f4)"
thread="$(printf -- '%s' "${url:?}" | cut -d '/' -f6)"
workdir="Jow Forums/$board/$thread"

mkdir -p "$workdir" "$workdir/media" "$workdir/thumbnails" "$workdir/snapshots" > /dev/null 2>&1
pushd "$workdir" > /dev/null 2>&1

echo "$url" > url.txt

curl --silent --time-cond "$thread.json" --user-agent 'Mozilla/5.0' \
"a.4cdn.org/$board/thread/$thread.json" --output ".$thread" > /dev/null 2>&1

if [ -s ".$thread" ]; then
isodate=$(date -u +'%Y%m%dT%H%M%SZ')
echo "$url"

"$thread.json"
cp ".$thread" "snapshots/$thread.$isodate.json"
mv ".$thread" "$thread.json"
else
echo "$url" >&2
fi

jq -r '
.posts[]
| select(.tim != null)
| .ext as $ext
| "

wget called, this shit already exists
Good job though, user

Thanks, lads

that's pretty niggerlicious.

a.4cdn.org/g/threads.json
a.4cdn.org/g/thread/51971506.json

You know, all threads have a json file..

a.4cdn.org/g/thread/70447342.json

u can do this w/wget
but w/e well done u made somethin

Your point being?

You can press x to .json

OP could also download the JSON file as an additional feature.
Or he could stop wasting his life downloading anything off this website.