import json, bunny, os
from concurrent.futures import ThreadPoolExecutor

medias = json.load(open('missing_videos.json', 'r'))
#videoIDS = [media['url'].split('/')[-1] for media in medias]
videoIDS = [media['guid'] for media in medias]

with ThreadPoolExecutor(max_workers=10) as executor:
    for id in videoIDS:
        filePath = f"MISSING_STREAM_VIDEOS/{id}.zip"
        
        if os.path.exists(filePath):
            print(f'Video already exists as {filePath}. Skipping...')
            continue

        executor.submit(bunny.download_video, id)