Code Monkey home page Code Monkey logo

stats-area-spider's Introduction

stats-area-spider

**国家统计局行政区划代码爬虫

http://www.stats.gov.cn/sj/tjbz/tjyqhdmhcxhfdm/2022/index.html

一些数据

年份
2022 31 342 3338 42508 618267
2021 31 342 3064 42505 616906

山东省/潍坊市/坊子区/太保庄街道 有最多的村,共 168 个 http://www.stats.gov.cn/sj/tjbz/tjyqhdmhcxhfdm/2022/37/07/04/370704008.html

使用方式

  1. 安装依赖包

pip install -r requirements.txt

依赖的库 requests beautifulsoup4 lxml

  1. 修改 data.json

如果是首次执行,确保 data.json 内容如下

{
    "code": 0,
    "name": "**",
    "url": "http://www.stats.gov.cn/sj/tjbz/tjyqhdmhcxhfdm/2022/index.html",
    "status": "start",
    "children": []
}
字段说明:
code          区划代码
name          区划名称
sort          城乡分类代码,村级别有,其他层级应该没有
url           当前区域对应的页面地址
status        爬虫状态标记 start【尚未抓取】 finish【抓取完成】
children      下级区域列表
children-size 子节点数量

如果是执行中途中断,不用修改改文件,重新执行脚本会按照当前进度继续抓取。

  1. 执行脚本

单线程,爬取的时间比较慢,可能需要 10 个小时,感受到了**的广袤。

stats-area-spider's People

Contributors

hao1032 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 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.