aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/hitbox.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-04-22 21:01:25 +0600
committerSergey M․ <dstftw@gmail.com>2015-04-22 21:01:25 +0600
commitbc94bd510bfb8a98f7456912f930c69c21bd6e15 (patch)
tree2a17e04ad7ee30ae3c735798456d317d4e13255a /youtube_dl/extractor/hitbox.py
parent9dd8e46a2d0860421b4bb4f616f05e5ebd686380 (diff)
downloadyoutube-dl-bc94bd510bfb8a98f7456912f930c69c21bd6e15.tar.xz
[hitbox] Extract all formats (Closes #5494)
Diffstat (limited to 'youtube_dl/extractor/hitbox.py')
-rw-r--r--youtube_dl/extractor/hitbox.py32
1 files changed, 26 insertions, 6 deletions
diff --git a/youtube_dl/extractor/hitbox.py b/youtube_dl/extractor/hitbox.py
index d606429ca..d7cd8bb7e 100644
--- a/youtube_dl/extractor/hitbox.py
+++ b/youtube_dl/extractor/hitbox.py
@@ -96,13 +96,33 @@ class HitboxIE(InfoExtractor):
'https://www.hitbox.tv/api/player/config/video/%s' % video_id,
video_id)
- clip = player_config.get('clip')
- video_url = clip.get('url')
- res = clip.get('bitrates', [])[0].get('label')
+ formats = []
+ for video in player_config['clip']['bitrates']:
+ label = video.get('label')
+ if label == 'Auto':
+ continue
+ video_url = video.get('url')
+ if not video_url:
+ continue
+ bitrate = int_or_none(video.get('bitrate'))
+ if determine_ext(video_url) == 'm3u8':
+ if not video_url.startswith('http'):
+ continue
+ formats.append({
+ 'url': video_url,
+ 'ext': 'mp4',
+ 'tbr': bitrate,
+ 'format_note': label,
+ 'protocol': 'm3u8_native',
+ })
+ else:
+ formats.append({
+ 'url': video_url,
+ 'tbr': bitrate,
+ 'format_note': label,
+ })
- metadata['resolution'] = res
- metadata['url'] = video_url
- metadata['protocol'] = 'm3u8'
+ metadata['formats'] = formats
return metadata