plugin/xiaoji/html结构分析.md
www.xiaojitv.comhttps://www.xiaojitv.com/?s={关键词}https://www.xiaojitv.com/{ID}.html搜索结果页面使用poster布局,主要内容位于.poster-grid元素内:
<div class="poster-grid">
<article class="poster-item excerpt-1">
<!-- 单个搜索结果 -->
</article>
<article class="poster-item excerpt-2">
<!-- 单个搜索结果 -->
</article>
<!-- 更多搜索结果... -->
</div>
每个搜索结果包含以下主要元素:
<div class="poster-image">
<a class="poster-link" href="https://www.xiaojitv.com/656.html">
</a>
<div class="poster-top-left"></div>
<div class="poster-rating poster-top-right">
<span class="rating-score">7.9</span>
</div>
<div class="poster-category poster-bottom-left">
<a href="https://www.xiaojitv.com/dongman">动漫</a>
</div>
<div class="poster-views">阅读(<span class="ajaxlistpv" data-id="656"></span>)</div>
</div>
<div class="poster-content">
<h2 class="poster-title">
<a href="https://www.xiaojitv.com/656.html" title="凡人修仙传(2020) | 小鸡影视">
凡人修仙传(2020)
</a>
</h2>
<div class="poster-tags">
<a href="https://www.xiaojitv.com/tag/2020年">2020年</a> /
<a href="https://www.xiaojitv.com/tag/7-9分">7.9分</a> /
<a href="https://www.xiaojitv.com/tag/中国大陆">中国大陆</a> /
<a href="https://www.xiaojitv.com/tag/动画">动画</a> /
<a href="https://www.xiaojitv.com/tag/奇幻">奇幻</a>
</div>
</div>
详情页面包含完整的影片信息和网盘下载链接。
<h1 class="article-title">
<a href="https://www.xiaojitv.com/656.html">凡人修仙传(2020)</a>
</h1>
网盘下载链接位于相关资源区域,这是xiaoji插件的核心提取目标:
<div class="cloud-search-resource-results" data-post-id="656">
<div class="cloud-search-resource-header">
<h3>相关资源</h3>
<!-- 操作按钮 -->
</div>
<!-- 资源列表 -->
<div class="resource-compact-item">
<div class="resource-compact-link">
<a href="https://www.xiaojitv.com/go.html?url=aHR0cHM6Ly9wYW4ucXVhcmsuY24vcy9kNjQ5MWJmZWQxNmI="
target="_blank" rel="nofollow">
凡人修仙传 2024 4K 持续更新中
</a>
</div>
<div class="resource-compact-info">
<span class="resource-compact-source">聚合盘</span>
</div>
</div>
<div class="resource-compact-item">
<div class="resource-compact-link">
<a href="https://www.xiaojitv.com/go.html?url=aHR0cHM6Ly9jbG91ZC4xODkuY24vdC9JYmFVVnpFN1puZXk="
target="_blank" rel="nofollow">
凡人修仙传 2024 4K 持续更新中 txb
</a>
</div>
<div class="resource-compact-info">
<span class="resource-compact-source">小愛盘②</span>
</div>
</div>
<!-- 更多资源... -->
</div>
xiaoji网站使用特殊的链接保护机制:
原始链接格式:
https://www.xiaojitv.com/go.html?url=aHR0cHM6Ly9wYW4ucXVhcmsuY24vcy9kNjQ5MWJmZWQxNmI=
提取步骤:
aHR0cHM6Ly9wYW4ucXVhcmsuY24vcy9kNjQ5MWJmZWQxNmI=https://pan.quark.cn/s/d6491bfed16barticle.poster-item元素.poster-link的href属性提取详情页链接/(\d+)\.html).poster-title a提取标题.poster-rating .rating-score提取评分.poster-category a提取分类.poster-image img的src属性提取封面图片URL.poster-tags a提取标签信息获取资源基本信息:
.article-title a的文本内容提取网盘链接 ⭐ 核心逻辑:
// 1. 查找所有资源链接
doc.Find(".resource-compact-link a").Each(func(i int, s *goquery.Selection) {
href, exists := s.Attr("href")
if !exists {
return
}
var realURL string
// 2. 检查链接类型并处理
if strings.Contains(href, "/go.html?url=") {
// Base64编码链接,需要解码
parts := strings.Split(href, "url=")
if len(parts) == 2 {
encoded := parts[1]
decoded, err := base64.StdEncoding.DecodeString(encoded)
if err == nil {
realURL = string(decoded)
}
}
} else if strings.HasPrefix(href, "http://") || strings.HasPrefix(href, "https://") ||
strings.HasPrefix(href, "magnet:") || strings.HasPrefix(href, "ed2k://") {
// 直接链接,无需解码
realURL = href
}
// 3. 处理有效链接
if realURL != "" {
link := model.Link{
Type: determineCloudType(realURL),
URL: realURL,
Password: "", // xiaoji网站通常无密码
}
links = append(links, link)
}
})
提取资源描述:
.resource-compact-link a的文本内容.resource-compact-source的文本内容根据分析,xiaoji网站支持多种网盘类型:
https://pan.quark.cn/s/xxxxxhttps://cloud.189.cn/t/xxxxxhttps://www.alipan.com/s/xxxxxhttps://pan.baidu.com/s/xxxxxhttps://115.com/s/xxxxx、https://115cdn.com/s/xxxxxhttps://url91.ctfile.com/f/xxxxx (归类到others)magnet:?xt=urn:btih:xxxxxed2k://xxxxx网站使用base64编码保护真实的网盘链接,这是xiaoji插件的最大特点:
/go.html?url={base64字符串}使用现代的poster布局,与传统的列表布局不同:
页面可能使用了AJAX动态加载:
网站可能有一定的反爬虫措施:
| 字段 | HTML位置 | 提取方法 |
|---|---|---|
| 标题 | .poster-title a | 文本内容 |
| 详情页链接 | .poster-link | href属性 |
| 资源ID | 详情页URL | 正则提取 |
| 封面图片 | .poster-image img | src属性 |
| 评分 | .rating-score | 文本内容 |
| 分类 | .poster-category a | 文本内容 |
| 标签 | .poster-tags a | 文本内容数组 |
| 网盘链接 | .resource-compact-link a | href属性(需base64解码) |
| 资源描述 | .resource-compact-link a | 文本内容 |
| 资源来源 | .resource-compact-source | 文本内容 |
determineCloudType函数