scrapy

scrapy fail to cooperate with python3.7

牧云@^-^@ 提交于 2020-02-05 11:57:10
问题 I failed to install twisted by pip command, so I manually downloaded the .whl file and got it installed( version 18.7.0). Only after i did that, my laptop could install scrapy; however, it seems that the twisted package is not compatible with python 3.7 and it keeps saying "syntax error" I have tried some method posted on the Github about this issue(https://github.com/scrapy/scrapy/issues/3143), but none of them solve it. I wonder whether I need to shift to python 3.6 or not? cause my python

scrapy框架的概念和流程

混江龙づ霸主 提交于 2020-02-05 10:16:30
1.scrapy框架的概念: 文档地址: http://scrapy-chs.readthedocs.io/zh_CN/1.0/intro/overview.html Scrapy 使用了Twisted['twɪstɪd]异步网络框架,可以加快我们的下载速度。 Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架,我们只需要实现少量的代码,就能够快速的抓取。 2.异步和非阻塞的区别 异步 :调用在发出之后,这个调用就直接返回,不管有无结果;异步是过程。 非阻塞 :关注的是程序在等待调用结果(消息,返回值)时的状态,指在不能立刻得到结果之前,该调用不会阻塞当前线程。 3.scrapy的工作流程 3.1 爬虫流程 3.2 上面的流程可以改写为 3.3 scrapy的流程 其流程可以描述如下: 调度器把requests–>引擎–>下载中间件—>下载器 下载器发送请求,获取响应---->下载中间件---->引擎—>爬虫中间件—>爬虫 爬虫提取url地址,组装成request对象---->爬虫中间件—>引擎—>调度器 爬虫提取数据—>引擎—>管道 管道进行数据的处理和保存 注意: 图中绿色线条的表示数据的传递 注意图中中间件的位置,决定了其作用 注意其中引擎的位置,所有的模块之前相互独立,只和引擎进行交互 3.4 scrapy中每个模块的具体作用 scrapy中每个模块的作用:

VSCode Settings.json is missing

僤鯓⒐⒋嵵緔 提交于 2020-02-05 03:27:26
问题 I'm following a tutorial and I'm trying to point vscode to my virtual workspace I had set up for Scrapy, but when I open settings in VSCode, Workspace Settings tab is not there next to User Settings tab. Also I tried to go to file manually by going to %APPDATA%\Code\User\settings.json which I got from here: https://vscode.readthedocs.io/en/latest/getstarted/settings/ but settings.json isn't in there. How can I get this setting to appear or get to my settings.json file so I can make the

爬虫基础——scrapy基本使用

筅森魡賤 提交于 2020-02-04 19:11:58
scrapy支持 Python2.7 和 python3.4 以上版本。 python包可以用全局安装(也称为系统范围),也可以安装咋用户空间中。 Windows 1.在 https://www.lfd.uci.edu/~gohlke/pythonlibs/ 下载对应的Twisted的版本文件 2. 在命令行进入到Twisted的目录 执行pip install 加Twisted文件名 3.执行pip install scrapy Ubuntu 14.04或以上 安装 scrapy目前正在使用最新版的lxml,twisted和pyOpenSSL进行测试,并且与最近的Ubuntu发行版兼容。但它也支持旧版本的Ubuntu,比如Ubuntu14.04,尽管可能存在TLS连接问题。 Ubuntu安装注意事项 不要使用 python-scrapyUbuntu提供的软件包,它们通常太旧而且速度慢,无法赶上最新的Scrapy。 要在Ubuntu(或基于Ubuntu)系统上安装scrapy,您需要安装这些依赖项: sudo apt-get install python-dev python-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev 如果你想在python3上安装scrapy,你还需要Python3的开发头文件:

python爬虫框架之scrapy安装记

雨燕双飞 提交于 2020-02-04 12:17:36
火柴人大战scrapy 一、Windows安装Scrapy框架 一、Windows安装Scrapy框架 安装lxml解析库 pip3 install lxml 安装依赖包pyOpenSSL 在官方网站下载 wheel 文件(详见 https://pypi.python.org/pypi/pyOpenSSL#downloads)即可 pip3 install pyOpenSSL - 17.2 .0 - py2 . py3 - none - any . whl (要执行命令要选择依赖放入的目录) 安装PyWin32 依赖包链接: https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/ 入坑记: 选择对应python时下载的位数下载对应PyWin32对应的位数安装包,安装成功后如果下一步报version required啥的,就说明位数或者版本没有对应上,下一步自动抓取不到python文件的位置。 安装Scrapy pip3 install Scrapy (这里的一切运行报错都有可能是因为你缺少依赖包) 验证Scrapy是否安装成功 输入 scrapy 即可 来源: CSDN 作者: MatchstickMen_roukun 链接: https://blog.csdn.net/qq_43264377

python核心教程:scrapyd和scrapydweb使用详细教程

笑着哭i 提交于 2020-02-03 09:37:58
Ⅰ、首先要搞清楚几个概念 1、scrapy是什么? 一个爬虫框架,你可以创建一个scrapy项目 2、scrapyd是什么? 相当于一个组件,能够将scrapy项目进行远程部署,调度使用等 因此scrapyd可以看作一个cs(client-server)程序,因此毫无疑问我们需要安装和配置scrapyd(server) 和连接的scrapy-client(client) 3、scrapydweb是什么? 是一个基于scrapyd的可视化组件,集成并且提供更多可视化功能和更优美的界面 总结:三者如同葫芦套娃,总共三层 II、安装scrapy和创建一个scrapy项目 安装scrapyd和scrapyd-client和配置 1、安装 pip install scrapyd pip install scrapy-client 安装完成后,在cmd中启动命令 scrapyd 在浏览器中输入:http://localhost:6800/,如果出现下面界面则表示启动成功(不要关闭cmd,后面步骤还需要) 2、配置 ①配置scrapy项目 打开scrapy项目,有个scrapy.cfg文件,按如下进行配置 ②上传scrapy项目 将你的scrapy-deploy文件复制到与scrapy.cfg文件同一目录,scrapy-deploy文件位于你python环境下的scripts文件夹中

Python核心编程:Scrapyd 对接 Docker汇总

老子叫甜甜 提交于 2020-02-03 04:20:16
我们使用了 Scrapyd-Client 成功将 Scrapy 项目部署到 Scrapyd 运行,前提是需要提前在服务器上安装好 Scrapyd 并运行 Scrapyd 服务,而这个过程比较麻烦。如果同时将一个 Scrapy 项目部署到 100 台服务器上,我们需要手动配置每台服务器的 Python 环境,更改 Scrapyd 配置吗?如果这些服务器的 Python 环境是不同版本,同时还运行其他的项目,而版本冲突又会造成不必要的麻烦。 所以,我们需要解决一个痛点,那就是 Python 环境配置问题和版本冲突解决问题。如果我们将 Scrapyd 直接打包成一个 Docker 镜像,那么在服务器上只需要执行 Docker 命令就可以启动 Scrapyd 服务,这样就不用再关心 Python 环境问题,也不需要担心版本冲突问题。 接下来,我们就将 Scrapyd 打包制作成一个 Docker 镜像。 准备工作 请确保本机已经正确安装好了 Docker,如没有安装可以参考第 1 章的安装说明。 对接 Docker 接下来我们首先新建一个项目,然后新建一个 scrapyd.conf,即 Scrapyd 的配置文件,内容如下: 在这里实际上是修改自官方文档的配置文件:https://scrapyd.readthedocs.io/en/stable/config.html#example

Python爬虫学习(三)使用Scrapy库

不羁的心 提交于 2020-02-02 23:55:57
(一)Scrapy库概述   1,安装:pip install scrapy失败;       运行D:\Python\Python36\python.exe -m pip install --upgrade pip命令升级pip命令失败;       修改Python36文件的权限: https://www.cnblogs.com/liaojiafa/p/5100550.html       安装:D:\Python\Python36\python.exe -m pip install wheel       安装:D:\Python\Python36\python.exe -m pip install scrapy   2,框架概述:               入口:SPIDERS;出口:ITEM PIPELINES;用户编写SPIDERS(URL),ITEM PIPELINES(对数据处理)     ENGINE:控制所有模块之间的数据流,根据条件触发事件,不允许用户修改,代码已实现     DOWNLOADER:根据请求下载网页,功能单一,不允许用户修改,代码已实现     SCHEDULER:对所有爬取请求进行调度管理,不允许用户修改,代码已实现     DOWNLOADER MIDDLEWARE:用户可以修改配置;中间件            SPIDERS

Python Scrapy not always downloading data from website

☆樱花仙子☆ 提交于 2020-02-02 06:25:07
问题 Scrapy is used to parse an html page. My question is why sometimes scrapy returns the response I want, but sometimes does not return a response. Is it my fault? Here's my parsing function: class AmazonSpider(BaseSpider): name = "amazon" allowed_domains = ["amazon.org"] start_urls = [ "http://www.amazon.com/s?rh=n%3A283155%2Cp_n_feature_browse-bin%3A2656020011" ] def parse(self, response): sel = Selector(response) sites = sel.xpath('//div[contains(@class, "result")]') items = [] titles = {

scrapy: exceptions.AttributeError: 'unicode' object has no attribute 'dont_filter'

我的梦境 提交于 2020-02-02 03:17:24
问题 In scrapy, I am getting the error exceptions.AttributeError: 'unicode' object has no attribute 'dont_filter' . After searching around, I found this answer (which made sense as it was the only bit of code I modified before getting the error) according to which I modified my code. I changed start_request to yield values in the list instead of retruning it whole but I'm still getting it. Any ideas? def start_requests(self): connection = pymongo.Connection(settings['MONGODB_SERVER'], settings[