1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-25 08:10:31 +01:00

[imdb] Add support for mobile site URLs

This commit is contained in:
dst 2013-12-20 00:21:04 +07:00
parent 71507a11c8
commit 97e302a419

View File

@ -11,7 +11,7 @@ from ..utils import (
class ImdbIE(InfoExtractor): class ImdbIE(InfoExtractor):
IE_NAME = u'imdb' IE_NAME = u'imdb'
IE_DESC = u'Internet Movie Database trailers' IE_DESC = u'Internet Movie Database trailers'
_VALID_URL = r'http://www\.imdb\.com/video/imdb/vi(?P<id>\d+)' _VALID_URL = r'http://(?:www|m)\.imdb\.com/video/imdb/vi(?P<id>\d+)'
_TEST = { _TEST = {
u'url': u'http://www.imdb.com/video/imdb/vi2524815897', u'url': u'http://www.imdb.com/video/imdb/vi2524815897',
@ -27,7 +27,7 @@ class ImdbIE(InfoExtractor):
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('id') video_id = mobj.group('id')
webpage = self._download_webpage(url,video_id) webpage = self._download_webpage('http://www.imdb.com/video/imdb/vi%s' % video_id, video_id)
descr = get_element_by_attribute('itemprop', 'description', webpage) descr = get_element_by_attribute('itemprop', 'description', webpage)
available_formats = re.findall( available_formats = re.findall(
r'case \'(?P<f_id>.*?)\' :$\s+url = \'(?P<path>.*?)\'', webpage, r'case \'(?P<f_id>.*?)\' :$\s+url = \'(?P<path>.*?)\'', webpage,