forked from ruangrupa/konfluks
video: paginate results
This commit is contained in:
parent
539d3fa6d0
commit
ab1f8d9d7a
@ -100,11 +100,26 @@ def update_post(post_directory, video_metadata, host):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
v = peertube.VideoApi(client)
|
v = peertube.VideoApi(client)
|
||||||
|
count = 100
|
||||||
response = v.videos_get(count=100, filter="local", tags_one_of="publish")
|
page = 0
|
||||||
|
response = v.videos_get(count=count, filter="local", tags_one_of="publish", start=page)
|
||||||
|
|
||||||
videos = response.to_dict()
|
videos = response.to_dict()
|
||||||
videos = videos["data"]
|
total = videos['total']
|
||||||
|
videos = videos['data']
|
||||||
|
total -= count
|
||||||
|
if total > 0:
|
||||||
|
to_download = total // count
|
||||||
|
last_page = total % count
|
||||||
|
for i in range(to_download):
|
||||||
|
page += 1
|
||||||
|
response = v.videos_get(count=count, filter="local", tags_one_of="publish", start=page)
|
||||||
|
videos += response.to_dict()['data']
|
||||||
|
if last_page > 0:
|
||||||
|
page += 1
|
||||||
|
response = v.videos_get(count=count, filter="local", tags_one_of="publish", start=page)
|
||||||
|
videos += response.to_dict()['data'][-1*last_page:]
|
||||||
|
|
||||||
|
|
||||||
output_dir = os.environ.get("OUTPUT_DIR")
|
output_dir = os.environ.get("OUTPUT_DIR")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user