]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/thesun.py
[TheSun] Add new extractor
[yt-dlp.git] / youtube_dl / extractor / thesun.py
CommitLineData
5f3e0b69
E
1from __future__ import unicode_literals
2
3from .common import InfoExtractor
4from .ooyala import OoyalaIE
5
6
7class TheSunIE(InfoExtractor):
8 _VALID_URL = r'https://(?:www\.)?thesun\.co\.uk/\w+/(?P<id>\d+)/[\w-]'
9 _TEST = {
10 'url': 'https://www.thesun.co.uk/tvandshowbiz/2261604/orlando-bloom-and-katy-perry-post-adorable-instagram-video-together-celebrating-thanksgiving-after-split-rumours/',
11 'md5': '5667123b24f25f43f4c4f381ef34c5c2',
12 'info_dict': {
13 'id': 'h4OXN0NzE6rv6ObkEifKcNA-gYUw4xFf',
14 'ext': 'mp4',
15 'title': 'Katy Perry and Orlando Bloom shut down split rumours with cute Thanksgiving video',
16 'description': 'Still going strong',
17 'duration': 31.28,
18 }
19 }
20
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23
24 webpage = self._download_webpage(url, video_id)
25 ooyala_id = self._search_regex(r'id\s*=\s*"thesun-ooyala-player-([^"]+)"', webpage, 'ooyala id')
26
27 return OoyalaIE._build_url_result(ooyala_id)