-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
47 lines (33 loc) · 1.1 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Installing dependencies
-----------------------
Make sure you have Python 3.7+ somewhere.
Option 1: Using pipenv
pip3 install pipenv # skip if pipenv is already installed
cd <project-dir>
pipenv install --python <path-to-python-binary> # --python is optional
pipenv shell # start shell
Option 2: Using venv
cd <project-dir>
python -m venv ./venv
source venv/bin/activate
pip install -r requirements.txt
Running the crawler
-------------------
Show help
./main.py -h
Crawl URL with concurrency=10 and depth=2
./main.py -n 10 -d 2 -o output.json https://old.reddit.com
Check output
less output.json
Features
--------
- Configurable concurrency and depth limit.
- Uses asyncio for faster performance and reduced CPU usage.
- Uses url-normalize for normalizing URLs to prevent duplicates.
Limitations
-----------
- Very basic output format
- Does not handle all kinds of URLs in <a> tags
- Only handles responses with status 200 and text/html content type
- Hardcoded breadth-first crawling, no option to change
- aiohttp can fail randomly (SSL certificate issues)