using System
;
using System
.Collections
.Generic
;
using System
.Linq
;
using System
.Web
;
using System
.Web
.UI
;
using System
.Web
.UI
.WebControls
;
using HtmlAgilityPack
;
using System
.Text
;
using DotNet
;
using System
.Net
;
using System
.IO
;
public partial class _Default
: System
.Web
.UI
.Page
{
protected void Page_Load(object sender
, EventArgs e
)
{
kwldg_Reptile();
}
private void TencentHome_HotProdcut_Reptile()
{
string url
= "http://hm.jia360.com/";
HtmlWeb web
= new HtmlWeb();
HtmlDocument htmldoc
= web
.Load(url
);
HtmlNodeCollection aCollection
= htmldoc
.DocumentNode
.SelectNodes("//*[starts-with(@class,'tab_box ')]//li/a");
foreach (var item
in aCollection
)
{
string title
= item
.InnerText
;
string href
= item
.Attributes
["href"].Value
;
string imgpath
= item
.SelectSingleNode("./img/@src").Attributes
["src"].Value
;
string SavePath
= Server
.MapPath("~/upload/link/" + Path
.GetFileName(imgpath
));
WebClient wc
= new WebClient();
wc
.DownloadFile(imgpath
, SavePath
);
Response
.Write(title
+ "<br/>");
Response
.Write(href
+ "<br/>");
Response
.Write(imgpath
+ "<br/>");
}
}
private void kwldg_Reptile()
{
string url
= "http://98keji.com/article/article_list.aspx?pn=1";
HtmlWeb web
= new HtmlWeb();
HtmlDocument htmldoc
= web
.Load(url
);
HtmlNodeCollection aCollection
= htmldoc
.DocumentNode
.SelectNodes("//*[starts-with(@class,'article_list ')]//li/a");
foreach (var item
in aCollection
)
{
string title
= item
.InnerText
;
string href
= item
.Attributes
["href"].Value
;
Response
.Write(title
+ "<br/>");
Response
.Write(href
+ "<br/>");
}
}
}
转载请注明原文地址: https://lol.8miu.com/read-30884.html