Skip to content

Instantly share code, notes, and snippets.

@0bach0
Created March 14, 2020 01:27
Show Gist options
  • Save 0bach0/d68c4eabb61fe9ad8542cf46c2178f47 to your computer and use it in GitHub Desktop.
Save 0bach0/d68c4eabb61fe9ad8542cf46c2178f47 to your computer and use it in GitHub Desktop.
I found a free manga, which is a bunch of image. I decided to download and store on my local computer
# I will hide the original source by [somewher], the file name will start by [abcd]
# 1st version: just assume there're around unlimit file. Will halt the command by using `Ctrl + C` when programs throw 404
for i in $(seq 1 10000); do curl -o abcd-${i}.jpg https://somewhere/${i}; done
# 2nd version: skip the progress bar and output only the http status code.
for i in $(seq 1 10000); do curl -w "%{http_code}" -s -o abcd-${i}.jpg https://somewhere/${i} | xargs; done
# 3rd version: there're around 130 images. So will download 150 images. After that can delete the empty image by UI (open the folder and check the thumbnail)
for i in $(seq 1 150); do curl -s -o abcd-${i}.jpg https://somewhere/${i} | xargs; done
# 4rd version: Create a nested loop for download multi-chapters
# j will be the chapter number, i is the page number
for j in $(seq 1 9); do ; for i in $(seq 1 150); do curl -o 0${j}/abcd${j}-${i}.jpg https://somewhere${j}/${i} | xargs; done; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment