mirror of https://github.com/yt-dlp/yt-dlp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
8 years ago
|
from __future__ import unicode_literals
|
||
|
|
||
8 years ago
|
import re
|
||
|
|
||
8 years ago
|
from .common import InfoExtractor
|
||
5 years ago
|
from ..utils import extract_attributes
|
||
8 years ago
|
|
||
|
|
||
|
class TheSunIE(InfoExtractor):
|
||
8 years ago
|
_VALID_URL = r'https://(?:www\.)?thesun\.co\.uk/[^/]+/(?P<id>\d+)'
|
||
8 years ago
|
_TEST = {
|
||
|
'url': 'https://www.thesun.co.uk/tvandshowbiz/2261604/orlando-bloom-and-katy-perry-post-adorable-instagram-video-together-celebrating-thanksgiving-after-split-rumours/',
|
||
|
'info_dict': {
|
||
8 years ago
|
'id': '2261604',
|
||
|
'title': 'md5:cba22f48bad9218b64d5bbe0e16afddf',
|
||
|
},
|
||
|
'playlist_count': 2,
|
||
8 years ago
|
}
|
||
5 years ago
|
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s'
|
||
8 years ago
|
|
||
|
def _real_extract(self, url):
|
||
8 years ago
|
article_id = self._match_id(url)
|
||
|
|
||
|
webpage = self._download_webpage(url, article_id)
|
||
8 years ago
|
|
||
8 years ago
|
entries = []
|
||
5 years ago
|
for video in re.findall(
|
||
|
r'<video[^>]+data-video-id-pending=[^>]+>',
|
||
8 years ago
|
webpage):
|
||
5 years ago
|
attrs = extract_attributes(video)
|
||
|
video_id = attrs['data-video-id-pending']
|
||
|
account_id = attrs.get('data-account', '5067014667001')
|
||
|
entries.append(self.url_result(
|
||
|
self.BRIGHTCOVE_URL_TEMPLATE % (account_id, video_id),
|
||
|
'BrightcoveNew', video_id))
|
||
8 years ago
|
|
||
8 years ago
|
return self.playlist_result(
|
||
|
entries, article_id, self._og_search_title(webpage, fatal=False))
|