mad/hosts/eternalhosting.sh
kittykat d62376f7a8
# 2025.02.18 - [uploadhive] Add handling of the new /cgi-bin/dl.cgi/ url tickets (WIP)
#               (unfortunately, this is tied to the requesting ip, so downloads get "Wrong IP")
# 2025.02.18 - [up_oshi] Add Manage url as comment on uploads
# 2025.02.18 - [up_oshi / oshi] use /nossl/ url and http
# 2025.02.17 - [gofile] Add a random sleep if 429 response detected (too many requests)
# 2025.02.17 - [*ALL] Audit and update all single bracket operations
# 2025.02.17 - [filehaus] Fix downloading from fh
# 2025.02.15 - [uploadbay] Update urls regex for acceptable alternate
# 2025.02.15 - [up_sendnow] Add send.now as upload host
# 2025.02.15 - [sendnow] Fix handling of filenames with special characters in url
2025-02-19 13:41:07 +00:00

46 lines
2.1 KiB
Bash

#! Name: eternalhosting.sh
#! Author: kittykat
#! Version: 2024.12.28
#! Desc: Add support for downloading and processing of urls for a new host
#! Usage: Copy this file into the ./${ScriptDir}/hosts/ folder
#!
#!
#! ------------ REQUIRED SECTION ---------------
#! @[UPDATE] HostAndDomainRegexes: This string is loaded into mad.sh and allows dynamic handling of new url data
#! Format: '/HostCode/HostNick/HostFuncPrefix:HostDomainRegex@'
#! HostCode: <aUniqueCodeForHost> (ie. 'fh' for filehaus -- cannot be used by other hosts)
#! HostNick: What is displayed throughout MAD output (ie. 'filehaus' -- "urls.txt has 10 filehaus.." will be displayed)
#! HostFuncPrefix: <aUniqueStringThatMustPrefixHostFunctions> (ie. 'fh' -- fh_DownloadFile(), fh_FetchFileInfo() .. )
#! * Note: Must begin with a letter a-z (functions beginning with numbers are no bueno)
#! HostDomainRegex: The regex used to verify matching urls
HostCode='eh'
HostNick='eternal hosting'
HostFuncPrefix='eh'
HostUrls='eternalcbrzpicytj4zyguygpmkjlkddxob7tptlr25cdipe5svyqoqd.onion'
HostDomainRegex='^(http|https)://eternalcbrzpicytj4zyguygpmkjlkddxob7tptlr25cdipe5svyqoqd\.onion/file/'
#!
#! !! DO NOT UPDATE OR REMOVE !!
#! This merges the Required HostAndDomainRegexes into mad.sh
ListHostAndDomainRegexes=${ListHostAndDomainRegexes}'/'${HostCode}'/'${HostNick}'/'${HostFuncPrefix}'/'${HostUrls}':'${HostDomainRegex}'@'
#!
#!
#! ------------ (1) Host Main Download Function --------------- #
#!
#! @REQUIRED: Host Main Download function
#! Must be named specifically as such:
#! <HostFuncPrefix>_DownloadFile()
eh_DownloadFile() {
local pUrl="$1"
local pFileCnt="$2"
local pUrlMod="$pUrl"
if grep -Eqi '\.onion' <<< "$pUrlMod" && grep -Eqi 'https://' <<< "$pUrlMod" ; then
echo -e "${PINK}| Reverting .onion address to http...${NC}"
pUrlMod="${pUrlMod/https/http}"
fi
if grep -Eqi '\.onion/file/' <<< "$pUrlMod" ; then
echo -e "${PINK}| Switching to download url...${NC}"
pUrlMod="${pUrlMod/\.onion\/file\//\.onion\/download\/}"
fi
echo -e "[${BLUE}ModifiedUrl${NC}]: ${pUrlMod}"
direct_DownloadFile "$pUrl" "$pFileCnt" "$pUrlMod"
}