add _search_regex to the new IEs

This commit is contained in:
Filippo Valsorda 2013-06-17 19:47:44 +02:00
parent 8bc7c3d858
commit 0251f9c9c0
1 changed files with 8 additions and 10 deletions

View File

@ -4465,11 +4465,12 @@ class Vbox7IE(InfoExtractor):
video_id = mobj.group(1) video_id = mobj.group(1)
redirect_page, urlh = self._download_webpage_handle(url, video_id) redirect_page, urlh = self._download_webpage_handle(url, video_id)
redirect_url = urlh.geturl() + re.search(r'window\.location = \'(.*)\';', redirect_page).group(1) new_location = self._search_regex(r'window\.location = \'(.*)\';', redirect_page, u'redirect location')
redirect_url = urlh.geturl() + new_location
webpage = self._download_webpage(redirect_url, video_id, u'Downloading redirect page') webpage = self._download_webpage(redirect_url, video_id, u'Downloading redirect page')
title = re.search(r'<title>(.*)</title>', webpage) title = self._html_search_regex(r'<title>(.*)</title>',
title = (title.group(1)).split('/')[0].strip() webpage, u'title').split('/')[0].strip()
ext = "flv" ext = "flv"
info_url = "http://vbox7.com/play/magare.do" info_url = "http://vbox7.com/play/magare.do"
@ -4503,10 +4504,7 @@ class GametrailersIE(InfoExtractor):
mgid_re = r'data-video="(?P<mgid>mgid:.*?)"' mgid_re = r'data-video="(?P<mgid>mgid:.*?)"'
else: else:
mgid_re = r'data-contentId=\'(?P<mgid>mgid:.*?)\'' mgid_re = r'data-contentId=\'(?P<mgid>mgid:.*?)\''
m_mgid = re.search(mgid_re, webpage) mgid = self._search_regex(mgid_re, webpage, u'mgid')
if m_mgid is None:
raise ExtractorError(u'Unable to extract mgid')
mgid = m_mgid.group(1)
data = compat_urllib_parse.urlencode({'uri': mgid, 'acceptMethods': 'fms'}) data = compat_urllib_parse.urlencode({'uri': mgid, 'acceptMethods': 'fms'})
info_page = self._download_webpage('http://www.gametrailers.com/feeds/mrss?' + data, info_page = self._download_webpage('http://www.gametrailers.com/feeds/mrss?' + data,
@ -4528,11 +4526,11 @@ class GametrailersIE(InfoExtractor):
video_description = m_info.group('description') video_description = m_info.group('description')
video_thumb = m_info.group('thumb') video_thumb = m_info.group('thumb')
m_urls = re.finditer(r'<src>(?P<url>.*)</src>', links_webpage) m_urls = list(re.finditer(r'<src>(?P<url>.*)</src>', links_webpage))
if m_urls is None: if m_urls is None or len(m_urls) == 0:
raise ExtractError(u'Unable to extrat video url') raise ExtractError(u'Unable to extrat video url')
# They are sorted from worst to best quality # They are sorted from worst to best quality
video_url = list(m_urls)[-1].group('url') video_url = m_urls[-1].group('url')
return {'url': video_url, return {'url': video_url,
'id': video_id, 'id': video_id,