import vimeo import pandas as pd from dotenv import load_dotenv import os load_dotenv() v = vimeo.VimeoClient( token=os.environ.get("VIMEO_TOKEN"), key=os.environ.get("VIMEO_KEY"), secret=os.environ.get("VIMEO_SECRET") ) user_id = 'pedrombr' # Replace with the actual user ID endpoint = f'/users/{user_id}/videos' # Make the GET request response1 = v.get(f'{endpoint}?per_page=100').json() response2 = v.get(f'{endpoint}?per_page=100&page=2').json() response = response1 response['data'].extend(response2['data']) gem_videos = [ ("_".join(v['name'].split("_")[1:]), v['uri'].split("/")[-1]) for v in response['data'] if v['name'].startswith('GEM') ] vista_videos = [ ("_".join(v['name'].split("_")[1:]), v['uri'].split("/")[-1]) for v in response['data'] if v['name'].startswith('Vista') ] assert len(gem_videos) == len(vista_videos) and len(gem_videos) == 99 # Match files by title and create a csv data = [] for vista_file in vista_videos: for gem_file in gem_videos: if vista_file[0] == gem_file[0]: data.append((vista_file[0], vista_file[1], gem_file[1])) # sort by file_name data.sort(key=lambda x: x[0]) df = pd.DataFrame(data, columns=['file_name', 'vista_id', 'gem_id']) df.to_csv('file_pairs.csv', index=False)