2
正是我想要實現的是從this address,鏈接爲每個單獨的壁紙鏈接。例如,此鏈接:https://www.flickr.com/photos/visualechos/14925188846/in/album-72157622467976256/。從網站URL獲得鏈接
這是一些我試過的事情,但都存在使用這些方法由於某種原因,壁紙鏈接:
using (WebClient client = new WebClient())
{
string code = client.DownloadString("http://www.flickr.com/photos/visualechos/sets/72157622467976256");
}
-
using (WebClient client = new WebClient())
{
client.DownloadFile("http://www.flickr.com/photos/visualechos/sets/72157622467976256", @"C:\code.html");
}
-
// Using HtmlAgilityPack
public void GetLinks(string url)
{
HtmlWeb hw = new HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = hw.Load(url);
foreach (HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]"))
{
LINK.Add(link.GetAttributeValue("href", "link not found"));
}
}
private void btnStoreLinks_Click(object sender, EventArgs e)
{
GetLinks("https://www.flickr.com/photos/visualechos/sets/72157622467976256");
}
我看了鏈接,但看起來很複雜......我不擅長這種事情,我很害怕,對不起。我是否應該將OAuth作爲參考?或者我該如何開始? – spunit