Added missing scraping for XKCD 501 to 1000
Browse filesCurrently, the scraper would miss the XKCDs ranging from 501 to 1000 due to these being listed on a different page at explainxkcd.com. This change extends the scraper capabilities to include those.
Note that the full page starts at 1001, so there is no overlap between these three lists
- scrapper.py +8 -1
scrapper.py
CHANGED
@@ -13,6 +13,9 @@ from bs4.element import Tag
|
|
13 |
LIST_COMICS_500_URL = (
|
14 |
"https://www.explainxkcd.com/wiki/index.php/List_of_all_comics_(1-500)"
|
15 |
)
|
|
|
|
|
|
|
16 |
LIST_COMICS_FULL_URL = (
|
17 |
"https://www.explainxkcd.com/wiki/index.php/List_of_all_comics_(full)"
|
18 |
)
|
@@ -184,7 +187,11 @@ async def main():
|
|
184 |
# Get all comic urls
|
185 |
comic_urls = await scap_comic_urls(
|
186 |
session, LIST_COMICS_500_URL
|
187 |
-
) + await scap_comic_urls(
|
|
|
|
|
|
|
|
|
188 |
|
189 |
# Scrap all comics asynchronously
|
190 |
data = await asyncio.gather(
|
|
|
13 |
LIST_COMICS_500_URL = (
|
14 |
"https://www.explainxkcd.com/wiki/index.php/List_of_all_comics_(1-500)"
|
15 |
)
|
16 |
+
LIST_COMICS_1000_URL = (
|
17 |
+
"https://www.explainxkcd.com/wiki/index.php/List_of_all_comics_(501-1000)"
|
18 |
+
)
|
19 |
LIST_COMICS_FULL_URL = (
|
20 |
"https://www.explainxkcd.com/wiki/index.php/List_of_all_comics_(full)"
|
21 |
)
|
|
|
187 |
# Get all comic urls
|
188 |
comic_urls = await scap_comic_urls(
|
189 |
session, LIST_COMICS_500_URL
|
190 |
+
) + await scap_comic_urls(
|
191 |
+
session, LIST_COMICS_1000_URL
|
192 |
+
) + await scap_comic_urls(
|
193 |
+
session, LIST_COMICS_FULL_URL
|
194 |
+
)
|
195 |
|
196 |
# Scrap all comics asynchronously
|
197 |
data = await asyncio.gather(
|