![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
爬虫
lcqin111
这个作者很懒,什么都没留下…
展开
-
scrapy:同时运行多个爬虫
有的时候需要在scrapy工程里面运行多个爬虫,试用了网上两种方法。运行环境:scrapy:2.3.0 + python3.8第一种:# coding:utf-8from scrapy import cmdlinecmdline.execute("scrapy crawl spider1".split())cmdline.execute("scrapy crawl spider2".split())无效,只能运行第一个。第二种:https://www.cnblogs.com原创 2020-11-08 15:15:44 · 1318 阅读 · 0 评论 -
scrapy+splash:设置超时失败,仍然504
我使用scrapy-splash来爬行网页,并在docker上运行splash服务。命令是:docker run -p 8050:8050 scrapinghub/splash --max-timeout 3600但是设置并没有生效。解决方法是:yield scrapy_splash.SplashRequest( url, self.parse, endpoint='execute', args={'lua_source': script, 'timeout': 36原创 2020-10-22 21:03:40 · 722 阅读 · 0 评论 -
爬虫:scrapy+splash 记录一次靠运气解决的问题
Lua脚本:URL:https://sustainabledevelopment.un.org/globalsdreport/2019#mediafunction main(splash, args) splash.resource_timeout = 90 splash.images_enabled = false assert(splash:go(args.url)) return {html=splash:html(), png=splash:png(),原创 2020-10-09 21:52:57 · 954 阅读 · 1 评论 -
在scrapy与selemium对接结束后,关闭浏览器的方法
参考https://blog.csdn.net/Hepburn_li/article/details/91039747博客。一般在DownloaderMiddleware中建立browser对象。例如:class NewscrawlerDownloaderMiddleware: # Not all methods need to be defined. If a method is not defined, # scrapy acts as if the downloader mi原创 2020-08-04 13:09:39 · 662 阅读 · 2 评论 -
MySQL: win10安装MySQL 8.0.21成功记录
主机配置:拯救者R7000,win10,4600HMySQL下载MySQL直接去官网下载就行,选择community版本(免费)下载,链接:https://dev.mysql.com/downloads/mysql/选择community server-ZIP Archive安装包,第二个是调试文件。安装与配置将下载好的压缩包解压缩到全英文目录下,比如我在D盘新建了MySQL文件夹,解压到该文件夹下,D:/MySQL然后把mysql 8.0.21所在的路径D:\MySQL\mys原创 2020-07-25 13:25:46 · 1085 阅读 · 0 评论 -
python: classmethod修饰符的使用以及在scrapy中的使用例子
import pymongoclass MongoPipeline(object): def __init__(self, mongo_uri, mongo_db): self.mongo_uri = mongo_uri self.mongo_db = mongo_db @classmethod def from_crawler(cls, crawler): return cls(mongo_uri=crawle.原创 2020-07-23 14:53:15 · 291 阅读 · 0 评论 -
Selenium开启无界面模拟浏览器,节省程序运行时间
今天展示一下python操作无界面的chrome浏览器。主要利用selenium 和对应自己电脑上Chrome浏览器版本的webdriver。chrome版本的webdriver下载地址:http://chromedriver.storage.googleapis.com/index.html。windows版本的只有32位的chromedriver.你无需担心你用的是64位的浏览器。我写这写代码测试的正是64位的chrome浏览器。下载解压好的chromediver.exe文件放进python安装路径下的转载 2020-07-16 17:43:02 · 766 阅读 · 0 评论