36 lines
2.4 KiB
Bash
Executable File
36 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Re-captures test/fixtures from the real services. Run by hand, never from tests.
|
|
# Wayback: honest User-Agent and 10 s between requests (spec §2.2), or it flags us as a bot.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
F=test/fixtures
|
|
mkdir -p "$F/webtoons" "$F/wayback" "$F/mangabaka" "$F/images"
|
|
BROWSER='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0 Safari/537.36'
|
|
TOOL='mangabaka-seeder/0.1.0 (+https://gitea.lucaswinther.info/lucasw89/mangabaka-seeder)'
|
|
get() { curl -sSfL --max-time 90 -A "$1" -o "$2" "$3"; echo "ok $2 ($(wc -c <"$2") bytes)"; }
|
|
wb() { get "$TOOL" "$1" "$2"; sleep 10; }
|
|
|
|
# Webtoons: the /-/-/-/ form (official) or /-/canvas/-/ form (canvas) 301s to the canonical page.
|
|
get "$BROWSER" "$F/webtoons/tower-of-god.html" 'https://www.webtoons.com/-/-/-/list?title_no=95'
|
|
get "$BROWSER" "$F/webtoons/crow-time-canvas.html" 'https://www.webtoons.com/-/canvas/-/list?title_no=693372'
|
|
get "$BROWSER" "$F/webtoons/zombie-revelation-mature.html" 'https://www.webtoons.com/-/-/-/list?title_no=6065'
|
|
|
|
CDX='https://web.archive.org/cdx/search/cdx?matchType=prefix&filter=statuscode:200&collapse=timestamp:6&fl=timestamp,original&url='
|
|
wb "$F/wayback/tower-of-god-cdx-www.txt" "${CDX}www.webtoons.com/en/fantasy/tower-of-god/list?title_no=95"
|
|
wb "$F/wayback/tower-of-god-cdx-m.txt" "${CDX}m.webtoons.com/en/fantasy/tower-of-god/list?title_no=95"
|
|
row() { grep -m1 "^$1" "$F/wayback/tower-of-god-cdx-www.txt"; }
|
|
read -r TS ORIG <<<"$(row 2015)"; wb "$F/wayback/tower-of-god-2015.html" "https://web.archive.org/web/${TS}id_/${ORIG}"
|
|
read -r TS ORIG <<<"$(row 2023)"; wb "$F/wayback/tower-of-god-2023.html" "https://web.archive.org/web/${TS}id_/${ORIG}"
|
|
|
|
API='https://api.mangabaka.org/v1/series/9999'
|
|
get "$TOOL" "$F/mangabaka/series-9999.json" "$API"
|
|
get "$TOOL" "$F/mangabaka/links-9999.json" "$API/links?limit=100"
|
|
get "$TOOL" "$F/mangabaka/images-9999-page1.json" "$API/images?limit=24&page=1"
|
|
get "$TOOL" "$F/mangabaka/images-9999-page2.json" "$API/images?limit=24&page=2"
|
|
|
|
IMG='https://swebtoon-phinf.pstatic.net'
|
|
get "$BROWSER" "$F/images/poster-95.jpg" "$IMG/20250204_46/17386458444547o1b2_JPEG/95.jpg"
|
|
get "$BROWSER" "$F/images/foreground-95.png" "$IMG/20230324_64/1679612177711Smf0u_PNG/6TowerOfGod_landingpage_desktop_fg.png"
|
|
get "$BROWSER" "$F/images/landing-2023.jpg" "$IMG/20230324_114/1679612146968KhLLz_JPEG/6TowerOfGod_landingpage_mobile.jpg"
|
|
echo "done"
|