Skip to content

Commit

Permalink
Added -x for random and completed documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hashhar committed Nov 3, 2015
1 parent be7429c commit 746bb6b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
52 changes: 50 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
# XKCD Scraper

Let's download all the XKCD comics and their titles! Why not use a plugin? Because I am a geek!!!
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 :satisfied:)!!!

I am still working on it.
## Setup Instructions

Why are you even reading this (unless you are somebody new to Python)???
Make sure you have all the dependencies resolved

```github
git clone https://github.com/hashhar/xkcd-scraper.git
python xkcd-scraper.py --your-arguments
```

## Dependencies

**Requests Python Module**
Get it by doing
```python
pip install requests
```

## Command Line Options

Unfortunately, you will need to provide command line parameters everytime you run the script (because I am a bad, bad man :smiling_imp:)

- **`-o`** *`directory`*, **`--output-dir`** *`directory`*
Changes the output directory to `directory`.
The default output directory is the cuurent working directory.

- *`N`*
This will fetch the comic number `N` from xkcd where `N` 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 range `M` to `N`.
`-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`*
Fetches `N` pseudo-random (because, well, <a href="#bonus">the world is not fair</a>) comics. You can specify how many you want to fetch as -x 10, --random 30. This will fetch 30 random comics.

## Comments

I am still working on it so feel free to contribute code and file issues and feature requests.

## <a name="bonus">Food For Thought</a>

[Is there anything that is totally random? - StackExchange](http://philosophy.stackexchange.com/questions/2439/is-there-anything-that-is-totally-random)
[Randomness vs Unpredictability - Wikipedia](https://en.wikipedia.org/wiki/Randomness#Randomness_versus_unpredictability)
[Can we sure that randomeness exists? - Quora](https://www.quora.com/Can-we-be-sure-that-true-randomness-exists-Can-it-be-proven-that-anything-is-truly-random)
2 changes: 1 addition & 1 deletion xkcd-scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def main():
# The all argument to download all comics
parser.add_argument('-a', '--all', action='store_true', help='Fetch all comics')
# The random argument
parser.add_argument('--random', metavar='ITERATIONS', type=int, help='Fetch random comics', nargs='?', const=1)
parser.add_argument('-x' ,'--random', metavar='ITERATIONS', type=int, help='Fetch random comics', nargs='?', const=1)

# Parse the arguments
args = parser.parse_args()
Expand Down

0 comments on commit 746bb6b

Please sign in to comment.