{"id":13813878,"url":"https://github.com/xluohome/phonedata","last_synced_at":"2025-05-15T05:07:43.205Z","repository":{"id":41045617,"uuid":"85793653","full_name":"xluohome/phonedata","owner":"xluohome","description":"手机号码归属地信息库、手机号归属地查询   phone.dat 最后更新：2023年02月 ","archived":false,"fork":false,"pushed_at":"2023-11-14T05:23:28.000Z","size":11523,"stargazers_count":2142,"open_issues_count":14,"forks_count":389,"subscribers_count":72,"default_branch":"master","last_synced_at":"2025-04-14T08:11:31.648Z","etag":null,"topics":["golang","java","phonenumber","php","python"],"latest_commit_sha":null,"homepage":"https://github.com/xluohome/phonedata","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xluohome.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-03-22T06:39:53.000Z","updated_at":"2025-04-13T03:30:07.000Z","dependencies_parsed_at":"2023-11-14T06:35:56.572Z","dependency_job_id":null,"html_url":"https://github.com/xluohome/phonedata","commit_stats":{"total_commits":37,"total_committers":7,"mean_commits":5.285714285714286,"dds":0.5405405405405406,"last_synced_commit":"934554285b9082e97ce676d4c89a890814532963"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xluohome%2Fphonedata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xluohome%2Fphonedata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xluohome%2Fphonedata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xluohome%2Fphonedata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xluohome","download_url":"https://codeload.github.com/xluohome/phonedata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254276447,"owners_count":22043867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","java","phonenumber","php","python"],"created_at":"2024-08-04T04:01:34.254Z","updated_at":"2025-05-15T05:07:38.196Z","avatar_url":"https://github.com/xluohome.png","language":"Go","funding_links":[],"categories":["Go","Go (531)"],"sub_categories":[],"readme":"手机号码归属地信息库、手机号归属地查询\r\n----------------------------\r\n\r\n### 这可能是github上能找到的最新最全的中国境内手机号归属地信息库\r\n基于GO语言实现，使用二分查找法。\r\n\r\n - 归属地信息库文件大小：4,484,792 字节\r\n - 归属地信息库最后更新：2023年02月\r\n - 手机号段记录条数：497191\r\n\r\n### phone.dat文件格式\r\n\r\n        | 4 bytes |                     \u003c- phone.dat 版本号（如：1701即17年1月份）\r\n        ------------\r\n        | 4 bytes |                     \u003c-  第一个索引的偏移\r\n        -----------------------\r\n        |  offset - 8            |      \u003c-  记录区\r\n        -----------------------\r\n        |  index                 |      \u003c-  索引区\r\n        -----------------------\r\n\r\n1. 头部为8个字节，版本号为4个字节，第一个索引的偏移为4个字节；\r\n2. 记录区 中每条记录的格式为\"\u003c省份\u003e|\u003c城市\u003e|\u003c邮编\u003e|\u003c长途区号\u003e\\0\"。 每条记录以'\\0'结束；\r\n3. 索引区 中每条记录的格式为\"\u003c手机号前七位\u003e\u003c记录区的偏移\u003e\u003c卡类型\u003e\"，每个索引的长度为9个字节；\r\n\r\n### 安装使用\r\n\r\n vi test.go\r\n\r\n```\r\npackage main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\r\n\t\"github.com/xluohome/phonedata\"\r\n)\r\n\r\nfunc main() {\r\n\tpr, err := phonedata.Find(\"18957509123\")\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tfmt.Print(pr)\r\n}\r\n\r\n````\r\ngo run test.go\r\n\r\n```\r\nPhoneNum: 18957509123\r\nAreaZone: 0575\r\nCardType: 中国电信\r\nCity: 绍兴\r\nZipCode: 312000\r\nProvince: 浙江\r\n```\r\n\r\n### 快速使用\r\n\r\ncmd 目录下phonedata是一个命令行查询手机号归属地信息的终端程序。\r\n```\r\n\r\nLinux:\r\n#PHONE_DATA_DIR=../ ./phonedata  18957509123\r\n\r\nWindows:\r\n\u003eset PHONE_DATA_DIR=../\r\n\u003ephonedata.exe  18957509123\r\n```\r\nstdout:\r\n```\r\nPhoneNum: 18957509123\r\nAreaZone: 0575\r\nCardType: 中国电信\r\nCity: 绍兴\r\nZipCode: 312000\r\nProvince: 浙江\r\n```\r\n\r\n### 性能测试\r\n\r\ngo version go1.17.6 windows/amd64\r\n\r\n```\r\n\u003e go test --bench=\".\"\r\n\r\ngoos: windows\r\ngoarch: amd64\r\npkg: github.com/xluohome/phonedata\r\ncpu: AMD Ryzen 5 PRO 4650U with Radeon Graphics\r\nBenchmarkFindPhone-12            8454013               152.5 ns/op\r\n\r\n```\r\n\r\n### 我仅想要phone.dat的csv文本文件?\r\n\r\n好。下载地址\r\nhttps://git.oschina.net/oss/phonedata/attach_files\r\n\r\n\r\n### 其他语言实现\r\n\r\npython: https://github.com/ls0f/phone\r\n\r\nphp:  https://github.com/shitoudev/phone-location , https://github.com/iwantofun/php_phone\r\n\r\nphp ext: https://github.com/jonnywang/phone\r\n\r\njava: https://github.com/fengjiajie/phone-number-geo , https://github.com/EeeMt/phone-number-geo\r\n\r\nNode: https://github.com/conzi/phone\r\n\r\nC++: https://github.com/yanxijian/phonedata\r\n\r\nC#: https://github.com/sndnvaps/Phonedata ,  https://github.com/rwecho/Phone.Dotnet.git (dotnet core)\r\n\r\nRust: https://github.com/vincascm/phonedata\r\n\r\nKotlin: https://github.com/bytebeats/phone-geo\r\n\r\nRuby: https://github.com/forwaard/phonedata\r\n\r\n### 安全保证\r\n\r\n手机号归属地信息是通过网上公开数据进行收集整理。\r\n\r\n对手机号归属地信息数据的绝对正确，我不做任何保证。因此在生产环境使用前请您自行校对测试。\r\n\r\n\r\n### 客户案例\r\n\r\n- [360](https://www.360.cn/)\r\n- [MAGAPP](http://www.magapp.cc/)\r\n- ...\r\n\r\n### 感谢\r\n@ls0f https://github.com/ls0f\r\n\r\n@zhengji  https://github.com/zheng-ji/gophone\r\n\r\n### 联系作者\r\n\r\n加作者微信\r\n\r\n![wx.jpg](https://ucc.alicdn.com/pic/developer-ecology/f41fd688affb41fc8853c4f99abd3d45.jpg)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxluohome%2Fphonedata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxluohome%2Fphonedata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxluohome%2Fphonedata/lists"}