]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/giantbomb.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
14 class GiantBombIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?giantbomb\.com/(?:videos|shows)/(?P<display_id>[^/]+)/(?P<id>\d+-\d+)'
17 'url': 'http://www.giantbomb.com/videos/quick-look-destiny-the-dark-below/2300-9782/',
18 'md5': '132f5a803e7e0ab0e274d84bda1e77ae',
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$',
29 'url': 'https://www.giantbomb.com/shows/ben-stranding/2970-20212',
30 'only_matching': True,
33 def _real_extract(self
, url
):
34 mobj
= self
._match
_valid
_url
(url
)
35 video_id
= mobj
.group('id')
36 display_id
= mobj
.group('display_id')
38 webpage
= self
._download
_webpage
(url
, display_id
)
40 title
= self
._og
_search
_title
(webpage
)
41 description
= self
._og
_search
_description
(webpage
)
42 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
44 video
= json
.loads(unescapeHTML(self
._search
_regex
(
45 r
'data-video="([^"]+)"', webpage
, 'data-video')))
47 duration
= int_or_none(video
.get('lengthSeconds'))
50 'f4m_low', 'progressive_low', 'f4m_high',
51 'progressive_high', 'f4m_hd', 'progressive_hd'])
54 for format_id
, video_url
in video
['videoStreams'].items():
55 if format_id
== 'f4m_stream':
57 ext
= determine_ext(video_url
)
59 f4m_formats
= self
._extract
_f
4m
_formats
(video_url
+ '?hdcore=3.3.1', display_id
)
61 f4m_formats
[0]['quality'] = quality(format_id
)
62 formats
.extend(f4m_formats
)
64 formats
.extend(self
._extract
_m
3u8_formats
(
65 video_url
, display_id
, ext
='mp4', entry_protocol
='m3u8_native',
66 m3u8_id
='hls', fatal
=False))
70 'format_id': format_id
,
71 'quality': quality(format_id
),
75 youtube_id
= video
.get('youtubeID')
77 return self
.url_result(youtube_id
, 'Youtube')
79 self
._sort
_formats
(formats
)
83 'display_id': display_id
,
85 'description': description
,
86 'thumbnail': thumbnail
,