草庐IT

scrapy-pipeline

全部标签

python - Scrapy SgmlLinkExtractor 问题

我正在尝试让SgmlLinkExtractor工作。这是签名:SgmlLinkExtractor(allow=(),deny=(),allow_domains=(),deny_domains=(),restrict_xpaths(),tags=('a','area'),attrs=('href'),canonicalize=True,unique=True,process_value=None)我只是在使用allow=()所以,我输入rules=(Rule(SgmlLinkExtractor(allow=("/aadler/",)),callback='parse'),)所以,初始ur

python - 如何用scrapy抓取每个链接的所有内容?

我是scrapy的新手,我想从这个website中提取每个广告的所有内容.所以我尝试了以下方法:fromscrapy.spidersimportSpiderfromcraigslist_sample.itemsimportCraigslistSampleItemfromscrapy.selectorimportSelectorclassMySpider(Spider):name="craig"allowed_domains=["craigslist.org"]start_urls=["http://sfbay.craigslist.org/search/npo"]defparse(se

python - 在 scrapy 中将基本 url 与结果 href 结合起来

下面是我的爬虫代码,classBlurb2Spider(BaseSpider):name="blurb2"allowed_domains=["www.domain.com"]defstart_requests(self):yieldself.make_requests_from_url("http://www.domain.com/bookstore/new")defparse(self,response):hxs=HtmlXPathSelector(response)urls=hxs.select('//div[@class="bookListingBookTitle"]/a/@hr

python - scrapy response.xpath 在具有默认命名空间的 xml 文档上返回空数组,而 response.re 有效

我是scrapy的新手,我正在玩scrapyshell试图抓取这个网站:www.spiegel.de/sitemap.xml我用scrapyshell"http://www.spiegel.de/sitemap.xml"在我使用的时候一切正常response.body我可以看到整个页面,包括xml标签但是例如这个:response.xpath('//loc')根本行不通。我得到的结果是一个空数组同时response.selector.re('somevalidregexpexpression')会起作用知道可能是什么原因吗?可能与编码有关?该网站不是utf-8我在Win7上使用pyth

python - 学习 : Is there any way to debug Pipelines?

我已经为分类任务创建了一些管道,我想检查每个阶段存在/存储的信息(例如text_stats、ngram_tfidf)。我怎么能这样做。pipeline=Pipeline([('features',FeatureUnion([('text_stats',Pipeline([('length',TextStats()),('vect',DictVectorizer())])),('ngram_tfidf',Pipeline([('count_vect',CountVectorizer(tokenizer=tokenize_bigram_stem,stop_words=stopwords))

python - Scrapy SgmlLinkExtractor 忽略允许的链接

请看thisspiderexample在Scrapy文档中。解释是:Thisspiderwouldstartcrawlingexample.com’shomepage,collectingcategorylinks,anditemlinks,parsingthelatterwiththeparse_itemmethod.Foreachitemresponse,somedatawillbeextractedfromtheHTMLusingXPath,andaItemwillbefilledwithit.我完全复制了同一个蜘蛛,并用另一个初始url替换了“example.com”。from

python - 如何在 Heroku 云上部署 Scrapy 蜘蛛

我在scrapy中开发了几个蜘蛛,我想在Heroku云上测试它们。有人知道如何在Heroku云上部署Scrapy蜘蛛吗? 最佳答案 是的,在Heroku上部署和运行Scrapy爬虫相当简单。以一个真实的Scrapy项目为例,步骤如下:克隆项目(注意,它必须有一个requirements.txt文件,Heroku才能将其识别为Python项目):gitclonehttps://github.com/scrapinghub/testspiders.git将cffi添加到requirement.txt文件(例如cffi==1.1.0)。创

python - Scrapy 与 TOR (Windows)

我用几个蜘蛛创建了一个Scrapy项目来爬取一些网站。现在我想使用TOR来:对已抓取的服务器隐藏我的ip;将我的请求关联到不同的ip,模拟来自不同用户的访问。我已经阅读了一些关于此的信息,例如:usingtorwithscrapyframework,HowtoconnecttohttpssitewithScrapyviaPolipooverTOR?这些链接的答案对我没有帮助。要使Scrapy与TOR正常工作,我应该采取哪些步骤?编辑1:考虑到答案1,我开始安装TOR。由于我使用的是Windows,因此我下载了TORExpertBundle(https://www.torproject.

python - 为什么我在 scrapy 中收到此错误 - python3.7 语法无效

我在安装scrapy时遇到了麻烦。我已将它安装在我的Mac上,但在运行教程时出现此错误:Virtualenvs/scrapy_env/lib/python3.7/site-packages/twisted/conch/manhole.py",line154defwrite(self,data,async=False):^SyntaxError:invalidsyntax据我所知,我正在使用最新版本的所有内容。启动并运行它很痛苦。嘘。操作系统高Sierra10.13.3python3.7安装ipython我已经更新了我能想到的一切。终端线是:scrapyshellhttp://quote

python - 使用 scrapyd 一次运行多个 scrapy 蜘蛛

我正在使用scrapy对于一个我想抓取多个站点(可能是数百个)的项目,我必须为每个站点编写一个特定的蜘蛛。我可以在部署到scrapyd的项目中安排一个蜘蛛,使用:curlhttp://localhost:6800/schedule.json-dproject=myproject-dspider=spider2但是我如何一次安排一个项目中的所有蜘蛛?非常感谢所有帮助! 最佳答案 我一次运行200多个蜘蛛的解决方案是为项目创建一个自定义命令。参见http://doc.scrapy.org/en/latest/topics/command