Git Product home page Git Product logo

phonedata's Introduction

手机号码归属地信息库、手机号归属地查询

这可能是github上能找到的最新最全的**境内手机号归属地信息库

基于GO语言实现,使用二分查找法。

  • 归属地信息库文件大小:4,484,792 字节
  • 归属地信息库最后更新:2023年02月
  • 手机号段记录条数:497191

phone.dat文件格式

    | 4 bytes |                     <- phone.dat 版本号(如:1701即17年1月份)
    ------------
    | 4 bytes |                     <-  第一个索引的偏移
    -----------------------
    |  offset - 8            |      <-  记录区
    -----------------------
    |  index                 |      <-  索引区
    -----------------------
  1. 头部为8个字节,版本号为4个字节,第一个索引的偏移为4个字节;
  2. 记录区 中每条记录的格式为"<省份>|<城市>|<邮编>|<长途区号>\0"。 每条记录以'\0'结束;
  3. 索引区 中每条记录的格式为"<手机号前七位><记录区的偏移><卡类型>",每个索引的长度为9个字节;

安装使用

vi test.go

package main

import (
	"fmt"

	"github.com/xluohome/phonedata"
)

func main() {
	pr, err := phonedata.Find("18957509123")
	if err != nil {
		panic(err)
	}
	fmt.Print(pr)
}

go run test.go

PhoneNum: 18957509123
AreaZone: 0575
CardType: **电信
City: 绍兴
ZipCode: 312000
Province: 浙江

快速使用

cmd 目录下phonedata是一个命令行查询手机号归属地信息的终端程序。


Linux:
#PHONE_DATA_DIR=../ ./phonedata  18957509123

Windows:
>set PHONE_DATA_DIR=../
>phonedata.exe  18957509123

stdout:

PhoneNum: 18957509123
AreaZone: 0575
CardType: **电信
City: 绍兴
ZipCode: 312000
Province: 浙江

性能测试

go version go1.17.6 windows/amd64

> go test --bench="."

goos: windows
goarch: amd64
pkg: github.com/xluohome/phonedata
cpu: AMD Ryzen 5 PRO 4650U with Radeon Graphics
BenchmarkFindPhone-12            8454013               152.5 ns/op

我仅想要phone.dat的csv文本文件?

好。下载地址 https://git.oschina.net/oss/phonedata/attach_files

其他语言实现

python: https://github.com/ls0f/phone

php: https://github.com/shitoudev/phone-location , https://github.com/iwantofun/php_phone

php ext: https://github.com/jonnywang/phone

java: https://github.com/fengjiajie/phone-number-geo , https://github.com/EeeMt/phone-number-geo

Node: https://github.com/conzi/phone

C++: https://github.com/yanxijian/phonedata

C#: https://github.com/sndnvaps/Phonedata , https://github.com/rwecho/Phone.Dotnet.git (dotnet core)

Rust: https://github.com/vincascm/phonedata

Kotlin: https://github.com/bytebeats/phone-geo

Ruby: https://github.com/forwaard/phonedata

安全保证

手机号归属地信息是通过网上公开数据进行收集整理。

对手机号归属地信息数据的绝对正确,我不做任何保证。因此在生产环境使用前请您自行校对测试。

客户案例

感谢

@ls0f https://github.com/ls0f

@zhengji https://github.com/zheng-ji/gophone

联系作者

加作者微信

wx.jpg

phonedata's People

Contributors

bytebeats avatar ls0f avatar rwecho avatar stiekel avatar xluohome avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phonedata's Issues

phone.dat更新问题

请问一下 phone.dat还更新吗?目前我查到的手机号码195开头的几个号码,都查不到信息。

cmd目录下的phonedata.exe不能用

Microsoft Windows [版本 6.3.9600]
(c) 2013 Microsoft Corporation。保留所有权利。

e:\Backup\go\src\github.com\xluohome\phonedata\cmd>go run phonedata.go 1388888
PhoneNum: 1388888
AreaZone: 0871
CardType: **移动
City: 昆明
ZipCode: 650000
Province: 云南

e:\Backup\go\src\github.com\xluohome\phonedata\cmd>phonedata 1388888
panic: open C:/Users/xluo/Documents/goproject/src/github.com/xluohome/phonedata/phone.dat: The system cannot find the path specified.

goroutine 1 [running]:
github.com/xluohome/phonedata.init.1()
        C:/Users/xluo/Documents/goproject/src/github.com/xluohome/phonedata/phonedata.go:58 +0x152
github.com/xluohome/phonedata.init()
        C:/Users/xluo/Documents/goproject/src/github.com/xluohome/phonedata/phonedata.go:185 +0x12e
main.init()
        C:/Users/xluo/Documents/goproject/src/github.com/xluohome/phonedata/cmd/phonedata.go:23 +0x55

e:\Backup\go\src\github.com\xluohome\phonedata\cmd>

依赖编译时phone.dat的路径,建议删除可执行文件,readme里添加编译说明。

运营商信息全部为0

你好,经过测试发现所有拿出来的<卡类型>数据都是0,不知是不是我方法有问题.
4月份的数据是utf-8编码的,7月的为GBK编码,

phone.dat更新

建议提供一个方便添加号段的工具,比如读取同一目录下phone.dat和json文件,json文件可以定义一些可读性比较强的格式,解决某些号段未识别,用户想自己添加号段的问题,该工具会merge phone.dat和同目录下json文件,合并成一个新的phone.dat文件

1300000000 报错

在csv版本的手机号码信息里1300000号段是属于山东济南的号段,在新版里面却消失了。

E:\tools\phonedata\cmd>set PHONE_DATA_DIR=../

E:\tools\phonedata\cmd>phonedata.exe 1300000000
phone's data not found

166、167、195等号码段无数据

16690991091 河南濮阳号码(来源百度)
16699843893 **喀什
16687674077 云南德宏
16750318466 安徽 阜阳 **联通
19522432985 陕西 西安 **移动

16715203188 报错

panic: runtime error: invalid memory address or nil pointer dereference

cmd/phonedata error

open C:/Users/xluo/Documents/goproject/src/github.com/xluohome/phonedata/phone.dat: no such file or directory

数据更新问题

非常感谢,很好用。但是好久没更新了,是弃坑了吗

phone.dat 还在更新吗

您好 目前的phone.dat截止到2021年8月份 有些号段的当前查不出归属地 想问问您这个文件还在保持更新吗 ?

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.