Skip to content

Instantly share code, notes, and snippets.

@octagonal
Last active December 27, 2019 21:20
Show Gist options
  • Save octagonal/8668642 to your computer and use it in GitHub Desktop.
Save octagonal/8668642 to your computer and use it in GitHub Desktop.
Fast + Simple 4chan Image Downloader
#!/usr/bin/sh
# Every time you use this, Moot sheds a single manly tear. Please use it sparingly if at all.
echo -e "(curl)\t\t Downloading thread"
curl -s http://boards.4chan.org/$1 -o thread.html
echo -e "(grep -Po)\t Finding images "
cat thread.html | grep -Po '(?<=fileThumb" href=")\S+(?=")' > img
echo -e "(sed)\t\t Extracting image links"
sed -i "s/\/\///g" img
echo -e "(mkdir)\t Building directory from argument"
#imgdir=`echo $1 | sed "s/\//-/g"`
mkdir -p $1 2>/dev/null
cd $imgdir
echo -e "(curl)\t\t Downloading images, might take a few seconds"
xargs -n 1 curl -s -O < ../img
echo -e "(rm)\t\t Removing helper files"
rm ../thread.html
rm ../img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment