diff options
author | Charles Chen <chaochichen@gmail.com> | 2014-07-22 14:44:38 -0700 |
---|---|---|
committer | Charles Chen <chaochichen@gmail.com> | 2014-07-22 14:44:38 -0700 |
commit | c4f731262dbee921147b94aac5035b5d9ec75502 (patch) | |
tree | 98a93f1de2b7c71a8e25fa072515b4efc5f43ea1 /youtube_dl/extractor/nbc.py | |
parent | 07cc63f386c6afe253b7707631663072d2fb8789 (diff) | |
parent | e42a692f003eabdb1efad7b9f4b10ce97c712d32 (diff) |
Merge remote-tracking branch 'upstream/master' into MLB
Conflicts:
youtube_dl/extractor/mlb.py
Diffstat (limited to 'youtube_dl/extractor/nbc.py')
-rw-r--r-- | youtube_dl/extractor/nbc.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/youtube_dl/extractor/nbc.py b/youtube_dl/extractor/nbc.py index aa34665d1..70aa98aee 100644 --- a/youtube_dl/extractor/nbc.py +++ b/youtube_dl/extractor/nbc.py @@ -85,11 +85,25 @@ class NBCNewsIE(InfoExtractor): flags=re.MULTILINE) bootstrap = json.loads(bootstrap_json) info = bootstrap['results'][0]['video'] - playlist_url = info['fallbackPlaylistUrl'] + '?form=MPXNBCNewsAPI' mpxid = info['mpxId'] - all_videos = self._download_json(playlist_url, title)['videos'] - # The response contains additional videos - info = next(v for v in all_videos if v['mpxId'] == mpxid) + + base_urls = [ + info['fallbackPlaylistUrl'], + info['associatedPlaylistUrl'], + ] + + for base_url in base_urls: + playlist_url = base_url + '?form=MPXNBCNewsAPI' + all_videos = self._download_json(playlist_url, title)['videos'] + + try: + info = next(v for v in all_videos if v['mpxId'] == mpxid) + break + except StopIteration: + continue + + if info is None: + raise ExtractorError('Could not find video in playlists') return { '_type': 'url', |