收录了几个免费的IP地址查询接口,网上搜罗了一番发现有些已经阵亡了,但是以下收录的截止目前(2021.04.14)都是有效的;

淘宝

官网
注意:请求限制1QPS

GET https://ip.taobao.com/outGetIpInfo?ip=39.156.69.79

响应体:

{
    "data": {
        "area": "",
        "country": "中国",
        "isp_id": "100025",
        "queryIp": "39.156.69.79",
        "city": "北京",
        "ip": "39.156.69.79",
        "isp": "移动",
        "county": "",
        "region_id": "110000",
        "area_id": "",
        "county_id": null,
        "region": "北京",
        "country_id": "CN",
        "city_id": "110100"
    },
    "msg": "query success",
    "code": 0
}

IP-API

可国际化查询(即获得不同语言的结果),但是我试了下貌似地理位置不准确

GET http://ip-api.com/json/
GET http://ip-api.com/json/39.156.69.79?lang=zh-CN	# 获得中文的IP信息

响应体:

{
    "status": "success",
    "country": "中国",
    "countryCode": "CN",
    "region": "GD",
    "regionName": "广东",
    "city": "深圳市",
    "zip": "",
    "lat": 22.5431,
    "lon": 114.058,
    "timezone": "Asia/Shanghai",
    "isp": "China Mobile",
    "org": "China Mobile",
    "as": "AS9808 Guangdong Mobile Communication Co.Ltd.",
    "query": "39.156.69.79"
}

搜狐

返回的是字符串

GET http://pv.sohu.com/cityjson?ie=utf-8?ip=39.156.69.79

响应体:

var returnCitySN = {"cip": "36.142.169.192", "cid": "CN", "cname": "CHINA"};
GET http://txt.go.sohu.com/ip/soip?ip=39.156.69.79

响应体:

String.prototype.getQueryString=function(v){var reg=new RegExp("(^|&|\\?)" + v + "=([^&]*)(&|$)"), r;if(r=this.match(reg)){return unescape(r[2]);}return null;};var sohu_IP_Loc="unknown",LocUrl=document.location.href;if((LocUrl.indexOf("sohusce.com") >= 0)||(LocUrl.indexOf("sohu.com") >= 0)||(LocUrl.indexOf("chinaren.com") >= 0)||(LocUrl.indexOf("17173.com") >= 0)||(LocUrl.indexOf("focus.cn") >= 0)){window.sohu_user_ip="36.142.169.192";sohu_IP_Loc="CN429000";sohu_IP_Loc_V="CN";}var AdLoc2=sohu_IP_Loc.substr(0,2),AdLoc4=sohu_IP_Loc.substr(0,4),AdLoc6=sohu_IP_Loc.substr(0,6);if(window.location.href.getQueryString("ip"))sohu_IP_Loc=AdLoc2=AdLoc4=AdLoc6=window.location.href.getQueryString("ip");

IPIP.NET

只会返回地理位置,这家同时有收费的,在下面

GET http://freeapi.ipip.net/39.156.69.79

响应体:

[
    "中国",
    "北京",
    "北京",
    "",
    ""
]

收费版

百度智能云

详情
应该可以免费领取1000次调用且支持IPV6查询,百度的查的最顶,可以查到县级(虽然并不一定准确)
20210414FgEpPP9pEb8eq64F-1xwY085tL8r
阿里云也有这项服务,但是价格比百度贵,而且IPV6需要购买另外的版本

IPIP.NET

详情

GET http://ipapi.ipip.net/find?addr=118.28.8.8

20210414Fi-0VAJtZU2pfON2cSAPTpL27cKF