Read youtube channel xml file with c# xmldocument -
i want channel information , list of files rss feed channel. instance, http://gdata.youtube.com/feeds/api/users/google/uploads rss feed google. how title feed, instance? or list of videos? tried
webclient wc = new webclient(); xmldocument xd = new xmldocument(); xd.loadxml(wc.downloadstring(strurl)); xmlnode xn = xd.selectsinglenode("/feed/title");
but xn returning null. tried "/title", "feed/title", , "title", none of worked. list of videos, tired
xmlnodelist vids = xd.selectnodes("/entry");
and few other permutations without success.
(edit adding xml info no 1 have click on link)
here's top of xml file looks like:
<?xml version='1.0' encoding='utf-8'?> <feed xmlns="http://www.w3.org/2005/atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:yt="http://gdata.youtube.com/schemas/2007"> <id>http://gdata.youtube.com/feeds/api/users/google/uploads</id> <updated>2013-08-19t21:47:34.674z</updated> <category scheme="http://schemas.google.com/g/2005#kind" term="http://gdata.youtube.com/schemas/2007#video" /> <title type="text">uploads google</title> <logo>http://www.gstatic.com/youtube/img/logo.png</logo> </feed>
i want know how value out of there, such title or id
try this:
xmldocument xml = new xmldocument(); xml.loadxml(wc.downloadstring(strurl)); xmlnodelist xnlist = xml.selectnodes("/feed/title"); foreach (xmlnode xn in xnlist) { string title= xn["title"].innertext; }
or
var doc = xdocument.load(wc.downloadstring(strurl)); string result = (string)doc.root.element("title");
Comments
Post a Comment