fix: nexusphp 脚本 parseUserInfo/sync 正则修复,适配 carpt 实际 HTML
1. 上传/下载: 兼容 '上传量:' 等变体 2. 魔力/邀请: 兼容中间有 HTML 链接的情况 3. 做种/下载数: 改为识别 '当前活动' 后的两个数字(NexusPHP 用 img 图标不是文字)
This commit is contained in:
@@ -64,19 +64,19 @@ private Map parseUserInfo(doc) {
|
||||
def el = doc.selectFirst('#info_block, td.bottom.clearfix, .userbar')
|
||||
if (el) {
|
||||
def t = el.text()
|
||||
def um = t =~ /上传[::]\s*([0-9.,]+)\s*(TB|GB|MB|KB|B)?/
|
||||
def dm = t =~ /下载[::]\s*([0-9.,]+)\s*(TB|GB|MB|KB|B)?/
|
||||
// 上传/下载:兼容 "上传量:" "上传:" 等变体
|
||||
def um = t =~ /上传[^::]*[::]\s*([0-9.,]+)\s*(TB|GB|MB|KB|B)?/
|
||||
def dm = t =~ /下载[^::]*[::]\s*([0-9.,]+)\s*(TB|GB|MB|KB|B)?/
|
||||
def rm = t =~ /分享率[::]\s*([\d.,]+)/
|
||||
def bm = t =~ /魔力[值::]*[^0-9]*([\d.,]+)/
|
||||
def sm = t =~ /⬆\s*(\d+)/
|
||||
def lm = t =~ /⬇\s*(\d+)/
|
||||
def im = t =~ /邀请[::]\s*(\d+)/
|
||||
def bm = t =~ /魔力[^::]*[::]\s*([\d.,]+)/
|
||||
// 做种/下载数:识别 "当前活动" 后的两个数字(NexusPHP 用 img 图标,不是文字)
|
||||
def am = t =~ /当前活动[^::]*[::]\s*(\d+)\s+(\d+)/
|
||||
def im = t =~ /邀请[^::]*[::]\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]
|
||||
if (bm) fields.bonus = bm[0][1]
|
||||
if (sm) fields.seeding = sm[0][1]
|
||||
if (lm) fields.leeching = lm[0][1]
|
||||
if (am) { fields.seeding = am[0][1]; fields.leeching = am[0][2] }
|
||||
if (im) fields.invites = im[0][1]
|
||||
// H&R 红色数字(未达标)
|
||||
def hrEl = doc.selectFirst('#info_block font[class=fcr], #info_block font[color=red], #info_block .red')
|
||||
@@ -170,17 +170,17 @@ Map sync(PluginContext ctx) {
|
||||
if (!el) { ctx.incomplete = true; return [message: '未找到用户信息'] }
|
||||
def t = el.text()
|
||||
def result = [:]
|
||||
def um = t =~ /上传[::]\s*([0-9.,]+)\s*(TB|GB|MB|KB|B)?/
|
||||
def dm = t =~ /下载[::]\s*([0-9.,]+)\s*(TB|GB|MB|KB|B)?/
|
||||
def um = t =~ /上传[^::]*[::]\s*([0-9.,]+)\s*(TB|GB|MB|KB|B)?/
|
||||
def dm = t =~ /下载[^::]*[::]\s*([0-9.,]+)\s*(TB|GB|MB|KB|B)?/
|
||||
def rm = t =~ /分享率[::]\s*([\d.,]+)/
|
||||
def bm = t =~ /魔力[值::]*[^0-9]*([\d.,]+)/
|
||||
def sm = t =~ /⬆\s*(\d+)/
|
||||
def im = t =~ /邀请[::]\s*(\d+)/
|
||||
def bm = t =~ /魔力[^::]*[::]\s*([\d.,]+)/
|
||||
def am = t =~ /当前活动[^::]*[::]\s*(\d+)\s+(\d+)/
|
||||
def im = t =~ /邀请[^::]*[::]\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 (am) { result.seeding = am[0][1] as int; result.leeching = am[0][2] as int }
|
||||
if (im) result.invites = im[0][1] as int
|
||||
def hrEl = doc.selectFirst('#info_block font[class=fcr], #info_block font[color=red], #info_block .red')
|
||||
if (hrEl) {
|
||||
|
||||
Reference in New Issue
Block a user