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

Commit

Permalink
Add explicit error for no download button on cyberfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Jun 15, 2024
1 parent ef77047 commit 0c0197f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 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.3.26"
__version__ = "5.3.27"
14 changes: 9 additions & 5 deletions cyberdrop_dl/scraper/crawlers/cyberfile_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from bs4 import BeautifulSoup
from yarl import URL

from cyberdrop_dl.clients.errors import PasswordProtected
from cyberdrop_dl.clients.errors import PasswordProtected, ScrapeFailure
from cyberdrop_dl.scraper.crawler import Crawler
from cyberdrop_dl.utils.dataclasses.url_objects import ScrapeItem
from cyberdrop_dl.utils.utilities import error_handling_wrapper, log, get_filename_and_ext
Expand Down Expand Up @@ -152,10 +152,14 @@ async def handle_content_id(self, scrape_item: ScrapeItem, contentId: int) -> No

file_menu = ajax_soup.select_one('ul[class="dropdown-menu dropdown-info account-dropdown-resize-menu"] li a')
file_button = ajax_soup.select_one('div[class="btn-group responsiveMobileMargin"] button')
if file_menu:
html_download_text = file_menu.get("onclick")
else:
html_download_text = file_button.get("onclick")
try:
if file_menu:
html_download_text = file_menu.get("onclick")
else:
html_download_text = file_button.get("onclick")
except AttributeError:
await log(f"Couldn't find download button for {scrape_item.url}", 30)
raise ScrapeFailure(422, "Couldn't find download button")
link = URL(html_download_text.split("'")[1])

file_detail_table = ajax_soup.select('table[class="table table-bordered table-striped"]')[-1]
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.3.26"
version = "5.3.27"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 0c0197f

Please sign in to comment.