youtube-dl: ERROR: Unable to extract yt initial data on playlist
Checklist
- I’m reporting a broken site support issue
- I’ve verified that I’m running youtube-dl version 2021.12.17
- I’ve checked that all provided URLs are alive and playable in a browser
- I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
- I’ve searched the bugtracker for similar bug reports including closed ones
- I’ve read bugs section in FAQ
Verbose log
PASTE VERBOSE LOG HERE
[debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: [‘–verbose’, ‘-x’, ‘https://youtube.com/playlist?list=PLA_zjX3swAf5tsw9KdHOGodzcJ_PptL9a’] [debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8 [debug] youtube-dl version 2021.12.17 [debug] Python version 3.8.10 (CPython) - Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.29 [debug] exe versions: none [debug] Proxy map: {} [youtube:tab] PLA_zjX3swAf5tsw9KdHOGodzcJ_PptL9a: Downloading webpage ERROR: Unable to extract yt initial data; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. Traceback (most recent call last): File “/usr/local/lib/python3.8/dist-packages/youtube_dl/YoutubeDL.py”, line 815, in wrapper return func(self, *args, **kwargs) File “/usr/local/lib/python3.8/dist-packages/youtube_dl/YoutubeDL.py”, line 836, in __extract_info ie_result = ie.extract(url) File “/usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/common.py”, line 534, in extract ie_result = self._real_extract(url) File “/usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/youtube.py”, line 2841, in _real_extract data = self._extract_yt_initial_data(item_id, webpage) File “/usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/youtube.py”, line 299, in _extract_yt_initial_data self._search_regex( File “/usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/common.py”, line 1012, in _search_regex raise RegexNotFoundError(‘Unable to extract %s’ % _name) youtube_dl.utils.RegexNotFoundError: Unable to extract yt initial data; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Description
WRITE DESCRIPTION HERE
as you can see above the program fails to download even a single video from the playlist i was using the minimum of arguments in the command and trying the same command with single videos from the playlist produces a different error: “ERROR: Unable to extract uploader id;” this seems to be consistent across the entire playlist
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 7
- Comments: 45 (18 by maintainers)
Using a VPN to move from the EU to outside the EU is also a workaround.
@1268
> WARNING: [youtube] Unable to decode n-parameter: download likely to be throttledI faced the same. See issue #32534.Until the patch arrives, you can apply this diff:
Then it works fine again:
I’m running youtube-dl on a Raspberry Pi. So, using any of the solutions given here did not work for me.
But I ultimately succeeded in extracting a cookies.txt file, perfectly working with version 2021.12.17, from another computer, using a standard Chrome browser on a standard Windows version with no additional extensions or whatsoever, just by using Google Chrome Developer Tools (F12) and pasting a script on the Console, to get the cookies in Netscape format.
See https://apple.stackexchange.com/a/425700
Go to YouTube with Chrome and connect to your account the usual way. Open the DevTools using F12 Go to the Applications tab, scroll down to the Cookies section, uncheck all the HttpOnly checkboxes to ensure that all cookies will be extracted Run the script given in the above-linked answer into Chrome’s console. Copy and paste the output in a UTF-8 .txt file Put this file in your youtube-dl environment Add --cookies yourcookiefile.txt to your youtube-dl command line And voilà!
Kudos to Maksim for this neat, straightforward working solution! In case the link would break, I attached the script here, with credits, of course. Cookie Extraction Google Chrome Script.txt
Based on https://github.com/ytdl-org/youtube-dl/issues/32533#issuecomment-1698311971, the patch from yt-dlp solves the problem for EU users. PR here RSN
See manual and FAQ.
YT is now ignoring the
ucbc=1parameter that the extractor adds and redirecting via consent.youtube.com, for some pages. There is a fix but meanwhile try passing cookies from a browser session where you have already gone through the consent check, using the nightly build.See also https://github.com/yt-dlp/yt-dlp/issues/7594.
Sadly, I’m out of ideas, except to expedite the QA on the extractor update.
Any minute now.
Or even, “fewer duplicates”.
The error message depends on how exactly Google wants to screw with you but now that you’ve mentioned this version people who follow search suggestions in #30839 will find this issue as the second hit.
maybe renaming this ticket to “WARNING: unable to extract player URL -> ERROR: No video formats found” would result in less duplicates
If the
initial player responseJSON can’t be extracted, the extractor tries to proceed by fetching equivalent JSON from/youtubei/v1/player?videoId={video_id}.The media links can be extracted from the
.streamingDatamember, but the extractor only knows how to pull the player JS URL from the full web page (containing theinitial player response) and not from the JSON (if it’s even sent), so the unscrambling logic can’t be used.In the console of your web browser.
Hey I get undefined when running this
sorry, I can’t reproduce it myself today (2023.09.07 and 2021.12.17), so just forget about it. as far I remember, I had played around with user-agent and cookies and it simply never worked until I moved all these arguments to the front. and I remember one day where I had a -x afterwards and it downloaded a video instead of music. i know, it’s not how parameters are supposed to work, that’s why I wrote it.
Just make the leading spaces tabs (this isn’t clear in the forum posting). The
<<-POSIX heredoc syntax (vs<<) means “strip leading tabs”.This is the output after passing my browser’s User Agent header to youtube-dl. BTW - I’m using Brave browser. Unfortunately it still does not work. Note that the cookies file is named cookies2.txt it’s because I also tried various methods like signing in to google, to no avail.
I also tried changing browser, thinking it might be an issue with Brave’s agressive privacy behaviour. So here is the output of a fresh Firefox install, with cookies passed after consent and UA header:
Interestingly enough it works with another video. I clicked one of the first things that appeared on my feed (https://www.youtube.com/watch?v=FxdbD-N7pHE) and was greeted with a successfull download with the same parameters. There were errors (unable to extract player URL), but the video was still downloaded succesfully. I posted it here since I think it might be more appropriate: #https://github.com/ytdl-org/youtube-dl/issues/32538#issuecomment-1702282364
Thank you for your answer, unfortunately it does not solve the issue, I have now updated to the nightly build but I still get the error message. I made sure to export cookies AFTER consenting to youtube cookies.
You have to have consented in the browser and then export the cookies.
Although it may not make any difference, also review #30839 to update to a newer version: it will have an earlier date, but I think the ytdl-patched repo is not currently being updated even though builds are being run.
I came accross the issue with consent yesterday.
For people using qutebrowser, you first need to convert its cookies into netscape format.
I used https://gist.github.com/guidocella/a272b6e68f9c44532b011f6596e95c61#file-dump-cookies-sh to do so and then youtube-dl --cookies $XDG_RUNTIME_DIR/cookies.txt
Just posting this in case it saves some people some trouble.
Hello! Do you have instructions on how to pass the cookies from a browser session? Thanks!
this happens on the nightly build:
[debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: [‘–verbose’, ‘-x’, ‘https://youtube.com/playlist?list=PLA_zjX3swAf5tsw9KdHOGodzcJ_PptL9a’] [debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252 [debug] youtube-dl version 2023.08.07 [86e3cf5e5] (single file build) [debug] ** This version was built from the latest master code at https://github.com/ytdl-org/youtube-dl. [debug] ** For support, visit the main site. [debug] Python 3.4.4 (CPython AMD64 32bit) - Windows-10-10.0.22621 - OpenSSL 1.0.2d 9 Jul 2015 [debug] exe versions: none [debug] Proxy map: {} [youtube:tab] PLA_zjX3swAf5tsw9KdHOGodzcJ_PptL9a: Downloading webpage ERROR: Unable to extract yt initial data; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. Traceback (most recent call last): File “D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py”, line 863, in wrapper File “D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\YoutubeDL.py”, line 959, in __extract_info File “D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\extractor\common.py”, line 565, in extract File “D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\extractor\youtube.py”, line 3335, in _real_extract File “D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\extractor\youtube.py”, line 312, in _extract_yt_initial_data File “D:\a\ytdl-nightly\ytdl-nightly\youtube_dl\extractor\common.py”, line 1045, in _search_regex youtube_dl.utils.RegexNotFoundError: Unable to extract yt initial data; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.