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

Please add workaround for forced YouTube translated video titles #10758

Open
rcajal opened this issue Sep 25, 2016 · 9 comments
Open

Please add workaround for forced YouTube translated video titles #10758

rcajal opened this issue Sep 25, 2016 · 9 comments
Labels

Comments

@rcajal
Copy link

@rcajal rcajal commented Sep 25, 2016

Please follow the guide below

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

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2016.09.24. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2016.09.24

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

YouTube has added a feature where it allows users or channel owners to contribute translations of video titles. This feature has been around for some time but rolled out in increments hitting users in different regions.

On YouTube's web interface whether the original title (desired) or one of the translated titles are shown depends on the choice of interface language. If the language interface is selected to be other than English then YouTube will show the non-English titles in their original form.

When using youtube-dl the desired outcome is for %(title)s to be the original title since this allows for better accounting of the saved material. There is no guarantee user-contributed or machine translations are accurate. These titles also make searching among files saved by youtube-dl harder than it should be.

The problem has now hit youtube-dl because it requests en-US (or en-GB for embedded SWF) content from YouTube via hardcoded 'hl=en' parameter in multiple places in extractor/youtube.py. This results in YouTube presenting youtube-dl with (often inaccurate or nonsensical) translated titles.

Please make the location, 'gl=??', and language 'hl=??', configurable via commandline switches. The parameter hl=?? is in particular effective for working around this issue. Currently, changing the occurrences of hl=en to, for example, hl=fr causes YouTuble, and consequently youtube-dl, to present the correct original title of videos.

Example

Video code: 2sKgVz79NZE

Original correct title (in Japanese, accessible via YouTube API or a browser where YouTube language interface has been set to something other than English): "人を怒らせる方法 「放棄」"

Translated title (acquired with --get-filename -f22 -o '%(title)s.%(ext)s' to youtube-dl, or a browser with YouTube interface language set to English): "How to make peopke angry 'renounse'.mp4"

@yan12125 yan12125 added the request label Sep 25, 2016
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Sep 25, 2016

For interested, there are some more details on IRC.

@InfiniteStyles
Copy link

@InfiniteStyles InfiniteStyles commented Nov 1, 2016

Seems like a doable issue. I'm not advanced enough to solve it yet, but wish I could.

@Slider-Whistle
Copy link

@Slider-Whistle Slider-Whistle commented Dec 12, 2018

This seems to be the default behaviour with video titles for me at the moment. Descriptions are still localised, though, and I imagine implementing the specific feature rcajal described would solve this.

@rautamiekka
Copy link

@rautamiekka rautamiekka commented Dec 12, 2018

This is ancient. I'm on Python 3.7.1 x64 installed through Anaconda x64 I've updated, on Window$ 10.0.17134.345 Enterprise x64, of course using NTFS on my C drive, and youtube-dl 2018.12.03, and the filename is correct using just the defaults
(人を怒らせる方法 「放棄」-2sKgVz79NZE.webm). So, surely, this problem has been fixed on either end ?

@Slider-Whistle
Copy link

@Slider-Whistle Slider-Whistle commented Dec 13, 2018

As far as the title of the issue goes, but descriptions still seem to be localised. I imagine that changing the gl and hl attributes by command switch as suggested by the first post would resolve it.
I downloaded one video and the title was accurately recorded in Japanese, but the description was still in English, with a section clarifying that it was the version that displays for all non-Japanese users.

@rococode
Copy link

@rococode rococode commented Aug 19, 2019

I think this is the relevant issue - is there anything we can do to force a title language? I'm trying to download some videos from nicovideo.jp (niconico) and the titles are downloaded in English when available. I'd prefer to have the titles downloaded in Japanese. On the website, the way to force Japanese is to swap the website language to it (from English).

Edit: It seems like language is selected based on browser language - when I swap my browser language to Japanese I get the Japanese version by default (I presume through checking window.navigator.userLanguage || window.navigator.language). Is there a flag in youtube-dl that allows setting this so that we can choose the title language in this kind of scenario?

@sebma
Copy link

@sebma sebma commented Aug 22, 2019

@yan12125 Hi,
I propose you use this translate-shell tool :

Here's an example of usage of the trans tool :

First here's a video title displayed in Chinese :

$ youtube-dl --ignore-config --get-filename XMaxBthVLx4 
273 恩典的话语满有能力-XMaxBthVLx4.mp4

To translate it to English (language used by trans by default) :

$ youtube-dl --ignore-config --get-filename XMaxBthVLx4 | trans -b
273 The Word of Grace is full of power - XMaxBthVLx4.mp4

To translate it to French (for example) :

$ youtube-dl --ignore-config --get-filename XMaxBthVLx4 | trans -b :fr
273 La Parole de Grâce est pleine de puissance - XMaxBthVLx4.mp4

You could call the trans tool by a sub-process through a new --translate or --trans option.

@Slider-Whistle
Copy link

@Slider-Whistle Slider-Whistle commented Aug 28, 2019

@sebma; The important part isn't being able to read the title or not, it's being able to avoid the translations Youtube provides.

@remitamine remitamine mentioned this issue Dec 7, 2019
4 of 6 tasks complete
@remitamine
Copy link
Collaborator

@remitamine remitamine commented Dec 7, 2019

it's the same, youtube-dl is using the description from the English interface, while what you're getting in the browser is the description from the Hindi interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants
You can’t perform that action at this time.