Reputation: 45
I am currently creating an application in python which involves the use of the Youtube Data API (v3). However, I have been receiving an error regarding the category ID. This is the code:
import os
from subprocess import run
os.chdir(os.path.dirname(__file__))
video_name = "video1010.mp4"
title = "This is a test"
vid_des = "This is a test"
keywords = "this, is, a, test"
category = "42"
command = f'python3 uploadYoutube.py --file="{video_name}" --title="{title}" --description="{vid_des}" --keywords="{keywords}" --category="{category}" --privacyStatus="public"'
terminal_output = run(command, capture_output=True).stdout
print(terminal_output)
The output I get is (shortened):
An HTTP error 400 occurred:\r\nb\'{\\n "error": {\\n "code": 400,\\n "message"
: "The \\\\u003ccode\\\\u003esnippet.categoryId\\\\u003c/code\\\\u003e property specif
ies an invalid category ID.
I have used Curl to obtain the category IDs for this API, and 42 appears to be valid:
{
"kind": "youtube#videoCategory",
"etag": "TxVSfGoUyT7CJ7h7ebjg4vhIt6g",
"id": "42",
"snippet": {
"title": "Shorts",
"assignable": false,
"channelId": "UCBR8-60-B28hp2BmDPdntcQ"
}
},
Is this caused by the "assignable":false line, or is it something else?
Upvotes: 0
Views: 17