[youtube] Fix extraction.
[youtube-dl] / youtube_dl / extractor / fox9.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class FOX9IE(InfoExtractor):
8     _VALID_URL = r'https?://(?:www\.)?fox9\.com/video/(?P<id>\d+)'
9
10     def _real_extract(self, url):
11         video_id = self._match_id(url)
12         return self.url_result(
13             'anvato:anvato_epfox_app_web_prod_b3373168e12f423f41504f207000188daf88251b:' + video_id,
14             'Anvato', video_id)
15
16
17 class FOX9NewsIE(InfoExtractor):
18     _VALID_URL = r'https?://(?:www\.)?fox9\.com/news/(?P<id>[^/?&#]+)'
19     _TEST = {
20         'url': 'https://www.fox9.com/news/black-bear-in-tree-draws-crowd-in-downtown-duluth-minnesota',
21         'md5': 'd6e1b2572c3bab8a849c9103615dd243',
22         'info_dict': {
23             'id': '314473',
24             'ext': 'mp4',
25             'title': 'Bear climbs tree in downtown Duluth',
26             'description': 'md5:6a36bfb5073a411758a752455408ac90',
27             'duration': 51,
28             'timestamp': 1478123580,
29             'upload_date': '20161102',
30             'uploader': 'EPFOX',
31             'categories': ['News', 'Sports'],
32             'tags': ['news', 'video'],
33         },
34     }
35
36     def _real_extract(self, url):
37         display_id = self._match_id(url)
38         webpage = self._download_webpage(url, display_id)
39         anvato_id = self._search_regex(
40             r'anvatoId\s*:\s*[\'"](\d+)', webpage, 'anvato id')
41         return self.url_result('https://www.fox9.com/video/' + anvato_id, 'FOX9')