1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

[groupon] Add support for Youtube embeds (Closes #9508)

This commit is contained in:
Sergey M․ 2016-05-16 00:30:13 +06:00
parent a0a81918f1
commit f7199423e5
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -4,7 +4,7 @@ from .common import InfoExtractor
class GrouponIE(InfoExtractor): class GrouponIE(InfoExtractor):
_VALID_URL = r'https?://www\.groupon\.com/deals/(?P<id>[^?#]+)' _VALID_URL = r'https?://(?:www\.)?groupon\.com/deals/(?P<id>[^/?#&]+)'
_TEST = { _TEST = {
'url': 'https://www.groupon.com/deals/bikram-yoga-huntington-beach-2#ooid=tubGNycTo_9Uxg82uESj4i61EYX8nyuf', 'url': 'https://www.groupon.com/deals/bikram-yoga-huntington-beach-2#ooid=tubGNycTo_9Uxg82uESj4i61EYX8nyuf',
@ -15,18 +15,26 @@ class GrouponIE(InfoExtractor):
}, },
'playlist': [{ 'playlist': [{
'info_dict': { 'info_dict': {
'id': 'tubGNycTo_9Uxg82uESj4i61EYX8nyuf', 'id': 'fk6OhWpXgIQ',
'ext': 'flv', 'ext': 'mp4',
'title': 'Bikram Yoga Huntington Beach | Orange County', 'title': 'Bikram Yoga Huntington Beach | Orange County !tubGNycTo@9Uxg82uESj4i61EYX8nyuf',
'description': 'md5:d41d8cd98f00b204e9800998ecf8427e', 'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
'duration': 44.961, 'duration': 45,
'upload_date': '20160405',
'uploader_id': 'groupon',
'uploader': 'Groupon',
}, },
}], }],
'params': { 'params': {
'skip_download': 'HDS', 'skip_download': True,
} }
} }
_PROVIDERS = {
'ooyala': ('ooyala:%s', 'Ooyala'),
'youtube': ('%s', 'Youtube'),
}
def _real_extract(self, url): def _real_extract(self, url):
playlist_id = self._match_id(url) playlist_id = self._match_id(url)
webpage = self._download_webpage(url, playlist_id) webpage = self._download_webpage(url, playlist_id)
@ -36,12 +44,17 @@ class GrouponIE(InfoExtractor):
videos = payload['carousel'].get('dealVideos', []) videos = payload['carousel'].get('dealVideos', [])
entries = [] entries = []
for v in videos: for v in videos:
if v.get('provider') != 'OOYALA': provider = v.get('provider')
video_id = v.get('media') or v.get('id') or v.get('baseURL')
if not provider or not video_id:
continue
url_pattern, ie_key = self._PROVIDERS.get(provider.lower())
if not url_pattern:
self.report_warning( self.report_warning(
'%s: Unsupported video provider %s, skipping video' % '%s: Unsupported video provider %s, skipping video' %
(playlist_id, v.get('provider'))) (playlist_id, provider))
continue continue
entries.append(self.url_result('ooyala:%s' % v['media'])) entries.append(self.url_result(url_pattern % video_id, ie_key))
return { return {
'_type': 'playlist', '_type': 'playlist',