]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/fox9.py
Adapt changes from Andreas Tille for porting to Salsa.
[youtubedl] / youtube_dl / extractor / fox9.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .anvato import AnvatoIE
5
6
7 class FOX9IE(AnvatoIE):
8 _VALID_URL = r'https?://(?:www\.)?fox9\.com/(?:[^/]+/)+(?P<id>\d+)-story'
9 _TESTS = [{
10 'url': 'http://www.fox9.com/news/215123287-story',
11 'md5': 'd6e1b2572c3bab8a849c9103615dd243',
12 'info_dict': {
13 'id': '314473',
14 'ext': 'mp4',
15 'title': 'Bear climbs tree in downtown Duluth',
16 'description': 'md5:6a36bfb5073a411758a752455408ac90',
17 'duration': 51,
18 'timestamp': 1478123580,
19 'upload_date': '20161102',
20 'uploader': 'EPFOX',
21 'categories': ['News', 'Sports'],
22 'tags': ['news', 'video'],
23 },
24 }, {
25 'url': 'http://www.fox9.com/news/investigators/214070684-story',
26 'only_matching': True,
27 }]
28
29 def _real_extract(self, url):
30 video_id = self._match_id(url)
31
32 webpage = self._download_webpage(url, video_id)
33
34 video_id = self._parse_json(
35 self._search_regex(
36 r"this\.videosJson\s*=\s*'(\[.+?\])';",
37 webpage, 'anvato playlist'),
38 video_id)[0]['video']
39
40 return self._get_anvato_videos(
41 'anvato_epfox_app_web_prod_b3373168e12f423f41504f207000188daf88251b',
42 video_id)