Advertisement
Guest User

8chan.moe script downloader (v0.3)

a guest
Dec 10th, 2022
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.78 KB | None | 0 0
  1. #!/bin/bash
  2. chan_thread=$1;
  3. # Get domain of the site (8chan.moe, 8chan.se, etc)
  4. chan_domain=$(echo $chan_thread | cut -d"/" -f1-3);
  5. # Download the thread's html and embedded elements
  6. wget --no-cookies --header 'Cookie: splash=1' --referer "$chan_domain" -N --convert-links --page-requisites $chan_thread;
  7. # Make the thread locally accessible
  8. local_thread=$(echo $chan_thread | cut -d"/" -f3-);
  9. # Download the files uploaded to the thread
  10. wget --no-cookies --header 'Cookie: splash=1' --referer "$chan_domain" -N --mirror $(grep -o -i -P 'href=".+/.media/[a-f0-9]{64}(\.[^"]+)?' $local_thread | sed 's/href="//g' | sort -u);
  11. # Make the html point to the files saved with the previous command
  12. sed -i 's/\(href="\).\+\(\/.media\/[a-f0-9]\{64\}\(\.[^"]\+\)\?\)/\1..\/..\2/g' $local_thread;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement