From 8d7c0cca138c38c178d1b5518a46ca1f0ef18871 Mon Sep 17 00:00:00 2001 From: anovicecodemonkey Date: Thu, 20 Mar 2014 00:56:32 +1030 Subject: [PATCH 1/2] [generic] Add support for embeded TED videos --- youtube_dl/extractor/generic.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py index 5a4933146..273a3e282 100644 --- a/youtube_dl/extractor/generic.py +++ b/youtube_dl/extractor/generic.py @@ -487,6 +487,13 @@ def _real_extract(self, url): if mobj is None: # Broaden the search a little bit: JWPlayer JS loader mobj = re.search(r'[^A-Za-z0-9]?file["\']?:\s*["\'](http(?![^\'"]+\.[0-9]+[\'"])[^\'"]+)["\']', webpage) + + # Look for embedded TED player + mobj = re.search( + r']+?src=(["\'])(?Phttp://embed\.ted\.com/.+?)\1', webpage) + if mobj is not None: + return self.url_result(mobj.group('url'), 'TED') + if mobj is None: # Try to find twitter cards info mobj = re.search(r' Date: Thu, 20 Mar 2014 01:04:21 +1030 Subject: [PATCH 2/2] [TEDIE] Add support for embeded TED video URLs --- youtube_dl/extractor/ted.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/ted.py b/youtube_dl/extractor/ted.py index 3968b718e..aab026936 100644 --- a/youtube_dl/extractor/ted.py +++ b/youtube_dl/extractor/ted.py @@ -11,7 +11,7 @@ class TEDIE(SubtitlesInfoExtractor): - _VALID_URL = r'''(?x)http://www\.ted\.com/ + _VALID_URL = r'''(?x)http://(?Pwww|embed)\.ted\.com/ ( (?Pplaylists(?:/\d+)?) # We have a playlist | @@ -48,6 +48,9 @@ def _extract_info(self, webpage): def _real_extract(self, url): 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') if m.group('type_talk'): return self._talk_info(url, name)