[nbcnews] Ignore HTTP errors while coping with playlists (Closes #4749)

This commit is contained in:
Sergey M․ 2015-01-20 21:23:51 +06:00
parent 030aa5d9e7
commit 2df54b4ba8
1 changed files with 22 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import json
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import ( from ..compat import (
compat_str, compat_str,
compat_HTTPError,
) )
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
@ -78,6 +79,16 @@ class NBCNewsIE(InfoExtractor):
}, },
'add_ie': ['ThePlatform'], 'add_ie': ['ThePlatform'],
}, },
{
'url': 'http://www.nbcnews.com/feature/dateline-full-episodes/full-episode-family-business-n285156',
'md5': 'fdbf39ab73a72df5896b6234ff98518a',
'info_dict': {
'id': 'Wjf9EDR3A_60',
'ext': 'mp4',
'title': 'FULL EPISODE: Family Business',
'description': 'md5:757988edbaae9d7be1d585eb5d55cc04',
},
},
] ]
def _real_extract(self, url): def _real_extract(self, url):
@ -115,10 +126,19 @@ class NBCNewsIE(InfoExtractor):
if not base_url: if not base_url:
continue continue
playlist_url = base_url + '?form=MPXNBCNewsAPI' playlist_url = base_url + '?form=MPXNBCNewsAPI'
all_videos = self._download_json(playlist_url, title)['videos']
try: try:
info = next(v for v in all_videos if v['mpxId'] == mpxid) all_videos = self._download_json(playlist_url, title)
except ExtractorError as ee:
if isinstance(ee.cause, compat_HTTPError):
continue
raise
if not all_videos or not 'videos' in all_videos:
continue
try:
info = next(v for v in all_videos['videos'] if v['mpxId'] == mpxid)
break break
except StopIteration: except StopIteration:
continue continue