Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is what finally worked for me to get JSON-C feed with tags (keywords):</p> <pre><code> /** AUTHENITICATION **/ // HTTP connection URL url = new URL("https://www.google.com/accounts/ClientLogin"); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestMethod("POST"); urlConnection.setDoInput(true); urlConnection.setDoOutput(true); urlConnection.setUseCaches(false); urlConnection.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); // Form the POST parameters StringBuilder content = new StringBuilder(); content.append("Email=").append(URLEncoder.encode("MY-GMAIL-LOGIN", "UTF-8")); content.append("&amp;Passwd=").append(URLEncoder.encode("MY-GMAIL-PASSWORD", "UTF-8")); content.append("&amp;service=").append(URLEncoder.encode("youtube", "UTF-8")); OutputStream outputStream = urlConnection.getOutputStream(); outputStream.write(content.toString().getBytes("UTF-8")); outputStream.close(); // Check response status int responseCode = urlConnection.getResponseCode(); if( responseCode != HttpURLConnection.HTTP_OK ) { // EXCEPTION } // Get the token from the response String token; InputStream inputStream = urlConnection.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(inputStream)); String line = null; while((line = in.readLine()) != null) { if ( line.indexOf("Auth=") &gt; -1 ) { token = line.split("=")[1]; } } /** JSON-C FEED WITH TAGS **/ HttpClient client = new HttpClient(); GetMethod method = new GetMethod("http://gdata.youtube.com/feeds/api/users/default/uploads?v=2&amp;alt=jsonc&amp;max-results=50&amp;start-index=1"); // set the authentication headers method.setRequestHeader("Authorization", "GoogleLogin auth=" + token); method.setRequestHeader("X-GData-Key", "key=MY-DEV-KEY"); method.setRequestHeader("GData-Version", "2"); method.setRequestHeader("Content-Type", "application/json; charset=UTF-8"); // Make the call int statusCode = client.executeMethod(method); if ( statusCode != HttpStatus.SC_OK ) { // EXCEPTION } String JSON = method.getResponseBodyAsString(); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload