|
11 | 11 | compat_etree_Element,
|
12 | 12 | compat_HTTPError,
|
13 | 13 | compat_parse_qs,
|
| 14 | + compat_str, |
14 | 15 | compat_urllib_parse_urlparse,
|
15 | 16 | compat_urlparse,
|
16 | 17 | )
|
|
25 | 26 | js_to_json,
|
26 | 27 | parse_duration,
|
27 | 28 | parse_iso8601,
|
| 29 | + strip_or_none, |
28 | 30 | try_get,
|
29 | 31 | unescapeHTML,
|
| 32 | + unified_timestamp, |
30 | 33 | url_or_none,
|
31 | 34 | urlencode_postdata,
|
32 | 35 | urljoin,
|
@@ -761,8 +764,17 @@ class BBCIE(BBCCoUkIE):
|
761 | 764 | 'only_matching': True,
|
762 | 765 | }, {
|
763 | 766 | # custom redirection to www.bbc.com
|
| 767 | + # also, video with window.__INITIAL_DATA__ |
764 | 768 | 'url': 'http://www.bbc.co.uk/news/science-environment-33661876',
|
765 |
| - 'only_matching': True, |
| 769 | + 'info_dict': { |
| 770 | + 'id': 'p02xzws1', |
| 771 | + 'ext': 'mp4', |
| 772 | + 'title': "Pluto may have 'nitrogen glaciers'", |
| 773 | + 'description': "Pluto could have glaciers of nitrogen ice, new photographs from Nasa's New Horizons probe suggest.", |
| 774 | + 'thumbnail': r're:https?://.+/.+\.jpg', |
| 775 | + 'timestamp': 1437785037, |
| 776 | + 'upload_date': '20150725', |
| 777 | + }, |
766 | 778 | }, {
|
767 | 779 | # single video article embedded with data-media-vpid
|
768 | 780 | 'url': 'http://www.bbc.co.uk/sport/rowing/35908187',
|
@@ -1164,12 +1176,23 @@ def parse_media(media):
|
1164 | 1176 | continue
|
1165 | 1177 | formats, subtitles = self._download_media_selector(item_id)
|
1166 | 1178 | self._sort_formats(formats)
|
| 1179 | + item_desc = try_get( |
| 1180 | + media, |
| 1181 | + lambda x: x['summary']['blocks'][0]['model']['text'], |
| 1182 | + compat_str) |
| 1183 | + item_time = None |
| 1184 | + for meta in try_get(media, lambda x: x['metadata']['items'], list) or []: |
| 1185 | + if try_get(meta, lambda x: x['label']) == 'Published': |
| 1186 | + item_time = unified_timestamp(meta.get('timestamp')) |
| 1187 | + break |
1167 | 1188 | entries.append({
|
1168 | 1189 | 'id': item_id,
|
1169 | 1190 | 'title': item_title,
|
1170 | 1191 | 'thumbnail': item.get('holdingImageUrl'),
|
1171 | 1192 | 'formats': formats,
|
1172 | 1193 | 'subtitles': subtitles,
|
| 1194 | + 'timestamp': item_time, |
| 1195 | + 'description': strip_or_none(item_desc), |
1173 | 1196 | })
|
1174 | 1197 | for resp in (initial_data.get('data') or {}).values():
|
1175 | 1198 | name = resp.get('name')
|
|
0 commit comments