-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
New Player 20dfca59 has broken YouTube extractor #32885
Comments
this isn't YT-DLP. |
Indeed: #30839: ... if you were actually running yt-dlp ... In the UK, I'm getting ... a.D&&(PL(a),b=a.j.n||null)&&(b=oDa[0](b),a.set("n",b),oDa.length||rma("")) A tweak to the extraction pattern handles this: --- old/youtube-dl/youtube_dl/extractor/youtube.py
+++ new/youtube-dl/youtube_dl/extractor/youtube.py
def _extract_n_function_name(self, jscode):
func_name, idx = self._search_regex(
# new: (b=String.fromCharCode(110),c=a.get(b))&&c=nfunc[idx](c)
- # or: (b="nn"[+a.D],c=a.get(b))&&(c=nfunc[idx](c)s
+ # or: (b="nn"[+a.D],c=a.get(b))&&(c=nfunc[idx](c)
+ # or: (PL(a),b=a.j.n||null)&&(b=nfunc[idx](b)
# old: .get("n"))&&(b=nfunc[idx](b)
# older: .get("n"))&&(b=nfunc(b)
r'''(?x)
- (?:\(\s*(?P<b>[a-z])\s*=\s*(?:
+ (?:\((?:[\w$()\s]+,)*?\s*(?P<b>[a-z])\s*=\s*(?:
String\s*\.\s*fromCharCode\s*\(\s*110\s*\)|
- "n+"\[\s*\+?s*[\w$.]+\s*]
- )\s*,(?P<c>[a-z])\s*=\s*[a-z]\s*)?
- \.\s*get\s*\(\s*(?(b)(?P=b)|"n{1,2}")(?:\s*\)){2}\s*&&\s*\(\s*(?(c)(?P=c)|b)\s*=\s*
+ "n+"\[\s*\+?s*[\w$.]+\s*]|
+ (?P<b1>(?:[\w$]+\s*\.\s*)+n\b(?:(?!&&).)+\))
+ )\s*
+ (?(b1)
+ &&\s*\(\s*(?P=b)|
+ (?:
+ ,(?P<c>[a-z])\s*=\s*[a-z]\s*)?
+ \.\s*get\s*\(\s*(?(b)(?P=b)|"n{1,2}")(?:\s*\)){2}\s*
+ &&\s*\(\s*(?(c)(?P=c)|(?P=b))
+ )
+ )\s*=\s*
(?P<nfunc>[a-zA-Z_$][\w$]*)(?:\s*\[(?P<idx>\d+)\])?\s*\(\s*[\w$]+\s*\)
''', jscode, 'Initial JS player n function name', group=('nfunc', 'idx'))
if not idx: |
Also: yt-dlp/yt-dlp#10608 |
Okay I am providing actual ytdl and ytdl-nightly logs for this, since it is the same player id. As always, freshly compiled and ran from each repo.
|
Thank you, so sorry about that. The referenced branch fixes what you've mentioned. I really appreciate the help! |
@dirkf is there a branch/release with the nsig fix for |
Actually, a PR would be very helpful as I'm busy on something else. I have some further tweaks but I can add those to the patch above. We need the matching test too: --- old/youtube-dl/test/test_youtube_signature.py
+++ new/youtube-dl/test/test_youtube_signature.py
@@ -173,6 +173,10 @@
(
'https://www.youtube.com/s/player/5604538d/player_ias.vflset/en_US/base.js',
'7X-he4jjvMx7BCX', 'sViSydX8IHtdWA',
+ ),
+ (
+ 'https://www.youtube.com/s/player/20dfca59/player_ias.vflset/en_US/base.js',
+ '-fLCxedkAk4LUTK2', 'O8kfRq1y1eyHGw',
),
]
|
@dirkf for the nsig fix patch, i'm getting |
I'd just edit the function on the first line (ie, removing the You can make one commit or more, as you like. I'll probably merge the PR into a single commit. |
For some reason it just wouldn't apply with any value of
It works, but then when I ran the
With lots of |
New Error that i get kindof consistently now after this fix, not 100% sure what went wrong there. Will open a new Issue if necessary. Edit: I should mention Format 18 (the super basic one) works, everything else does not because Error 403 showing up 95% of the time.
|
See #32882 |
minor question, has youtube always had the "sign in to prove you're not a bot" thing? because after the fix this particular error happens with my vpn too now (but not an issue without that particular selfhosted vpn), and i do not know whether that would qualify as a bug or not here, since i am pretty sure you can give ytdl your account info. |
See yt-dlp discussion here and in linked issues. Maybe staying under the radar is the answer, though a known data centre IP might be targeted regardless. |
Checklist
Verbose log
Description
A new player (20dfca59) has broken the YouTube extractor
The text was updated successfully, but these errors were encountered: