1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-07 19:52:40 +01:00

[bbc] Use _search_json_ld

This commit is contained in:
Yen Chi Hsuan 2016-01-16 20:46:28 +08:00
parent 0b26ba3fc8
commit 350e02d40d

View File

@ -718,19 +718,10 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, playlist_id) webpage = self._download_webpage(url, playlist_id)
timestamp = None json_ld_info = self._search_json_ld(webpage, playlist_id, default=None)
playlist_title = None timestamp = json_ld_info.get('timestamp')
playlist_description = None playlist_title = json_ld_info.get('title')
playlist_description = json_ld_info.get('description')
ld = self._parse_json(
self._search_regex(
r'(?s)<script type="application/ld\+json">(.+?)</script>',
webpage, 'ld json', default='{}'),
playlist_id, fatal=False)
if ld:
timestamp = parse_iso8601(ld.get('datePublished'))
playlist_title = ld.get('headline')
playlist_description = ld.get('articleBody')
if not timestamp: if not timestamp:
timestamp = parse_iso8601(self._search_regex( timestamp = parse_iso8601(self._search_regex(