|
|
@ -3,6 +3,11 @@ import re
|
|
|
|
|
|
|
|
|
|
|
|
from .subtitles import SubtitlesInfoExtractor
|
|
|
|
from .subtitles import SubtitlesInfoExtractor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from ..utils import (
|
|
|
|
|
|
|
|
compat_str,
|
|
|
|
|
|
|
|
RegexNotFoundError,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class TEDIE(SubtitlesInfoExtractor):
|
|
|
|
class TEDIE(SubtitlesInfoExtractor):
|
|
|
|
_VALID_URL=r'''http://www\.ted\.com/
|
|
|
|
_VALID_URL=r'''http://www\.ted\.com/
|
|
|
|
(
|
|
|
|
(
|
|
|
@ -105,6 +110,7 @@ class TEDIE(SubtitlesInfoExtractor):
|
|
|
|
return info
|
|
|
|
return info
|
|
|
|
|
|
|
|
|
|
|
|
def _get_available_subtitles(self, video_id, webpage):
|
|
|
|
def _get_available_subtitles(self, video_id, webpage):
|
|
|
|
|
|
|
|
try:
|
|
|
|
options = self._search_regex(r'(?:<select name="subtitles_language_select" id="subtitles_language_select">)(.*?)(?:</select>)', webpage, 'subtitles_language_select', flags=re.DOTALL)
|
|
|
|
options = self._search_regex(r'(?:<select name="subtitles_language_select" id="subtitles_language_select">)(.*?)(?:</select>)', webpage, 'subtitles_language_select', flags=re.DOTALL)
|
|
|
|
languages = re.findall(r'(?:<option value=")(\S+)"', options)
|
|
|
|
languages = re.findall(r'(?:<option value=")(\S+)"', options)
|
|
|
|
if languages:
|
|
|
|
if languages:
|
|
|
@ -113,4 +119,6 @@ class TEDIE(SubtitlesInfoExtractor):
|
|
|
|
url = 'http://www.ted.com/talks/subtitles/id/%s/lang/%s/format/srt' % (video_id, l)
|
|
|
|
url = 'http://www.ted.com/talks/subtitles/id/%s/lang/%s/format/srt' % (video_id, l)
|
|
|
|
sub_lang_list[l] = url
|
|
|
|
sub_lang_list[l] = url
|
|
|
|
return sub_lang_list
|
|
|
|
return sub_lang_list
|
|
|
|
|
|
|
|
except RegexNotFoundError as err:
|
|
|
|
|
|
|
|
self._downloader.report_warning(u'video doesn\'t have subtitles')
|
|
|
|
return {}
|
|
|
|
return {}
|
|
|
|