我试着通过写剧本来教自己一个概念。基本上,我正在尝试编写一个Python脚本,给定几个关键字,它将抓取网页,直到找到我需要的数据。例如,假设我想找到一份生活在美国的威尼斯蛇的列表。我可能使用关键字list,venemous,snakes,US
运行我的脚本,并且我希望能够至少有80%的把握相信它将返回美国的蛇列表。在
我已经知道如何实现网络蜘蛛部分,我只想学习如何在不知道网页结构的情况下确定网页的相关性。我研究过网页抓取技术,但它们似乎都假定了解网页的html标记结构。有没有某种算法可以让我从页面中提取数据并确定其相关性?在
如有任何建议,我们将不胜感激。我使用Python
和{
使用scrapy这样的爬虫程序(只用于处理并发下载),您可以编写这样一个简单的spider,并可能从Wikipedia开始作为一个好的起点。这个脚本是使用
scrapy
、nltk
和whoosh
的完整示例。它永远不会停止,并将使用whoosh
索引链接以供以后搜索 它是一个小谷歌:This is the file对于已完成的垃圾示例:
你基本上是在问“我怎么写搜索引擎”这是。。。不是小事。在
正确的方法是使用Google(或者Bing,或者Yahoo!)s、 或…)搜索API并显示前n个结果。但是,如果你只是在做一个个人项目来教自己一些概念(虽然不确定哪些概念是确切的),那么以下是一些建议:
<p>
,<div>
,等等)的文本内容,寻找相关的关键字(duh)<ul>
或{<table>
的页面可能是一个不错的候选者祝你好运(你需要它)!在
相关问题 更多 >
编程相关推荐