40 lines
1.0 KiB
Python
Executable File
40 lines
1.0 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
from lib import *
|
|
import sys
|
|
import os
|
|
import argparse
|
|
|
|
|
|
def parse_args():
|
|
parser = argparse.ArgumentParser(
|
|
description='Download clips from a course',
|
|
)
|
|
|
|
parser.add_argument('courseId', type=str, help='Course ID')
|
|
parser.add_argument('--outDir', type=str,
|
|
help='Output directory', default='./out')
|
|
parser.add_argument('--starterUrl', type=str,
|
|
help='Starter URL', default="https://www.fau.tv/auth/sso")
|
|
parser.add_argument('--startAt', type=int,
|
|
help='Skip all previous indizes (starts at 1)', default=1)
|
|
|
|
return parser.parse_args()
|
|
|
|
|
|
def main():
|
|
args = parse_args()
|
|
|
|
load_token(args.starterUrl)
|
|
|
|
os.makedirs(args.outDir, exist_ok=True)
|
|
|
|
for index, clip_id in enumerate(get_course_clip_ids(args.courseId)):
|
|
if index < args.startAt - 1:
|
|
continue
|
|
|
|
download_clip(clip_id, f'{args.outDir}/{index+1: 04d}_{clip_id}.mp4')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|