Skip to content

Bulk asynchronous downloader for multiple file hosts

Close clientsession, fix inf scrolling issue with jpg.church user albums.

Jules-WinnfieldX7d2405101cdc
diff --git a/README.md b/README.md
index 7a4e615f9..046b44dad 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# `cyberdrop-dl`
**Bulk downloader for multiple file hosts**
-The latest version of the program is 3.5.6
+The latest version of the program is 3.5.7
<a href="https://www.buymeacoffee.com/juleswinnft" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
diff --git a/changelog.txt b/changelog.txt
index 6c00591e2..37787aa6c 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -48,4 +48,8 @@
- Fix bug with pre-allocation
3.5.6
-- Fix support for links with apostrophes
\ No newline at end of file
+- Fix support for links with apostrophes
+
+3.5.7
+- Close client session after use instead of relying on deletion.
+- Fix jpg.church infinite scroll/not getting all user albums.
diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py
index 37f46012c..5bc016710 100644
--- a/cyberdrop_dl/__init__.py
+++ b/cyberdrop_dl/__init__.py
@@ -1 +1 @@
-__version__ = "3.5.6"
+__version__ = "3.5.7"
diff --git a/cyberdrop_dl/base_functions/base_functions.py b/cyberdrop_dl/base_functions/base_functions.py
index 80481f6ea..02225470b 100644
--- a/cyberdrop_dl/base_functions/base_functions.py
+++ b/cyberdrop_dl/base_functions/base_functions.py
@@ -118,11 +118,11 @@ async def check_direct(url: URL):
async def create_config(config: Path, passed_args=None, remake=None):
if config.is_file() and not remake:
- await log("Validating Config")
+ logging.debug("Validating Config")
await validate_config(config)
return
- await log("Creating Config File")
+ logging.debug("Creating Config File")
config_data = config_default
if passed_args:
for arg in authentication_args:
@@ -160,7 +160,7 @@ async def validate_config(config: Path):
if recreate:
config.unlink()
- await log("Recreating Config")
+ logging.debug("Recreating Config")
args = {}
args_list = [data['Authentication'], data['Files'], data['JDownloader'], data['Runtime']]
@@ -181,7 +181,7 @@ async def run_args(config: Path, cmd_arg: Dict):
if data['Apply_Config']:
return data
- await log("Gathering Args")
+ logging.debug("Gathering Args")
config_data = config_default[0]["Configuration"]
for arg in authentication_args:
if arg in cmd_arg.keys():
diff --git a/cyberdrop_dl/client/downloaders.py b/cyberdrop_dl/client/downloaders.py
index 3379dd914..caf89d2e8 100644
--- a/cyberdrop_dl/client/downloaders.py
+++ b/cyberdrop_dl/client/downloaders.py
@@ -284,6 +284,7 @@ class Downloader:
"""Download the content of all links and save them as files."""
session = DownloadSession(self.client, conn_timeout)
await self.download_all(self.album_obj, session, show_progress=show_progress)
+ await session.client_session.close()
self.SQL_helper.conn.commit()
diff --git a/cyberdrop_dl/crawlers/ShareX_Spider.py b/cyberdrop_dl/crawlers/ShareX_Spider.py
index 71a5367aa..5b1c28d73 100644
--- a/cyberdrop_dl/crawlers/ShareX_Spider.py
+++ b/cyberdrop_dl/crawlers/ShareX_Spider.py
@@ -45,6 +45,16 @@ class ShareXCrawler:
for album in albums:
album_url = URL(album.get('href'))
results.extend(result for result in await self.parse(session, album_url))
+
+ next_page = soup.select_one('li.pagination-next a')
+ if not next_page:
+ next_page = soup.select_one('a[data-pagination=next]')
+ if next_page is not None:
+ next_page = next_page.get('href')
+ if next_page is not None:
+ next_page = URL(next_page)
+ results.extend(result for result in await self.get_albums(session, next_page))
+
except Exception as e:
logger.debug("Error encountered while handling %s", str(url), exc_info=True)
await log("Error scraping " + str(url))
@@ -93,9 +103,8 @@ class ShareXCrawler:
titlep2 = url.name
title = title + " - " + titlep2
title = await make_title_safe(title.replace(r"\n", "").strip())
+ results.extend(result for result in await self.get_list_links(session, url, title))
- list_recent = URL(soup.select_one("a[id=list-most-recent-link]").get('href'))
- results.extend(result for result in await self.get_list_links(session, list_recent, title))
except Exception as e:
logger.debug("Error encountered while handling %s", str(url), exc_info=True)
await log("Error scraping " + str(url))
@@ -115,6 +124,8 @@ class ShareXCrawler:
link = link.with_name(link.name.replace('.md.', '.').replace('.th.', '.'))
results.append({'url': link, 'title': title, 'referral': url, 'cookies': ''})
next_page = soup.select_one('li.pagination-next a')
+ if not next_page:
+ next_page = soup.select_one('a[data-pagination=next]')
if next_page is not None:
next_page = next_page.get('href')
if next_page is not None:
@@ -126,7 +137,7 @@ class ShareXCrawler:
logger.debug(e)
return results
- async def parse(self, session: Session, url: URL, og_title=None):
+ async def parse(self, session: Session, url: URL, og_title=None, page=None, prior_result=None):
results = []
try:
soup = await session.get_BS4(url)