Skip to content

Question about get_clips #70

Description

@wolfgangam31

Hello,

I'm pretty sure I'm doing something wrong, but I didn't find examples, so maybe it really doesn't work.
this is the request I'm doing for get_clips:

clip_settings = {
"broadcaster_id": None,
"game_id": 509658,
"clip_ids": None,
"after": None,
"before": None,
"started_at": (datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(days=7)).isoformat(),
"ended_at": None,
"page_size": 100
}

clips = client.get_clips(**clip_settings)

and I'm trying to write all the clips to CSV file, but it doesn't stop , it seems that when it gets to the end, it just writes the last page over and over again (so I added if i==4000)

with open('clips.csv', 'w', encoding='utf-8') as f:
writer = csv.writer(f)
for i, clip in enumerate(clips):
if i == 0:
writer.writerow([x for x in clip])
writer.writerow([clip[x] for x in clip])
if i == 4000:
break

how to I go over the results of each page and ask to continue only if there is another page?

thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions