mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
30 lines
710 B
Bash
Executable File
30 lines
710 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if [ -z "$*" ]; then
|
|
printf "enter number:"
|
|
read -r num
|
|
else
|
|
num=$*
|
|
fi
|
|
|
|
mkdir -p $HOME/.cache/$num
|
|
dir="$HOME/.cache/$num"
|
|
trap "rm -rf $dir;exit 0" INT HUP
|
|
webp="$(curl -s "https://nhentai.net/g/$num/1/")"
|
|
id=$(printf "$webp" | sed -nE 's/.*galleries\/([^"]*)\/.*/\1/p')
|
|
pg=$(printf "$webp" | sed -nE 's/.*pages">(.*)/\1/p' | cut -d\< -f1)
|
|
|
|
for i in $(seq $pg)
|
|
do
|
|
echo "downloading $i.jpg"
|
|
i_t=$(printf "%03d" $i)
|
|
setsid -f curl -s "https://i.nhentai.net/galleries/$id/$i.jpg" -o "$dir/$i_t"
|
|
sleep 1
|
|
done
|
|
|
|
echo "waiting 3 sec for images to download completely"
|
|
sleep 3
|
|
echo "converting images to pdf"
|
|
convert "$dir/*" "$num.pdf" && printf "saved pdf as $num.pdf\nenjoy 😏😏"
|
|
rm -rf $dir
|