1
我有一個頻道ID,我有一個視頻ID。如何通過API發佈對該頻道視頻的評論。我有以下片段:通過api使用Python發佈對Youtube頻道視頻的評論
url = 'https://gdata.youtube.com/feeds/api/videos/'+str(entity)+'/comments'
values = { 'Content-Type': 'application/atom+xml','Content-Length' :len(str(message)),'Authorization': str(access_token),'GData-Version' : 2 , 'X-GData-Key': 'AIzaSyApCAE4SbaCtSOAKayxMS6qFNNWbtzhhSo'}
data = urllib.urlencode(values)
req = urllib2.Request(url, data,method='POST')
req.add_header('Accept', 'application/json')
response = urllib2.urlopen(req)
result = response.read()
print (result)
它給出了以下錯誤。
HTTP 415 Error: Unsupported Media Type
我一直在這裏呆了幾天。請幫助我。 我也讀了下面的線程。我提供了下面的鏈接。
https://developers.google.com/youtube/2.0/developers_guide_protocol_comments#Retrieve_comments, https://developers.google.com/youtube/articles/changes_to_comments#create-comments
在此先感謝。