private static void Main(string[] args)
{
string url = "http://www.dealdey.com/deals";
startover:
try
{
int iphoneCount = 0;
while (iphoneCount < 1)
{
Console.WriteLine("Connecting to " + url+"\n");
HtmlWeb htmlWeb = new HtmlWeb();
HtmlDocument htmlDocument = htmlWeb.Load(url);
Console.WriteLine("Connected to " + url);
foreach (HtmlNode htmlNode in htmlDocument.DocumentNode.SelectNodes("//a[@@href]"))
{
HtmlAttribute htmlAttribute = htmlNode.Attributes["href"];
if (htmlAttribute.Value.Contains("iphone-6"))
{
iphoneCount++;
Console.WriteLine("Link found\n");
Console.WriteLine(htmlAttribute.Value);
}
}
if (iphoneCount < 1)
{
Thread.Sleep(10000);
Console.Clear();
iphoneCount = 0;
}
else
{
break;
}
}
Console.WriteLine("Iphone is available \n");
Console.Beep(500, 5000);
Console.ReadLine();
}
catch(Exception e)
{
Console.WriteLine("Encountered Error, Starting Over Again \n");
goto startover;
}
}
Share this page on
4
People Like(s) This Page
Permalink
comments powered by Disqus