]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/giantbomb.py
29b684d35875031c0b5a256e0f12cf0695b90353
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class GiantBombIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?giantbomb\.com/videos/(?P<display_id>[^/]+)/(?P<id>\d+-\d+)'
17 'url': 'http://www.giantbomb.com/videos/quick-look-destiny-the-dark-below/2300-9782/',
18 'md5': '57badeface303ecf6b98b812de1b9018',
21 'display_id': 'quick-look-destiny-the-dark-below',
23 'title': 'Quick Look: Destiny: The Dark Below',
24 'description': 'md5:0aa3aaf2772a41b91d44c63f30dfad24',
26 'thumbnail': r
're:^https?://.*\.jpg$',
30 def _real_extract(self
, url
):
31 mobj
= re
.match(self
._VALID
_URL
, url
)
32 video_id
= mobj
.group('id')
33 display_id
= mobj
.group('display_id')
35 webpage
= self
._download
_webpage
(url
, display_id
)
37 title
= self
._og
_search
_title
(webpage
)
38 description
= self
._og
_search
_description
(webpage
)
39 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
41 video
= json
.loads(unescapeHTML(self
._search
_regex
(
42 r
'data-video="([^"]+)"', webpage
, 'data-video')))
44 duration
= int_or_none(video
.get('lengthSeconds'))
47 'f4m_low', 'progressive_low', 'f4m_high',
48 'progressive_high', 'f4m_hd', 'progressive_hd'])
51 for format_id
, video_url
in video
['videoStreams'].items():
52 if format_id
== 'f4m_stream':
54 if video_url
.endswith('.f4m'):
55 f4m_formats
= self
._extract
_f
4m
_formats
(video_url
+ '?hdcore=3.3.1', display_id
)
57 f4m_formats
[0]['quality'] = quality(format_id
)
58 formats
.extend(f4m_formats
)
62 'format_id': format_id
,
63 'quality': quality(format_id
),
67 youtube_id
= video
.get('youtubeID')
69 return self
.url_result(youtube_id
, 'Youtube')
71 self
._sort
_formats
(formats
)
75 'display_id': display_id
,
77 'description': description
,
78 'thumbnail': thumbnail
,