GithubHelp home page GithubHelp logo

jizhi-error / china_regions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gaohuazi/china_regions

0.0 0.0 0.0 25.82 MB

2022最新最全省市区街道sql/json 文件

License: MIT License

PHP 61.52% Go 38.48%

china_regions's Introduction

2023 全网最完整、最新、最全、**省市区街道 sql/json 文件


效果演示

联动效果演示
国内备用演示

image

更新记录

  • 2022-03-10:增加 github action,每日自动抓取最新数据,快速下载最新 json/sql快速下载步骤,需科学上网
  • 2022-02-13:增加 golang 版爬虫源码
  • 2022-02-08:增加 PHP 版爬虫源码
  • 2022-02-08master增加街道数据(4 级联动),增加了香港、澳门、**、钓鱼岛相关数据~

分支说明

  • master分支:4 级联动-包括省、市、区、街道,数据来源于京东网页版
  • level5分支:5 级联动-包括省、市、区、街道、社区,数据来源于国家统计局,数据比较 old

目录结构描述

├── json                        // json文件目录
│   ├── province.json           // 省
│   ├── city.json               // 市
│   ├── area.json               // 区
│   └── street.json             // 街道
├── sql                         // mysql文件目录
│   ├── province.sql            // 省
│   ├── city.sql                // 市
│   ├── area.sql                // 区
│   ├── street.sql              // 街道
│   └── init.sql                // mysql表结构文件, 需要4张表
├── spider                      // 爬虫源文件目录
│   ├── go                      // golang版爬虫
│   │   ├── main.go             // demo入口文件
│   │   └── core                // 核心类库文件
│   └── php                     // php版爬虫
│       ├── index.php           // demo入口文件
│       └── Region.class.php    // 核心类库文件
├── docs                        // github联动效果演示文件,忽略
├── LICENSE                     // MIT
└── Readme.md                   // help

如何抓取最新数据

1.使用 PHP 版爬虫

clone 项目后 直接执行 php spider/php/index.php 耗时约 180s

2.使用 golang 版爬虫

clone 项目后 直接执行 GO111MODULE=off go run spider/go/main.go 耗时约 30s


执行后会在当前目录生成最新 json/sql 文件

其他说明

# 导入sql时报错时可以尝试以下方式导入
mysql -uroot -p --default-character-set=utf8 dbname < /path/community.sql

有问题请提 issue,持续更新中.........

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.