mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 15:25:20 +05:30
23 lines
768 B
Bash
Executable File
23 lines
768 B
Bash
Executable File
#!/bin/sh
|
|
|
|
[ -z "$*" ] && printf "enter(paste) number or link:" && read -r num || num=$*
|
|
num=$(printf "$num" | cut -d\/ -f5)
|
|
dir="$HOME/.cache/$num"
|
|
mkdir -p $dir
|
|
trap "rm -rf $dir;exit 0" INT HUP
|
|
pg=$(curl -s "https://nhentai.net/g/$num/1/" | sed -nE 's/.*pages">(.*)<\/span><.*/\1/p')
|
|
echo "pages : $pg"
|
|
for i in $(seq $pg);do
|
|
url=$(curl -s "https://nhentai.net/g/$num/$i/" | sed -nE 's/.*<img src="([^"]*)".*/\1/p')
|
|
i_t=$(printf "%03d" $i)
|
|
echo "downloading page $i($url)"
|
|
setsid -f curl -s "$url" -o "$dir/$i_t"
|
|
sleep 2
|
|
done
|
|
|
|
echo "waiting 5 sec for pages to download completely"
|
|
sleep 5
|
|
echo "concatenating pages to pdf"
|
|
convert "$dir/*" "$num.pdf" && printf "saved pdf as $num.pdf\nopening pdf...enjoy 😏😏" && setsid -f xdg-open "$num.pdf"
|
|
rm -rf $dir
|