mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 03:03:01 +00:00
Merge remote-tracking branch 'anovicecodemonkey/TEDIEimprovements'
This commit is contained in:
commit
2bd9efd4c2
2 changed files with 11 additions and 1 deletions
|
@ -487,6 +487,13 @@ def _real_extract(self, url):
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
# Broaden the search a little bit: JWPlayer JS loader
|
# Broaden the search a little bit: JWPlayer JS loader
|
||||||
mobj = re.search(r'[^A-Za-z0-9]?file["\']?:\s*["\'](http(?![^\'"]+\.[0-9]+[\'"])[^\'"]+)["\']', webpage)
|
mobj = re.search(r'[^A-Za-z0-9]?file["\']?:\s*["\'](http(?![^\'"]+\.[0-9]+[\'"])[^\'"]+)["\']', webpage)
|
||||||
|
|
||||||
|
# Look for embedded TED player
|
||||||
|
mobj = re.search(
|
||||||
|
r'<iframe[^>]+?src=(["\'])(?P<url>http://embed\.ted\.com/.+?)\1', webpage)
|
||||||
|
if mobj is not None:
|
||||||
|
return self.url_result(mobj.group('url'), 'TED')
|
||||||
|
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
# Try to find twitter cards info
|
# Try to find twitter cards info
|
||||||
mobj = re.search(r'<meta (?:property|name)="twitter:player:stream" (?:content|value)="(.+?)"', webpage)
|
mobj = re.search(r'<meta (?:property|name)="twitter:player:stream" (?:content|value)="(.+?)"', webpage)
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
|
|
||||||
class TEDIE(SubtitlesInfoExtractor):
|
class TEDIE(SubtitlesInfoExtractor):
|
||||||
_VALID_URL = r'''(?x)http://www\.ted\.com/
|
_VALID_URL = r'''(?x)http://(?P<type>www|embed)\.ted\.com/
|
||||||
(
|
(
|
||||||
(?P<type_playlist>playlists(?:/\d+)?) # We have a playlist
|
(?P<type_playlist>playlists(?:/\d+)?) # We have a playlist
|
||||||
|
|
|
|
||||||
|
@ -48,6 +48,9 @@ def _extract_info(self, webpage):
|
||||||
|
|
||||||
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') == 'embed': # if the _VALID_URL is an embed
|
||||||
|
desktop_url = re.sub("embed", "www", url)
|
||||||
|
return self.url_result(desktop_url, 'TED') # pass the desktop version to the extractor
|
||||||
name = m.group('name')
|
name = m.group('name')
|
||||||
if m.group('type_talk'):
|
if m.group('type_talk'):
|
||||||
return self._talk_info(url, name)
|
return self._talk_info(url, name)
|
||||||
|
|
Loading…
Reference in a new issue