我如何进行简单查询? [英] how can i make a simple query ?

查看:132
本文介绍了我如何进行简单查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我在一个社交网站上工作.收到2条消息后,我想阻止来自
的剪贴簿留言 上午6点至5.59点.

如何进行简单查询?

DATE
9/26/2011 10:08:16 AM

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

推荐答案

在这里我们需要更多详细信息!乍一看,我认为您会使用Page Scraper-首先要做的就是获取Html Agility Pack: http://htmlagilitypack.codeplex.com/ [ ^ ]

这是一个很棒的库,它使您可以获取网页并使用XPath刮取数据:

http://www.w3schools.com/xpath/ [
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:

// 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;



您可以快速构建高级的``查询''(即XPath查询),以从Html页面获取所需的确切数据.

如果这是您要查找的内容,请更详细地更新问题,我可以向您展示如何使用Html Agility抓取数据.



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.


这篇关于我如何进行简单查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆