mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
parent
c628757ac0
commit
e3dde90870
@ -16,14 +16,14 @@ from twitchdl.exceptions import ConsoleError
|
|||||||
from twitchdl.output import print_out, print_video
|
from twitchdl.output import print_out, print_video
|
||||||
|
|
||||||
|
|
||||||
def videos(channel_name, limit, offset, sort, **kwargs):
|
def videos(channel_name, limit, offset, sort, type, **kwargs):
|
||||||
print_out("Looking up user...")
|
print_out("Looking up user...")
|
||||||
user = twitch.get_user(channel_name)
|
user = twitch.get_user(channel_name)
|
||||||
if not user:
|
if not user:
|
||||||
raise ConsoleError("User {} not found.".format(channel_name))
|
raise ConsoleError("User {} not found.".format(channel_name))
|
||||||
|
|
||||||
print_out("Loading videos...")
|
print_out("Loading videos...")
|
||||||
videos = twitch.get_channel_videos(user["id"], limit, offset, sort)
|
videos = twitch.get_channel_videos(user["id"], limit, offset, sort, type)
|
||||||
count = len(videos['videos'])
|
count = len(videos['videos'])
|
||||||
if not count:
|
if not count:
|
||||||
print_out("No videos found")
|
print_out("No videos found")
|
||||||
|
@ -57,6 +57,12 @@ COMMANDS = [
|
|||||||
"choices": ["views", "time"],
|
"choices": ["views", "time"],
|
||||||
"default": "time",
|
"default": "time",
|
||||||
}),
|
}),
|
||||||
|
(["-t", "--type"], {
|
||||||
|
"help": "Broadcast type. (default: archive)",
|
||||||
|
"type": str,
|
||||||
|
"choices": ["archive", "highlight", "upload"],
|
||||||
|
"default": "archive",
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Command(
|
Command(
|
||||||
|
@ -93,14 +93,14 @@ def get_clip(slug):
|
|||||||
return data["data"]["clip"]
|
return data["data"]["clip"]
|
||||||
|
|
||||||
|
|
||||||
def get_channel_videos(channel_id, limit, offset, sort):
|
def get_channel_videos(channel_id, limit, offset, sort, type="archive"):
|
||||||
"""
|
"""
|
||||||
https://dev.twitch.tv/docs/v5/reference/channels#get-channel-videos
|
https://dev.twitch.tv/docs/v5/reference/channels#get-channel-videos
|
||||||
"""
|
"""
|
||||||
url = "https://api.twitch.tv/kraken/channels/{}/videos".format(channel_id)
|
url = "https://api.twitch.tv/kraken/channels/{}/videos".format(channel_id)
|
||||||
|
|
||||||
return kraken_get(url, {
|
return kraken_get(url, {
|
||||||
"broadcast_type": "archive",
|
"broadcast_type": type,
|
||||||
"limit": limit,
|
"limit": limit,
|
||||||
"offset": offset,
|
"offset": offset,
|
||||||
"sort": sort,
|
"sort": sort,
|
||||||
|
Loading…
Reference in New Issue
Block a user