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