Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Set no warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Jan 15, 2024
1 parent 73a423d commit bf09fd5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cyberdrop_dl/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.1.41"
__version__ = "5.1.42"
13 changes: 12 additions & 1 deletion cyberdrop_dl/scraper/crawlers/ehentai_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@ class EHentaiCrawler(Crawler):
def __init__(self, manager: Manager):
super().__init__(manager, "e-hentai", "E-Hentai")
self.request_limiter = AsyncLimiter(10, 1)
self.warnings_set = False

"""~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"""

async def fetch(self, scrape_item: ScrapeItem) -> None:
"""Determines where to send the scrape item based on the url"""
task_id = await self.scraping_progress.add_task(scrape_item.url)

if not self.warnings_set:
await self.set_no_warnings(scrape_item)

if "g" in scrape_item.url.parts:
scrape_item.url = URL(str(scrape_item.url) + "/").with_query("nw=session")
await self.album(scrape_item)
elif "s" in scrape_item.url.parts:
await self.image(scrape_item)
Expand Down Expand Up @@ -85,3 +88,11 @@ async def parse_datetime(self, date: str) -> int:
date = date + ":00"
date = datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S")
return calendar.timegm(date.timetuple())

@error_handling_wrapper
async def set_no_warnings(self, scrape_item) -> None:
"""Sets the no warnings cookie"""
self.warnings_set = True
async with self.request_limiter:
scrape_item.url = URL(str(scrape_item.url) + "/").update_query("nw=session")
soup = await self.client.get_BS4(self.domain, scrape_item.url)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cyberdrop-dl"
version = "5.1.41"
version = "5.1.42"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit bf09fd5

Please sign in to comment.