Created
January 21, 2020 11:01
-
-
Save gcg/771a3dcc8e2be1a79bfe7ae48327c530 to your computer and use it in GitHub Desktop.
Solo Leveling bash downloader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Downloading Solo Leveling..." | |
start=$(date -d "2018-02-05" '+%s') | |
today=$(date -d $(date +%Y-%m-%d) '+%s') | |
diff=$(( ($today - $start) / (60*60*24) )) | |
last=$(((diff / 7) + (diff % 7 > 0))) | |
for (( i=0; i<=$last; i++ )) | |
do | |
echo "Downloading Chapter: $i" | |
# Download the chapter | |
if [ -f "Chapter$i.pdf" ]; then | |
echo "Chapter$i.pdf already exists, moving on" | |
continue; | |
fi | |
wget -c https://jaiminisbox.com/reader/download/solo-leveling/en/0/$i/ -O Chapter$i.zip | |
download=$? | |
if [ $download -eq 0 ]; then | |
# Unzip the downloaded chapter | |
unzip Chapter$i.zip -d Chapter$i | |
# Convert to PDF | |
convert Chapter$i/* Chapter$i.pdf | |
# Clean up | |
rm -rf Chapter$i/ Chapter$i.zip | |
# blaber to user | |
echo "Chapter$i downloaded and converted to PDF." | |
else | |
echo "Download failed, stopping at chapter: $i"; | |
break; | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment