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