diff options
author | Yen Chi Hsuan <yan12125@gmail.com> | 2016-01-16 20:46:28 +0800 |
---|---|---|
committer | Yen Chi Hsuan <yan12125@gmail.com> | 2016-01-16 20:46:28 +0800 |
commit | 350e02d40d93c341d73b23d630f458b14638fcb6 (patch) | |
tree | bbff7422bdfd8e0047e28de01b1627f0e15a8947 /youtube_dl/extractor/bbc.py | |
parent | 0b26ba3fc8eee0bb047c5e78e6f1a8ba59fa9457 (diff) |
[bbc] Use _search_json_ld
Diffstat (limited to 'youtube_dl/extractor/bbc.py')
-rw-r--r-- | youtube_dl/extractor/bbc.py | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/youtube_dl/extractor/bbc.py b/youtube_dl/extractor/bbc.py index ce99a34ab..1c493b72d 100644 --- a/youtube_dl/extractor/bbc.py +++ b/youtube_dl/extractor/bbc.py @@ -718,19 +718,10 @@ class BBCIE(BBCCoUkIE): webpage = self._download_webpage(url, playlist_id) - timestamp = None - playlist_title = None - playlist_description = None - - 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') + json_ld_info = self._search_json_ld(webpage, playlist_id, default=None) + timestamp = json_ld_info.get('timestamp') + playlist_title = json_ld_info.get('title') + playlist_description = json_ld_info.get('description') if not timestamp: timestamp = parse_iso8601(self._search_regex( |