diff --git a/lumbunglib/video.py b/lumbunglib/video.py index 94a1908..3623381 100644 --- a/lumbunglib/video.py +++ b/lumbunglib/video.py @@ -100,11 +100,26 @@ def update_post(post_directory, video_metadata, host): def main(): v = peertube.VideoApi(client) - - response = v.videos_get(count=100, filter="local", tags_one_of="publish") + count = 100 + page = 0 + response = v.videos_get(count=count, filter="local", tags_one_of="publish", start=page) 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")