]>
jfr.im git - yt-dlp.git/blob - youtube_dlc/extractor/americastestkitchen.py
e20f00fc3efabf7ed5c12892aeeafa986bfb803e
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class AmericasTestKitchenIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?(?:americastestkitchen|cooks(?:country|illustrated))\.com/(?P<resource_type>episode|videos)/(?P<id>\d+)'
17 'url': 'https://www.americastestkitchen.com/episode/582-weeknight-japanese-suppers',
18 'md5': 'b861c3e365ac38ad319cfd509c30577f',
20 'id': '5b400b9ee338f922cb06450c',
21 'title': 'Japanese Suppers',
23 'description': 'md5:64e606bfee910627efc4b5f050de92b3',
24 'thumbnail': r
're:^https?://',
25 'timestamp': 1523664000,
26 'upload_date': '20180414',
27 'release_date': '20180410',
28 'series': "America's Test Kitchen",
30 'episode': 'Japanese Suppers',
34 'skip_download': True,
37 'url': 'https://www.americastestkitchen.com/videos/3420-pan-seared-salmon',
38 'only_matching': True,
40 'url': 'https://www.cookscountry.com/episode/564-when-only-chocolate-will-do',
41 'only_matching': True,
43 'url': 'https://www.cooksillustrated.com/videos/4478-beef-wellington',
44 'only_matching': True,
47 def _real_extract(self
, url
):
48 resource_type
, video_id
= re
.match(self
._VALID
_URL
, url
).groups()
49 is_episode
= resource_type
== 'episode'
51 resource_type
= 'episodes'
53 resource
= self
._download
_json
(
54 'https://www.americastestkitchen.com/api/v6/%s/%s' % (resource_type
, video_id
), video_id
)
55 video
= resource
['video'] if is_episode
else resource
56 episode
= resource
if is_episode
else resource
.get('episode') or {}
59 '_type': 'url_transparent',
60 'url': 'https://player.zype.com/embed/%s.js?api_key=jZ9GUhRmxcPvX7M3SlfejB6Hle9jyHTdk2jVxG7wOHPLODgncEKVdPYBhuz9iWXQ' % video
['zypeId'],
62 'description': clean_html(video
.get('description')),
63 'release_date': unified_strdate(video
.get('publishDate')),
64 'series': try_get(episode
, lambda x
: x
['show']['title']),
65 'episode': episode
.get('title'),