Skip to content

Bulk asynchronous downloader for multiple file hosts

Add support for coomer favourites (#227)

Jacob250a40a13c94
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d53c47ce5..36f88152c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,14 @@ All notable changes to this project will be documented here. For more details, v
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [UNRELEASED] - 2024-10-31
+
+This update introduces the following changes:
+1. Add support for scraping a users' coomer favourites
+
+#### Details:
+- Add support for scraping a users' coomer favourites by allowing the user to pass the coomer favourites page URL as an input URL (https://coomer.su/favorites). This requires them to have their coomer session token in the `authentication.yaml` file.
+
## [5.7.1] - 2024-10-28
This update introduces the following changes:
diff --git a/cyberdrop_dl/scraper/crawlers/coomer_crawler.py b/cyberdrop_dl/scraper/crawlers/coomer_crawler.py
index 9dc7b180f..67e580f1e 100644
--- a/cyberdrop_dl/scraper/crawlers/coomer_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/coomer_crawler.py
@@ -7,6 +7,7 @@ from typing import TYPE_CHECKING, Tuple, Dict, Optional
from aiolimiter import AsyncLimiter
from yarl import URL
+from cyberdrop_dl.clients.errors import ScrapeFailure
from cyberdrop_dl.scraper.crawler import Crawler
from cyberdrop_dl.utils.dataclasses.url_objects import ScrapeItem
from cyberdrop_dl.utils.utilities import get_filename_and_ext, error_handling_wrapper
@@ -39,11 +40,32 @@ class CoomerCrawler(Crawler):
await self.post(scrape_item)
elif "onlyfans" in scrape_item.url.parts or "fansly" in scrape_item.url.parts:
await self.profile(scrape_item)
+ elif "favorites" in scrape_item.url.parts:
+ await self.favorites(scrape_item)
else:
await self.handle_direct_link(scrape_item)
await self.scraping_progress.remove_task(task_id)
+ @error_handling_wrapper
+ async def favorites(self, scrape_item: ScrapeItem) -> None:
+ """Scrapes the users' favourites and creates scrape items for each artist found"""
+ if not self.manager.config_manager.authentication_data['Coomer']['session']:
+ raise ScrapeFailure(401, message = "No session cookie found in the config file, cannot scrape favorites", origin = scrape_item)
+ async with self.request_limiter:
+ # Use the session cookie to get the user's favourites
+ self.client.client_manager.cookies.update_cookies({"session": self.manager.config_manager.authentication_data['Coomer']['session']}, response_url=self.primary_base_domain)
+ favourites_api_url = (self.api_url / "account/favorites").with_query({"type": "artist"})
+ JSON_Resp = await self.client.get_json(self.domain, favourites_api_url, origin=scrape_item)
+ self.client.client_manager.cookies.update_cookies({"session": ""}, response_url=self.primary_base_domain)
+ for user in JSON_Resp:
+ id = user['id']
+ name = user['name']
+ service = user['service']
+ url = self.primary_base_domain / service / "user" / id
+ new_scrape_item = await self.create_scrape_item(scrape_item, url, None, True, None, None)
+ self.manager.task_group.create_task(self.run(new_scrape_item))
+
@error_handling_wrapper
async def profile(self, scrape_item: ScrapeItem) -> None:
"""Scrapes a profile"""
@@ -54,7 +76,7 @@ class CoomerCrawler(Crawler):
while True:
async with self.request_limiter:
JSON_Resp = await self.client.get_json(self.domain, api_call.with_query({"o": offset}),
- origin=scrape_item)
+ origin=scrape_item)
offset += 50
if not JSON_Resp:
break
@@ -93,7 +115,7 @@ class CoomerCrawler(Crawler):
link = self.primary_base_domain / ("data" + file_obj['path'])
link = link.with_query({"f": file_obj['name']})
await self.create_new_scrape_item(link, scrape_item, user_str, post_title, post_id, date,
- add_parent=scrape_item.url.joinpath("post", post_id))
+ add_parent=scrape_item.url.joinpath("post", post_id))
if post['file']:
await handle_file(post['file'])
diff --git a/cyberdrop_dl/utils/args/config_definitions.py b/cyberdrop_dl/utils/args/config_definitions.py
index af427222b..6aa4f00b5 100644
--- a/cyberdrop_dl/utils/args/config_definitions.py
+++ b/cyberdrop_dl/utils/args/config_definitions.py
@@ -28,6 +28,9 @@ authentication_settings: Dict = {
"xbunker_username": "",
"xbunker_password": "",
},
+ "Coomer": {
+ "session": "",
+ },
"XXXBunker": {
"PHPSESSID": "",
},
diff --git a/docs/reference/configuration-options/authentication.md b/docs/reference/configuration-options/authentication.md
index e7a071013..845c36e8b 100644
--- a/docs/reference/configuration-options/authentication.md
+++ b/docs/reference/configuration-options/authentication.md
@@ -6,6 +6,16 @@ description: These are all of the configuration options for Authentication.
<details>
+<summary>Coomer</summary>
+
+In order to scrape your favorites from coomer, you need to provide Cyberdrop-DL with your coomer `session` cookie.
+
+Once you have put your `session` cookie into the authentication file, you can add `https://coomer.su/favorites` to the URLs file, and Cyberdrop-DL will scrape your favorites.
+
+</details>
+
+<details>
+
<summary>Forums</summary>
In order to scrape links/content from forums, you need to provide Cyberdrop-DL with your login details so it can access the website. This section also includes cookies for the support forums.
diff --git a/docs/reference/supported-websites.md b/docs/reference/supported-websites.md
index 48d9b8faa..0e04354af 100644
--- a/docs/reference/supported-websites.md
+++ b/docs/reference/supported-websites.md
@@ -9,7 +9,7 @@ description: These are the websites supported by Cyberdrop-DL
| Domain | Supported URL Paths |
| --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Bunkrr | Albums: `/a/...` Videos: `/v/...` Others: `/f/...` Direct links |
-| Coomer | OnlyFans Model: `/onlyfans/user/...` Fansly Model: `/fansly/user/...` Individual Post: `/<service>/user/.../post/...` Direct links |
+| Coomer | OnlyFans Model: `/onlyfans/user/...` Fansly Model: `/fansly/user/...` Individual Post: `/<service>/user/.../post/...` Favorites: `/favorites` Direct links |
| Cyberdrop | Albums: `/a/...` Files: `/f/...` Direct Links |
| Cyberfile | Folders: `/folder/...` Shared: `/shared/...` Files: `/...` |
| E-Hentai | Albums: `/g/...` Files: `/s/...` |