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

Commit

Permalink
update file handling, invalidcontenttype
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Feb 6, 2024
1 parent 13c7e4a commit d2c1797
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 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.63"
__version__ = "5.1.64"
3 changes: 2 additions & 1 deletion cyberdrop_dl/downloader/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ async def wrapper(self, *args, **kwargs):
while True:
try:
return await f(self, *args, **kwargs)
except InvalidContentTypeFailure:
except InvalidContentTypeFailure as e:
media_item = args[0]
if not isinstance(media_item.download_task_id, Field):
await self.manager.progress_manager.file_progress.remove_file(media_item.download_task_id)
await log(f"Download Failed: {media_item.url} received Invalid Content", 40)
await log(e.message, 40)
await self.manager.progress_manager.download_stats_progress.add_failure("Invalid Content Type")
await self.manager.progress_manager.download_progress.add_failed()
break
Expand Down
9 changes: 6 additions & 3 deletions cyberdrop_dl/scraper/crawlers/bunkrr_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,14 @@ async def other(self, scrape_item: ScrapeItem) -> None:
try:
filename, ext = await get_filename_and_ext(link.name)
except NoExtensionFailure:
filename, ext = await get_filename_and_ext(scrape_item.url.name)
if "get" in link.host:
link = await self.reinforced_link(link)
filename, ext = await get_filename_and_ext(link.name)
else:
filename, ext = await get_filename_and_ext(scrape_item.url.name)

await self.handle_file(link, scrape_item, filename, ext)

@error_handling_wrapper
async def reinforced_link(self, url: URL) -> URL:
"""Gets the download link for a given reinforced URL"""
"""get.bunkr.su"""
Expand All @@ -152,7 +155,7 @@ async def reinforced_link(self, url: URL) -> URL:

async def get_stream_link(self, url: URL) -> URL:
"""Gets the stream link for a given url"""
cdn_possibilities = r"^(?:(?:(?:media-files|cdn|c|pizza|cdn-burger)[0-9]{0,2})|(?:(?:big-taco-|cdn-pizza|cdn-meatballs|cdn-milkshake|meatballs|i.kebab|i.fries)[0-9]{0,2}(?:redir)?))\.bunkr?\.[a-z]{2,3}$"
cdn_possibilities = r"^(?:(?:(?:media-files|cdn|c|pizza|cdn-burger|burger|taquito|pizza|fries|meatballs|milkshake|kebab)[0-9]{0,2})|(?:(?:big-taco-|cdn-pizza|cdn-meatballs|cdn-milkshake|i.kebab|i.fries)[0-9]{0,2}(?:redir)?))\.bunkr?\.[a-z]{2,3}$"

if not re.match(cdn_possibilities, url.host):
return url
Expand Down
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.63"
version = "5.1.64"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit d2c1797

Please sign in to comment.