ytdlbot icon indicating copy to clipboard operation
ytdlbot copied to clipboard

WARNING: [youtube] Unable to download API page: HTTPSConnectionPool(host='www.youtube.com', port=443): Read timed out

Open kang000feng opened this issue 1 year ago • 7 comments

dear developers,

here is the logs from docker , and i login the ytdl_1 container and rum curl -o /dev/null https://www.youtube.com --limit-rate 500k , it goes well. how to fix this error ?

ytdl_1 | [2025-04-17 15:22:42 session.py:281 I] PingTask started ytdl_1 | [2025-04-17 15:22:43 dispatcher.py:224 I] Started 64 HandlerTasks ytdl_1 | [2025-04-17 15:28:15 main.py:346 I] start https://youtu.be/3GjNSbmhePg?si=KS8CRls8E8ZirXP4 ytdl_1 | [2025-04-17 15:28:15 generic.py:121 I] yt-dlp options: {'progress_hooks': [<function YoutubeDownload._download.. at 0xffff7cd5bd80>], 'outtmpl': '/tmp/ytdl-w7cisrzt/%(title).70s.%(ext)s', 'restrictfilenames': False, 'quiet': True, 'match_filter': <function match_filter at 0xffff7fd007c0>, 'format': 'bestvideo[ext=mp4][vcodec!=av01][vcodec!=vp09]+bestaudio[ext=m4a]/bestvideo+bestaudio'} ytdl_1 | WARNING: [youtube] HTTPSConnectionPool(host='www.youtube.com', port=443): Read timed out. (read timeout=20.0). Retrying (1/3)... ytdl_1 | WARNING: [youtube] HTTPSConnectionPool(host='www.youtube.com', port=443): Read timed out. (read timeout=20.0). Retrying (2/3)... ytdl_1 | WARNING: [youtube] HTTPSConnectionPool(host='www.youtube.com', port=443): Read timed out. (read timeout=20.0). Retrying (3/3)... ytdl_1 | WARNING: [youtube] Unable to download API page: HTTPSConnectionPool(host='www.youtube.com', port=443): Read timed out. (read timeout=20.0) (caused by TransportError("HTTPSConnectionPool(host='www.youtube.com', port=443): Read timed out. (read timeout=20.0)")) ytdl_1 | WARNING: [youtube] 3GjNSbmhePg: Signature extraction failed: Some formats may be missing ytdl_1 | WARNING: [youtube] Failed to download m3u8 information: HTTPSConnectionPool(host='manifest.googlevideo.com', port=443): Read timed out. (read timeout=20.0) ytdl_1 | WARNING: Only images are available for download. use --list-formats to see them ytdl_1 | ERROR: [youtube] 3GjNSbmhePg: Requested format is not available. Use --list-formats for a list of available formats ytdl_1 | [2025-04-17 15:30:00 main.py:366 E] Download failed ytdl_1 | Traceback (most recent call last): ytdl_1 | File "/usr/local/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 1651, in wrapper ytdl_1 | return func(self, *args, **kwargs) ytdl_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ytdl_1 | File "/usr/local/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 1807, in __extract_info ytdl_1 | return self.process_ie_result(ie_result, download, extra_info) ytdl_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ytdl_1 | File "/usr/local/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 1866, in process_ie_result ytdl_1 | ie_result = self.process_video_result(ie_result, download=download) ytdl_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ytdl_1 | File "/usr/local/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 3000, in process_video_result ytdl_1 | raise ExtractorError( ytdl_1 | yt_dlp.utils.ExtractorError: [youtube] 3GjNSbmhePg: Requested format is not available. Use --list-formats for a list of available formats ytdl_1 | ytdl_1 | During handling of the above exception, another exception occurred: ytdl_1 | ytdl_1 | Traceback (most recent call last): ytdl_1 | File "/app/main.py", line 353, in download_handler ytdl_1 | youtube_entrance(client, bot_msg, url) ytdl_1 | File "/app/engine/init.py", line 17, in youtube_entrance ytdl_1 | youtube.start() ytdl_1 | File "/app/engine/base.py", line 270, in start ytdl_1 | self._start() ytdl_1 | File "/app/engine/generic.py", line 136, in _start ytdl_1 | self._download(default_formats) ytdl_1 | File "/app/engine/generic.py", line 123, in _download ytdl_1 | ydl.download([self._url]) ytdl_1 | File "/usr/local/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 3632, in download ytdl_1 | self.__download_wrapper(self.extract_info)( ytdl_1 | File "/usr/local/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 3605, in wrapper ytdl_1 | res = func(*args, **kwargs) ytdl_1 | ^^^^^^^^^^^^^^^^^^^^^ ytdl_1 | File "/usr/local/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 1640, in extract_info ytdl_1 | return self.__extract_info(url, self.get_info_extractor(key), download, extra_info, process) ytdl_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ytdl_1 | File "/usr/local/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 1669, in wrapper ytdl_1 | self.report_error(str(e), e.format_traceback()) ytdl_1 | File "/usr/local/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 1109, in report_error ytdl_1 | self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs) ytdl_1 | File "/usr/local/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 1048, in trouble ytdl_1 | raise DownloadError(message, exc_info) ytdl_1 | yt_dlp.utils.DownloadError: ERROR: [youtube] 3GjNSbmhePg: Requested format is not available. Use --list-formats for a list of available formats

kang000feng avatar Apr 17 '25 16:04 kang000feng

it seems like a temporary network issue. Try again later

BennyThink avatar Apr 17 '25 16:04 BennyThink

it seems like a temporary network issue. Try again later

Thanks. I did try, but it didn’t work. My friend used yt_dlp to download the same URL (https://youtu.be/3GjNSbmhePg?si=KS8CRls8E8ZirXP4), and it worked for him. i also try other youtube video URL but get same error. may i ask is there a way to increase the timeout from 20 to 120s to debug ?

kang000feng avatar Apr 17 '25 16:04 kang000feng

it seems like a temporary network issue. Try again later

Thanks. I did try, but it didn’t work. My friend used yt_dlp to download the same URL (https://youtu.be/3GjNSbmhePg?si=KS8CRls8E8ZirXP4), and it worked for him. i also try other youtube video URL but get same error. may i ask is there a way to increase the timeout from 20 to 120s to debug ?

This doesn't look like a problem from the bot side. As @BennyThink mentioned seems like a network issue. According to logs, yt-dlp trying to access the YT host and failing.

Instead of curl, try running yt-dlp inside the container and share the output.

yt-dlp -f bestvideo+bestaudio "https://youtu.be/3GjNSbmhePg"

SanujaNS avatar Apr 17 '25 17:04 SanujaNS

yt-dlp -f bestvideo+bestaudio "https://youtu.be/3GjNSbmhePg"

/app # curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 2990k 100 2990k 0 0 2226k 0 0:00:01 0:00:01 --:--:-- 206M /app # chmod +x /usr/local/bin/yt-dlp /app # yt-dlp -f bestvideo+bestaudio "https://youtu.be/3GjNSbmhePg" [youtube] Extracting URL: https://youtu.be/3GjNSbmhePg [youtube] 3GjNSbmhePg: Downloading webpage [youtube] 3GjNSbmhePg: Downloading tv client config [youtube] 3GjNSbmhePg: Downloading player 9a279502-main [youtube] 3GjNSbmhePg: Downloading tv player API JSON WARNING: [youtube] HTTPSConnectionPool(host='www.youtube.com', port=443): Read timed out. (read timeout=20.0). Retrying (1/3)... [youtube] 3GjNSbmhePg: Downloading tv player API JSON WARNING: [youtube] HTTPSConnectionPool(host='www.youtube.com', port=443): Read timed out. (read timeout=20.0). Retrying (2/3)... [youtube] 3GjNSbmhePg: Downloading tv player API JSON WARNING: [youtube] HTTPSConnectionPool(host='www.youtube.com', port=443): Read timed out. (read timeout=20.0). Retrying (3/3)... [youtube] 3GjNSbmhePg: Downloading tv player API JSON WARNING: [youtube] Unable to download API page: HTTPSConnectionPool(host='www.youtube.com', port=443): Read timed out. (read timeout=20.0) (caused by TransportError("HTTPSConnectionPool(host='www.youtube.com', port=443): Read timed out. (read timeout=20.0)")) [youtube] 3GjNSbmhePg: Downloading ios player API JSON ERROR: [youtube] 3GjNSbmhePg: Sign in to confirm you’re not a bot. Use --cookies-from-browser or --cookies for the authentication. See https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp for how to manually pass cookies. Also see https://github.com/yt-dlp/yt-dlp/wiki/Extractors#exporting-youtube-cookies for tips on effectively exporting YouTube cookies

kang000feng avatar Apr 17 '25 18:04 kang000feng

it seems like a temporary network issue. Try again later

Thanks. I did try, but it didn’t work. My friend used yt_dlp to download the same URL (https://youtu.be/3GjNSbmhePg?si=KS8CRls8E8ZirXP4), and it worked for him. i also try other youtube video URL but get same error. may i ask is there a way to increase the timeout from 20 to 120s to debug ?

This doesn't look like a problem from the bot side. As @BennyThink mentioned seems like a network issue. According to logs, yt-dlp trying to access the YT host and failing.

Instead of curl, try running yt-dlp inside the container and share the output.

yt-dlp -f bestvideo+bestaudio "https://youtu.be/3GjNSbmhePg"

and at the same time i try to download x.com video, both yt-dlp and ytdlbot work fine ,

/app # yt-dlp -f bestvideo+bestaudio "https://x.com/luamyupup/status/1912455981621211148" [twitter] Extracting URL: https://x.com/luamyupup/status/1912455981621211148 [twitter] 1912455981621211148: Downloading guest token [twitter] 1912455981621211148: Downloading GraphQL JSON [twitter] 1912455981621211148: Downloading m3u8 information [info] 1912455890319360000: Downloading 1 format(s): hls-1046+hls-audio-128000-Audio [hlsnative] Downloading m3u8 manifest [hlsnative] Total fragments: 20 [download] Destination: Amy xxxxxx! [1912455890319360000].fhls-1046.mp4 [download] 100% of 6.56MiB in 00:00:01 at 5.24MiB/s

pretty wired, is there a way to increase the timeout from 20 to 120s to debug ?

kang000feng avatar Apr 17 '25 18:04 kang000feng

i also upload my tcpdump result at pastebin for your reference. thx so much. https://pastebin.com/5Lunyddq

kang000feng avatar Apr 18 '25 12:04 kang000feng

@kang000feng are you using YouTube cookies or not ?

prono69 avatar Jul 08 '25 08:07 prono69