Skip to content
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

[utils] js_to_json: Implement template strings #6623

Merged
merged 3 commits into from
Mar 25, 2023

Conversation

Grub4K
Copy link
Member

@Grub4K Grub4K commented Mar 24, 2023

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

Rel: #6505 (comment)

Note that I have not really tested against edge cases and only in isolation. More tests are probably required. However I currently lack a lot of time and so just wanted to share this. Feel free to use.

Additionally the current implementation of template_substitute works only okayish (undefined/void * => null instead of undefined). Generally we would have to provide the real string value of each object which seems out of scope for js_to_json.

Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:

  • 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)

What is the purpose of your pull request?

@pukkandan pukkandan added the enhancement New feature or request label Mar 25, 2023
@pukkandan
Copy link
Member

Note that I have not really tested against edge cases and only in isolation. More tests are probably required.

Limited implementation that covers just our required use case is fine for these kinds of functions

@Grub4K Grub4K marked this pull request as ready for review March 25, 2023 18:16
@Grub4K
Copy link
Member Author

Grub4K commented Mar 25, 2023

This passes the common cases in tests and resolves the BibelTV case so should be good to go.

@Grub4K Grub4K merged commit 0898c5c into yt-dlp:master Mar 25, 2023
@Grub4K Grub4K deleted the feat/js_to_json-template-strings branch April 30, 2023 15:06
dirkf added a commit to dirkf/youtube-dl that referenced this pull request May 3, 2023
* support variable substitution, from https://github.com/yt-dlp/yt-dlp/pull/#521 etc,
  thanks ChillingPepper, Grub4k, pukkandan
* improve escape handling, from https://github.com/yt-dlp/yt-dlp/pull/#521
  thanks Grub4k
* support template strings from yt-dlp/yt-dlp#6623
  thanks Grub4k
* add limited `!` evaluation (eg, !!0 -> false, see tests)
flashdagger added a commit to flashdagger/yt-dlp that referenced this pull request May 25, 2023
Co-authored-by: Simon Sawicki <accounts@grub4k.xyz>
dirkf added a commit to dirkf/youtube-dl that referenced this pull request Jul 18, 2023
* support variable substitution, from https://github.com/yt-dlp/yt-dlp/pull/#521 etc,
  thanks ChillingPepper, Grub4k, pukkandan
* improve escape handling, from https://github.com/yt-dlp/yt-dlp/pull/#521
  thanks Grub4k
* support template strings from yt-dlp/yt-dlp#6623
  thanks Grub4k
* add limited `!` evaluation (eg, !!0 -> false, see tests)
dirkf added a commit to ytdl-org/youtube-dl that referenced this pull request Jul 19, 2023
* support variable substitution, from https://github.com/yt-dlp/yt-dlp/pull/#521 etc,
  thanks ChillingPepper, Grub4k, pukkandan
* improve escape handling, from https://github.com/yt-dlp/yt-dlp/pull/#521
  thanks Grub4k
* support template strings from yt-dlp/yt-dlp#6623
  thanks Grub4k
* add limited `!` evaluation (eg, !!0 -> false, see tests)
aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this pull request Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants