Skip to content

Conversation

@dirkf
Copy link
Contributor

@dirkf dirkf commented Apr 7, 2025

Boilerplate: own+yt-dlp code/bug fix+improvement

Please follow the guide below

  • You will be asked some questions, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your pull request (like that [x])
  • Use Preview tab to see how your pull request will actually look like

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, except for portions from_yt-dlp_ for which this or the below have already been asserted, 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)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

Description of your pull request and other information

The main object of this PR is to update the Youtube extractor to handle the latest players and improve compatibility with yt-dlp:

  • [cache] now uses similar logic to yt-dlp, but with the modified esc_rfc3986() encoding cache keys, for Py2/3 compat
  • [JSInterp]
    • various refactoring
    • unary operator handling is improved, now supporting !
  • [JSInterp] Updates from yt-dlp
    • improve nested attribute support, attribute syntax prioritised over indexing
    • pass global stack when extracting objects
    • fix assignment to array elements with nested brackets
  • [YouTube]
    • rework nsig function name search
    • update cache required versions
  • [YouTube] Updates from yt-dlp
    • rework signature test framework
    • add new signature tests

Perhaps too long delayed, the program version is updated.

Rolled in are these changes:

  • [compat]
    • add compat_os_makedirs()
    • improve Py2 compatibility for URL Quoting
  • [utils] Support optional safe argument for escape_rfc3986()
  • [YouTube]
    • fix playlist continuation extraction
    • remove remaining hard-coded API keys
    • support shorts playlist
  • [core]
    • align message routines better with yt-dlp
    • use InfoExtractor variants for remaining parent method calls
    • fix merging subtitles to empty target

Thx to relevant contributors per commit messages.

dirkf added 16 commits April 4, 2025 04:04
* in particular, support `only_once` in the same methods
* support exists_ok parameter in Py < 3.2
* use compat_os_makedirs
* support non-ASCII characters in cache key
* improve logging
* no longer required for these cases
* thx seproDev, bashonly: yt-dlp/yt-dlp#12760, yt-dlp/yt-dlp#12761:
  - Improve nested attribute support
  - Pass global stack when extracting objects
  - interpret_statement: Match attribute before indexing
  - Fix assignment to array elements with nested brackets
  - Add new signature tests
  - Invalidate JS function cache
  - Avoid testdata dupes now that we cache by URL

* rework nsig function name search
* fully fixes ytdl-org#33102
* update cache required versions
* update program version
@dirkf dirkf merged commit c052a16 into ytdl-org:master Apr 8, 2025
14 checks passed
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

Successfully merging this pull request may close these issues.

[YouTube] Unable to decode n-parameter with player 20830619 (eg, Cannot get index 43 in: "<class 'youtube_dl.jsinterp.JS_Undefined'>")

1 participant