From 8765a68903561cb990b20747eaf2d4ac85bbc4e2 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Mon, 2 Sep 2019 15:56:44 +1000 Subject: Added support for archive.rebeccablacktech.com. Patched regex generator to now match any URL ending with a downloaded file for replacement in the HTML. This is due to some sites hosting the same file across multiple CDN servers, thus creating different links to the same file within the page. --- 4car | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/4car b/4car index 0417d21..727a6e2 100755 --- a/4car +++ b/4car @@ -24,9 +24,10 @@ split_pipe() { } filter_image_urls() { - grep -oe 'http[s]*:\/\/i\.4cdn\.org\/[a-z0-9]\+\/[0-9]\+\.[a-zA-Z0-9]\+' \ - -e 'http[s]*:\/\/is[0-9]\+\.4chan\.org\/[a-z0-9]\+\/[0-9]\+\.[a-zA-Z0-9]\+' \ - -e 'http[s]*:\/\/img\.fireden\.net\/[a-z0-9]\+\/image\/[0-9]\+\/[0-9]\+\/[0-9]\+\.[a-zA-Z0-9]\+' + grep -oe 'http[s]\?:\/\/i\.4cdn\.org\/[a-z0-9]\+\/[0-9]\+\.[a-zA-Z0-9]\+' \ + -e 'http[s]\?:\/\/is[0-9]\+\.4chan\.org\/[a-z0-9]\+\/[0-9]\+\.[a-zA-Z0-9]\+' \ + -e 'http[s]\?:\/\/img\.fireden\.net\/[a-z0-9]\+\/image\/[0-9]\+\/[0-9]\+\/[0-9]\+\.[a-zA-Z0-9]\+' \ + -e 'http[s]\?:\/\/s[0-9]\+\.desu-usergeneratedcontent\.xyz\/[a-z0-9]\+\/image\/[0-9]\+\/[0-9]\+\/[0-9]\+\.[a-zA-Z0-9]\+' } # Check dependencies @@ -59,7 +60,7 @@ for i in "$@"; do wget -i - -P "$dir" -nv |& split_pipe | filter_image_urls | - sed "s/\(.*\)\/\(.*\)/s;\1\/\2;.\/$rdir\/\2;g/" | + sed "s/\(.*\)\/\(.*\)/s;http[s]\\\\{0,1\\\\}:\/\/[^ \"]*\/\2;.\/$rdir\/\2;g/" | sed -f - "$file" | sponge "$file" done -- cgit v1.3