c#HtmlAgilityPack Wrapp拍摄多个图像,标题和链接Windows Phone [英] c# HtmlAgilityPack Wrapp taking several images, titles and links Windows Phone
本文介绍了c#HtmlAgilityPack Wrapp拍摄多个图像,标题和链接Windows Phone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在此页面上获取数据?我需要获取图像及其相应的标题并显示在列表框中.是否使用课堂.我不知道该怎么办,请帮帮我!
How to fetch the data on this page? I need to get the image and its corresponding title and display in a list box. Using class or not. I do not know how to do, please help me!
甚至都不知道从哪里开始!我已经尝试了几件事,但没有任何效果,然后变成一团糟,有人会从一开始就指导我.
Do not even know where to start! I've tried several things and none work, then turned into a mess, would someone guide me from the beginning.
var imgs = e.Document.DocumentNode.SelectNodes(@"//img[@src]")
.Select(img => new
{
Link = img.Attributes["src"].Value,
Title = img.Attributes["alt"].Value,
}).ToList();
listBoxPopular.ItemsSource = imgs;
foreach (var item in imgs)
{
listBoxPopular.Items.Add(new PopularVideos(item.Title, item.Link));
}
推荐答案
var data = doc.DocumentNode.SelectSingleNode("//div[@class='content']")
.Descendants("img")
.Select(img => new
{
Title = img.Attributes["alt"].Value,
Url = img.Attributes["src"].Value,
})
.ToList();
这篇关于c#HtmlAgilityPack Wrapp拍摄多个图像,标题和链接Windows Phone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文