{"id":13815384,"url":"https://github.com/ls0f/phone","last_synced_at":"2026-01-03T21:12:00.469Z","repository":{"id":17590170,"uuid":"20393757","full_name":"ls0f/phone","owner":"ls0f","description":"手机号码归属地库","archived":false,"fork":false,"pushed_at":"2023-12-25T04:07:06.000Z","size":7076,"stargazers_count":939,"open_issues_count":2,"forks_count":222,"subscribers_count":55,"default_branch":"master","last_synced_at":"2024-03-25T18:16:51.582Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/ls0f/phone","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"open-guides/og-aws","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ls0f.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2014-06-02T05:07:06.000Z","updated_at":"2024-03-25T02:34:42.000Z","dependencies_parsed_at":"2022-07-13T04:31:27.612Z","dependency_job_id":"4a444689-552c-4299-8b53-e9a19cf4859d","html_url":"https://github.com/ls0f/phone","commit_stats":{"total_commits":35,"total_committers":12,"mean_commits":"2.9166666666666665","dds":0.6285714285714286,"last_synced_commit":"e8d0e70fceb6bc7fd7072ec89811cc4f0b284078"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ls0f%2Fphone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ls0f%2Fphone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ls0f%2Fphone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ls0f%2Fphone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ls0f","download_url":"https://codeload.github.com/ls0f/phone/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225342756,"owners_count":17459462,"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":[],"created_at":"2024-08-04T04:03:25.187Z","updated_at":"2026-01-03T21:12:00.423Z","avatar_url":"https://github.com/ls0f.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/lovedboy/phone.svg?branch=master)](https://travis-ci.org/lovedboy/phone)\n\n## 手机号码库\n\n#### 安装\n\n使用pip安装:\n\n```\npip install phone\n\n```\n或者直接clone源码。\n\n使用：\n\n```\nfrom phone import Phone\np  = Phone()\np.find(1888888)\n```\n\n### 支持号段\n13\\*,15\\*,18\\*,14[5,7],17[0,6,7,8], 19[2,3,7,9]\n\n#### 记录条数\n\n499527 (updated:2023年12月)\n\n#### 其他语言支持\n\n下载[phone.dat](https://github.com/lovedboy/phone/raw/master/phone/phone.dat)文件，用其他语言解析即可。\n\n* [lua解析](https://gist.github.com/lovedboy/bbff19c91e3d98388d52)，如果不支持bit32，用[这个](https://gist.github.com/lovedboy/fe7750e202572712615a)\n* [go解析](https://github.com/xluohome/phonedata)\n* [Node解析](https://github.com/conzi/phone)\n* [PHP解析](https://github.com/shitoudev/phone-location)\n\n#### phone.dat文件格式\n\n```\n\n        | 4 bytes |                     \u003c- phone.dat 版本号\n        ------------\n        | 4 bytes |                     \u003c-  第一个索引的偏移\n        -----------------------\n        |  offset - 8            |      \u003c-  记录区\n        -----------------------\n        |  index                 |      \u003c-  索引区\n        -----------------------\n\n```\n\n* `头部` 头部为8个字节，版本号为4个字节，第一个索引的偏移为4个字节(\u003c4si)。      \n* `记录区` 中每条记录的格式为\"\\\u003c省份\\\u003e|\\\u003c城市\\\u003e|\\\u003c邮编\\\u003e|\\\u003c长途区号\\\u003e\\0\"。 每条记录以'\\0'结束。  \n* `索引区` 中每条记录的格式为\"\u003c手机号前七位\u003e\u003c记录区的偏移\u003e\u003c卡类型\u003e\"，每个索引的长度为9个字节(`\u003ciiB`)。\n\n解析步骤:\n\n * 解析头部8个字节，得到索引区的第一条索引的偏移。\n * 在索引区用二分查找得出手机号在记录区的记录偏移。\n * 在记录区从上一步得到的记录偏移处取数据，直到遇到'\\0'。\n \n我定义的卡类型为:\n\n* 1 移动\n* 2 联通\n* 3 电信\n* 4 电信虚拟运营商\n* 5 联通虚拟运营商\n* 6 移动虚拟运营商\n\n## License\n#### [MIT](https://opensource.org/licenses/mit-license.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fls0f%2Fphone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fls0f%2Fphone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fls0f%2Fphone/lists"}