From 8cb4ff53af07741b7dca20669d3452145bd29372 Mon Sep 17 00:00:00 2001 From: mediabot-pt <295750538+mediabot-pt@users.noreply.github.com> Date: Thu, 2 Jul 2026 00:03:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20H&R=E5=8F=AA=E8=A7=A3=E6=9E=90=E7=BA=A2?= =?UTF-8?q?=E8=89=B2=E6=95=B0=E5=AD=97(=E6=9C=AA=E8=BE=BE=E6=A0=87)?= =?UTF-8?q?=EF=BC=8C=E7=94=A8CSS=E9=80=89=E6=8B=A9=E5=99=A8font.fcr/font[c?= =?UTF-8?q?olor=3Dred]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/pttime.groovy | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/pttime.groovy b/docs/pttime.groovy index 6c8ce5c..b2bebab 100644 --- a/docs/pttime.groovy +++ b/docs/pttime.groovy @@ -26,7 +26,6 @@ private Map parseIndex(doc) { def sm = t =~ /⬆\s*(\d+)/ def lm = t =~ /⬇\s*(\d+)/ def im = t =~ /邀请[::]\s*(\d+)/ - def hm = t =~ /H[&&]R[::]\s*(\d+)/ if (um) fields.upload = um[0][1] + (um[0][2] ?: '') if (dm) fields.download = dm[0][1] + (dm[0][2] ?: '') if (rm) fields.ratio = rm[0][1] @@ -34,7 +33,13 @@ private Map parseIndex(doc) { if (sm) fields.seeding = sm[0][1] if (lm) fields.leeching = lm[0][1] if (im) fields.invites = im[0][1] - if (hm) fields.hnr = hm[0][1] + // H&R:只取红色数字(未达标数),用 CSS 选取 red 元素 + def hrEl = doc.selectFirst('#info_block font[class=fcr], #info_block font[color=red], #info_block .red') + if (hrEl) { + def hrText = hrEl.text() + def hrm = hrText ==~ /(\d+)/ ? (hrText =~ /(\d+)/) : null + if (hrm) fields.hnr = hrm[0][1] + } return [pageName: '用户信息', fields: fields, message: fields.isEmpty() ? '未提取' : '解析成功'] } @@ -103,14 +108,18 @@ Map sync(PluginContext ctx) { def bm = t =~ /魔力值\([^)]*\)[^0-9]*([\d.,]+)/ def sm = t =~ /⬆\s*(\d+)/ def im = t =~ /邀请[::]\s*(\d+)/ - def hm = t =~ /H[&&]R[::]\s*(\d+)/ if (um) result.upload = utils.parseTraffic(um[0][1] + (um[0][2] ?: '')) if (dm) result.download = utils.parseTraffic(dm[0][1] + (dm[0][2] ?: '')) if (rm) result.shareRatio = rm[0][1].replace(',','') as double if (bm) result.bonus = bm[0][1].replace(',','') as double if (sm) result.seeding = sm[0][1] as int if (im) result.invites = im[0][1] as int - if (hm) result.hnr = hm[0][1] as int + // H&R 红色数字(未达标数) + def hrEl = doc.selectFirst('#info_block font[class=fcr], #info_block font[color=red], #info_block .red') + if (hrEl) { + def hrm = hrEl.text() =~ /(\d+)/ + if (hrm) result.hnr = hrm[0][1] as int + } if (!result.upload || !result.download) ctx.incomplete = true return result } catch (e) { ctx.incomplete = true; return [message: "同步失败: ${e.message}"] }