How can I insert multiple language caption files into YouTube videos using batch processing mode

86 Views Asked by At
batch = BatchHttpRequest()
    requests = []
    for language, caption in caption_files.items():
        request = youtube.captions().insert(
            part='snippet',
            body={
                'snippet': {
                    'videoId': video_id,
                    'language': caption.get("code"),
                    'name': language,
                    'isDraft': False
                }
            },
            media_body=caption.get("path")
        )
        batch.add(request, callback=insert_caption, request_id=video_id)

    batch.execute()

I tried with batch = youtube.new_batch_http_request() also. Both are not working. I am getting errors.

Can anyone help me resolve these issues? Are there classes and functions available in Google's Python modules related to batch processing that support inserting/updating captions for YouTube videos?

0

There are 0 best solutions below