]>
Commit | Line | Data |
---|---|---|
1139a54d S |
1 | from __future__ import unicode_literals |
2 | ||
d7e82645 | 3 | import re |
4 | ||
3793090b | 5 | from .amp import AMPIE |
1139a54d S |
6 | |
7 | ||
3793090b | 8 | class FoxNewsIE(AMPIE): |
5307c332 | 9 | IE_DESC = 'Fox News and Fox Business Video' |
1b660cce | 10 | _VALID_URL = r'https?://(?P<host>video\.fox(?:news|business)\.com)/v/(?:video-embed\.html\?video_id=)?(?P<id>\d+)' |
1139a54d S |
11 | _TESTS = [ |
12 | { | |
13 | 'url': 'http://video.foxnews.com/v/3937480/frozen-in-time/#sp=show-clips', | |
14 | 'md5': '32aaded6ba3ef0d1c04e238d01031e5e', | |
15 | 'info_dict': { | |
16 | 'id': '3937480', | |
17 | 'ext': 'flv', | |
18 | 'title': 'Frozen in Time', | |
3793090b | 19 | 'description': '16-year-old girl is size of toddler', |
1139a54d | 20 | 'duration': 265, |
c7fa5fa4 | 21 | # 'timestamp': 1304411491, |
22 | # 'upload_date': '20110503', | |
1139a54d S |
23 | 'thumbnail': 're:^https?://.*\.jpg$', |
24 | }, | |
25 | }, | |
26 | { | |
27 | 'url': 'http://video.foxnews.com/v/3922535568001/rep-luis-gutierrez-on-if-obamas-immigration-plan-is-legal/#sp=show-clips', | |
28 | 'md5': '5846c64a1ea05ec78175421b8323e2df', | |
29 | 'info_dict': { | |
30 | 'id': '3922535568001', | |
31 | 'ext': 'mp4', | |
32 | 'title': "Rep. Luis Gutierrez on if Obama's immigration plan is legal", | |
3793090b | 33 | 'description': "Congressman discusses president's plan", |
1139a54d | 34 | 'duration': 292, |
c7fa5fa4 | 35 | # 'timestamp': 1417662047, |
36 | # 'upload_date': '20141204', | |
1139a54d S |
37 | 'thumbnail': 're:^https?://.*\.jpg$', |
38 | }, | |
39 | }, | |
40 | { | |
41 | 'url': 'http://video.foxnews.com/v/video-embed.html?video_id=3937480&d=video.foxnews.com', | |
42 | 'only_matching': True, | |
43 | }, | |
8df8c278 | 44 | { |
45 | 'url': 'http://video.foxbusiness.com/v/4442309889001', | |
46 | 'only_matching': True, | |
47 | }, | |
1139a54d S |
48 | ] |
49 | ||
50 | def _real_extract(self, url): | |
c7fa5fa4 | 51 | host, video_id = re.match(self._VALID_URL, url).groups() |
d7e82645 | 52 | |
c7fa5fa4 | 53 | info = self._extract_feed_info( |
54 | 'http://%s/v/feed/video/%s.js?template=fox' % (host, video_id)) | |
3793090b | 55 | info['id'] = video_id |
56 | return info |