]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ign.py
4 from .common
import InfoExtractor
10 class IGNIE(InfoExtractor
):
12 Extractor for some of the IGN sites, like www.ign.com, es.ign.com de.ign.com.
13 Some videos of it.ign.com are also supported
16 _VALID_URL
= r
'https?://.+?\.ign\.com/(?:videos|show_videos)(/.+)?/(?P<name_or_id>.+)'
19 _CONFIG_URL_TEMPLATE
= 'http://www.ign.com/videos/configs/id/%s.config'
20 _DESCRIPTION_RE
= [r
'<span class="page-object-description">(.+?)</span>',
21 r
'id="my_show_video">.*?<p>(.*?)</p>',
25 u
'url': u
'http://www.ign.com/videos/2013/06/05/the-last-of-us-review',
26 u
'file': u
'8f862beef863986b2785559b9e1aa599.mp4',
27 u
'md5': u
'eac8bdc1890980122c3b66f14bdd02e9',
29 u
'title': u
'The Last of Us Review',
30 u
'description': u
'md5:c8946d4260a4d43a00d5ae8ed998870c',
34 def _find_video_id(self
, webpage
):
35 res_id
= [r
'data-video-id="(.+?)"',
36 r
'<object id="vid_(.+?)"',
37 r
'<meta name="og:image" content=".*/(.+?)-(.+?)/.+.jpg"',
39 return self
._search
_regex
(res_id
, webpage
, 'video id')
41 def _real_extract(self
, url
):
42 mobj
= re
.match(self
._VALID
_URL
, url
)
43 name_or_id
= mobj
.group('name_or_id')
44 webpage
= self
._download
_webpage
(url
, name_or_id
)
45 video_id
= self
._find
_video
_id
(webpage
)
46 result
= self
._get
_video
_info
(video_id
)
47 description
= self
._html
_search
_regex
(self
._DESCRIPTION
_RE
,
48 webpage
, 'video description',
50 result
['description'] = description
53 def _get_video_info(self
, video_id
):
54 config_url
= self
._CONFIG
_URL
_TEMPLATE
% video_id
55 config
= json
.loads(self
._download
_webpage
(config_url
, video_id
,
56 u
'Downloading video info'))
57 media
= config
['playlist']['media']
58 video_url
= media
['url']
60 return {'id': media
['metadata']['videoId'],
62 'ext': determine_ext(video_url
),
63 'title': media
['metadata']['title'],
64 'thumbnail': media
['poster'][0]['url'].replace('{size}', 'grande'),
69 """Extractor for 1up.com, it uses the ign videos system."""
71 _VALID_URL
= r
'https?://gamevideos.1up.com/video/id/(?P<name_or_id>.+)'
74 _DESCRIPTION_RE
= r
'<div id="vid_summary">(.+?)</div>'
77 u
'url': u
'http://gamevideos.1up.com/video/id/34976',
78 u
'file': u
'34976.mp4',
79 u
'md5': u
'68a54ce4ebc772e4b71e3123d413163d',
81 u
'title': u
'Sniper Elite V2 - Trailer',
82 u
'description': u
'md5:5d289b722f5a6d940ca3136e9dae89cf',
86 def _real_extract(self
, url
):
87 mobj
= re
.match(self
._VALID
_URL
, url
)
88 id = mobj
.group('name_or_id')
89 result
= super(OneUPIE
, self
)._real
_extract
(url
)