java - Retrieving Youtube Thumbnail URLs using gdata? -


ive been researching information on how data youtube. want information on videos (titles, descritions, , thumbnail urls) playlist (ex: http://gdata.youtube.com/feeds/api/playlists/6a40ab04892e2a1f). able retrieve titles using code snippet (which borrowed question):

string featuredfeed = "http://gdata.youtube.com/feeds/api/playlists/6a40ab04892e2a1f";  url = new url(featuredfeed);  urlconnection connection; connection = url.openconnection();  httpurlconnection httpconnection = (httpurlconnection) connection;  int responsecode = httpconnection.getresponsecode();  if (responsecode == httpurlconnection.http_ok) {     inputstream in = httpconnection.getinputstream();      documentbuilderfactory dbf = documentbuilderfactory.newinstance();     dbf.setnamespaceaware(true);     documentbuilder db = dbf.newdocumentbuilder();      document dom = db.parse(in);     element docele = dom.getdocumentelement();      nodelist nl = docele.getelementsbytagname("entry");     // nodelist nl2 = ;     if (nl != null && nl.getlength() > 0) {         (int = 0; < nl.getlength(); i++) {              element entry = (element) nl.item(i);             element title = (element) entry.getelementsbytagname(                     "title").item(0);              string titlestr = title.getfirstchild().getnodevalue();              log.i("test log", "titles: " + titlestr);          }     } } 

however can't quite figure out how can retrieve thumbnail urls. i've seen tag, dont know how call nodelist. can tell how can retrieve video's thumbnail url , video descriptions, using method?

thanks in advance.

log.i("test log", "titles: " + titlestr); (...)                     element groupnode = (element)entry.getelementsbytagnamens("*", "group").item(0);                      nodelist tnl = groupnode.getelementsbytagnamens("*", "thumbnail");                      (int k = 0; k < tnl.getlength(); k++) {                         element te = (element)tnl.item(k);                          if (te != null) {                             system.out.println("thumbnail url = " + te.getattribute("url"));                         }                     }                      nodelist dnl = groupnode.getelementsbytagnamens("*", "description");                      (int k = 0; k < dnl.getlength(); k++) {                         element te = (element)dnl.item(k);                          if (te != null) {                             system.out.println("description = " + te.getfirstchild().getnodevalue());                         }                     }                  } // end  (...) 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -