Let's download all the XKCD comics and their titles! Why not use a browser plugin? Because you are a geek (or just want to look cool among your friends 😆)!!!
Requests Python Module
Get it by doing
pip install requests
Why are you even reading this (unless you are somebody new to Python)???
Make sure you have all the dependencies resolved before proceeding.
git clone https://github.com/hashhar/xkcd-scraper.git
python xkcd-scraper.py --your-arguments
Unfortunately, you will need to provide command line parameters everytime you run the script (because I am a bad, bad man 😈)
-
-o
directory
,--output-dir
directory
Changes the output directory todirectory
.
The default output directory is the current working directory. -
N
This will fetch the comic numberN
from xkcd whereN
is an integer or a set of integers greater than or equal to 0.
Use 0 to fetch the latest comic. -
-r
M N
,--range
M N
Fetches comics within the rangeM
toN
.
-r 3 30
,--range 3 30
will fetch the comics from 3 to 30. -
-a
,--all
Fetches all the comics from the first one to the latest. -
-x
N
,--random
N
FetchesN
pseudo-random (because, well, the world is not fair) comics. You can specify how many you want to fetch as -x 10, --random 30. This will fetch 30 random comics. -
-t
,--title
Appends the title of the comic to the filename of the downloaded comic
I am still working on it so feel free to contribute code and file issues and feature requests.
Is there anything that is totally random? - StackExchange
Randomness vs Unpredictability - Wikipedia
Can we sure that randomeness exists? - Quora