[mtv] Add support for urls from the mobile site (fixes #1959)

This commit is contained in:
Jaime Marquínez Ferrándiz 2013-12-16 22:05:28 +01:00
parent ebce53b3d8
commit 5c541b2cb7

View file

@ -93,7 +93,9 @@ class MTVServicesInfoExtractor(InfoExtractor):
class MTVIE(MTVServicesInfoExtractor): class MTVIE(MTVServicesInfoExtractor):
_VALID_URL = r'^https?://(?:www\.)?mtv\.com/videos/.+?/(?P<videoid>[0-9]+)/[^/]+$' _VALID_URL = r'''(?x)^https?://
(?:(?:www\.)?mtv\.com/videos/.+?/(?P<videoid>[0-9]+)/[^/]+$|
m\.mtv\.com/videos/video\.rbml\?.*?id=(?P<mgid>[^&]+))'''
_FEED_URL = 'http://www.mtv.com/player/embed/AS3/rss/' _FEED_URL = 'http://www.mtv.com/player/embed/AS3/rss/'
@ -127,16 +129,17 @@ class MTVIE(MTVServicesInfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('videoid') video_id = mobj.group('videoid')
uri = mobj.group('mgid')
webpage = self._download_webpage(url, video_id) if uri is None:
webpage = self._download_webpage(url, video_id)
# Some videos come from Vevo.com
m_vevo = re.search(r'isVevoVideo = true;.*?vevoVideoId = "(.*?)";', # Some videos come from Vevo.com
webpage, re.DOTALL) m_vevo = re.search(r'isVevoVideo = true;.*?vevoVideoId = "(.*?)";',
if m_vevo: webpage, re.DOTALL)
vevo_id = m_vevo.group(1); if m_vevo:
self.to_screen(u'Vevo video detected: %s' % vevo_id) vevo_id = m_vevo.group(1);
return self.url_result('vevo:%s' % vevo_id, ie='Vevo') self.to_screen(u'Vevo video detected: %s' % vevo_id)
return self.url_result('vevo:%s' % vevo_id, ie='Vevo')
uri = self._html_search_regex(r'/uri/(.*?)\?', webpage, u'uri')
uri = self._html_search_regex(r'/uri/(.*?)\?', webpage, u'uri')
return self._get_videos_info(uri) return self._get_videos_info(uri)