diff options
author | remitamine <[email protected]> | 2015-12-23 17:48:37 +0100 |
---|---|---|
committer | remitamine <[email protected]> | 2015-12-23 17:48:37 +0100 |
commit | 261b4c23c70c7c5dc4fe9fd22cf9e867b7456c40 (patch) | |
tree | 65c17efc73ecd112a2a05dad87cd29bb84e543bc | |
parent | dcdc352371115007028632da6ae377d0ad39b62a (diff) | |
download | youtube-dl-261b4c23c70c7c5dc4fe9fd22cf9e867b7456c40.tar.gz youtube-dl-261b4c23c70c7c5dc4fe9fd22cf9e867b7456c40.zip |
[appletrailers] skip clips with empty url
-rw-r--r-- | youtube_dl/extractor/appletrailers.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/youtube_dl/extractor/appletrailers.py b/youtube_dl/extractor/appletrailers.py index 82beed2ce..62ed0c918 100644 --- a/youtube_dl/extractor/appletrailers.py +++ b/youtube_dl/extractor/appletrailers.py @@ -65,6 +65,12 @@ class AppleTrailersIE(InfoExtractor): }, ] }, { + 'url': 'http://trailers.apple.com/trailers/magnolia/blackthorn/', + 'info_dict': { + 'id': 'blackthorn', + }, + 'playlist_mincount': 2, + }, { 'url': 'http://trailers.apple.com/ca/metropole/autrui/', 'only_matching': True, }] @@ -97,6 +103,9 @@ class AppleTrailersIE(InfoExtractor): trailer_info_json = self._search_regex(self._JSON_RE, on_click, 'trailer info') trailer_info = json.loads(trailer_info_json) + first_url = trailer_info.get('url') + if not first_url: + continue title = trailer_info['title'] video_id = movie + '-' + re.sub(r'[^a-zA-Z0-9]', '', title).lower() thumbnail = li.find('.//img').attrib['src'] @@ -108,7 +117,6 @@ class AppleTrailersIE(InfoExtractor): if m: duration = 60 * int(m.group('minutes')) + int(m.group('seconds')) - first_url = trailer_info['url'] trailer_id = first_url.split('/')[-1].rpartition('_')[0].lower() settings_json_url = compat_urlparse.urljoin(url, 'includes/settings/%s.json' % trailer_id) settings = self._download_json(settings_json_url, trailer_id, 'Downloading settings json') |