TL;DR版本:,我只在我没有参与的智力对话中听说过网络爬虫。我只想知道他们能走一条特定的道路,比如:
first page (has lot of links) -->go to links specified-->go to
links(specified, yes again)-->go to certain link-->reach final page
and download source.
我在谷歌上搜索了一下,发现了。但我不确定我是否完全理解网络爬虫的开始,是否好斗可以帮助我遵循我想要的具体路径。
长版本
我想提取一组静态网页的文本。这些网页非常简单
我有一个由以下元素组成的HTML站点地图( sitemap链接到我的页脚)
logo (linking to / )
link for the first block of 150 links
link for the second block of 150 links
....
我现在有一个SEO魔术大师,这不能解释我为什么,但他说,标志必须链接到首页和每一页与150个链接块应该链接到/sitemap。他简单地说:“这正是谷歌所喜欢的”。我是开发商。我知道爬虫的工作原理,以及那些写得很好的爬虫器(我们可以假设google爬虫是最先进的爬虫器),解析页面中的所有链接,只访问/爬行以前没有访问
我目前正在尝试使用Scrapey在python中创建一个简单的爬虫。我想让它做的是读取链接列表,并保存链接到的网站的html。现在,我能够获得所有的URL,但我无法弄清楚如何下载页面。这是到目前为止我的爬虫的代码:
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from tutorial.items import BookItem
# Book scrappy spider
class DmozSpider(BaseSpider):
name = "boo
我一直在运行一个抓取爬虫在抓取一个大网站,我宁愿不提。我使用教程蜘蛛作为模板,然后创建了一系列启动请求并让它从那里爬行,使用如下所示:
def start_requests(self):
f = open('zipcodes.csv', 'r')
lines = f.readlines()
for line in lines:
zipcode = int(line)
yield self.make_requests_from_url("http://www.e
我用urllib2和漂亮汤构建了一个简单的爬虫应用程序,现在我打算把它变成刮擦蜘蛛,但是如何在运行爬虫时处理错误,我的当前应用程序有如下代码,
error_file = open('errors.txt','a')
finish_file = open('finishlink.txt','a')
try:
#Code for process each links
#if sucessfully finished link store into 'finish.txt' file
except Exc