[crackle] Look for non-DRM formats (#1938)

Authored by: raleeper
This commit is contained in:
raleeper 2021-12-09 03:39:51 -08:00 committed by GitHub
parent e3c7d49571
commit 1619836cb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,32 +23,35 @@
class CrackleIE(InfoExtractor): class CrackleIE(InfoExtractor):
_VALID_URL = r'(?:crackle:|https?://(?:(?:www|m)\.)?(?:sony)?crackle\.com/(?:playlist/\d+/|(?:[^/]+/)+))(?P<id>\d+)' _VALID_URL = r'(?:crackle:|https?://(?:(?:www|m)\.)?(?:sony)?crackle\.com/(?:playlist/\d+/|(?:[^/]+/)+))(?P<id>\d+)'
_TESTS = [{ _TESTS = [{
# geo restricted to CA # Crackle is available in the United States and territories
'url': 'https://www.crackle.com/andromeda/2502343', 'url': 'https://www.crackle.com/thanksgiving/2510064',
'info_dict': { 'info_dict': {
'id': '2502343', 'id': '2510064',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Under The Night', 'title': 'Touch Football',
'description': 'md5:d2b8ca816579ae8a7bf28bfff8cefc8a', 'description': 'md5:cfbb513cf5de41e8b56d7ab756cff4df',
'duration': 2583, 'duration': 1398,
'view_count': int, 'view_count': int,
'average_rating': 0, 'average_rating': 0,
'age_limit': 14, 'age_limit': 17,
'genre': 'Action, Sci-Fi', 'genre': 'Comedy',
'creator': 'Allan Kroeker', 'creator': 'Daniel Powell',
'artist': 'Keith Hamilton Cobb, Kevin Sorbo, Lisa Ryder, Lexa Doig, Robert Hewitt Wolfe', 'artist': 'Chris Elliott, Amy Sedaris',
'release_year': 2000, 'release_year': 2016,
'series': 'Andromeda', 'series': 'Thanksgiving',
'episode': 'Under The Night', 'episode': 'Touch Football',
'season_number': 1, 'season_number': 1,
'episode_number': 1, 'episode_number': 1,
}, },
'params': { 'params': {
# m3u8 download # m3u8 download
'skip_download': True, 'skip_download': True,
} },
'expected_warnings': [
'Trying with a list of known countries'
],
}, { }, {
'url': 'https://www.sonycrackle.com/andromeda/2502343', 'url': 'https://www.sonycrackle.com/thanksgiving/2510064',
'only_matching': True, 'only_matching': True,
}] }]
@ -129,7 +132,6 @@ def _real_extract(self, url):
break break
ignore_no_formats = self.get_param('ignore_no_formats_error') ignore_no_formats = self.get_param('ignore_no_formats_error')
allow_unplayable_formats = self.get_param('allow_unplayable_formats')
if not media or (not media.get('MediaURLs') and not ignore_no_formats): if not media or (not media.get('MediaURLs') and not ignore_no_formats):
raise ExtractorError( raise ExtractorError(
@ -143,8 +145,8 @@ def _real_extract(self, url):
for e in media.get('MediaURLs') or []: for e in media.get('MediaURLs') or []:
if e.get('UseDRM'): if e.get('UseDRM'):
has_drm = True has_drm = True
if not allow_unplayable_formats: format_url = url_or_none(e.get('DRMPath'))
continue else:
format_url = url_or_none(e.get('Path')) format_url = url_or_none(e.get('Path'))
if not format_url: if not format_url:
continue continue