]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/localnews8.py
[extractor/sibnet] Separate from VKIE
[yt-dlp.git] / yt_dlp / extractor / localnews8.py
1 from .common import InfoExtractor
2
3
4 class LocalNews8IE(InfoExtractor):
5 _VALID_URL = r'https?://(?:www\.)?localnews8\.com/(?:[^/]+/)*(?P<display_id>[^/]+)/(?P<id>[0-9]+)'
6 _TEST = {
7 'url': 'http://www.localnews8.com/news/rexburg-business-turns-carbon-fiber-scraps-into-wedding-rings/35183304',
8 'md5': 'be4d48aea61aa2bde7be2ee47691ad20',
9 'info_dict': {
10 'id': '35183304',
11 'display_id': 'rexburg-business-turns-carbon-fiber-scraps-into-wedding-rings',
12 'ext': 'mp4',
13 'title': 'Rexburg business turns carbon fiber scraps into wedding ring',
14 'description': 'The process was first invented by Lamborghini and less than a dozen companies around the world use it.',
15 'duration': 153,
16 'timestamp': 1441844822,
17 'upload_date': '20150910',
18 'uploader_id': 'api',
19 }
20 }
21
22 def _real_extract(self, url):
23 mobj = self._match_valid_url(url)
24 video_id = mobj.group('id')
25 display_id = mobj.group('display_id')
26
27 webpage = self._download_webpage(url, display_id)
28
29 partner_id = self._search_regex(
30 r'partnerId\s*[:=]\s*(["\'])(?P<id>\d+)\1',
31 webpage, 'partner id', group='id')
32 kaltura_id = self._search_regex(
33 r'videoIdString\s*[:=]\s*(["\'])kaltura:(?P<id>[0-9a-z_]+)\1',
34 webpage, 'videl id', group='id')
35
36 return {
37 '_type': 'url_transparent',
38 'url': 'kaltura:%s:%s' % (partner_id, kaltura_id),
39 'ie_key': 'Kaltura',
40 'id': video_id,
41 'display_id': display_id,
42 }