-
Notifications
You must be signed in to change notification settings - Fork 10k
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
[YoutubeDL] Fix function signature parser (refs ytdl-org/#30363) #30366
Conversation
I tested this change and it worked for me, thanks for fixing, @lanegramling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working well. Thanks
thanks for fixing, @lanegramling |
How can I approve it? Can I download it using python pip before the changes are committed? It works for me and I need it fast. |
Thanks for this. To help updating while releases are on hold I've pulled the commit into PR #30184 so that a single Please add this text to your PR description, to link the potentially resolved issues through GH magic:
|
r'\bm=(?P<sig>[a-zA-Z0-9$]{2,})\(decodeURIComponent\(h\.s\)\)', | ||
r'\bc&&\(c=(?P<sig>[a-zA-Z0-9$]{2,})\(decodeURIComponent\(c\)\)', | ||
r'(?:\b|[^a-zA-Z0-9$])(?P<sig>[a-zA-Z0-9$]{2,})\s*=\s*function\(\s*a\s*\)\s*{\s*a\s*=\s*a\.split\(\s*""\s*\);[a-zA-Z0-9$]{2}\.[a-zA-Z0-9$]{2}\(a,\d+\)', | ||
r'(?:\b|[^a-zA-Z0-9$])(?P<sig>[a-zA-Z0-9$]{2,})\s*=\s*function\(\s*a\s*\)\s*{\s*a\s*=\s*a\.split\(\s*""\s*\)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 regexes ought to be merged, though maybe not in the scope of this PR:
r'(?:\b|[^a-zA-Z0-9$])(?P<sig>[a-zA-Z0-9$]{2,})\s*=\s*function\(\s*a\s*\)\s*{\s*a\s*=\s*a\.split\(\s*""\s*\)(?:;[a-zA-Z0-9$]{2}\.[a-zA-Z0-9$]{2}\(a,\d+\))?',
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍work for me, modify the file by hand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works also for me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question What do windows peeps do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suffer.
In addition to that they can install python and run this themselves quite fine.
This works fine here 👍 |
Can someone please also compile a windows version or pointing us the the path, where the related file usually sits? I am using Yoube-DLG on windows in version 0.4. I cannot find the file youtube.py anywhere to motify it by hand. |
Read issue #29326 for hints. |
Added. Thanks for taking the time to combine the PRs. |
r'(?:\b|[^a-zA-Z0-9$])(?P<sig>[a-zA-Z0-9$]{2})\s*=\s*function\(\s*a\s*\)\s*{\s*a\s*=\s*a\.split\(\s*""\s*\)', | ||
r'\bm=(?P<sig>[a-zA-Z0-9$]{2,})\(decodeURIComponent\(h\.s\)\)', | ||
r'\bc&&\(c=(?P<sig>[a-zA-Z0-9$]{2,})\(decodeURIComponent\(c\)\)', | ||
r'(?:\b|[^a-zA-Z0-9$])(?P<sig>[a-zA-Z0-9$]{2,})\s*=\s*function\(\s*a\s*\)\s*{\s*a\s*=\s*a\.split\(\s*""\s*\);[a-zA-Z0-9$]{2}\.[a-zA-Z0-9$]{2}\(a,\d+\)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r'(?:\b|[^a-zA-Z0-9$])(?P<sig>[a-zA-Z0-9$]{2,})\s*=\s*function\(\s*a\s*\)\s*{\s*a\s*=\s*a\.split\(\s*""\s*\);[a-zA-Z0-9$]{2}\.[a-zA-Z0-9$]{2}\(a,\d+\)', | |
r'(?:\b|[^a-zA-Z0-9$])(?P<sig>[a-zA-Z0-9$]{2,})\s*=\s*function\(\s*a\s*\)\s*{\s*a\s*=\s*a\.split\(\s*""\s*\);[a-zA-Z0-9$]{2,}\.[a-zA-Z0-9$]{2,}\(a,\d+\)', |
This works for me.👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this observation as well. I was torn here - Wasn't sure whether it would be necessary, so I did some tests without these extra commas and everything worked just fine, so I left them out. I will elect to the suggestion of the greater democracy for opinions on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This worked for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks heaps, worked a charm. I always wondered how the updates fixed these kinds of errors in the past. Love open source, love learning, love sharing.
How would I go about decompiling this properly so I can edit the file myself? I'm using Chocolatey. |
I would suggest the reverse route: cloning a source repository with the included fix found in #30366 , and performing the build yourself based on the instructions available in the readme. That is, if you do need to use a binary version to agree with your existing environment. |
Could you please accept this soon and push it to pypl |
I tried the fix by uninstalling youtube-dl and reinstalling from this branch, then running If it helps, I ran |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixed the issue
@alvinbengeorge |
Thanks! It work for me. |
I'm glad it worked for you but it didn't work for me :v |
Thanks my dude, it worked like a charm! |
I decided to just switch to yt-dlp, someone was kind enough to PR youtube-dl-explorer (which is what I use): Best of luck folks! |
* commit 'afaec67d45df19642eb4af230b506127af84ceff': Fixes 404 Issue Currently Present On XVIDEOS.COM release 2021.12.17 [ChangeLog] Actualize [ci skip] [youtube] Update signature function patterns (closes ytdl-org#30363) (ytdl-org#30366)
Playback fixed based on similar change in youtube-dl: ytdl-org/youtube-dl#30366
Please follow the guide below
x
into all the boxes [ ] relevant to your pull request (like that [x])Before submitting a pull request make sure you have:
In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:
I am the original author of this code and I am willing to release it under Unlicense
I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)
This is NOT my code. This code is copied from PSlava's merged fix to the same issue (Link to issue: youtube_dl.utils.ExtractorError: Could not find JS function 'na' #30363) observed in the yt-dlp repository using the same regexes for signature parsing. Link to analogous yt-dlp bugfix: [youtube] fix for signature decode function detection yt-dlp/yt-dlp#641. (This also doubles as a qualifier that this code is released under Unlicense by the original author)
What is the purpose of your pull request?
Description of your pull request and other information
Relevant issue: #30363
Referring to the discussion in the comments of the aforementioned PR on yt-dlp, along with what is apparent upon scrutinizing Youtube's base.js (https://www.youtube.com/s/player/850eb2bc/player_ias.vflset/en_US/base.js), function signatures are not always 2 characters. An adjustment is made to the regex here to reflect this. I don't know when Youtube changed this, but I have had ~>80% of requests failing for the last 24 hours approx., due to a failure in parsing the function in youtube_dl/extractor/youtube.py::_parse_sig_js. Applying this fix to my local branch has resolved the ExtractorError exceptions and everything works fine now.
Resolves #30363
Resolves #30364
Resolves #30367
Resolves #30369.
Resolves #30370
Resolves #30372.