mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 15:25:20 +05:30
add new script and some optimizations
This commit is contained in:
37
nsfw
37
nsfw
@@ -1,29 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$*" ]; then
|
||||
printf "enter number:"
|
||||
read -r num
|
||||
else
|
||||
num=$*
|
||||
fi
|
||||
|
||||
mkdir -p $HOME/.cache/$num
|
||||
[ -z "$*" ] && printf "enter(paste) number or link:" && read -r num || num=$*
|
||||
num=$(printf "$num" | cut -d\/ -f5)
|
||||
dir="$HOME/.cache/$num"
|
||||
mkdir -pv $dir
|
||||
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"
|
||||
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)
|
||||
setsid -f curl -s "https://i.nhentai.net/galleries/$id/$i.jpg" -o "$dir/$i_t"
|
||||
sleep 1
|
||||
echo "downloading page $i($url)"
|
||||
setsid -f curl -s "$url" -o "$dir/$i_t"
|
||||
sleep 2
|
||||
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
|
||||
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 -rvf $dir
|
||||
|
||||
Reference in New Issue
Block a user