fix: 所有默认脚本添加 import groovy.xml.XmlSlurper,nexusphp 补上 download 页面处理
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
// 适用: RED / OPS / BHD / PTP 等 Gazelle 架构站点
|
||||
// 覆盖: 搜索 / 种子详情 / 首页
|
||||
|
||||
import groovy.xml.XmlSlurper
|
||||
|
||||
Map parse(String content, String url) {
|
||||
def doc = jsoup.parse(content)
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 适用: M-Team 及其 API 兼容站点
|
||||
// 覆盖: 用户信息 / 做种统计 / 搜索
|
||||
|
||||
import groovy.xml.XmlSlurper
|
||||
|
||||
final String API_BASE = "https://api.m-team.io"
|
||||
|
||||
Map parse(String content, String url) {
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
// NexusPHP 站点默认脚本
|
||||
// 适用: PThome / HDSky / HDFans / OurBits 等
|
||||
|
||||
import groovy.xml.XmlSlurper
|
||||
|
||||
Map parse(String content, String url) {
|
||||
def doc = Jsoup.parse(content)
|
||||
|
||||
if (url.contains('/torrents.php')) return parseSearch(doc)
|
||||
if (url.contains('/details.php')) return parseDetail(doc)
|
||||
if (url.contains('/attendance.php')) return parseSign(doc)
|
||||
if (url.contains('/download.php')) return parseDownload(content)
|
||||
if (url.contains('/index.php') && !url.contains('?')) return parseUserInfo(doc)
|
||||
if (url.contains('/usercp.php')) return parseUserPanel(doc)
|
||||
if (url.contains('/torrentrss.php') || url.contains('/rss')) return parseRss(content)
|
||||
@@ -14,6 +17,17 @@ Map parse(String content, String url) {
|
||||
return [pageName: '未知页面', message: "未配置: ${url}"]
|
||||
}
|
||||
|
||||
private Map parseDownload(String content) {
|
||||
if (!content || content.length() < 100) return [pageName: '下载', matched: false, message: '内容过短']
|
||||
def isTorrent = content.startsWith('d8:announce') || content.startsWith('d13:announce-list')
|
||||
if (!isTorrent) {
|
||||
def doc = Jsoup.parse(content)
|
||||
def title = doc.title()
|
||||
return [pageName: '下载', matched: false, message: title ? "非 torrent 文件: ${title}" : '非 torrent 文件']
|
||||
}
|
||||
return [pageName: '下载', matched: true, fields: [fileSize: content.length(), isTorrent: true], message: "torrent ${content.length() / 1024}KB"]
|
||||
}
|
||||
|
||||
private Map parseRss(String xml) {
|
||||
if (!xml) return [pageName: 'RSS', matched: false, message: '无内容']
|
||||
try {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 适用: BLU / TL / ACM 等 UNIT3D 架构站点(HTML + 可选 API)
|
||||
// 覆盖: 搜索 / 种子详情 / 首页
|
||||
|
||||
import groovy.xml.XmlSlurper
|
||||
|
||||
Map parse(String content, String url) {
|
||||
def doc = jsoup.parse(content)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user