]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/giantbomb.py
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
15 class GiantBombIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:www\.)?giantbomb\.com/(?:videos|shows)/(?P<display_id>[^/]+)/(?P<id>\d+-\d+)'
18 'url': 'http://www.giantbomb.com/videos/quick-look-destiny-the-dark-below/2300-9782/',
19 'md5': '132f5a803e7e0ab0e274d84bda1e77ae',
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$',
30 'url': 'https://www.giantbomb.com/shows/ben-stranding/2970-20212',
31 'only_matching': True,
34 def _real_extract(self
, url
):
35 mobj
= re
.match(self
._VALID
_URL
, url
)
36 video_id
= mobj
.group('id')
37 display_id
= mobj
.group('display_id')
39 webpage
= self
._download
_webpage
(url
, display_id
)
41 title
= self
._og
_search
_title
(webpage
)
42 description
= self
._og
_search
_description
(webpage
)
43 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
45 video
= json
.loads(unescapeHTML(self
._search
_regex
(
46 r
'data-video="([^"]+)"', webpage
, 'data-video')))
48 duration
= int_or_none(video
.get('lengthSeconds'))
51 'f4m_low', 'progressive_low', 'f4m_high',
52 'progressive_high', 'f4m_hd', 'progressive_hd'])
55 for format_id
, video_url
in video
['videoStreams'].items():
56 if format_id
== 'f4m_stream':
58 ext
= determine_ext(video_url
)
60 f4m_formats
= self
._extract
_f
4m
_formats
(video_url
+ '?hdcore=3.3.1', display_id
)
62 f4m_formats
[0]['quality'] = quality(format_id
)
63 formats
.extend(f4m_formats
)
65 formats
.extend(self
._extract
_m
3u8_formats
(
66 video_url
, display_id
, ext
='mp4', entry_protocol
='m3u8_native',
67 m3u8_id
='hls', fatal
=False))
71 'format_id': format_id
,
72 'quality': quality(format_id
),
76 youtube_id
= video
.get('youtubeID')
78 return self
.url_result(youtube_id
, 'Youtube')
80 self
._sort
_formats
(formats
)
84 'display_id': display_id
,
86 'description': description
,
87 'thumbnail': thumbnail
,