Skip to content

Instantly share code, notes, and snippets.

@vitezfh
Last active January 26, 2024 13:31
Show Gist options
  • Save vitezfh/8264898719ad6aebe633c82938694aea to your computer and use it in GitHub Desktop.
Save vitezfh/8264898719ad6aebe633c82938694aea to your computer and use it in GitHub Desktop.
scrape-ch is a simple command line tool for scraping media (webm, jpg, png) from a 4ch thread. Useful for fetching wallpapers
#! /bin/bash
directory="4ch_pictures"
directory_named=0
url=""
for arg in "$@"; do
if [ "$arg" == "--help" ] || [ "$arg" == "-h" ]; then
echo "Scrapes all media from a 4ch thread;
Usage:
scrape-ch target_thread_url [-d download path]
Example:
scrape-ch 'https://boards.4chan.org/wg/thread/7565401' -d 'space-wallpapers'"
continue
fi
if [ "$directory_named" == 1 ]; then
directory=$arg
directory_named=0
continue
fi
if [ "$arg" == "-d" ]; then
directory_named=1
continue
fi
url=$arg
done
if [ "$url" != "" ]; then
wget -P "$directory" -nd -r -l 1 -H -D i.4cdn.org -A png,gif,jpg,jpeg,webm -R '?????????????s.*' "$url"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment