Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Youtube Data API Invalid Category ID

$
0
0

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 osfrom subprocess import runos.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).stdoutprint(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 specifies 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?


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>