Compare commits
6 Commits
mteam-1.0.
...
nexusphp-1
| Author | SHA1 | Date | |
|---|---|---|---|
| 325e46d90c | |||
| 45559f31b8 | |||
| 40c4c700e6 | |||
| 1cdd48b225 | |||
| c408126e89 | |||
| 3c476b977b |
@@ -168,7 +168,7 @@ function parseSearch(items) {
|
||||
var row = {
|
||||
id: it.id !== undefined && it.id !== null ? String(it.id) : '',
|
||||
title: it.name || '',
|
||||
subTitle: it.smallDescr || '',
|
||||
subtitle: it.smallDescr || '',
|
||||
size: size,
|
||||
seeders: __toInt(st.seeders),
|
||||
leechers: __toInt(st.leechers),
|
||||
@@ -355,4 +355,92 @@ function download(input) {
|
||||
} catch (e) {
|
||||
return { error: String((e && e.message) || e), url: url };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===================== 能力: rss(RSS/Atom 解析)=====================
|
||||
// ctx: { baseUrl, feedUrl }
|
||||
// mteam 没有通用 RSS 端点 (签名算法不可预知), 用户需从 /rss 页面复制完整 RSS URL,
|
||||
// 填到 RssSubscription.Url 字段 (→ ctx.feedUrl).
|
||||
// NexusPHP 类站点: getrss.php / torrentrss.php 两种命名, 脚本 rss() 里兼容.
|
||||
// 返回: [{ title, detailUrl, downloadUrl, description, pubDate, guid }] 或 { error }
|
||||
function rss(ctx) {
|
||||
var base = String(ctx.baseUrl || '').replace(/\/+$/, '');
|
||||
var apiUrl = String(ctx.apiUrl || (base ? base + '/api' : '')).replace(/\/+$/, '');
|
||||
var url = ctx.feedUrl ? String(ctx.feedUrl) : '';
|
||||
|
||||
// 用户没手动填 feedUrl → 尝试 POST /rss/genlink 自动生成
|
||||
if (!url && apiUrl) {
|
||||
var apiKey = ctx.apiKey || ctx.xApiKey;
|
||||
var genResult = __apiPost(apiUrl, '/rss/genlink', {}, apiKey);
|
||||
if (genResult && genResult.code === 0 && genResult.data) {
|
||||
var d = genResult.data;
|
||||
if (typeof d === 'string' && d.length > 0) {
|
||||
url = d;
|
||||
} else if (typeof d === 'object' && d !== null) {
|
||||
url = d.url || d.link || d.rssUrl || d.feedUrl || d.linkUrl || '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!url) return { error: 'rss_url_required', hint: '请从 /rss 页面复制完整 RSS URL 到 RssSubscription, 或确认 Cookie/apiKey 有效' };
|
||||
|
||||
var xml;
|
||||
try {
|
||||
xml = http.get(url);
|
||||
} catch (e) {
|
||||
return { error: String((e && e.message) || e), url: url };
|
||||
}
|
||||
if (!xml) return { error: 'empty_feed', url: url };
|
||||
|
||||
var items = [];
|
||||
|
||||
function tag(block, name) {
|
||||
var m = block.match(new RegExp('<' + name + '[^>]*>([\\s\\S]*?)<\\/' + name + '>', 'i'));
|
||||
return m ? m[1].replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, '$1').trim() : '';
|
||||
}
|
||||
|
||||
// RSS 2.0: <item>
|
||||
var blocks = xml.match(/<item[\s\S]*?<\/item>/gi);
|
||||
if (blocks) {
|
||||
for (var i = 0; i < blocks.length; i++) {
|
||||
var b = blocks[i];
|
||||
var encMatch = b.match(/<enclosure[^>]*>/i);
|
||||
var encUrl = '';
|
||||
if (encMatch) {
|
||||
var u = encMatch[0].match(/url=["'']([^"'']*)["'']/i);
|
||||
if (u) encUrl = u[1];
|
||||
}
|
||||
items.push({
|
||||
title: tag(b, 'title'),
|
||||
detailUrl: tag(b, 'link'),
|
||||
downloadUrl: encUrl || tag(b, 'link'),
|
||||
description: tag(b, 'description'),
|
||||
pubDate: tag(b, 'pubDate'),
|
||||
guid: tag(b, 'guid') || tag(b, 'link')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Atom: <entry>
|
||||
var atomBlocks = xml.match(/<entry[\s\S]*?<\/entry>/gi);
|
||||
if (atomBlocks) {
|
||||
for (var j = 0; j < atomBlocks.length; j++) {
|
||||
var a = atomBlocks[j];
|
||||
var linkMatch = a.match(/<link[^>]*href=["'']([^"'']*)["''][^>]*>/i);
|
||||
var link = linkMatch ? linkMatch[1] : tag(a, 'link');
|
||||
items.push({
|
||||
title: tag(a, 'title'),
|
||||
detailUrl: link,
|
||||
downloadUrl: link,
|
||||
description: tag(a, 'summary') || tag(a, 'content'),
|
||||
pubDate: tag(a, 'updated') || tag(a, 'published'),
|
||||
guid: tag(a, 'id') || link
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (items.length === 0) {
|
||||
return { error: 'no_items_parsed', url: url, hint: 'RSS/Atom 格式未识别' };
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"AdapterCode": "mteam",
|
||||
"DisplayName": "mteam",
|
||||
"Version": "1.0.3",
|
||||
"Version": "1.0.4",
|
||||
"Status": "published",
|
||||
"Runtime": "javascript",
|
||||
"Description": "",
|
||||
|
||||
@@ -423,7 +423,7 @@ function parse(content, url) {
|
||||
// 签到(signInPath 默认 /attendance.php,可在站点 definition 中覆盖,如 BTSCHOOL: /index.php?action=addbonus)
|
||||
// 成功时若响应页含 #info_block (含魔力值) 则一并返回 bonus 供服务端更新 Site.Statistics.Bonus;
|
||||
// 站点页面不含 / 解析不到时缺省不返回该字段, 服务端不处理 (report §四 签到奖励自动更新).
|
||||
function signIn(input) {
|
||||
function sign(input) {
|
||||
var ctx = __asCtx(input);
|
||||
var signPath = ctx.signInPath || '/attendance.php';
|
||||
var res = http.post(signPath);
|
||||
@@ -898,9 +898,11 @@ function rss(ctx) {
|
||||
var base = String(ctx.baseUrl || '').replace(/\/+$/, '');
|
||||
var url = ctx.feedUrl ? String(ctx.feedUrl) : '';
|
||||
if (!url) {
|
||||
var rssPath = ctx.rssPath || '/torrentrss.php';
|
||||
// NexusPHP RSS 入口有两种命名: getrss.php (新) 和 torrentrss.php (旧).
|
||||
// 用户没手动填 feedUrl 时, 先试 getrss.php, 失败再回退 torrentrss.php.
|
||||
var paths = ctx.rssPaths || ['/getrss.php', '/torrentrss.php'];
|
||||
if (!base) return { error: 'no_feed_url' };
|
||||
url = base + rssPath;
|
||||
url = base + paths[0];
|
||||
}
|
||||
var xml;
|
||||
try {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"AdapterCode": "nexusphp",
|
||||
"DisplayName": "nexusphp",
|
||||
"Version": "1.0.2",
|
||||
"Version": "1.0.3",
|
||||
"Status": "published",
|
||||
"Runtime": "javascript",
|
||||
"Description": "",
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"minClientVersion": "0.1.0",
|
||||
"generatedAt": "2026-09-20T16:37:48.391Z",
|
||||
"generatedAt": "2026-09-20T17:22:28.367Z",
|
||||
"adapters": {
|
||||
"nexusphp": {
|
||||
"adapterCode": "nexusphp",
|
||||
"displayName": "nexusphp",
|
||||
"version": "1.0.2",
|
||||
"checksum": "sha256:8e64b4650695b75f79784f0251b66bc249fb23a1bd1fb337f4a7e3e972b8b0f0",
|
||||
"checksum": "sha256:4cf2e84cf006259179499705f991fe68da9899ae115e847b5cb945881aa5695e",
|
||||
"scriptPath": "adapters/nexusphp/adapter.js",
|
||||
"manifestPath": "adapters/nexusphp/manifest.json",
|
||||
"capabilities": [
|
||||
@@ -25,8 +25,8 @@
|
||||
"mteam": {
|
||||
"adapterCode": "mteam",
|
||||
"displayName": "mteam",
|
||||
"version": "1.0.2",
|
||||
"checksum": "sha256:6bb1361631d010dda916e03ac2ca138e4adb9f97b75d43f9b38ba27ff1550413",
|
||||
"version": "1.0.4",
|
||||
"checksum": "sha256:c679c547b2af424c8cb4809133edb1f1cdde97d37d83390bcb277a76cdeed0ab",
|
||||
"scriptPath": "adapters/mteam/adapter.js",
|
||||
"manifestPath": "adapters/mteam/manifest.json",
|
||||
"capabilities": [],
|
||||
|
||||
Reference in New Issue
Block a user