3
我想解析youtube頻道的原子提要。 這是rss原子提要的鏈接。用linq解析youtube提要
http://gdata.youtube.com/feeds/api/users/cokestudio/uploads?orderby=updated
List<YTFeeds> lstYT = new List<YTFeeds>();
XDocument xDocumentYT = XDocument.Load(Server.MapPath("XMLFile.xml"));
XNamespace xmlns = "http://www.w3.org/2005/Atom";
lstYT.AddRange((from entry in xDocumentYT.Descendants(xmlns + "entry").Elements(xmlns + "media:group")
select new YTFeeds
{
Title = entry.Element(xmlns + "media:title").Value,
Description = entry.Element(xmlns + "media:description").Value,
Video = entry.Elements(xmlns + "media:player").ElementAt(1).Attribute("url").Value,
Image = entry.Elements(xmlns + "media:thumbnail").ElementAt(1).Attribute("url").Value
}).ToList());
我得到它說invalid character or hexcode ":"
錯誤。我想從標記中獲取元素:<media:group>
請建議。
謝謝Jeff Mercado .. –