mirror of
https://github.com/SocialSisterYi/bilibili-API-collect.git
synced 2024-12-27 13:00:29 +08:00
60a0c5d1a2
* fix(video/collection.md): unclosed xml tags * feat(video/report.md): uuid not really random * feat: b23.tv short link * feat: login/moral/exp log * feat: v_voucher * feat: upload video cover & post * feat(creativecenter/upload.md): upload octet-stream * feat(creativecenter/upload.md): update some notes * feat(clientinfo/ip.md): another from live * feat: live web heartbeat * feat: update popular series & precious * fix(creativecenter/upload.md): mistakes in example * feat: merge duplicate fav info * feat(README.md): missing link to webmask * feat(search/hot.md): word_type * feat(login/login_action): recovery old api * feat(video/collection.md): series operation * feat: video season operation * feat: add & mod some links * feat(search/suggest.md): up to date * feat: web home header image * feat(misc/sign/bili_ticket.md): demo for nodejs * feat(creativecenter/upload.md): x-upos-auth validity period * feat: add referer & buvid3 to request header * feat: customer service message heartbeat & upload * feat(customerservice/msg.md): upload code 1200201 * feat(video/report.md): click/web/h5 * feat(video/report.md): view count desc * feat: laser2 * feat: wbi_key in bili_ticket * fix: typo & unclosed XML tags * feat(misc/sign/v_voucher): cookie x-bili-gaia-vtoken * feat(search/hot.md): square * feat(video/status_number.md): fold archive_stat/stat * feat(fav/info.md): resource/infos invalid type 21 * feat: /x/activity/subject/info * feat: lottery * feat(docs/misc/b23.tv): remove some unnecessary fields * feat(creativecenter/upload.md): types/predict * fix(video/collection.md): invalid end tag * feat: app version upgrade * feat(creativecenter/upload.md): tag/recommend #528 * feat(user/status_number.md): navnum * feat: /x/activity/page/list * feat(comment/list.md): desc about pagination_str * feat(comment/list.md): update example * feat(dynamic/all.md): #1082 * fix(comment/list.md): -352 not -412 * feat: #700 * feat(video/video_stream.md): #606 & cv949156 * feat(message/private_msg.md): single_unread freq * feat: getUserWallet * fix: broken form * feat(Layout.vue): copyright to 2024 * feat: /x/topic/pub/rcmd/search * feat: #425 * feat(misc/time_stamp.md): rtc/getTimestamp * fix(misc/time_stamp.md): missing end tag * feat: #745 * feat(dynamic/all.md): update feed/all * feat(danmaku/action.md): #220 * feat(live/info.md): gethistory from cv8186413 * fix(danmaku/action.md): missing end tag
156 lines
3.5 KiB
Markdown
156 lines
3.5 KiB
Markdown
# 通过ip确定地理位置
|
||
|
||
## 根据请求IP确定属地
|
||
|
||
> https://api.bilibili.com/x/web-interface/zone
|
||
>
|
||
> https://api.live.bilibili.com/xlive/web-room/v1/index/getIpInfo
|
||
|
||
*请求方式:GET*
|
||
|
||
**json回复:**
|
||
|
||
根对象:
|
||
|
||
| 字段 | 类型 | 内容 | 备注 |
|
||
| ------- | ---- | -------- | ------- |
|
||
| code | num | 返回值 | 0:成功 |
|
||
| message | str | 错误信息 | 默认为0 |
|
||
| ttl | num | 1 | |
|
||
| data | obj | 信息本体 | |
|
||
|
||
`data`对象:
|
||
|
||
| 字段 | 类型 | 内容 | 备注 |
|
||
| ------------ | ---- | ------------- | ------------ |
|
||
| addr | str | 公网IP地址 | |
|
||
| country | str | 国家/地区名 | |
|
||
| province | str | 省/州 | 非必须存在项 |
|
||
| city | str | 城市 | 非必须存在项 |
|
||
| isp | str | 运营商名 | |
|
||
| latitude | num | 纬度 | |
|
||
| longitude | num | 经度 | |
|
||
| zone_id | num | ip数据库id | 第二个接口无 |
|
||
| country_code | num | 国家/地区代码 | 第二个接口无 |
|
||
|
||
**示例:**
|
||
|
||
```shell
|
||
curl 'https://api.bilibili.com/x/web-interface/zone'
|
||
```
|
||
|
||
<details>
|
||
<summary>查看响应示例:</summary>
|
||
|
||
```json
|
||
{
|
||
"code":0,
|
||
"message":"0",
|
||
"ttl":1,
|
||
"data":{
|
||
"addr":"36.40.120.145",
|
||
"country":"中国",
|
||
"province":"陕西",
|
||
"city":"渭南",
|
||
"isp":"电信",
|
||
"latitude":34.4995,
|
||
"longitude":109.492821,
|
||
"zone_id":4472912,
|
||
"country_code":86
|
||
}
|
||
}
|
||
```
|
||
|
||
</details>
|
||
|
||
## 查询任意 IP 地址的归属地
|
||
|
||
> https://api.live.bilibili.com/ip_service/v1/ip_service/get_ip_addr
|
||
> https://api.live.bilibili.com/client/v1/Ip/getInfoNew
|
||
|
||
注: 以上接口等效
|
||
|
||
*请求方式:GET*
|
||
|
||
**URL参数:**
|
||
|
||
|
||
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
|
||
| ------ | ---- | -------- | ------ | ---- |
|
||
| ip | str | IP地址 | 不必要 | IPv4或IPv6地址不限, 留空与[根据请求IP确定地理位置](#根据请求ip确定地理位置)基本相同 |
|
||
|
||
**JSON回复:**
|
||
|
||
根对象:
|
||
|
||
| 字段 | 类型 | 内容 | 备注 |
|
||
| ------- | ---- | -------- | ------- |
|
||
| code | num | 返回值 | 0: 成功 |
|
||
| message | str | 错误信息 | 默认为空 |
|
||
| msg | str | 错误信息 | 同message |
|
||
| data | obj | 信息本体 | 出错时为空数组 |
|
||
|
||
`data`对象:
|
||
|
||
与[根据请求IP确定地理位置](#根据请求ip确定地理位置)回复的`data`对象基本相同, 但无 `zone_id` `country_code` 字段
|
||
|
||
**示例:**
|
||
|
||
查询请求IP地址的归属地:
|
||
|
||
```shell
|
||
curl -G 'https://api.live.bilibili.com/client/v1/Ip/getInfoNew'
|
||
```
|
||
|
||
<details>
|
||
<summary>查看响应示例:</summary>
|
||
|
||
|
||
```json
|
||
{
|
||
"code": 0,
|
||
"msg": "",
|
||
"message": "",
|
||
"data": {
|
||
"addr": "104.28.156.113",
|
||
"country": "新加坡",
|
||
"province": "新加坡",
|
||
"city": "",
|
||
"isp": "cloudflare.com",
|
||
"latitude": "1.352083",
|
||
"longitude": "103.819836"
|
||
}
|
||
}
|
||
```
|
||
|
||
</details>
|
||
|
||
查询IP地址`8.8.8.8`的归属地:
|
||
|
||
```shell
|
||
curl -G 'https://api.live.bilibili.com/ip_service/v1/ip_service/get_ip_addr' \
|
||
--data-urlencode 'ip=8.8.8.8'
|
||
```
|
||
|
||
<details>
|
||
<summary>查看响应示例:</summary>
|
||
|
||
```json
|
||
{
|
||
"code": 0,
|
||
"msg": "",
|
||
"message": "",
|
||
"data": {
|
||
"addr": "8.8.8.8",
|
||
"country": "GOOGLE.COM",
|
||
"province": "GOOGLE.COM",
|
||
"city": "",
|
||
"isp": "level3.com",
|
||
"latitude": "",
|
||
"longitude": ""
|
||
}
|
||
}
|
||
```
|
||
|
||
</details>
|