logo

utils

~/.local/bin tools and git-hooks
commit: 5c7bef349d7ec874ee337858fbf3c7ea2d91588e
parent: c18982151fa006083e9cccd0540fa4473afde264
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed, 23 Aug 2017 23:47:48 +0200

bin/manga{here.co,reader.net}.sh: Add script to fetch scan images

Diffstat:

Abin/mangahere.co.sh13+++++++++++++
Abin/mangareader.net.sh13+++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/bin/mangahere.co.sh b/bin/mangahere.co.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +name="${1}" + +for chap in $(seq -w 001 "${2:-1}") + do mkdir -p "${HOME}/${name}/${chap}" + cd "${HOME}/${name}/${chap}" || exit + total_pages=$(curl "http://www.mangahere.co/manga/${name}/c${chap}/" 2>/dev/null | grep 'total_pages' | sed -r 's|.*=.([0-9]*).*|\1|') + curl "http://www.mangahere.co/manga/${name}/c${chap}/" 2>/dev/null | grep 'id="image"' | sed -r 's|.* src="([^"]*)" .*|\1|' | xargs wget -c -O 1.jpg + for page in $(seq 2 "${total_pages}") + do curl "http://www.mangahere.co/manga/${name}/c${chap}/${page}.html" 2>/dev/null | grep 'id="image"' | sed -r 's|.* src="([^"]*)" .*|\1|' | xargs wget -c -O "${page}.jpg" + done +done diff --git a/bin/mangareader.net.sh b/bin/mangareader.net.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +name="${1}" + +for chap in $(seq 1 "${2:-1}") + do mkdir -p "${HOME}/${name}/${chap}" + cd "$HOME/${name}/${chap}" || exit + chap_pages=$(curl "http://www.mangareader.net/${name}/${chap}/" 2>/dev/null | grep '</select> of' | sed -r 's|</select> of ([0-9]*).*|\1|') + curl "http://www.mangareader.net/${name}/${chap}/" 2>/dev/null | grep 'img id="img"' | sed -r 's|.* src="(.*)" alt.*|\1|' | xargs wget -c -O 1.jpg + for p in $(seq 2 "${chap_pages}") + do curl "http://www.mangareader.net/${name}/${chap}/${p}" 2>/dev/null | grep 'img id="img"' | sed -r 's|.* src="(.*)" alt.*|\1|' | xargs wget -c -O "${p}.jpg" + done +done