diff options
author | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2013-07-12 00:00:21 +0200 |
---|---|---|
committer | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2013-07-12 00:03:59 +0200 |
commit | 2ef648d3d3c55c2882dd114ddc95edf17fa062bf (patch) | |
tree | f1790ec050e5805a5e02ad2191ab28fba8b46168 /youtube_dl/extractor | |
parent | 33f6830fd5a252f3a7524c07d4edf9339d28df81 (diff) |
Add IGNIE
Only for www.ign.com, it doesn't support country specific versions (like es.ign.com)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/__init__.py | 1 | ||||
-rw-r--r-- | youtube_dl/extractor/ign.py | 45 |
2 files changed, 46 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 1c28cdbc9..491c5368f 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -27,6 +27,7 @@ from .googlesearch import GoogleSearchIE from .hotnewhiphop import HotNewHipHopIE from .howcast import HowcastIE from .hypem import HypemIE +from .ign import IGNIE from .ina import InaIE from .infoq import InfoQIE from .instagram import InstagramIE diff --git a/youtube_dl/extractor/ign.py b/youtube_dl/extractor/ign.py new file mode 100644 index 000000000..b3a850d74 --- /dev/null +++ b/youtube_dl/extractor/ign.py @@ -0,0 +1,45 @@ +import re +import json + +from .common import InfoExtractor +from ..utils import ( + determine_ext, +) + +class IGNIE(InfoExtractor): + _VALID_URL = r'http://www.ign.com/videos/.+/(?P<name>.+)' + IE_NAME = u'ign.com' + + _TEST = { + u'url': u'http://www.ign.com/videos/2013/06/05/the-last-of-us-review', + u'file': u'8f862beef863986b2785559b9e1aa599.mp4', + u'md5': u'eac8bdc1890980122c3b66f14bdd02e9', + u'info_dict': { + u'title': u'The Last of Us Review', + u'description': u'md5:c8946d4260a4d43a00d5ae8ed998870c', + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + name = mobj.group('name') + config_url = url + '.config' + webpage = self._download_webpage(url, name) + config = json.loads(self._download_webpage(config_url, name, u'Downloading video info')) + + self.report_extraction(name) + description = self._html_search_regex(r'<span class="page-object-description">(.+?)</span>', + webpage, 'video description', flags=re.DOTALL) + media = config['playlist']['media'] + video_url = media['url'] + + return {'id': media['metadata']['videoId'], + 'url': video_url, + 'ext': determine_ext(video_url), + 'title': media['metadata']['title'], + 'description': description, + 'thumbnail': media['poster'][0]['url'].replace('{size}', 'small'), + } + + + |