]> jfr.im git - yt-dlp.git/blame - youtube_dlc/extractor/thesun.py
[skip travis] renaming
[yt-dlp.git] / youtube_dlc / extractor / thesun.py
CommitLineData
5f3e0b69
E
1from __future__ import unicode_literals
2
90e3f18f
S
3import re
4
5f3e0b69 5from .common import InfoExtractor
80c2126e 6from ..utils import extract_attributes
5f3e0b69
E
7
8
9class TheSunIE(InfoExtractor):
90e3f18f 10 _VALID_URL = r'https://(?:www\.)?thesun\.co\.uk/[^/]+/(?P<id>\d+)'
5f3e0b69
E
11 _TEST = {
12 'url': 'https://www.thesun.co.uk/tvandshowbiz/2261604/orlando-bloom-and-katy-perry-post-adorable-instagram-video-together-celebrating-thanksgiving-after-split-rumours/',
5f3e0b69 13 'info_dict': {
90e3f18f
S
14 'id': '2261604',
15 'title': 'md5:cba22f48bad9218b64d5bbe0e16afddf',
16 },
17 'playlist_count': 2,
5f3e0b69 18 }
80c2126e 19 BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s'
5f3e0b69
E
20
21 def _real_extract(self, url):
90e3f18f
S
22 article_id = self._match_id(url)
23
24 webpage = self._download_webpage(url, article_id)
5f3e0b69 25
90e3f18f 26 entries = []
80c2126e
RA
27 for video in re.findall(
28 r'<video[^>]+data-video-id-pending=[^>]+>',
90e3f18f 29 webpage):
80c2126e
RA
30 attrs = extract_attributes(video)
31 video_id = attrs['data-video-id-pending']
32 account_id = attrs.get('data-account', '5067014667001')
33 entries.append(self.url_result(
34 self.BRIGHTCOVE_URL_TEMPLATE % (account_id, video_id),
35 'BrightcoveNew', video_id))
5f3e0b69 36
90e3f18f
S
37 return self.playlist_result(
38 entries, article_id, self._og_search_title(webpage, fatal=False))