[mtv] Transform the urls from the mobile version to get the best quality
And don't report a warning, just log a message, it allows to pass the test from Europe.
This commit is contained in:
parent
a496524db2
commit
0ef68e04d9
@ -9,6 +9,7 @@ from ..utils import (
|
|||||||
ExtractorError,
|
ExtractorError,
|
||||||
find_xpath_attr,
|
find_xpath_attr,
|
||||||
fix_xml_ampersands,
|
fix_xml_ampersands,
|
||||||
|
HEADRequest,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
url_basename,
|
url_basename,
|
||||||
RegexNotFoundError,
|
RegexNotFoundError,
|
||||||
@ -49,14 +50,19 @@ class MTVServicesInfoExtractor(InfoExtractor):
|
|||||||
req.add_header('Youtubedl-user-agent', 'curl/7')
|
req.add_header('Youtubedl-user-agent', 'curl/7')
|
||||||
webpage = self._download_webpage(req, mtvn_id,
|
webpage = self._download_webpage(req, mtvn_id,
|
||||||
'Downloading mobile page')
|
'Downloading mobile page')
|
||||||
url = unescapeHTML(self._search_regex(r'<a href="(http://metrics.+?)"', webpage, 'url'))
|
metrics_url = unescapeHTML(self._search_regex(r'<a href="(http://metrics.+?)"', webpage, 'url'))
|
||||||
return [{'url': url,'ext': 'mp4',}]
|
req = HEADRequest(metrics_url)
|
||||||
|
response = self._request_webpage(req, mtvn_id, 'Resolving url')
|
||||||
|
url = response.geturl()
|
||||||
|
# Transform the url to get the best quality:
|
||||||
|
url = re.sub(r'.+pxE=mp4', 'http://mtvnmobile.vo.llnwd.net/kip0/_pxn=0+_pxK=18639+_pxE=mp4', url, 1)
|
||||||
|
return [{'url': url,'ext': 'mp4'}]
|
||||||
|
|
||||||
def _extract_video_formats(self, mdoc, mtvn_id):
|
def _extract_video_formats(self, mdoc, mtvn_id):
|
||||||
if re.match(r'.*/(error_country_block\.swf|geoblock\.mp4)$', mdoc.find('.//src').text) is not None:
|
if re.match(r'.*/(error_country_block\.swf|geoblock\.mp4)$', mdoc.find('.//src').text) is not None:
|
||||||
if mtvn_id is not None and self._MOBILE_TEMPLATE is not None:
|
if mtvn_id is not None and self._MOBILE_TEMPLATE is not None:
|
||||||
self._downloader.report_warning('The normal version is not '
|
self.to_screen('The normal version is not available from your '
|
||||||
'available from your country, trying with the mobile version')
|
'country, trying with the mobile version')
|
||||||
return self._extract_mobile_video_formats(mtvn_id)
|
return self._extract_mobile_video_formats(mtvn_id)
|
||||||
raise ExtractorError('This video is not available from your country.',
|
raise ExtractorError('This video is not available from your country.',
|
||||||
expected=True)
|
expected=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user