mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
Add support for downloading audio only
This commit is contained in:
parent
fbc227017d
commit
2fddb0c6a4
@ -147,6 +147,12 @@ Setting quality to `source` will download the best available quality:
|
||||
twitch-dl download -q source 221837124
|
||||
```
|
||||
|
||||
Setting quality to `audio_only` will download only audio:
|
||||
|
||||
```
|
||||
twitch-dl download -q audio_only 221837124
|
||||
```
|
||||
|
||||
### Overriding file name
|
||||
|
||||
The target filename can be defined by passing the `--output` option followed by
|
||||
|
@ -1,3 +1,8 @@
|
||||
1.19.0:
|
||||
date: TBA
|
||||
changes:
|
||||
- "Add support for downloading audio only (#10)"
|
||||
|
||||
1.18.1:
|
||||
date: 2022-02-05
|
||||
changes:
|
||||
|
@ -18,10 +18,15 @@ from twitchdl.output import print_out
|
||||
def _parse_playlists(playlists_m3u8):
|
||||
playlists = m3u8.loads(playlists_m3u8)
|
||||
|
||||
for p in playlists.playlists:
|
||||
name = p.media[0].name if p.media else ""
|
||||
resolution = "x".join(str(r) for r in p.stream_info.resolution)
|
||||
yield name, resolution, p.uri
|
||||
for p in sorted(playlists.playlists, key=lambda p: p.stream_info.resolution is None):
|
||||
if p.stream_info.resolution:
|
||||
name = p.media[0].name
|
||||
description = "x".join(str(r) for r in p.stream_info.resolution)
|
||||
else:
|
||||
name = p.media[0].group_id
|
||||
description = None
|
||||
|
||||
yield name, description, p.uri
|
||||
|
||||
|
||||
def _get_playlist_by_name(playlists, quality):
|
||||
@ -41,7 +46,10 @@ def _get_playlist_by_name(playlists, quality):
|
||||
def _select_playlist_interactive(playlists):
|
||||
print_out("\nAvailable qualities:")
|
||||
for n, (name, resolution, uri) in enumerate(playlists):
|
||||
if resolution:
|
||||
print_out("{}) {} [{}]".format(n + 1, name, resolution))
|
||||
else:
|
||||
print_out("{}) {}".format(n + 1, name))
|
||||
|
||||
no = utils.read_int("Choose quality", min=1, max=len(playlists) + 1, default=1)
|
||||
_, _, uri = playlists[no - 1]
|
||||
|
@ -309,6 +309,7 @@ def get_playlists(video_id, access_token):
|
||||
response = requests.get(url, params={
|
||||
"nauth": access_token['value'],
|
||||
"nauthsig": access_token['signature'],
|
||||
"allow_audio_only": "true",
|
||||
"allow_source": "true",
|
||||
"player": "twitchweb",
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user