Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7797717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:46:26+00:00 2026-06-01T23:46:26+00:00

How can Retriev a youtube feed tag and convert this to a string/int in

  • 0

How can Retriev a youtube feed tag and convert this to a string/int in android.
I want to use the tag , and the attribute :totalUploadViewCount ?

https://developers.google.com/youtube/2.0/reference#Response_codes_retrieving_feeds

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:46:28+00:00Added an answer on June 1, 2026 at 11:46 pm

    This can give you a starting point.

     WebRequest response = new WebRequest("https://gdata.youtube.com/feeds/api/channelstandardfeeds/most_viewed?v=2", PostType.GET);
     String responseXML = response.Get();
     Document doc = XMLfunctions.XMLfromString(responseXML);
     NodeList nodes = doc.getElementsByTagName("yt:channelStatistics");
     String totalUploadViewCount = nodes.item(0).getAttributes().getNamedItem("totalUploadViewCount").getNodeValue(); 
     Log.d("", totalUploadViewCount);    
    

    WebRequest.class

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.net.UnknownHostException;
    import java.nio.charset.Charset;
    import org.apache.http.HttpResponse;
    import org.apache.http.client.CookieStore;
    import org.apache.http.client.HttpClient;
    import org.apache.http.client.methods.HttpGet;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.client.protocol.ClientContext;
    import org.apache.http.impl.client.BasicCookieStore;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.apache.http.protocol.BasicHttpContext;
    import org.apache.http.protocol.HttpContext;
    
    public class WebRequest {
      public enum PostType{
        GET, POST;
      }
    
      public String _url;
      public String response = "";
      public PostType _postType;
      CookieStore _cookieStore = new BasicCookieStore();
    
      public WebRequest(String url) {
        _url = url;
        _postType = PostType.POST;
      }
    
      public WebRequest(String url, CookieStore cookieStore) {
        _url = url;
        _cookieStore = cookieStore;
        _postType = PostType.POST;
      }
    
      public WebRequest(String url, PostType postType) {
        _url = url;
        _postType = postType;
      }
    
      public String Get() {
        HttpClient httpclient = new DefaultHttpClient();
    
        try {
          // Create local HTTP context
          HttpContext localContext = new BasicHttpContext();
    
          // Bind custom cookie store to the local context
          localContext.setAttribute(ClientContext.COOKIE_STORE, _cookieStore);
    
          HttpResponse httpresponse;
          if (_postType == PostType.POST)
          {
            HttpPost httppost = new HttpPost(_url);
            httpresponse = httpclient.execute(httppost, localContext);
          }
          else
          {
            HttpGet httpget = new HttpGet(_url);
            httpresponse = httpclient.execute(httpget, localContext);
          }
    
          StringBuilder responseString = inputStreamToString(httpresponse.getEntity().getContent());
    
          response = responseString.toString();
        }
        catch (UnknownHostException e) {
          e.printStackTrace();
        }
        catch (Exception e) {
          e.printStackTrace();
        }
        finally {
          // When HttpClient instance is no longer needed,
          // shut down the connection manager to ensure
          // immediate deallocation of all system resources
          httpclient.getConnectionManager().shutdown();
        }
    
        return response;
      }
    
      private StringBuilder inputStreamToString(InputStream is) throws IOException {
        String line = "";
        StringBuilder total = new StringBuilder();
    
        // Wrap a BufferedReader around the InputStream
        BufferedReader rd = new BufferedReader(new InputStreamReader(is,Charset.forName("iso-8859-9")));
        // Read response until the end
        while ((line = rd.readLine()) != null) {
          total.append(line);
        }
    
        // Return full string
        return total;
      }
    }
    

    XMLfunctions.class

    import java.io.IOException;
    import java.io.StringReader;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    
    public class XMLfunctions {
    
      public final static Document XMLfromString(String xml) {
    
        Document doc = null;
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        try {
          DocumentBuilder db = dbf.newDocumentBuilder();
          InputSource is = new InputSource();
          is.setCharacterStream(new StringReader(xml));
          doc = db.parse(is);
        }
        catch (ParserConfigurationException e) {
          System.out.println("XML parse error: " + e.getMessage());
          return null;
        }
        catch (SAXException e) {
          System.out.println("Wrong XML file structure: " + e.getMessage());
          return null;
        }
        catch (IOException e) {
          System.out.println("I/O exeption: " + e.getMessage());
          return null;
        }
    
        return doc;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can you make youtube requests without a developer key? eg i have: Uri
Two days ago I wrote this question: How can I retrieve an object on
According to the Google Youtube Java API if I want to delete a video,
I have written a helper function that can retrieve content from a url. This
So I know that I can retrieve the youtube thumbnail by going here: http://img.youtube.com/vi/BoVBdxftEF8/0.jpg
I can not retrieve data from db in sql server. I use the c3p0
How I can retrieve the IP address for a client when this client is
I'm trying to use the Youtube .Net API in F# and I've come across
I have this code on C#/.NET : string user = "Username"; string feedUrl =
I have this javascript code : function showMyVideos(data) { var feed = data.feed; var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.