投稿    登录
  《Python3网络爬虫开发实战》赠书活动正在进行中!详情请戳赠书活动!欢迎参与!非常感谢!

[Python3网络爬虫开发实战] 1.8.3-Scrapy-Splash的安装

Python 崔庆才 8277浏览 117评论

Scrapy-Splash是一个Scrapy中支持JavaScript渲染的工具,本节来介绍它的安装方式。

Scrapy-Splash的安装分为两部分。一个是Splash服务的安装,具体是通过Docker,安装之后,会启动一个Splash服务,我们可以通过它的接口来实现JavaScript页面的加载。另外一个是Scrapy-Splash的Python库的安装,安装之后即可在Scrapy中使用Splash服务。

1. 相关链接

2. 安装Splash

Scrapy-Splash会使用Splash的HTTP API进行页面渲染,所以我们需要安装Splash来提供渲染服务。这里通过Docker安装,在这之前请确保已经正确安装好了Docker。

安装命令如下:

安装完成之后,会有类似的输出结果:

这样就证明Splash已经在8050端口上运行了。这时我们打开http://localhost:8050,即可看到Splash的主页,如图1-80所示。

图1-80 运行页面

当然,Splash也可以直接安装在远程服务器上。我们在服务器上以守护态运行Splash即可,命令如下:

这里多了-d参数,它代表将Docker容器以守护态运行,这样在中断远程服务器连接后,不会终止Splash服务的运行。

3. Scrapy-Splash的安装

成功安装Splash之后,接下来再来安装其Python库,命令如下:

命令运行完毕后,就会成功安装好此库,后面会详细介绍它的用法。

转载请注明:静觅 » [Python3网络爬虫开发实战] 1.8.3-Scrapy-Splash的安装

喜欢 (6)or分享 (0)

我的个人微信公众号,联系我请直接在公众号留言即可~

扫码或搜索:进击的Coder

进击的Coder

微信公众号 扫一扫关注

想结交更多的朋友吗?

来进击的Coder瞧瞧吧

进击的Coder

QQ群号 99350970 立即加入

进击的Coder灌水太多?

这里是纯粹的技术领地

激进的Coder

QQ群号 627725766 立即加入

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请狠狠点击下面的

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(117)个小伙伴在吐槽
  1. we like to honor many other web websites around the web, even though they arent linked to us, by linking to them. Underneath are some webpages really worth checking out
    Tory Burch2019-01-16 11:13 (1分钟前)回复
  2. Every the moment in a when we choose blogs that we read. Listed beneath would be the most current web-sites that we opt for
    gucci bags2019-01-16 05:14 (6小时前)回复
  3. very handful of internet websites that transpire to become in depth beneath, from our point of view are undoubtedly nicely really worth checking out
  4. we prefer to honor many other internet web-sites on the net, even though they arent linked to us, by linking to them. Below are some webpages really worth checking out
  5. we came across a cool web page which you may love. Take a look if you want
    sweet Sofia cam2019-01-15 07:23 (1天前)回复
  6. Here are some of the sites we recommend for our visitors
    sexy Melody webcam2019-01-15 02:36 (1天前)回复
  7. Here is an excellent Weblog You might Obtain Interesting that we Encourage You
    sexy gaming Chat2019-01-14 22:53 (2天前)回复
  8. Here are a number of the web pages we recommend for our visitors
    psicologo avezzano2019-01-14 07:36 (2天前)回复
  9. Every once in a while we pick out blogs that we study. Listed beneath would be the latest web pages that we select
    la mente torna testo2019-01-13 19:19 (3天前)回复
  10. below you will come across the link to some web pages that we think it is best to visit
  11. Wonderful story, reckoned we could combine some unrelated information, nevertheless actually worth taking a appear, whoa did one particular understand about Mid East has got additional problerms also.
    Google2019-01-13 06:54 (3天前)回复
  12. we prefer to honor numerous other net web sites around the internet, even if they arent linked to us, by linking to them. Underneath are some webpages really worth checking out
    Sexcams2019-01-12 18:23 (4天前)回复
1 6 7 8