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

Subtitle names on youtube may have HTML entities #2120

Closed
PinkPandaKatie opened this issue Jan 8, 2014 · 1 comment
Closed

Subtitle names on youtube may have HTML entities #2120

PinkPandaKatie opened this issue Jan 8, 2014 · 1 comment
Labels
bug

Comments

@PinkPandaKatie
Copy link

@PinkPandaKatie PinkPandaKatie commented Jan 8, 2014

On some videos (e.g. http://www.youtube.com/watch?v=r3QyKmaLvvk), if the name of the subtitle has an apostrophe, this is returned in the XML list as an escaped entity:

<?xml version="1.0" encoding="utf-8" ?><transcript_list docid="-5803958862083277063"><track id="0" name="Derpy&#39;s lyrics" lang_code="en" lang_original="English" lang_translated="English" lang_default="true"/></transcript_list>

This causes it to generate the following URL:

http://www.youtube.com/api/timedtext?lang=en&fmt=srt&name=Derpy%26%2339%3Bs+lyrics&v=r3QyKmaLvvk

Instead of the correct one:

http://www.youtube.com/api/timedtext?lang=en&fmt=srt&name=Derpy%27s+lyrics&v=r3QyKmaLvvk

diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 8361dda..70b8dec 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -998,7 +998,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
                 'lang': lang,
                 'v': video_id,
                 'fmt': self._downloader.params.get('subtitlesformat', 'srt'),
-                'name': l[0].encode('utf-8'),
+                'name': unescapeHTML(l[0]).encode('utf-8'),
             })
             url = u'http://www.youtube.com/api/timedtext?' + params
             sub_lang_list[lang] = url
@phihag phihag closed this in c3197e3 Jan 9, 2014
@phihag
Copy link
Contributor

@phihag phihag commented Jan 9, 2014

Thanks, fixed.

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
2 participants
You can’t perform that action at this time.