Zishy Downloader v1.0

This commit is contained in:
Simon Altmeyer 2024-06-08 21:57:22 +02:00
parent 60a16d3857
commit 0626d2369c
1 changed files with 41 additions and 0 deletions

41
zishy.sh Executable file
View File

@ -0,0 +1,41 @@
#!/usr/bin/env bash
# Zishy Downloader
# Allows automatic download of album zip file and bonus video, with extraction of release date and album title for unzipped directory naming and separate description file
# requires paid subscription
# v1.0 by Simon Altmeyer (simon@altmeyer.it)
# Required dependencies
# wget, sed, rename/perl-rename, grep, find, xargs, 7z
# Declare variables
USER_AGENT="Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
COOKIE_FILE="$HOME/.cookies/zishy.txt"
DOWNLOAD_DIR="$HOME/R-18/Zishy"
# Step 1: Download album zip-file
cd "$DOWNLOAD_DIR"
wget --quiet --content-disposition -U "$USER_AGENT" --load-cookies="$COOKIE_FILE" "https://www.zishy.com/galzip/$1"
perl-rename 's/134864//g' *.*
# Define more variables
ALBUM_NAME=$(find . -type f -cmin -1|sed 's|^\./||; s|\.zip$||')
# Download html of album page
wget --quiet -U "$USER_AGENT" --load-cookies="$COOKIE_FILE" -O "$ALBUM_NAME.html" "https://www.zishy.com/albums/$ALBUM_NAME"
sed -n '/<div id="descrip" style="font-size:16px; margin: 20px; ">/,/<\/div>/p' "$ALBUM_NAME.html" | sed '1d;$d' > "$ALBUM_NAME.description"
# Get gallery title and date
sed -n '/<span style='\''font-weight:bold; font-size:40px;text-decoration:none;white-space: nowrap'\''>/,/<\/span>/p' "$ALBUM_NAME.html" | sed '1d;$d' > "$ALBUM_NAME.title"
sed -n '/<span style='\''font-size:20px;'\''>/,/<\/span>/p' "$ALBUM_NAME.html" | sed '1d;$d' | sed '1d' | sed -E 's/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([0-9]{1,2}), ([0-9]{4})/\3-\1-\2/; s/Jan/01/; s/Feb/02/; s/Mar/03/; s/Apr/04/; s/May/05/; s/Jun/06/; s/Jul/07/; s/Aug/08/; s/Sep/09/; s/Oct/10/; s/Nov/11/; s/Dec/12/' > "$ALBUM_NAME.date"
# Extract zip file
7z x -y -bsp0 -bso0 "$ALBUM_NAME.zip" -o"$(cat $ALBUM_NAME.date) $(cat $ALBUM_NAME.title)"
# If available, download video
sed -i 's/href="\/uploads\/files/href="https:\/\/www.zishy.com\/uploads\/files/g' "$ALBUM_NAME".html
grep 'a href="https' "$ALBUM_NAME".html > "$ALBUM_NAME".txt
grep -Po '(?<=href=")[^"]*' "$ALBUM_NAME".txt > "$ALBUM_NAME".video
sed -i 's/ /%20/g' "$ALBUM_NAME".video
wget --quiet --content-disposition -U "$USER_AGENT" --load-cookies="$COOKIE_FILE" -i "$ALBUM_NAME".video
find . -type f -cmin -1 -name "*.mp4"|sed 's/^.\///'|xargs -I {} perl-rename 's/^/'$1'-/' {}