]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/americastestkitchen.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
13 class AmericasTestKitchenIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?americastestkitchen\.com/(?:episode|videos)/(?P<id>\d+)'
16 'url': 'https://www.americastestkitchen.com/episode/548-summer-dinner-party',
17 'md5': 'b861c3e365ac38ad319cfd509c30577f',
20 'title': 'Summer Dinner Party',
22 'description': 'md5:858d986e73a4826979b6a5d9f8f6a1ec',
23 'thumbnail': r
're:^https?://.*\.jpg',
24 'timestamp': 1497285541,
25 'upload_date': '20170612',
26 'uploader_id': 'roger.metcalf@americastestkitchen.com',
27 'release_date': '20170617',
28 'series': "America's Test Kitchen",
30 'episode': 'Summer Dinner Party',
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 partner_id
= self
._search
_regex
(
47 r
'src=["\'](?
:https?
:)?
//(?
:[^
/]+\
.)kaltura\
.com
/(?
:[^
/]+/)*(?
:p|partner_id
)/(\d
+)',
48 webpage, 'kaltura partner
id')
50 video_data = self._parse_json(
52 r'window\
.__INITIAL
_STATE
__\s
*=\s
*({.+?
})\s
*;\s
*</script
>',
53 webpage, 'initial context
'),
58 (lambda x: x['episodeDetail
']['content
']['data
'],
59 lambda x: x['videoDetail
']['content
']['data
']), dict)
60 ep_meta = ep_data.get('full_video
', {})
61 external_id = ep_data.get('external_id
') or ep_meta['external_id
']
63 title = ep_data.get('title
') or ep_meta.get('title
')
64 description = clean_html(ep_meta.get('episode_description
') or ep_data.get(
65 'description
') or ep_meta.get('description
'))
66 thumbnail = try_get(ep_meta, lambda x: x['photo
']['image_url
'])
67 release_date = unified_strdate(ep_data.get('aired_at
'))
69 season_number = int_or_none(ep_meta.get('season_number
'))
70 episode = ep_meta.get('title
')
71 episode_number = int_or_none(ep_meta.get('episode_number
'))
74 '_type
': 'url_transparent
',
75 'url
': 'kaltura
:%s:%s' % (partner_id, external_id),
78 'description
': description,
79 'thumbnail
': thumbnail,
80 'release_date
': release_date,
81 'series
': "America's Test Kitchen
",
82 'season_number': season_number,
84 'episode_number': episode_number,