]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/aenetworks.py
6018ae79a2a114451c79edc34af524898462004d
[youtubedl] / youtube_dl / extractor / aenetworks.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..utils import smuggle_url
5
6
7 class AENetworksIE(InfoExtractor):
8 IE_NAME = 'aenetworks'
9 IE_DESC = 'A+E Networks: A&E, Lifetime, History.com, FYI Network'
10 _VALID_URL = r'https?://(?:www\.)?(?:(?:history|aetv|mylifetime)\.com|fyi\.tv)/(?:[^/]+/)+(?P<id>[^/]+?)(?:$|[?#])'
11
12 _TESTS = [{
13 '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',
14 'info_dict': {
15 'id': 'g12m5Gyt3fdR',
16 'ext': 'mp4',
17 'title': "Bet You Didn't Know: Valentine's Day",
18 'description': 'md5:7b57ea4829b391995b405fa60bd7b5f7',
19 },
20 'params': {
21 # m3u8 download
22 'skip_download': True,
23 },
24 'add_ie': ['ThePlatform'],
25 'expected_warnings': ['JSON-LD'],
26 }, {
27 'url': 'http://www.history.com/shows/mountain-men/season-1/episode-1',
28 'info_dict': {
29 'id': 'eg47EERs_JsZ',
30 'ext': 'mp4',
31 'title': 'Winter Is Coming',
32 'description': 'md5:641f424b7a19d8e24f26dea22cf59d74',
33 },
34 'params': {
35 # m3u8 download
36 'skip_download': True,
37 },
38 'add_ie': ['ThePlatform'],
39 }, {
40 'url': 'http://www.aetv.com/shows/duck-dynasty/video/inlawful-entry',
41 'only_matching': True
42 }, {
43 'url': 'http://www.fyi.tv/shows/tiny-house-nation/videos/207-sq-ft-minnesota-prairie-cottage',
44 'only_matching': True
45 }, {
46 'url': 'http://www.mylifetime.com/shows/project-runway-junior/video/season-1/episode-6/superstar-clients',
47 'only_matching': True
48 }]
49
50 def _real_extract(self, url):
51 video_id = self._match_id(url)
52
53 webpage = self._download_webpage(url, video_id)
54
55 video_url_re = [
56 r'data-href="[^"]*/%s"[^>]+data-release-url="([^"]+)"' % video_id,
57 r"media_url\s*=\s*'([^']+)'"
58 ]
59 video_url = self._search_regex(video_url_re, webpage, 'video url')
60
61 info = self._search_json_ld(webpage, video_id, fatal=False)
62 info.update({
63 '_type': 'url_transparent',
64 'url': smuggle_url(video_url, {'sig': {'key': 'crazyjava', 'secret': 's3cr3t'}}),
65 })
66 return info