Coder Social home page Coder Social logo

henryhaoo / wenshu_spider Goto Github PK

View Code? Open in Web Editor NEW

This project forked from henryhaohao/wenshu_spider

1.0 2.0 0.0 2.39 MB

:rainbow:Wenshu_Spider-Scrapy框架爬取**裁判文书网案件数据

Home Page: http://wenshu.court.gov.cn/

Python 99.16% JavaScript 0.84%

wenshu_spider's Introduction

Scrapy框架爬取**裁判文书网案件数据 enter image description here

**裁判文书网 - http://wenshu.court.gov.cn/

Author 😎Henryhaohao😎
Email ♥️[email protected]♥️

🐬声明

抱歉,代码仅用于学习交流!!所以在此我并没有公开部分参数的JS解密文件。感谢大家!

因为我不想被请 drink tea 啊~~:coffee:大家懂得哈!:eyes:

🐬介绍

该项目为Scrapy框架爬取**裁判文书网案件数据(2018-10-20最新版)

  • 项目文件: Wenshu_Project
  • 运行须知:

数据库配置 : 运行前根据自己需要修改settings.py中的MongoDB数据库的配置

反爬问题 : 由于文书网的反爬监控很严格(一级验证码,二级验证码,JavaScript反爬,IP检测...),所有采用阿布云动态隧道代理方案,每一次request请求都是不同的IP,这样就不会触发反爬检测了~:sunglasses:。还是挺好用的,基本上每个IP都可以用,主要也还方便,直接用它的代理服务器发出请求,不用像一般的代理IP那样还需要取出IP,再代入IP进行请求。代理相关配置在middlewares.py的类ProxyMiddleware中。

爬取策略问题 : 现在的文书网总量已经高达5千多万份了,但是每个筛选条件下只能查看20页,每页10条。本项目以爬取1996-2000年的所有文书为例,大家有好的爬取方案,可以自行修改Param参数即可。

速度问题 : 配置在setting.py中:DOWNLOAD_DELAY = 0(无delay实现请求0延时);CONCURRENT_REQUESTS_PER_SPIDER = 5 (开启线程数为5);因为我用的代理配置是默认的每秒5个请求数,所以在此设置线程数为5;如果想爬取更快,可以加大代理请求数(当然是要money滴~),最高可以加到100的请求数,我滴天呀,那得多快啊!我现在的速度大概每秒爬取4个案件,加到100的话,估计每秒80个,一分钟4800个,一小时288000,一天就是6912000,目前总量5千4百万,大概8~9天就能爬完,如果在加上redis分布式的话,哇,不敢想象!:yum:

🐬运行环境

Version: Python3

🐬安装依赖库

pip3 install -r requirements.txt

🐬存储数据库

Database: MongoDB

🐬相关截图

  • 运行过程

    enter image description here
  • 数据截图

    enter image description here
  • 阿布云

    enter image description here enter image description here

🐬总结

最后,如果你觉得这个项目不错或者对你有帮助,给个Star呗,也算是对我学习路上的一种鼓励!
哈哈哈,感谢大家!笔芯哟~
💘💘

wenshu_spider's People

Contributors

henryhaohao avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.