[spike] Extract MGID via custom mobile URL
If the conventional MGID detection fails, fall back to searching for the mobile app's custom URL format.
This commit is contained in:
parent
9dde0e04e6
commit
2107c2b0aa
@ -201,7 +201,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):
|
def _extract_mgid(self, webpage, fatal=True):
|
||||||
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 +221,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')
|
r'embed/(mgid:.+?)["\'&?/]', sm4_embed, 'mgid', fatal=fatal)
|
||||||
return mgid
|
return mgid
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
from .mtv import MTVServicesInfoExtractor
|
from .mtv import MTVServicesInfoExtractor
|
||||||
|
|
||||||
|
|
||||||
@ -32,3 +34,12 @@ class SpikeIE(MTVServicesInfoExtractor):
|
|||||||
|
|
||||||
_FEED_URL = 'http://www.spike.com/feeds/mrss/'
|
_FEED_URL = 'http://www.spike.com/feeds/mrss/'
|
||||||
_MOBILE_TEMPLATE = 'http://m.spike.com/videos/video.rbml?id=%s'
|
_MOBILE_TEMPLATE = 'http://m.spike.com/videos/video.rbml?id=%s'
|
||||||
|
_CUSTOM_URL_REGEX = re.compile(r'spikenetworkapp://([^/]+/[-a-fA-F0-9]+)')
|
||||||
|
|
||||||
|
def _extract_mgid(self, webpage):
|
||||||
|
mgid = super(SpikeIE, self)._extract_mgid(webpage, fatal=False)
|
||||||
|
if mgid is None:
|
||||||
|
url_parts = self._search_regex(self._CUSTOM_URL_REGEX, webpage, 'episode_id')
|
||||||
|
video_type, episode_id = url_parts.split('/', 1)
|
||||||
|
mgid = 'mgid:arc:{}:spike.com:{}'.format(video_type, episode_id)
|
||||||
|
return mgid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user