From be6dfd1b4954e32009f788ea55ee06bb82781f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Sun, 10 Nov 2013 12:09:12 +0100 Subject: [PATCH] [ted] Return a single info_dict for talks urls It failed with the --list-subs option --- test/test_ted_subtitles.py | 8 +++----- youtube_dl/extractor/ted.py | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/test/test_ted_subtitles.py b/test/test_ted_subtitles.py index a0dd7eeed1..4c164ae99f 100644 --- a/test/test_ted_subtitles.py +++ b/test/test_ted_subtitles.py @@ -10,9 +10,7 @@ from youtube_dl.extractor import TEDIE from youtube_dl.utils import * -from helper import FakeYDL - -md5 = lambda s: hashlib.md5(s.encode('utf-8')).hexdigest() +from test.helper import FakeYDL, md5 class TestTedSubtitles(unittest.TestCase): def setUp(self): @@ -24,7 +22,7 @@ def getInfoDict(self): return info_dict def getSubtitles(self): info_dict = self.getInfoDict() - return info_dict[0]['subtitles'] + return info_dict['subtitles'] def test_no_writesubtitles(self): subtitles = self.getSubtitles() self.assertEqual(subtitles, None) @@ -45,7 +43,7 @@ def test_allsubtitles(self): def test_list_subtitles(self): self.DL.params['listsubtitles'] = True info_dict = self.getInfoDict() - self.assertEqual(info_dict, [None]) + self.assertEqual(info_dict, None) def test_automatic_captions(self): self.DL.params['writeautomaticsub'] = True self.DL.params['subtitleslang'] = ['en'] diff --git a/youtube_dl/extractor/ted.py b/youtube_dl/extractor/ted.py index 1b006bc9bc..76cfdfb90c 100644 --- a/youtube_dl/extractor/ted.py +++ b/youtube_dl/extractor/ted.py @@ -36,7 +36,7 @@ def suitable(cls, url): def _real_extract(self, url): m=re.match(self._VALID_URL, url, re.VERBOSE) if m.group('type_talk'): - return [self._talk_info(url)] + return self._talk_info(url) else : playlist_id=m.group('playlist_id') name=m.group('name')