Skip to content

Commit

Permalink
[ted] Improve playlist extraction (closes #21032)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw authored and cantre committed Jun 9, 2019
1 parent 0e1ff97 commit 0a99df1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions youtube_dl/extractor/ted.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,19 @@ def _playlist_videos_info(self, url, name):
'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):
Expand Down

0 comments on commit 0a99df1

Please sign in to comment.