diff --git a/youtube_dl/extractor/libsyn.py b/youtube_dl/extractor/libsyn.py index 4750b03a3..07bd18d64 100644 --- a/youtube_dl/extractor/libsyn.py +++ b/youtube_dl/extractor/libsyn.py @@ -11,14 +11,14 @@ class LibsynIE(InfoExtractor): _VALID_URL = r'(?Phttps?://html5-player\.libsyn\.com/embed/episode/id/(?P[0-9]+))' _TESTS = [{ - 'url': 'http://html5-player.libsyn.com/embed/episode/id/3377616/', - 'md5': '443360ee1b58007bc3dcf09b41d093bb', + 'url': 'http://html5-player.libsyn.com/embed/episode/id/6324076/', + 'md5': '5b497505660690028d482f9a28431cca', 'info_dict': { - 'id': '3377616', + 'id': '6324076', 'ext': 'mp3', - 'title': "The Daily Show Podcast without Jon Stewart - Episode 12: Bassem Youssef: Egypt's Jon Stewart", - 'description': 'md5:601cb790edd05908957dae8aaa866465', - 'upload_date': '20150220', + 'title': "Verily, Octopi Sing - Pandas are not smallpox", + 'description': 'md5:0d20ad472ae296f22a0c9df23a6d78f1', + 'upload_date': '20180303', 'thumbnail': 're:^https?://.*', }, }, { @@ -28,6 +28,7 @@ class LibsynIE(InfoExtractor): 'id': '3727166', 'ext': 'mp3', 'title': 'Clients From Hell Podcast - How a Sex Toy Company Kickstarted my Freelance Career', + 'description': 'md5:996a28b4f829ed4ffb8302a53d825704', 'upload_date': '20150818', 'thumbnail': 're:^https?://.*', } @@ -39,25 +40,30 @@ class LibsynIE(InfoExtractor): url = m.group('mainurl') webpage = self._download_webpage(url, video_id) - formats = [{ - 'url': media_url, - } for media_url in set(re.findall(r'var\s+mediaURL(?:Libsyn)?\s*=\s*"([^"]+)"', webpage))] - - podcast_title = self._search_regex( - r'

([^<]+)

', webpage, 'podcast title', default=None) - episode_title = self._search_regex( - r'(?:
|

)([^<]+)]*>([^<]+)

', webpage, 'podcast title', default=None) + episode_title_json = self._search_regex(r'"item_title"\s*:\s*("(\\"|[^"])+")', webpage, 'episode title', default=None) + episode_title = self._parse_json(episode_title_json, video_id, fatal=False) + if episode_title is None: + # Fallback: scrape from page + episode_title = self._html_search_regex(r']*>([^<]+)', webpage, 'episode title') title = '%s - %s' % (podcast_title, episode_title) if podcast_title else episode_title description = self._html_search_regex( - r'
(.+?)
', webpage, - 'description', default=None) - thumbnail = self._search_regex( - r']+class="info-show-icon"[^>]+src="([^"]+)"', - webpage, 'thumbnail', fatal=False) - release_date = unified_strdate(self._search_regex( - r'
Released: ([^<]+)<', webpage, 'release date', fatal=False)) + r'<(\w+)\b[^>]*id="info_text_body"[^>]*>(?P.+?)<\/\1>', + webpage, 'description', default=None, group='description') + + thumbnail_json = self._search_regex(r'"thumbnail_url"\s*:\s*("(\\"|[^"])+")', webpage, 'thumbnail') + thumbnail = self._parse_json(thumbnail_json, video_id, fatal=False) + + release_date_json = self._search_regex(r'"release_date"\s*:\s*("(\\"|[^"])+")', webpage, 'release date') + release_date = unified_strdate(self._parse_json(release_date_json, video_id, fatal=False)) + if release_date is None: + # Fallback: scrape from page + release_date = unified_strdate(self._search_regex( + r'
Released: ([^<]+)<', webpage, 'release date', fatal=False)) return { 'id': video_id, @@ -65,5 +71,5 @@ class LibsynIE(InfoExtractor): 'description': description, 'thumbnail': thumbnail, 'upload_date': release_date, - 'formats': formats, + 'url': media_url, }