From 95c3879f34c23e7fdb4bcfee94326cb31aedea21 Mon Sep 17 00:00:00 2001 From: g0ldyy <153996346+g0ldyy@users.noreply.github.com> Date: Sat, 30 Aug 2025 15:59:16 +0200 Subject: [PATCH 1/3] feat: debridio scraper --- .env-sample | 3 +++ comet/main.py | 8 +++++++ comet/scrapers/debridio.py | 42 +++++++++++++++++++++++++++++++++++++ comet/scrapers/jackettio.py | 1 - comet/scrapers/manager.py | 3 +++ comet/utils/models.py | 4 +++- 6 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 comet/scrapers/debridio.py diff --git a/.env-sample b/.env-sample index 88623cd..2a444b1 100644 --- a/.env-sample +++ b/.env-sample @@ -124,6 +124,9 @@ JACKETTIO_URL=https://jackettio.example.com # Full manifest URL without /manifes # Multi-instance example: # JACKETTIO_URL='["https://jackettio1.example.com", "https://jackettio2.example.com"]' +SCRAPE_DEBRIDIO=True +DEBRIDIO_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + # ============================== # # Debrid Stream Proxy Settings # # ============================== # diff --git a/comet/main.py b/comet/main.py index 2e494bc..c1a3f47 100644 --- a/comet/main.py +++ b/comet/main.py @@ -242,6 +242,14 @@ def start_log(): f"Jackettio Scraper: {bool(settings.SCRAPE_JACKETTIO)}{jackettio_url}", ) + debridio_api_key = ( + f" - {settings.DEBRIDIO_API_KEY}" if settings.SCRAPE_DEBRIDIO else "" + ) + logger.log( + "COMET", + f"Debridio Scraper: {bool(settings.SCRAPE_DEBRIDIO)}{debridio_api_key}", + ) + logger.log( "COMET", f"Debrid Stream Proxy: {bool(settings.PROXY_DEBRID_STREAM)} - Password: {settings.PROXY_DEBRID_STREAM_PASSWORD} - Max Connections: {settings.PROXY_DEBRID_STREAM_MAX_CONNECTIONS} - Default Debrid Service: {settings.PROXY_DEBRID_STREAM_DEBRID_DEFAULT_SERVICE} - Default Debrid API Key: {settings.PROXY_DEBRID_STREAM_DEBRID_DEFAULT_APIKEY}", diff --git a/comet/scrapers/debridio.py b/comet/scrapers/debridio.py new file mode 100644 index 0000000..57e99e2 --- /dev/null +++ b/comet/scrapers/debridio.py @@ -0,0 +1,42 @@ +import aiohttp + +from comet.utils.general import log_scraper_error, size_to_bytes +from comet.utils.torrent import extract_trackers_from_magnet +from comet.utils.models import settings + + +async def get_debridio(manager, session: aiohttp.ClientSession): + torrents = [] + + try: + data = await session.get( + f"https://debapi.debridio.com/{settings.DEBRIDIO_API_KEY}/search/{manager.media_only_id}" + ) + data = await data.json() + + for torrent in data: + size = torrent["size"] + if isinstance(size, str): + size = size_to_bytes(size) + elif isinstance(size, int): + size = size + else: + size = None + + torrents.append( + { + "title": torrent["name"], + "infoHash": torrent["hash"], + "fileIndex": None, + "seeders": torrent["seeders"], + "size": size, + "tracker": f"Debridio|{torrent['indexer']}", + "sources": extract_trackers_from_magnet(torrent["magnet"]), + } + ) + except Exception as e: + log_scraper_error( + "Debridio", settings.DEBRIDIO_API_KEY, manager.media_only_id, e + ) + + await manager.filter_manager(torrents) diff --git a/comet/scrapers/jackettio.py b/comet/scrapers/jackettio.py index 73f22bf..611ed65 100644 --- a/comet/scrapers/jackettio.py +++ b/comet/scrapers/jackettio.py @@ -1,6 +1,5 @@ import re - from comet.utils.general import ( size_to_bytes, log_scraper_error, diff --git a/comet/scrapers/manager.py b/comet/scrapers/manager.py index da83975..dc5b0dd 100644 --- a/comet/scrapers/manager.py +++ b/comet/scrapers/manager.py @@ -28,6 +28,7 @@ from .comet import get_comet from .stremthru import get_stremthru from .aiostreams import get_aiostreams from .jackettio import get_jackettio +from .debridio import get_debridio class TorrentManager: @@ -85,6 +86,8 @@ class TorrentManager: tasks.extend(get_all_aiostreams_tasks(self)) if settings.SCRAPE_JACKETTIO: tasks.extend(get_all_jackettio_tasks(self)) + if settings.SCRAPE_DEBRIDIO: + tasks.append(get_debridio(self, session)) if settings.INDEXER_MANAGER_API_KEY: queries = [self.title] diff --git a/comet/utils/models.py b/comet/utils/models.py index 91399ef..9c61258 100644 --- a/comet/utils/models.py +++ b/comet/utils/models.py @@ -70,6 +70,8 @@ class AppSettings(BaseSettings): AIOSTREAMS_URL: Optional[Union[str, List[str]]] = None SCRAPE_JACKETTIO: Optional[bool] = False JACKETTIO_URL: Optional[Union[str, List[str]]] = None + SCRAPE_DEBRIDIO: Optional[bool] = False + DEBRIDIO_API_KEY: Optional[str] = None CUSTOM_HEADER_HTML: Optional[str] = None PROXY_DEBRID_STREAM: Optional[bool] = False PROXY_DEBRID_STREAM_PASSWORD: Optional[str] = "".join( @@ -106,7 +108,7 @@ class AppSettings(BaseSettings): "TORRENTIO_URL", "MEDIAFUSION_URL", "AIOSTREAMS_URL", - "JACKETTIO_URL" + "JACKETTIO_URL", ) def normalize_urls(cls, v): if isinstance(v, str): From 031582d546533c871bfa4a0e7a3f21653c7315a8 Mon Sep 17 00:00:00 2001 From: g0ldyy <153996346+g0ldyy@users.noreply.github.com> Date: Sat, 30 Aug 2025 16:19:59 +0200 Subject: [PATCH 2/3] fix: remove unnecessary assignment in debridio scraper --- comet/scrapers/debridio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comet/scrapers/debridio.py b/comet/scrapers/debridio.py index 57e99e2..fde3e90 100644 --- a/comet/scrapers/debridio.py +++ b/comet/scrapers/debridio.py @@ -19,7 +19,7 @@ async def get_debridio(manager, session: aiohttp.ClientSession): if isinstance(size, str): size = size_to_bytes(size) elif isinstance(size, int): - size = size + pass else: size = None From f3acc64a1b58d0b7cd18fb204ba8915cbc45fb9f Mon Sep 17 00:00:00 2001 From: g0ldyy <153996346+g0ldyy@users.noreply.github.com> Date: Sat, 30 Aug 2025 16:29:17 +0200 Subject: [PATCH 3/3] docs: update README to consolidate supported scrapers into a single line --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index c36555f..bf261e5 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,7 @@ - The first Stremio addon to Proxy Debrid Streams to allow use of the Debrid Service on multiple IPs at the same time on the same account! - IP-Based Max Connection Limit - Administration Dashboard with Bandwidth Manager, Metrics and more... -- Jackett and Prowlarr support -- [Zilean](https://github.com/iPromKnight/zilean) Scraper -- [Torrentio](https://torrentio.strem.fun/) Scraper -- [MediaFusion](https://mediafusion.elfhosted.com/) Scraper -- [Stremthru](https://github.com/MunifTanjim/stremthru/) Scraper +- Supported Scrapers: Jackett, Prowlarr, Torrentio, Zilean, MediaFusion, Debridio, StremThru, AIOStreams, Comet, Jackettio - Caching system ft. SQLite / PostgreSQL - Blazing Fast Background Scraper - Smart Torrent Ranking powered by [RTN](https://github.com/dreulavelle/rank-torrent-name)