Click here to Skip to main content
16,023,339 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am work with a social network site. After 2 messages I would like to block scrap from
6 AM to 5.59AM.

How can i make a simple query ?

DATE
9/26/2011 10:08:16 AM
Posted
Updated 12-Oct-11 23:37pm
v2

1 solution

We'll need much more detail here! At first glance I think you'll be using a Page Scraper - the first thing to do would be to get the Html Agility Pack: http://htmlagilitypack.codeplex.com/[^]

This is a superb library that lets you get a web page and use XPath to scrape data:

http://www.w3schools.com/xpath/[^]

For example, you can load the page, if you know the date is in a div with a class called 'dateClass' you can do things like:

C#
// Note this is pseudo-code to demonstrate, the real code would be very similar.
HtmlDocument doc = htmlAgility.GetDocument("http://somepath");
var nodes = doc.SelectMany("//div[@class='dateClass']");
string date = nodes.First().InnerHtml;


You can rapidly build advanced 'queries' (i.e. XPath queries) that will get the exact data you require from the Html page.

If this is what you're looking for update the question with more detail and I can show how to use Html Agility to scrape data.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900