mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-22 18:22:21 +00:00
[ted] Return a single info_dict for talks urls
It failed with the --list-subs option
This commit is contained in:
parent
231516b6c9
commit
be6dfd1b49
2 changed files with 4 additions and 6 deletions
|
@ -10,9 +10,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
from youtube_dl.extractor import TEDIE
|
from youtube_dl.extractor import TEDIE
|
||||||
from youtube_dl.utils import *
|
from youtube_dl.utils import *
|
||||||
from helper import FakeYDL
|
from test.helper import FakeYDL, md5
|
||||||
|
|
||||||
md5 = lambda s: hashlib.md5(s.encode('utf-8')).hexdigest()
|
|
||||||
|
|
||||||
class TestTedSubtitles(unittest.TestCase):
|
class TestTedSubtitles(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -24,7 +22,7 @@ class TestTedSubtitles(unittest.TestCase):
|
||||||
return info_dict
|
return info_dict
|
||||||
def getSubtitles(self):
|
def getSubtitles(self):
|
||||||
info_dict = self.getInfoDict()
|
info_dict = self.getInfoDict()
|
||||||
return info_dict[0]['subtitles']
|
return info_dict['subtitles']
|
||||||
def test_no_writesubtitles(self):
|
def test_no_writesubtitles(self):
|
||||||
subtitles = self.getSubtitles()
|
subtitles = self.getSubtitles()
|
||||||
self.assertEqual(subtitles, None)
|
self.assertEqual(subtitles, None)
|
||||||
|
@ -45,7 +43,7 @@ class TestTedSubtitles(unittest.TestCase):
|
||||||
def test_list_subtitles(self):
|
def test_list_subtitles(self):
|
||||||
self.DL.params['listsubtitles'] = True
|
self.DL.params['listsubtitles'] = True
|
||||||
info_dict = self.getInfoDict()
|
info_dict = self.getInfoDict()
|
||||||
self.assertEqual(info_dict, [None])
|
self.assertEqual(info_dict, None)
|
||||||
def test_automatic_captions(self):
|
def test_automatic_captions(self):
|
||||||
self.DL.params['writeautomaticsub'] = True
|
self.DL.params['writeautomaticsub'] = True
|
||||||
self.DL.params['subtitleslang'] = ['en']
|
self.DL.params['subtitleslang'] = ['en']
|
||||||
|
|
|
@ -36,7 +36,7 @@ class TEDIE(SubtitlesInfoExtractor):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
m=re.match(self._VALID_URL, url, re.VERBOSE)
|
m=re.match(self._VALID_URL, url, re.VERBOSE)
|
||||||
if m.group('type_talk'):
|
if m.group('type_talk'):
|
||||||
return [self._talk_info(url)]
|
return self._talk_info(url)
|
||||||
else :
|
else :
|
||||||
playlist_id=m.group('playlist_id')
|
playlist_id=m.group('playlist_id')
|
||||||
name=m.group('name')
|
name=m.group('name')
|
||||||
|
|
Loading…
Reference in a new issue