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

[youtube] Use localized title & description #2539

Closed

Conversation

mjsir911
Copy link

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 one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense

What is the purpose of your pull request?

  • Bug fix
  • Improvement

Description of your pull request and other information

Pulled from - ytdl-org/youtube-dl#28538

Get the localized version of title, description (channel name is already translated ^.^)

  • Prioritize microformat title & description over basic title & description

Related:

Fixes:

@pukkandan
Copy link
Member

See discussion on #387 and related issues

@pukkandan pukkandan added do-not-merge site-enhancement Feature request for some website labels Jan 29, 2022
@mjsir911
Copy link
Author

mjsir911 commented Jan 29, 2022

See discussion on #387 and related issues

Yuup and I don't really have the bandwidth to deal with a PR more complicated, just putting this here for posterity.

This PR is desired by users & doesn't break any existing tests, and the fact of the matter is similar localization is already being done for the channel key (and maybe others, I haven't checked).

see this comment for the workaround/explanation as to how to change the languages of the returned metadata using this PR

Additionally, the inconsistencies outlined in mpv-player/mpv#8676 still exist where the playlist's returned title is translated, but the video's metadata on download is untranslated.

All in all, feel free to close this PR in preference of a more refined one maybe coming down the line, but consider adding tests that would cause these changes to fail them in an effort to document your stance.

@coletdjnz
Copy link
Member

coletdjnz commented Jan 31, 2022

To add on, unfortunately I don't think PR will really work as intended with yt-dlp atm anyways 😕. Recently we made a change that enforces English regardless of user provided cookies/lang header (see #387 (comment)).

@mjsir911
Copy link
Author

To add on, unfortunately I don't think PR will really work as intended with yt-dlp atm anyways. Recently we made a change that enforces English regardless of user provided cookies/lang header

I appreciate the addition, testing this out I can confirm this behaviour:

$ yt-dlp --get-title UnIhRpIT7nc --add-header 'Accept-Language: en'
inabakumori - Lagtrain (Vo. Kaai Yuki) / 稲葉曇『ラグトレイン』Vo. 歌愛ユキ
$ yt-dlp --get-title UnIhRpIT7nc --add-header 'Accept-Language: es'
inabakumori - Lagtrain (Vo. Kaai Yuki) / 稲葉曇『ラグトレイン』Vo. 歌愛ユキ

Additionally with the (existing) channel metadata:

$ yt-dlp -j UnIhRpIT7nc --add-header 'Accept-Language: en' | jq -S .channel
"inabakumori"
$ yt-dlp -j UnIhRpIT7nc --add-header 'Accept-Language: es' | jq -S .channel
"inabakumori"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment