First you need to install a NUGET package in your project, called Htmlagilitypack - Nuget, he who will help you in this!.
After that the Htmlweb of the code below will be available in your project for use.
Use as follows:
<img src="valor da lista aqui dentro ex: http://tse4.mm.bing.net/th?id=OIP.Meea6e108be6309f544bab7a1....">
Code in c#:
titulo.Text = "sou doador";
string minhaBusca = titulo.Text + " app";
string url = "http://www.bing.com/images/search?q=" + minhaBusca;
HtmlWeb web = new HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = web.Load(url);
var div = doc.DocumentNode.SelectSingleNode("//div[@class='imgres']"); //pega o que tendo dentro da div que tem a classe 'imgres'
List<string> ListaImagens = new List<string>(); // cria a lista que vai guardar os links
if (div != null) // verifica se a div achada anteriormente nao e nula.
{
foreach (HtmlNode type in div.Descendants("a")) // pego todos as tags <a> dentro da div, e percorre cada um (objeto type)
{
ListaImagens.Add(type.Element("img").Attributes["src2"].Value); //adiciono na lista o elemento 'img' dentro de 'a', e pego o valor do atributo 'src2' do elemento 'img'
}
}
else
{
MessageBox.Show("Ops! Não retornou imagem nenhuma!");
}
Remember to be using the following assemblies up there:
using HtmlAgilityPack; //do pacote nuget!
using System;
using System.Collections.Generic;
using System.Windows.Forms;
The values will be inside the Image List list list.
Ai is just use as I showed you in the HTML IMG tag example
i downloaded the page you put as a link and did not find the structure you point... I found a div with the class
dg_uand inside it the picture’s Thumb...– h3nr1ke
On line 17, you have the div
item, really noticed also that all the image has the classthumbthen it would be easier to catch the element, but how? kk– Leonardo