plugin/haisou/json结构分析.md
https://haisou.cc/api/pan/share/search (搜索API)https://haisou.cc/api/pan/share/{hsid}/fetch (链接获取API)GETapplication/jsonGET https://haisou.cc/api/pan/share/search?query={keyword}&scope=title&pan={type}&page={page}&filter_valid=true&filter_has_files=false
| 参数名 | 类型 | 必需 | 默认值 | 说明 |
|---|---|---|---|---|
query | string | 是 | - | 搜索关键词,需要URL编码 |
scope | string | 否 | "title" | 搜索范围,固定为"title" |
pan | string | 否 | 全部 | 网盘类型过滤 |
page | int | 否 | 1 | 页码,从1开始 |
filter_valid | bool | 否 | true | 过滤有效链接 |
filter_has_files | bool | 否 | false | 过滤包含文件的分享 |
GET https://haisou.cc/api/pan/share/{hsid}/fetch
| 参数名 | 类型 | 必需 | 说明 |
|---|---|---|---|
hsid | string | 是 | 从搜索结果中获取的海搜ID |
{
"code": 0,
"msg": null,
"data": {
"query": "凡人修仙传",
"count": 64,
"time": 3,
"pages": 7,
"page": 1,
"list": [
{
"hsid": "nlSwOaKeLW",
"platform": "tianyi",
"share_name": "\u003Cspan class=\"highlight\"\u003E凡人\u003C/span\u003E\u003Cspan class=\"highlight\"\u003E修仙\u003C/span\u003E\u003Cspan class=\"highlight\"\u003E传\u003C/span\u003E",
"stat_file": 65,
"stat_size": 81843197420
}
]
}
}
| 字段名 | 类型 | 说明 |
|---|---|---|
code | int | 状态码,0表示成功 |
msg | string/null | 错误信息,成功时为null |
| 字段名 | 类型 | 说明 |
|---|---|---|
query | string | 搜索关键词 |
count | int | 搜索结果总数 |
time | int | 搜索耗时(毫秒) |
pages | int | 总页数 |
page | int | 当前页码 |
list | array | 搜索结果列表 |
{
"hsid": "nlSwOaKeLW",
"platform": "tianyi",
"share_name": "\u003Cspan class=\"highlight\"\u003E凡人\u003C/span\u003E\u003Cspan class=\"highlight\"\u003E修仙\u003C/span\u003E\u003Cspan class=\"highlight\"\u003E传\u003C/span\u003E",
"stat_file": 65,
"stat_size": 81843197420
}
| 字段名 | 类型 | 必需 | 说明 |
|---|---|---|---|
hsid | string | 是 | 海搜ID,用于获取具体链接 |
platform | string | 是 | 网盘类型标识 |
share_name | string | 是 | 分享名称,可能包含HTML高亮标签 |
stat_file | int | 是 | 文件数量 |
stat_size | int64 | 是 | 总大小(字节) |
{
"code": 0,
"msg": null,
"data": {
"share_code": "RBRniaAVJbEb",
"share_pwd": null
}
}
| 字段名 | 类型 | 必需 | 说明 |
|---|---|---|---|
code | int | 是 | 状态码,0表示成功 |
msg | string/null | 否 | 错误信息,成功时为null |
data.share_code | string | 是 | 网盘分享码 |
data.share_pwd | string/null | 否 | 网盘提取密码,可能为null |
| 网盘类型 | API标识 | 域名特征 | 链接格式 |
|---|---|---|---|
| 阿里云盘 | ali | alipan.com | https://www.alipan.com/s/{share_code} |
| 百度网盘 | baidu | pan.baidu.com | https://pan.baidu.com/s/{share_code} |
| 夸克网盘 | quark | pan.quark.cn | https://pan.quark.cn/s/{share_code} |
| 迅雷网盘 | xunlei | pan.xunlei.com | https://pan.xunlei.com/s/{share_code} |
| 天翼云盘 | tianyi | cloud.189.cn | https://cloud.189.cn/t/{share_code} |
share_name 字段包含HTML高亮标签<span class="highlight">关键词</span>pages 字段判断总页数hsid 列表pan 参数返回所有类型结果type SearchAPIResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Query string `json:"query"`
Count int `json:"count"`
Time int `json:"time"`
Pages int `json:"pages"`
Page int `json:"page"`
List []ShareItem `json:"list"`
} `json:"data"`
}
type ShareItem struct {
HSID string `json:"hsid"` // 海搜ID
Platform string `json:"platform"` // 网盘类型
ShareName string `json:"share_name"` // 分享名称
StatFile int `json:"stat_file"` // 文件数量
StatSize int64 `json:"stat_size"` // 总大小
}
type FetchAPIResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
ShareCode string `json:"share_code"` // 分享码
SharePwd *string `json:"share_pwd"` // 密码
} `json:"data"`
}
// 根据平台类型和分享码构建完整链接
func buildShareURL(platform, shareCode string) string {
switch strings.ToLower(platform) {
case "ali":
return fmt.Sprintf("https://www.alipan.com/s/%s", shareCode)
case "baidu":
return fmt.Sprintf("https://pan.baidu.com/s/%s", shareCode)
case "quark":
return fmt.Sprintf("https://pan.quark.cn/s/%s", shareCode)
case "xunlei":
return fmt.Sprintf("https://pan.xunlei.com/s/%s", shareCode)
case "tianyi":
return fmt.Sprintf("https://cloud.189.cn/t/%s", shareCode)
default:
return ""
}
}
// 清理HTML高亮标签
func cleanHTMLTags(text string) string {
// 移除高亮标签
re := regexp.MustCompile(`<span[^>]*class="highlight"[^>]*>(.*?)</span>`)
cleaned := re.ReplaceAllString(text, "$1")
// 移除其他HTML标签
re2 := regexp.MustCompile(`<[^>]*>`)
cleaned = re2.ReplaceAllString(cleaned, "")
return strings.TrimSpace(cleaned)
}
curl "https://haisou.cc/api/pan/share/search?query=%E5%87%A1%E4%BA%BA%E4%BF%AE%E4%BB%99%E4%BC%A0&scope=title&pan=tianyi&page=1&filter_valid=true&filter_has_files=false"
curl "https://haisou.cc/api/pan/share/nlSwOaKeLW/fetch"