diff options
| author | M.Yasoob Khalid <yasoob.khld@gmail.com> | 2013-06-28 10:34:01 +0500 | 
|---|---|---|
| committer | Philipp Hagemeister <phihag@phihag.de> | 2013-06-28 18:42:45 +0200 | 
| commit | bf64ff72db6445bda477109ebcbd27f467c529a4 (patch) | |
| tree | 3c60feb6e682aba1131b11652f700b02f1cc91d1 | |
| parent | bc2884afc11fc5c7c64ba741d38ae88c735b66a1 (diff) | |
Added an IE for gamespot. Although gamespot allows downloading but it is only available to registered users. With this IE no registration is required.
| -rw-r--r-- | youtube_dl/extractor/__init__.py | 1 | ||||
| -rw-r--r-- | youtube_dl/extractor/gamespot.py | 45 | 
2 files changed, 46 insertions, 0 deletions
| diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 20dec216c..9fc5a7315 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -15,6 +15,7 @@ from .escapist import EscapistIE  from .facebook import FacebookIE  from .flickr import FlickrIE  from .funnyordie import FunnyOrDieIE +from .gamespot import GameSpotIE  from .gametrailers import GametrailersIE  from .generic import GenericIE  from .googleplus import GooglePlusIE diff --git a/youtube_dl/extractor/gamespot.py b/youtube_dl/extractor/gamespot.py new file mode 100644 index 000000000..cec3b7ac8 --- /dev/null +++ b/youtube_dl/extractor/gamespot.py @@ -0,0 +1,45 @@ +import re +import xml.etree.ElementTree + +from .common import InfoExtractor +from ..utils import ( +    unified_strdate, +) + +class GameSpotIE(InfoExtractor): +    _VALID_URL = r'(?:http://)?(?:www\.)?gamespot\.com/([^/]+)/videos/([^/]+)-([^/d]+)/' +    _TEST = { +        u"url": u"http://www.gamespot.com/arma-iii/videos/arma-iii-community-guide-sitrep-i-6410818/", +        u"file": u"6410818.mp4", +        u"md5": u"5569d64ca98db01f0177c934fe8c1e9b", +        u"info_dict": { +            u"title": u"Arma III - Community Guide: SITREP I", +            u"upload_date": u"20130627",  +        } +    } + + +    def _real_extract(self, url): +        mobj = re.match(self._VALID_URL, url) +        video_id = mobj.group(3).split("-")[-1] +        info_url = "http://www.gamespot.com/pages/video_player/xml.php?id="+str(video_id) +        info_xml = self._download_webpage(info_url, video_id) +        doc = xml.etree.ElementTree.fromstring(info_xml) +        clip_el = doc.find('./playList/clip') + +        video_url = clip_el.find('./URI').text +        title = clip_el.find('./title').text +        ext = video_url.rpartition('.')[2] +        thumbnail_url = clip_el.find('./screenGrabURI').text +        view_count = int(clip_el.find('./views').text) +        upload_date = unified_strdate(clip_el.find('./postDate').text) + +        return [{ +            'id'          : video_id, +            'url'         : video_url, +            'ext'         : ext, +            'title'       : title, +            'thumbnail'   : thumbnail_url, +            'upload_date' : upload_date, +            'view_count'  : view_count, +        }] | 
