Sign in to follow this  
Followers 0
m4rcin93

Help with API

2 posts in this topic

I have API code:

POST /feeds/api/videos/VIDEO_ID/complaints HTTP/1.1
Host: gdata.youtube.com
Content-Type: application/atom+xml
Content-Length: CONTENT_LENGTH
Authorization: AuthSub token="AUTHORIZATION_TOKEN"
GData-Version: 2
X-GData-Key: key=DEVELOPER_KEY

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom"
    xmlns:yt="http://gdata.youtube.com/schemas/2007">
  <summary>
 test
  </summary>
  <category scheme="http://gdata.youtube.com/schemas/2007/complaint-reasons.cat"
    term="VIOLENCE"/>
</entry>

I want convert it to autoit.

I wrote it but it doesn't work:

$YT_SITE = "gdata.youtube.com"
$YT_PATH = "/feeds/api/videos/VIDEO ID/complaints HTTP/1.1"
$HSESSION = _WINHTTPOPEN("Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17")
$HCONNECT = _WINHTTPCONNECT($HSESSION, $YT_SITE)
$HREQUEST = _WINHTTPOPENREQUEST($HCONNECT, "POST", $YT_PATH)
$GENERAL_BODY = "Authorization: GoogleLogin auth=" & $AUTHKEY & @CRLF & "GData-Version: 2" & @CRLF & "X-GData-Key: key=" & $DEVELOPER_KEY & @CRLF & "Content-Type: application/atom+xml" & @CRLF & @CRLF
$XML_BODY = '<?xml version="1.0" encoding="UTF-8"?>' & @CRLF & '<entry xmlns="http://www.w3.org/2005/Atom"' & @CRLF & 'xmlns:yt="http://gdata.youtube.com/schemas/2007">' & @CRLF & '<sumary>' & @CRLF & 'test' &@CRLF& '</sumary>' & @CRLF & '<category scheme="http://gdata.youtube.com/schemas/2007/complaint-reasons.cat" term="VIOLENCE"/>' & @CRLF & '</entry>' &@CRLF & @CRLF
_WINHTTPSENDREQUEST($HREQUEST, $GENERAL_BODY, $XML_BODY)
_WINHTTPRECEIVERESPONSE($HREQUEST)
If _WINHTTPQUERYDATAAVAILABLE($HREQUEST) Then
$SCHUNK = _WINHTTPREADDATA($HREQUEST)
$SDATA &= $SCHUNK
EndIf

Anyone can help me ?

Share this post


Link to post
Share on other sites



you already had one question related to the spam for youtube that did not end nicely

and at the moment you post code for adding a comment in response to a video

why did you post this?


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0