]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/aenetworks.py
[yahoo] Add improve content id regexes (Closes #8290)
[yt-dlp.git] / youtube_dl / extractor / aenetworks.py
CommitLineData
b9c7a973
S
1from __future__ import unicode_literals
2
3from .common import InfoExtractor
4from ..utils import smuggle_url
5
6
855f90fa
S
7class AENetworksIE(InfoExtractor):
8 IE_NAME = 'aenetworks'
9 IE_DESC = 'A+E Networks: A&E, Lifetime, History.com, FYI Network'
a78d6a9b 10 _VALID_URL = r'https?://(?:www\.)?(?:(?:history|aetv|mylifetime)\.com|fyi\.tv)/(?:[^/]+/)+(?P<id>[^/]+?)(?:$|[?#])'
b9c7a973
S
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',
b9c7a973 14 'info_dict': {
52767c1b 15 'id': 'g12m5Gyt3fdR',
b9c7a973
S
16 'ext': 'mp4',
17 'title': "Bet You Didn't Know: Valentine's Day",
18 'description': 'md5:7b57ea4829b391995b405fa60bd7b5f7',
19 },
52767c1b 20 'params': {
21 # m3u8 download
22 'skip_download': True,
23 },
24 'add_ie': ['ThePlatform'],
1358b941 25 'expected_warnings': ['JSON-LD'],
52767c1b 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",
1358b941 32 'description': 'md5:641f424b7a19d8e24f26dea22cf59d74',
52767c1b 33 },
34 'params': {
35 # m3u8 download
36 'skip_download': True,
37 },
b9c7a973 38 'add_ie': ['ThePlatform'],
587dfd44 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
b9c7a973
S
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
52767c1b 55 video_url_re = [
fad7a336 56 r'data-href="[^"]*/%s"[^>]+data-release-url="([^"]+)"' % video_id,
52767c1b 57 r"media_url\s*=\s*'([^']+)'"
58 ]
59 video_url = self._search_regex(video_url_re, webpage, 'video url')
b9c7a973 60
b4e44234
S
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