#!/bin/bashchan_thread=$1;# Get domain of the site (8chan.moe, 8chan.se, etc)chan_domain=$(echo$chan_thread| cut -d"/" -f1-3);# Download the thread's html and embedded elementswget --no-cookies --header 'Cookie: splash=1' --referer "$chan_domain" -N --convert-links --page-requisites $chan_thread;# Make the thread locally accessiblelocal_thread=$(echo$chan_thread| cut -d"/" -f3-);# Download the files uploaded to the threadwget --no-cookies --header 'Cookie: splash=1' --referer "$chan_domain" -N --mirror $(grep -o -i -P 'href=".+/.media/[^"]+'$local_thread| sed 's/href="//g'| sort -u);# Make the html point to the files saved with the previous commandsed -i 's/\(href="\).\+\(\/.media\/[^"]\+\)/\1..\/..\2/g'$local_thread;