]>
jfr.im git - yt-dlp.git/blob - youtube_dlc/extractor/americastestkitchen.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
14 class AmericasTestKitchenIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?americastestkitchen\.com/(?:episode|videos)/(?P<id>\d+)'
17 'url': 'https://www.americastestkitchen.com/episode/582-weeknight-japanese-suppers',
18 'md5': 'b861c3e365ac38ad319cfd509c30577f',
20 'id': '5b400b9ee338f922cb06450c',
21 'title': 'Weeknight Japanese Suppers',
23 'description': 'md5:3d0c1a44bb3b27607ce82652db25b4a8',
24 'thumbnail': r
're:^https?://',
25 'timestamp': 1523664000,
26 'upload_date': '20180414',
27 'release_date': '20180414',
28 'series': "America's Test Kitchen",
30 'episode': 'Weeknight Japanese Suppers',
34 'skip_download': True,
37 'url': 'https://www.americastestkitchen.com/videos/3420-pan-seared-salmon',
38 'only_matching': True,
41 def _real_extract(self
, url
):
42 video_id
= self
._match
_id
(url
)
44 webpage
= self
._download
_webpage
(url
, video_id
)
46 video_data
= self
._parse
_json
(
48 r
'window\.__INITIAL_STATE__\s*=\s*({.+?})\s*;\s*</script>',
49 webpage
, 'initial context'),
54 (lambda x
: x
['episodeDetail']['content']['data'],
55 lambda x
: x
['videoDetail']['content']['data']), dict)
56 ep_meta
= ep_data
.get('full_video', {})
58 zype_id
= ep_data
.get('zype_id') or ep_meta
['zype_id']
60 title
= ep_data
.get('title') or ep_meta
.get('title')
61 description
= clean_html(ep_meta
.get('episode_description') or ep_data
.get(
62 'description') or ep_meta
.get('description'))
63 thumbnail
= try_get(ep_meta
, lambda x
: x
['photo']['image_url'])
64 release_date
= unified_strdate(ep_data
.get('aired_at'))
66 season_number
= int_or_none(ep_meta
.get('season_number'))
67 episode
= ep_meta
.get('title')
68 episode_number
= int_or_none(ep_meta
.get('episode_number'))
71 '_type': 'url_transparent',
72 'url': 'https://player.zype.com/embed/%s.js?api_key=jZ9GUhRmxcPvX7M3SlfejB6Hle9jyHTdk2jVxG7wOHPLODgncEKVdPYBhuz9iWXQ' % zype_id
,
75 'description': description
,
76 'thumbnail': thumbnail
,
77 'release_date': release_date
,
78 'series': "America's Test Kitchen",
79 'season_number': season_number
,
81 'episode_number': episode_number
,