2014-12-04 4 views
1

채널 ID가 있으며 동영상 ID가 있습니다. API를 통해 해당 채널 동영상에 대한 의견을 게시하려면 어떻게해야합니까? 다음 스 니펫이 있습니다.Python을 사용하여 API를 통해 Youtube channel video에 덧글을 작성

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

감사합니다.

답변