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

Commit

Permalink
Add password protection check for cyberfile, fix date issue on modifi…
Browse files Browse the repository at this point in the history
…ed uploads.
  • Loading branch information
Jules-WinnfieldX committed Apr 20, 2024
1 parent 39c860a commit 2bb60bc
Show file tree
Hide file tree
Showing 3 changed files with 8 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.2.39"
__version__ = "5.2.41"
7 changes: 6 additions & 1 deletion cyberdrop_dl/scraper/crawlers/cyberfile_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from bs4 import BeautifulSoup
from yarl import URL

from cyberdrop_dl.clients.errors import PasswordProtected
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 @@ -145,6 +146,10 @@ async def handle_content_id(self, scrape_item: ScrapeItem, contentId: int) -> No
async with self.request_limiter:
ajax_dict = await self.client.post_data(self.domain, self.api_details, data=data)
ajax_soup = BeautifulSoup(ajax_dict['html'].replace("\\", ""), 'html.parser')

if "albumPasswordModel" in ajax_dict['html']:
await log(f"Album is password protected: {scrape_item.url}", 30)
raise PasswordProtected()

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')
Expand All @@ -154,7 +159,7 @@ async def handle_content_id(self, scrape_item: ScrapeItem, contentId: int) -> No
html_download_text = file_button.get("onclick")
link = URL(html_download_text.split("'")[1])

file_detail_table = ajax_soup.select_one('table[class="table table-bordered table-striped"]')
file_detail_table = ajax_soup.select('table[class="table table-bordered table-striped"]')[-1]
uploaded_row = file_detail_table.select('tr')[-2]
uploaded_date = uploaded_row.select_one('td[class=responsiveTable]').text.strip()
uploaded_date = await self.parse_datetime(uploaded_date)
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.2.39"
version = "5.2.41"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 2bb60bc

Please sign in to comment.