diff options
author | Sergey M․ <dstftw@gmail.com> | 2019-06-08 03:06:41 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2019-06-08 03:07:08 +0700 |
commit | dbb18861148beed6630ebf895cd3f9e8165f75df (patch) | |
tree | 37254853c65aee852382925bef448f32994bfa8a | |
parent | c2ee6fa66ac082a74e645e605c346d0abe95afe8 (diff) |
[ted] Improve playlist extraction (closes #21032)
-rw-r--r-- | youtube_dl/extractor/ted.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/youtube_dl/extractor/ted.py b/youtube_dl/extractor/ted.py index 17dc41a39..9b60cc462 100644 --- a/youtube_dl/extractor/ted.py +++ b/youtube_dl/extractor/ted.py @@ -157,16 +157,19 @@ class TEDIE(InfoExtractor): 'Downloading playlist webpage') playlist_entries = [] - for entry in re.findall(r'(?s)<[^>]+data-ga-context="playlist"[^>]*>', webpage): + for entry in re.findall(r'(?s)<[^>]+data-ga-context=["\']playlist["\'][^>]*>', webpage): attrs = extract_attributes(entry) entry_url = compat_urlparse.urljoin(url, attrs['href']) playlist_entries.append(self.url_result(entry_url, self.ie_key())) - final_url = self._og_search_url(webpage) + final_url = self._og_search_url(webpage, fatal=False) + playlist_id = ( + re.match(self._VALID_URL, final_url).group('playlist_id') + if final_url else None) + return self.playlist_result( - playlist_entries, - playlist_id=re.match(self._VALID_URL, final_url, re.VERBOSE).group('playlist_id'), - playlist_title=self._og_search_title(webpage), + playlist_entries, playlist_id=playlist_id, + playlist_title=self._og_search_title(webpage, fatal=False), playlist_description=self._og_search_description(webpage)) def _talk_info(self, url, video_name): |