沿 HTTP 重定向(301/302/307/308)与 HTML meta-refresh 两条链路逐跳追踪到最终地址,完整记录每一跳的状态码与 URL,并顺手提取落地页 <title> 与 og:url。内置 SSRF 防护(每一跳都校验,内网/保留地址直接拒绝)、浏览器级请求头应对短链平台反爬,最多 10 跳封顶。适合查「微博/短信里的短链接到底指向哪」。
安全说明:每一跳都会重新做内网/保留地址校验,短链跳转到 127.0.0.1、169.254.169.254 等地址会被中途拦截并返回已追踪到的链路。
https://rainapi.top/api/unshort在本站内直接调用 /api/unshort 即可;跨站调用请使用上方完整地址。响应头包含Access-Control-Allow-Origin: *,浏览器可 fetch。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| url 例: https://t.cn/A6Zxxxxx | string | 必填 | 要展开的短链或跳转地址,可省略协议(自动补 http://) |
| 字段 | 类型 | 说明 |
|---|---|---|
| final / finalHost | string | 最终落地地址与主机名 |
| hops | array | 逐跳记录 [{status, url}],含 meta-refresh 跳(status 200) |
| count | number | 跳数 |
| title / ogUrl | string | 落地页标题与 canonical(og:url),可能为空 |
GET /api/unshort?url=https%3A%2F%2Fhttpbin.org%2Fredirect%2F2{
"code": 200,
"final": "https://httpbin.org/get",
"finalHost": "httpbin.org",
"count": 3,
"hops": [
{
"status": 302,
"url": "https://httpbin.org/redirect/2"
},
{
"status": 302,
"url": "https://httpbin.org/redirect/1"
},
{
"status": 200,
"url": "https://httpbin.org/get"
}
]
}| HTTP | code | 含义 |
|---|---|---|
| 400 | 400 | 缺少 url 参数或 URL 无效 |
| 403 | 403 | 某一跳指向内网/保留地址(SSRF 拦截),附已走过的 hops |
| 429 | 429 | 超出频率限制(探测型接口,配额较严) |
| 502 | 502 | 某一跳请求失败(超时/断连),附已走过的 hops |
Retry-After: 30公开服务面向零散调用与轻量场景。批量任务请自行加入退避(收到 429 后等待 Retry-After 秒再重试), 或先本地缓存已查询过的结果。持续高频使用建议申请独立配额(未来提供)。
curl -s 'https://rainapi.top/api/unshort?url=https://t.cn/A6Zxxxxx' # 看某链接的完整跳转链 curl -s 'https://rainapi.top/api/unshort' --get --data-urlencode 'url=https://httpbin.org/redirect/3'