jbsparrow / CyberDropDownloader

Bulk Gallery Downloader for Cyberdrop.me and Other Sites
GNU General Public License v3.0
200 stars 14 forks source link

[BUG] Crashes when it can't reach RealDebrid API even when real-debrid is skipped #310

Open mullertremolo opened 1 day ago

mullertremolo commented 1 day ago

Describe the bug

cyberdrop-dl crashes when the RealDebrid manager can't connect to api.real-debrid.com even when you use --skip-hosts real-debrid. This is because it tries to download the list of supported hosts even when skipped in the startup function.

Error:

An error occurred, please report this to the developer with your logs file:
  HTTPSConnectionPool(host='api.real-debrid.com', port=443): Max retries exceeded with url: /rest/1.0/hosts/regex (Caused
by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x10b685f10>: Failed to establish a new connection:
[Errno 9] Bad file descriptor'))

To Help Reproduce

  1. IP block api.real-debrid.com
  2. Try to download any other URL

Setup Information

Downloader.log file

[11/21/24 12:20:17] DEBUG    Using Debug Log: None                                                                                                                                                                                  logger.py:21
                    INFO     Starting Async Processes...                                                                                                                                                                            logger.py:21
                    INFO     --------------------------------------------------                                                                                                                                                     logger.py:21
                    INFO     Starting CDL...                                                                                                                                                                                        logger.py:21

[11/21/24 12:20:19] CRITICAL An error occurred, please report this to the developer with your logs file:                                                                                                                            logger.py:21
                               HTTPSConnectionPool(host='api.real-debrid.com', port=443): Max retries exceeded with url: /rest/1.0/hosts/regex (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at
                             0x10b685f10>: Failed to establish a new connection: [Errno 9] Bad file descriptor'))
                             ╭──────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────────────────────────╮
                             │ [REDACTED]/cyberdrop_dl/cyberdrop_dl/main.py:180 in wrapper                                                                                                                       │
                             │                                                                                                                                                                                                    │
                             │   177 │   @wraps(func)                                                                                                                                                                             │
                             │   178 │   async def wrapper(*args, **kwargs):                                                                                                                                                      │
                             │   179 │   │   try:                                                                                                                                                                                 │
                             │ ❱ 180 │   │   │   return await func(*args, **kwargs)                                                                                                                                               │
                             │   181 │   │   except* Exception as e:                                                                                                                                                              │
                             │   182 │   │   │   exc_list = str(e)                                                                                                                                                                │
                             │   183 │   │   │   if isinstance(e, ExceptionGroup):                                                                                                                                                │
                             │                                                                                                                                                                                                    │
                             │ [REDACTED]/cyberdrop_dl/cyberdrop_dl/main.py:218 in director                                                                                                                      │
                             │                                                                                                                                                                                                    │
                             │   215 │   │   log("Starting CDL...\n", 20)                                                                                                                                                         │
                             │   216 │   │                                                                                                                                                                                        │
                             │   217 │   │   pre_runtime(manager)                                                                                                                                                                 │
                             │ ❱ 218 │   │   await runtime(manager)                                                                                                                                                               │
                             │   219 │   │   await post_runtime(manager)                                                                                                                                                          │
                             │   220 │   │                                                                                                                                                                                        │
                             │   221 │   │   log_spacer(20)                                                                                                                                                                       │
                             │                                                                                                                                                                                                    │
                             │ [REDACTED]/cyberdrop_dl/cyberdrop_dl/main.py:72 in runtime                                                                                                                        │
                             │                                                                                                                                                                                                    │
                             │    69 │                                                                                                                                                                                            │
                             │    70 │   with manager.live_manager.get_main_live(stop=True):                                                                                                                                      │
                             │    71 │   │   scrape_mapper = ScrapeMapper(manager)                                                                                                                                                │
                             │ ❱  72 │   │   async with asyncio.TaskGroup() as task_group:                                                                                                                                        │
                             │    73 │   │   │   manager.task_group = task_group                                                                                                                                                  │
                             │    74 │   │   │   await scrape_mapper.start()                                                                                                                                                      │
                             │    75                                                                                                                                                                                              │
                             │                                                                                                                                                                                                    │
                             │ /usr/local/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/taskgroups.py:145 in __aexit__                                                             │
                             │                                                                                                                                                                                                    │
                             │   142 │   │   │   # a bunch of them.                                                                                                                                                               │
                             │   143 │   │   │   try:                                                                                                                                                                             │
                             │   144 │   │   │   │   me = BaseExceptionGroup('unhandled errors in a TaskGroup', self._errors)                                                                                                     │
                             │ ❱ 145 │   │   │   │   raise me from None                                                                                                                                                           │
                             │   146 │   │   │   finally:                                                                                                                                                                         │
                             │   147 │   │   │   │   self._errors = None                                                                                                                                                          │
                             │   148                                                                                                                                                                                              │
                             ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
                             ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)

Additional context

My ISP is IP blocking api.real-debrid.com.

NTFSvolume commented 22 hours ago

It's not possible to handle the actual connection error cause this could technically happen with any other domain and CDL makes requests all over the codebase. As a workaround, a check will be implemented to skip making any request to RD unless an api key was provided. Should be available on the next release.