Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR 500 - when using impersonate yt-dlp works directly but not via metube #559

Open
admapop opened this issue Dec 27, 2024 · 15 comments
Open

Comments

@admapop
Copy link
Contributor

admapop commented Dec 27, 2024

YTDL_OPTIONS={"cookiefile":"/cookies/cookies.txt","verbose":"true","impersonate":"chrome"}

If I enter the docker container and execute yt-dlp directly with the cookiefile and impersonate, the download works.

When I try via the UI I get

INFO:ytdl:adding https://www.udemy.com/course/complete-react-developer-zero-to-mastery/learn/lecture/15090998#overview: quality='best' format='any' already=None folder=None custom_name_prefix='' playlist_strict_mode=False playlist_item_limit=0
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8 (No ANSI), error utf-8 (No ANSI), screen utf-8 (No ANSI)
[debug] yt-dlp version [email protected] from yt-dlp/yt-dlp [65cf46cdd] (pip) API
[debug] params: {'quiet': True, 'no_color': True, 'extract_flat': True, 'ignore_no_formats_error': True, 'noplaylist': False, 'paths': {'home': '/downloads', 'temp': '/downloads'}, 'cookiefile': '/cookies/cookies.txt', 'verbose': 'true', 'impersonate': 'chrome', 'color': 'no_color', 'compat_opts': set(), 'http_headers': {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': 'en-us,en;q=0.5', 'Sec-Fetch-Mode': 'navigate'}}
[debug] Python 3.11.11 (CPython aarch64 64bit) - Linux-6.8.0-1013-oracle-aarch64-with (OpenSSL 3.3.2 3 Sep 2024)
[debug] exe versions: ffmpeg 6.1.2 (setts), ffprobe 6.1.2
[debug] Optional libraries: Cryptodome-3.21.0, brotli-1.1.0, certifi-2024.08.30, curl_cffi-0.7.1, mutagen-1.47.0, requests-2.32.3, sqlite3-3.47.1, urllib3-2.2.3, websockets-13.1
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi
ERROR:aiohttp.server:Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 559, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/app/app/main.py", line 146, in add
    status = await dqueue.add(url, quality, format, folder, custom_name_prefix, playlist_strict_mode, playlist_item_limit, auto_start)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/app/ytdl.py", line 334, in add
    entry = await asyncio.get_running_loop().run_in_executor(None, self.__extract_info, url, playlist_strict_mode)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/app/ytdl.py", line 223, in __extract_info
    return yt_dlp.YoutubeDL(params={
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 742, in __init__
    if not self._impersonate_target_available(impersonate_target):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 4146, in _impersonate_target_available
    return any(
           ^^^^
  File "/usr/local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 4147, in <genexpr>
    rh.is_supported_target(target)
  File "/usr/local/lib/python3.11/site-packages/yt_dlp/networking/impersonate.py", line 119, in is_supported_target
    assert isinstance(target, ImpersonateTarget)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
INFO:aiohttp.access:10.0.7.1 [27/Dec/2024:11:50:53 +0000] "POST /add HTTP/1.1" 500 346 "https://MYDOMAIN/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
INFO:ytdl:adding https://www.udemy.com/course/complete-react-developer-zero-to-mastery/learn/lecture/15090998#overview: quality='best' format='mp4' already=None folder=None custom_name_prefix='' playlist_strict_mode=False playlist_item_limit=0
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8 (No ANSI), error utf-8 (No ANSI), screen utf-8 (No ANSI)
[debug] yt-dlp version [email protected] from yt-dlp/yt-dlp [65cf46cdd] (pip) API
[debug] params: {'quiet': True, 'no_color': True, 'extract_flat': True, 'ignore_no_formats_error': True, 'noplaylist': False, 'paths': {'home': '/downloads', 'temp': '/downloads'}, 'cookiefile': '/cookies/cookies.txt', 'verbose': 'true', 'impersonate': 'safari', 'color': 'no_color', 'compat_opts': set(), 'http_headers': {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': 'en-us,en;q=0.5', 'Sec-Fetch-Mode': 'navigate'}}
[debug] Python 3.11.11 (CPython aarch64 64bit) - Linux-6.8.0-1013-oracle-aarch64-with (OpenSSL 3.3.2 3 Sep 2024)
[debug] exe versions: ffmpeg 6.1.2 (setts), ffprobe 6.1.2
[debug] Optional libraries: Cryptodome-3.21.0, brotli-1.1.0, certifi-2024.08.30, curl_cffi-0.7.1, mutagen-1.47.0, requests-2.32.3, sqlite3-3.47.1, urllib3-2.2.3, websockets-13.1
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi
ERROR:aiohttp.server:Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 559, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/app/app/main.py", line 146, in add
    status = await dqueue.add(url, quality, format, folder, custom_name_prefix, playlist_strict_mode, playlist_item_limit, auto_start)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/app/ytdl.py", line 334, in add
    entry = await asyncio.get_running_loop().run_in_executor(None, self.__extract_info, url, playlist_strict_mode)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/app/ytdl.py", line 223, in __extract_info
    return yt_dlp.YoutubeDL(params={
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 742, in __init__
    if not self._impersonate_target_available(impersonate_target):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 4146, in _impersonate_target_available
    return any(
           ^^^^
  File "/usr/local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 4147, in <genexpr>
    rh.is_supported_target(target)
  File "/usr/local/lib/python3.11/site-packages/yt_dlp/networking/impersonate.py", line 119, in is_supported_target
    assert isinstance(target, ImpersonateTarget)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
INFO:aiohttp.access:10.0.7.1 [27/Dec/2024:11:50:57 +0000] "POST /add HTTP/1.1" 500 346 "https://MYDOMAIN/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
@PikuZheng
Copy link
Contributor

Have you inspected into the container and installed the chrome component?

@admapop
Copy link
Contributor Author

admapop commented Dec 27, 2024

@PikuZheng how do you mean?

I've opened a sh in the container and was able to use yt-dlp directly with impersonate chrome, but didn't do much else.

I also have a custom dockerfile to install some dependencies

@PikuZheng
Copy link
Contributor

[debug] yt-dlp version [email protected] from yt-dlp/yt-dlp [65cf46cdd] (pip) API
[debug] params: {'quiet': True, 'no_color': True, 'extract_flat': True, 'ignore_no_formats_error': True, 'noplaylist': False, 'paths': {'home': '/downloads', 'temp': '/downloads'}, 'cookiefile': '/cookies/cookies.txt', 'verbose': 'true', 'impersonate': 'chrome', 'color': 'no_color', 'compat_opts': set(), 'http_headers': {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8', 'Accept-Language': 'en-us,en;q=0.5', 'Sec-Fetch-Mode': 'navigate'}}
[debug] Python 3.11.11 (CPython aarch64 64bit) - Linux-6.8.0-1013-oracle-aarch64-with (OpenSSL 3.3.2 3 Sep 2024)
[debug] exe versions: ffmpeg 6.1.2 (setts), ffprobe 6.1.2
[debug] Optional libraries: Cryptodome-3.21.0, brotli-1.1.0, certifi-2024.08.30, curl_cffi-0.7.1, mutagen-1.47.0, requests-2.32.3, sqlite3-3.47.1, urllib3-2.2.3, websockets-13.1
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi

There is no impersonate named chrome, so I think something is missing in the runtime environment.
On the other hand, if the command line works fine in the same environment but the embedded one doesn't, it may be because the ytdl_options are incorrect. Can you write the command line that works properly so that we can determine the issue?

@admapop
Copy link
Contributor Author

admapop commented Dec 28, 2024

[debug] yt-dlp version [email protected] from yt-dlp/yt-dlp [65cf46cdd] (pip) API
[debug] params: {'quiet': True, 'no_color': True, 'extract_flat': True, 'ignore_no_formats_error': True, 'noplaylist': False, 'paths': {'home': '/downloads', 'temp': '/downloads'}, 'cookiefile': '/cookies/cookies.txt', 'verbose': 'true', 'impersonate': 'chrome', 'color': 'no_color', 'compat_opts': set(), 'http_headers': {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8', 'Accept-Language': 'en-us,en;q=0.5', 'Sec-Fetch-Mode': 'navigate'}}
[debug] Python 3.11.11 (CPython aarch64 64bit) - Linux-6.8.0-1013-oracle-aarch64-with (OpenSSL 3.3.2 3 Sep 2024)
[debug] exe versions: ffmpeg 6.1.2 (setts), ffprobe 6.1.2
[debug] Optional libraries: Cryptodome-3.21.0, brotli-1.1.0, certifi-2024.08.30, curl_cffi-0.7.1, mutagen-1.47.0, requests-2.32.3, sqlite3-3.47.1, urllib3-2.2.3, websockets-13.1
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi

There is no impersonate named chrome, so I think something is missing in the runtime environment. On the other hand, if the command line works fine in the same environment but the embedded one doesn't, it may be because the ytdl_options are incorrect. Can you write the command line that works properly so that we can determine the issue?

You might be right about chrome not being right, i just saw in the code that there's a quick mapping between chrome and chrome-110.

This is the command I use that works

yt-dlp https://www.udemy.com/course/complete-react-developer-zero-to-mastery/learn/lecture/14754858#overview --cookies /cookies/cookies.txt --impersonate="chrome-110"

My YTDL options are like this

YTDL_OPTIONS={"cookiefile":"/cookies/cookies.txt","verbose":"true","impersonate":"chrome"}

And loaded in the docker compose via env var

    environment:
      - SERVICE_FQDN_METUBE_8081
      - UID=1000
      - GID=1000
      - YTDL_OPTIONS

@PikuZheng
Copy link
Contributor

YTDL_OPTIONS={"cookiefile":"/cookies/cookies.txt","verbose":"true","impersonate":"chrome"}

according to https://github.com/yt-dlp/yt-dlp/blob/0b6b7742c2e7f2a1fcb0b54ef3dd484bab404b3f/yt_dlp/YoutubeDL.py#L422
impersonate should be an ImpersonateTarget object. metube processes ytdl_options as json, which does not support this

or you need to modify YoutubeDL.py so that json is converted to class object

@admapop
Copy link
Contributor Author

admapop commented Dec 28, 2024

YTDL_OPTIONS={"cookiefile":"/cookies/cookies.txt","verbose":"true","impersonate":"chrome"}

according to https://github.com/yt-dlp/yt-dlp/blob/0b6b7742c2e7f2a1fcb0b54ef3dd484bab404b3f/yt_dlp/YoutubeDL.py#L422 impersonate should be an ImpersonateTarget object. metube processes ytdl_options as json, which does not support this

or you need to modify YoutubeDL.py so that json is converted to class object

Good point. I made a quick PR to create the ImpersonateTarget object if the impersonate property exists

#560

@PikuZheng
Copy link
Contributor

nice job

@PikuZheng
Copy link
Contributor

Depending on your pr, should ytdl_options be written as "impersonate": "chrome-110:windows-10" ?

@admapop
Copy link
Contributor Author

admapop commented Dec 28, 2024

Depending on your pr, should ytdl_options be written as "impersonate": "chrome-110:windows-10" ?

I'm not sure? When running the command directly I can get away with using chrome-110 without specifying OS.

@PikuZheng
Copy link
Contributor

What I tried

YTDL_OPTIONS={ 
  "impersonate": {
    "client": "chrome",
    "version": "110",
    "os": "windows",
    "os_version": "10"
  }
}

main.py

from yt_dlp.networking.impersonate import ImpersonateTarget
class Config:
    def __init__(self):
        ................
        if impersonate_data := self.YTDL_OPTIONS.get("impersonate"):
            self.YTDL_OPTIONS["impersonate"] = ImpersonateTarget(**impersonate_data)

@ctschach
Copy link

ctschach commented Jan 8, 2025

I'm also running into this issue. If I just provide a string for impersonate, I see the exact same "AssertionError" that was mentioned in the beginning.

Now that the pull request has been merged, I was hoping that this will work. So I also tried:

"impersonate": { "client": "chrome", "version": "110", "os": windows, "os_version": "10" },

in my ytdl-options.json and I'm no getting a different error:

metube    |   File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
metube    |     result = self.fn(*self.args, **self.kwargs)
metube    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    |   File "/app/app/ytdl.py", line 232, in __extract_info
metube    |     **({'impersonate': yt_dlp.networking.impersonate.ImpersonateTarget.from_str(self.config.YTDL_OPTIONS['impersonate'])} if 'impersonate' in self.config.YTDL_OPTIONS else {}),
metube    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    |   File "/usr/local/lib/python3.11/site-packages/yt_dlp/networking/impersonate.py", line 55, in from_str
metube    |     mobj = re.fullmatch(r'(?:(?P<client>[^:-]+)(?:-(?P<version>[^:-]+))?)?(?::(?:(?P<os>[^:-]+)(?:-(?P<os_version>[^:-]+))?)?)?', target)
metube    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    |   File "/usr/local/lib/python3.11/re/__init__.py", line 171, in fullmatch
metube    |     return _compile(pattern, flags).fullmatch(string)
metube    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    | TypeError: expected string or bytes-like object, got 'dict'

Looks like a dict is not expected.

So what's the correct syntax to provide the impersonate parameters?

@admapop
Copy link
Contributor Author

admapop commented Jan 8, 2025

I'm also running into this issue. If I just provide a string for impersonate, I see the exact same "AssertionError" that was mentioned in the beginning.

Now that the pull request has been merged, I was hoping that this will work. So I also tried:

"impersonate": { "client": "chrome", "version": "110", "os": windows, "os_version": "10" },

in my ytdl-options.json and I'm no getting a different error:

metube    |   File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
metube    |     result = self.fn(*self.args, **self.kwargs)
metube    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    |   File "/app/app/ytdl.py", line 232, in __extract_info
metube    |     **({'impersonate': yt_dlp.networking.impersonate.ImpersonateTarget.from_str(self.config.YTDL_OPTIONS['impersonate'])} if 'impersonate' in self.config.YTDL_OPTIONS else {}),
metube    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    |   File "/usr/local/lib/python3.11/site-packages/yt_dlp/networking/impersonate.py", line 55, in from_str
metube    |     mobj = re.fullmatch(r'(?:(?P<client>[^:-]+)(?:-(?P<version>[^:-]+))?)?(?::(?:(?P<os>[^:-]+)(?:-(?P<os_version>[^:-]+))?)?)?', target)
metube    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    |   File "/usr/local/lib/python3.11/re/__init__.py", line 171, in fullmatch
metube    |     return _compile(pattern, flags).fullmatch(string)
metube    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    | TypeError: expected string or bytes-like object, got 'dict'

Looks like a dict is not expected.

So what's the correct syntax to provide the impersonate parameters?

Can you try either "impersonate": "chrome", or "impersonate": "chrome-110"

@ctschach
Copy link

ctschach commented Jan 8, 2025

As I mentioned before, this gives the same AssertionError that was already shown:

So this is with 'impersonate': 'chrome-110':

metube    | [debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8 (No ANSI), error utf-8 (No ANSI), screen utf-8 (No ANSI)
metube    | [debug] yt-dlp version [email protected] from yt-dlp/yt-dlp [65cf46cdd] (pip) API
metube    | [debug] params: {'quiet': True, 'no_color': True, 'extract_flat': True, 'ignore_no_formats_error': True, 'noplaylist': False, 'paths': {'home': '/inbox', 'temp': '/downloads'}, 'impersonate': 'chrome-110', 'cookiefile': '/cookies/cookies.txt', 'verbose': True, 'overwrites': True, 'updatetime': False, 'writedescription': True, 'writethumbnail': True, 'writeinfojson': True, 'clean_infojson': True, 'writesubtitles': True, 'subtitleslangs': ['all', '-live_chat'], 'format': 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best', 'exec': 'cp -p %(filepath)q %(filepath)q.h264.mp4', 'postprocessors': [{'key': 'Exec', 'exec_cmd': 'sh /savecopy.sh {}', 'when': 'post_process'}, {'key': 'FFmpegEmbedSubtitle', 'already_have_subtitle': False}, {'key': 'FFmpegMetadata', 'add_chapters': True, 'add_metadata': True, 'add_infojson': 'if_exists'}, {'key': 'EmbedThumbnail'}, {'key': 'FFmpegCopyStream'}], 'postprocessor_args': {'offmerger': ['-metadata:s', 'title=', '-metadata:s', 'handler_name='], 'copystream': ['-vaapi_device', '/dev/dri/renderD128', '-vf', 'format=nv12,hwupload', '-c:v', 'hevc_vaapi', '-crf', '20', '-tag:v', 'hvc1', '-c:a', 'copy']}, 'color': 'no_color', 'compat_opts': set(), 'http_headers': {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': 'en-us,en;q=0.5', 'Sec-Fetch-Mode': 'navigate'}}
metube    | [debug] Python 3.11.11 (CPython x86_64 64bit) - Linux-5.15.0-130-generic-x86_64-with (OpenSSL 3.3.2 3 Sep 2024)
metube    | [debug] exe versions: ffmpeg 6.1.2 (setts), ffprobe 6.1.2
metube    | [debug] Optional libraries: Cryptodome-3.21.0, brotli-1.1.0, certifi-2024.08.30, curl_cffi-0.7.1, mutagen-1.47.0, requests-2.32.3, sqlite3-3.47.1, urllib3-2.2.3, websockets-13.1
metube    | [debug] Proxy map: {}
metube    | [debug] Request Handlers: urllib, requests, websockets, curl_cffi
metube    | ERROR:aiohttp.server:Error handling request
metube    | Traceback (most recent call last):
metube    |   File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
metube    |     resp = await request_handler(request)
metube    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    |   File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 559, in _handle
metube    |     return await handler(request)
metube    |            ^^^^^^^^^^^^^^^^^^^^^^
metube    |   File "/app/app/main.py", line 146, in add
metube    |     status = await dqueue.add(url, quality, format, folder, custom_name_prefix, playlist_strict_mode, playlist_item_limit, auto_start)
metube    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    |   File "/app/app/ytdl.py", line 337, in add
metube    |     entry = await asyncio.get_running_loop().run_in_executor(None, self.__extract_info, url, playlist_strict_mode)
metube    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    |   File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
metube    |     result = self.fn(*self.args, **self.kwargs)
metube    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    |   File "/app/app/ytdl.py", line 225, in __extract_info
metube    |     return yt_dlp.YoutubeDL(params={
metube    |            ^^^^^^^^^^^^^^^^^^^^^^^^^
metube    |   File "/usr/local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 742, in __init__
metube    |     if not self._impersonate_target_available(impersonate_target):
metube    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    |   File "/usr/local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 4146, in _impersonate_target_available
metube    |     return any(
metube    |            ^^^^
metube    |   File "/usr/local/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 4147, in <genexpr>
metube    |     rh.is_supported_target(target)
metube    |   File "/usr/local/lib/python3.11/site-packages/yt_dlp/networking/impersonate.py", line 119, in is_supported_target
metube    |     assert isinstance(target, ImpersonateTarget)
metube    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metube    | AssertionError

@PikuZheng
Copy link
Contributor

I believe using a dictionary is a good idea, especially since curl-impersonate has been updated to provide more OS options

@admapop
Copy link
Contributor Author

admapop commented Jan 15, 2025

I'll give it a look maybe today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants