[compat] Clarify the versions requiring compat_kwargs
[youtube-dl] / youtube_dl / extractor / ae.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..utils import smuggle_url
5
6
7 class AEIE(InfoExtractor):
8     _VALID_URL = r'https?://(?:www\.)?(?:(?:history|aetv|mylifetime)\.com|fyi\.tv)/(?:[^/]+/)+(?P<id>[^/]+?)(?:$|[?#])'
9
10     _TESTS = [{
11         'url': 'http://www.history.com/topics/valentines-day/history-of-valentines-day/videos/bet-you-didnt-know-valentines-day?m=528e394da93ae&s=undefined&f=1&free=false',
12         'info_dict': {
13             'id': 'g12m5Gyt3fdR',
14             'ext': 'mp4',
15             'title': "Bet You Didn't Know: Valentine's Day",
16             'description': 'md5:7b57ea4829b391995b405fa60bd7b5f7',
17         },
18         'params': {
19             # m3u8 download
20             'skip_download': True,
21         },
22         'add_ie': ['ThePlatform'],
23         'expected_warnings': ['JSON-LD'],
24     }, {
25         'url': 'http://www.history.com/shows/mountain-men/season-1/episode-1',
26         'info_dict': {
27             'id': 'eg47EERs_JsZ',
28             'ext': 'mp4',
29             'title': "Winter Is Coming",
30             'description': 'md5:641f424b7a19d8e24f26dea22cf59d74',
31         },
32         'params': {
33             # m3u8 download
34             'skip_download': True,
35         },
36         'add_ie': ['ThePlatform'],
37     }, {
38         'url': 'http://www.aetv.com/shows/duck-dynasty/video/inlawful-entry',
39         'only_matching': True
40     }, {
41         'url': 'http://www.fyi.tv/shows/tiny-house-nation/videos/207-sq-ft-minnesota-prairie-cottage',
42         'only_matching': True
43     }, {
44         'url': 'http://www.mylifetime.com/shows/project-runway-junior/video/season-1/episode-6/superstar-clients',
45         'only_matching': True
46     }]
47
48     def _real_extract(self, url):
49         video_id = self._match_id(url)
50
51         webpage = self._download_webpage(url, video_id)
52
53         video_url_re = [
54             r'data-href="[^"]*/%s"[^>]+data-release-url="([^"]+)"' % video_id,
55             r"media_url\s*=\s*'([^']+)'"
56         ]
57         video_url = self._search_regex(video_url_re, webpage, 'video url')
58
59         info = self._search_json_ld(webpage, video_id, fatal=False)
60         info.update({
61             '_type': 'url_transparent',
62             'url': smuggle_url(video_url, {'sig': {'key': 'crazyjava', 'secret': 's3cr3t'}}),
63         })
64         return info