]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/giantbomb.py
6a1b1e96ebf4dc59f7f5e13dc18e3ee08ef1110c
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
15 class GiantBombIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:www\.)?giantbomb\.com/videos/(?P<display_id>[^/]+)/(?P<id>\d+-\d+)'
18 'url': 'http://www.giantbomb.com/videos/quick-look-destiny-the-dark-below/2300-9782/',
19 'md5': 'c8ea694254a59246a42831155dec57ac',
22 'display_id': 'quick-look-destiny-the-dark-below',
24 'title': 'Quick Look: Destiny: The Dark Below',
25 'description': 'md5:0aa3aaf2772a41b91d44c63f30dfad24',
27 'thumbnail': r
're:^https?://.*\.jpg$',
31 def _real_extract(self
, url
):
32 mobj
= re
.match(self
._VALID
_URL
, url
)
33 video_id
= mobj
.group('id')
34 display_id
= mobj
.group('display_id')
36 webpage
= self
._download
_webpage
(url
, display_id
)
38 title
= self
._og
_search
_title
(webpage
)
39 description
= self
._og
_search
_description
(webpage
)
40 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
42 video
= json
.loads(unescapeHTML(self
._search
_regex
(
43 r
'data-video="([^"]+)"', webpage
, 'data-video')))
45 duration
= int_or_none(video
.get('lengthSeconds'))
48 'f4m_low', 'progressive_low', 'f4m_high',
49 'progressive_high', 'f4m_hd', 'progressive_hd'])
52 for format_id
, video_url
in video
['videoStreams'].items():
53 if format_id
== 'f4m_stream':
55 ext
= determine_ext(video_url
)
57 f4m_formats
= self
._extract
_f
4m
_formats
(video_url
+ '?hdcore=3.3.1', display_id
)
59 f4m_formats
[0]['quality'] = quality(format_id
)
60 formats
.extend(f4m_formats
)
62 formats
.extend(self
._extract
_m
3u8_formats
(
63 video_url
, display_id
, ext
='mp4', entry_protocol
='m3u8_native',
64 m3u8_id
='hls', fatal
=False))
68 'format_id': format_id
,
69 'quality': quality(format_id
),
73 youtube_id
= video
.get('youtubeID')
75 return self
.url_result(youtube_id
, 'Youtube')
77 self
._sort
_formats
(formats
)
81 'display_id': display_id
,
83 'description': description
,
84 'thumbnail': thumbnail
,