Is there a way I could specify the token path? Because in this script I use there is nothing that specifies token pickle location. It is just being saved in the root directory.
The idea is to store multiple tokens for different channels, ie
my_tokens/channel1/token_youtube_v3.pickle
my_tokens/channel2/token_youtube_v3.pickle
etc etc :)
def upload(video_data): CLIENT_SECRET_FILE = os.path.abspath(root_dir() + f"/youtube_upload/files/{video_data['channel']}/client_secret.json") API_NAME = 'youtube' API_VERSION = 'v3' SCOPES = ['https://www.googleapis.com/auth/youtube.upload'] categories = {"Sports": 17, "Comedy": 23, "Entertainment": 24, "Animals": 15, "Pets & Animals": 15} socket.setdefaulttimeout(30000) service = Create_Service(CLIENT_SECRET_FILE, API_NAME, API_VERSION, SCOPES) upload_date_time = datetime.datetime.now().isoformat() +'.000Z' video_file = os.path.abspath(root_dir() +'/footage/'+ friendlify(video_data['title']) +'/composition.mp4') thumbnail = os.path.abspath(root_dir() +'/footage/'+ friendlify(video_data['title']) +'/thumbnail.jpg') category_id = categories[video_data['category']] request_body = {'snippet': {'categoryId': category_id,'title': video_data['title'],'description': video_data['description'],'tags': video_data['tags'] },'status': {'privacyStatus': 'public', # 'publishAt': upload_date_time,'selfDeclaredMadeForKids': False, },'notifySubscribers': True } print(os.getcwd()) mediaFile = MediaFileUpload(video_file) response_upload = service.videos().insert( part='snippet,status', body=request_body, media_body=mediaFile ).execute() service.thumbnails().set( videoId=response_upload.get('id'), media_body=MediaFileUpload(thumbnail)).execute()