示例#1
0
def videos(channel_name, **kwargs):
    videos = twitch.get_channel_videos(channel_name)

    print("Found {} videos".format(videos["_total"]))

    for video in videos['videos']:
        _print_video(video)
示例#2
0
def test_get_videos():
    videos = twitch.get_channel_videos(TEST_CHANNEL, 3, "time")
    assert videos["pageInfo"]
    assert len(videos["edges"]) > 0

    video_id = videos["edges"][0]["node"]["id"]
    video = twitch.get_video(video_id)
    assert video["id"] == video_id
示例#3
0
def videos(channel_name, limit, offset, sort, **kwargs):
    user = twitch.get_user(channel_name)
    if not user:
        raise ConsoleError("Utilisateur {} non trouvé.".format(channel_name))

    videos = twitch.get_channel_videos(user["id"], limit, offset, sort)
    count = len(videos['videos'])
    if not count:
        print_out("Pas de vidéos")
        return

    first = offset + 1
    last = offset + len(videos['videos'])
    total = videos["_total"]

    for video in videos['videos']:
        print_video(video)
示例#4
0
def videos(channel_name, limit, offset, sort, **kwargs):
    print_out("Looking up user...")
    user = twitch.get_user(channel_name)
    if not user:
        raise ConsoleError("User {} not found.".format(channel_name))

    print_out("Loading videos...")
    videos = twitch.get_channel_videos(user["id"], limit, offset, sort)
    count = len(videos['videos'])
    if not count:
        print_out("No videos found")
        return

    first = offset + 1
    last = offset + len(videos['videos'])
    total = videos["_total"]
    print_out("<yellow>Showing videos {}-{} of {}</yellow>".format(
        first, last, total))

    for video in videos['videos']:
        _print_video(video)
max_download_attempts = 10
channel_name = "aurateur"

print("\nWhere Was The Bald Man? - sup3rgh0st\n")

print("Looking up the latest VOD on the channel '"+channel_name+"'...")

# Get the URL of the latest VOD...
print("Looking up user...")
user = twitch.get_user(channel_name)
if not user:
    print("User {} not found.".format(channel_name))
    exit()

print("Loading videos...")
videos = twitch.get_channel_videos(user["id"], 1, 0, "time")
count = len(videos['videos'])
if not count:
    print("No videos found")
    exit()

vod_id = videos['videos'][0]["_id"][1:]
vod_url = videos['videos'][0]["url"]

#test url
#vod_id = "532684964"
#vod_url = "https://www.twitch.tv/videos/532684964"

print("  VOD ID: " + vod_id)
print("  VOD URL: " + vod_url)