Use default instead of fatal
This commit is contained in:
parent
d4b9a720dc
commit
9d60d1851a
@ -13,6 +13,7 @@ from ..utils import (
|
|||||||
fix_xml_ampersands,
|
fix_xml_ampersands,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
HEADRequest,
|
HEADRequest,
|
||||||
|
NO_DEFAULT,
|
||||||
RegexNotFoundError,
|
RegexNotFoundError,
|
||||||
sanitized_Request,
|
sanitized_Request,
|
||||||
strip_or_none,
|
strip_or_none,
|
||||||
@ -201,7 +202,7 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
|||||||
[self._get_video_info(item) for item in idoc.findall('.//item')],
|
[self._get_video_info(item) for item in idoc.findall('.//item')],
|
||||||
playlist_title=title, playlist_description=description)
|
playlist_title=title, playlist_description=description)
|
||||||
|
|
||||||
def _extract_mgid(self, webpage, fatal=True):
|
def _extract_mgid(self, webpage, default=NO_DEFAULT):
|
||||||
try:
|
try:
|
||||||
# the url can be http://media.mtvnservices.com/fb/{mgid}.swf
|
# the url can be http://media.mtvnservices.com/fb/{mgid}.swf
|
||||||
# or http://media.mtvnservices.com/{mgid}
|
# or http://media.mtvnservices.com/{mgid}
|
||||||
@ -221,7 +222,7 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
|||||||
sm4_embed = self._html_search_meta(
|
sm4_embed = self._html_search_meta(
|
||||||
'sm4:video:embed', webpage, 'sm4 embed', default='')
|
'sm4:video:embed', webpage, 'sm4 embed', default='')
|
||||||
mgid = self._search_regex(
|
mgid = self._search_regex(
|
||||||
r'embed/(mgid:.+?)["\'&?/]', sm4_embed, 'mgid', fatal=fatal)
|
r'embed/(mgid:.+?)["\'&?/]', sm4_embed, 'mgid', default=default)
|
||||||
return mgid
|
return mgid
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
@ -21,7 +21,6 @@ class SpikeIE(MTVServicesInfoExtractor):
|
|||||||
}, {
|
}, {
|
||||||
'url': 'http://www.spike.com/full-episodes/j830qm/lip-sync-battle-joel-mchale-vs-jim-rash-season-2-ep-209',
|
'url': 'http://www.spike.com/full-episodes/j830qm/lip-sync-battle-joel-mchale-vs-jim-rash-season-2-ep-209',
|
||||||
'md5': 'b25c6f16418aefb9ad5a6cae2559321f',
|
'md5': 'b25c6f16418aefb9ad5a6cae2559321f',
|
||||||
'expected_warnings': ['unable to extract .*mgid'],
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '37ace3a8-1df6-48be-85b8-38df8229e241',
|
'id': '37ace3a8-1df6-48be-85b8-38df8229e241',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
@ -47,7 +46,7 @@ class SpikeIE(MTVServicesInfoExtractor):
|
|||||||
_CUSTOM_URL_REGEX = re.compile(r'spikenetworkapp://([^/]+/[-a-fA-F0-9]+)')
|
_CUSTOM_URL_REGEX = re.compile(r'spikenetworkapp://([^/]+/[-a-fA-F0-9]+)')
|
||||||
|
|
||||||
def _extract_mgid(self, webpage):
|
def _extract_mgid(self, webpage):
|
||||||
mgid = super(SpikeIE, self)._extract_mgid(webpage, fatal=False)
|
mgid = super(SpikeIE, self)._extract_mgid(webpage, default=None)
|
||||||
if mgid is None:
|
if mgid is None:
|
||||||
url_parts = self._search_regex(self._CUSTOM_URL_REGEX, webpage, 'episode_id')
|
url_parts = self._search_regex(self._CUSTOM_URL_REGEX, webpage, 'episode_id')
|
||||||
video_type, episode_id = url_parts.split('/', 1)
|
video_type, episode_id = url_parts.split('/', 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user