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

Commit

Permalink
fix minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Dec 9, 2023
1 parent a4c57f0 commit 0bf54b7
Show file tree
Hide file tree
Showing 6 changed files with 10 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.0.98"
__version__ = "5.0.99"
1 change: 1 addition & 0 deletions cyberdrop_dl/managers/download_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ async def release_lock(self, filename: str) -> None:
except (KeyError, RuntimeError):
pass


class DownloadManager:
def __init__(self, manager: Manager):
self.manager = manager
Expand Down
4 changes: 2 additions & 2 deletions cyberdrop_dl/scraper/crawlers/bunkrr_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async def other(self, scrape_item: ScrapeItem) -> None:

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)[0-9]{0,2}(?:redir)?))\.bunkr?\.[a-z]{2,3}$"
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}$"

if not re.match(cdn_possibilities, url.host):
return url
Expand All @@ -111,7 +111,7 @@ async def get_stream_link(self, url: URL) -> URL:
return url

if ext in FILE_FORMATS['Images']:
url = url.with_host(re.sub(r"^cdn(\d*)\.", r"i\1.", url.host))
url = self.primary_base_domain / "d" / url.parts[-1]
elif ext in FILE_FORMATS['Videos']:
url = self.primary_base_domain / "v" / url.parts[-1]
else:
Expand Down
7 changes: 4 additions & 3 deletions cyberdrop_dl/scraper/crawlers/jpgchurch_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ async def parse_datetime(self, date: str) -> int:

async def check_direct_link(self, url: URL) -> bool:
"""Determines if the url is a direct link or not"""
mapping_direct = [r'jpg.church/images/...', r'simp..jpg.church', r'jpg.fish/images/...',
r'simp..jpg.fish', r'jpg.fishing/images/...', r'simp..jpg.fishing']
return any(re.search(domain, str(url)) for domain in mapping_direct)
cdn_possibilities = r"(?:(jpg.church\/images\/...)|(simp..jpg.church)|(jpg.fish\/images\/...)|(simp..jpg.fish)|(jpg.fishing\/images\/...)|(simp..jpg.fishing))"
if not re.match(cdn_possibilities, url.host):
return False
return True
1 change: 1 addition & 0 deletions cyberdrop_dl/utils/database/tables/history_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ async def insert_incompleted(self, domain: str, media_item: MediaItem) -> None:
"""Inserts an uncompleted file into the database"""
url_path = await get_db_path(media_item.url, str(media_item.referer))
download_filename = media_item.download_filename if isinstance(media_item.download_filename, str) else ""
await self.db_conn.execute("""UPDATE media SET domain = ? WHERE domain = 'no_crawler' and url_path = ? and referer = ?""", (domain, url_path, str(media_item.referer)))
await self.db_conn.execute("""INSERT OR IGNORE INTO media (domain, url_path, referer, download_path, download_filename, original_filename, completed) VALUES (?, ?, ?, ?, ?, ?, ?)""", (domain, url_path, str(media_item.referer), str(media_item.download_folder), download_filename, media_item.original_filename, 0))
await self.db_conn.execute("""UPDATE media SET download_filename = ? WHERE domain = ? and url_path = ?""", (download_filename, domain, url_path))
await self.db_conn.commit()
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.0.98"
version = "5.0.99"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 0bf54b7

Please sign in to comment.