福利吧论坛 - 好孩子看得见

好孩子才看得见,论坛小助手

< Feedback on 福利吧论坛 - 好孩子看得见

Review: Good - script works

§
Posted: 2020-02-11

大大有个小小的请求..

论坛里像这种链接 https://www.wnflb66.com/forum.php?mod=forumdisplay&fid=2 能够转换成这种么? https://www.wnflb66.com/forum-2-1.html 如何转换啊??可以更新在您的脚本里面吗?? 或者另外出一个脚本 :p

panaAuthor
§
Posted: 2020-02-12
Edited: 2020-02-12

@EasyKevin 说道: 论坛里像这种链接 https://www.wnflb66.com/forum.php?mod=forumdisplay&fid=2 能够转换成这种么? https://www.wnflb66.com/forum-2-1.html 如何转换啊??可以更新在您的脚本里面吗?? 或者另外出一个脚本 :p

看起来是可实现的,但是我不太清楚你是指将当前网页的地址转换成您所要求的格式,还是指将网页内容中的链接转换成您所要求的格式? = ̄ω ̄= 如果您是使用的桌面端浏览器,其实可以使用 Header Editor 插件直接对链接重定向即可实现上述功能。


Header Editor 的规则

名称

随便填写

规则类型

重定向请求

匹配类型

正则表达式

匹配规则

https?:\/\/www\.wnflb66\.com\/forum\.php\?mod=forumdisplay&fid=\d+

执行类型

自定义函数

代码

if (val.includes("&page=")) {
    let arr = /&fid=(\d+)&page=(\d+)/.exec(val);
    return "https://www.wnflb66.com/forum-" + arr[1] + "-" + arr[2] + ".html";
} else {
    return "https://www.wnflb66.com/forum-" + /&fid=(\d+)/.exec(val)[1] + "-1.html";
}

如果您不想安装 Header Editor,也可以将详细一些的转换要求告诉我,然后我通过脚本实现吧。

§
Posted: 2020-02-12

谢谢大大的回复 :D 我先试试HE扩展..

§
Posted: 2020-02-12
Edited: 2020-02-12

我用了您给的代码,这个可以解决第一层页面也就是发现之门这类.. 后面我自己照葫芦画瓢弄了个帖子的净化.. https://www.wnflb66.com/forum.php?mod=viewthread&tid=144561&extra=page%3D1https://www.wnflb66.com/thread-144561-1-1.html

但存在翻页后还是变成这样的 https://www.wnflb66.com/forum.php?mod=viewthread&tid=144561&extra=page%3D1&page=2https://www.wnflb66.com/thread-144561-2-1.html 想让它变成这样自动适配翻页的页数

之后的代码就不会了... :s 没学过代码方面的东西...

还有这些,就是看别人个人信息的页面.. https://www.wnflb66.com/home.php?mod=space&uid=12270 真实地址应该是这样的.. https://www.wnflb66.com/?12270 都想把整个论坛链接全都给净化了.. :D

panaAuthor
§
Posted: 2020-02-12
Edited: 2020-02-12

@EasyKevin 说道: 我用了您给的代码,这个可以解决第一层页面也就是发现之门这类.. 后面我自己照葫芦画瓢弄了个帖子的净化.. https://www.wnflb66.com/forum.php?mod=viewthread&tid=144561&extra=page%3D1https://www.wnflb66.com/thread-144561-1-1.html

但存在翻页后还是变成这样的 https://www.wnflb66.com/forum.php?mod=viewthread&tid=144561&extra=page%3D1&page=2https://www.wnflb66.com/thread-144561-2-1.html 想让它变成这样自动适配翻页的页数

之后的代码就不会了... :s 没学过代码方面的东西...

还有这些,就是看别人个人信息的页面.. https://www.wnflb66.com/home.php?mod=space&uid=12270 真实地址应该是这样的.. https://www.wnflb66.com/?12270 都想把整个论坛链接全都给净化了.. :D

您尝试一下下面这段代码是否可行。

匹配规则

https?:\/\/www\.wnflb66\.com\/forum\.php\?mod=(forumdisplay&fid=\d+|viewthread&tid=\d+)

代码

if (val.includes("mod=forumdisplay")) {
    if (val.includes("&page=")) {
        let arr = /&fid=(\d+)&page=(\d+)/.exec(val);
        return "https://www.wnflb66.com/forum-" + arr[1] + "-" + arr[2] + ".html";
    } else {
        return "https://www.wnflb66.com/forum-" + /&fid=(\d+)/.exec(val)[1] + "-1.html";
    }
} else if (val.includes("mod=viewthread")) {
    if (val.includes("&page=")) {
        return "https://www.wnflb66.com/thread-" + /&tid=(\d+)/.exec(val)[1] + "-" + /&page=(\d+)/.exec(val)[1] + "-1.html";
    } else {
        return "https://www.wnflb66.com/thread-" + /&tid=(\d+)/.exec(val)[1] + "-1-1.html";
    }
}
panaAuthor
§
Posted: 2020-02-12
Edited: 2020-02-12

至于个人信息的页面,为了防止误匹配,建议这样写。

匹配规则

https?:\/\/www\.wnflb66\.com\/home\.php\?mod=space&uid=(\d+)(&do=profile&from=space)?$

执行类型选常规

重定向至 https:\\www.wnflb66.com\?$1

§
Posted: 2020-02-12

谢谢大大 :D ..用您的代码可以弄好.. 只是论坛需要匹配的相关代码太多了...要获取的话得写好多好多代码... GreasyFork上也没有找到能够匹配论坛相关的清洁链接的脚本...唉,真希望有哪个能弄出来匹配到所有论坛格式上的..

§
Posted: 2020-02-12

我在Github上找到了一些规则,里面包含了通用论坛规则.我去试试.. https://github.com/dupontjoy/customization https://github.com/bhoppi/headereditor_rules 再次感谢大大为我编写的代码..谢谢 :D

§
Posted: 2020-02-12

{ "request": [ { "enable": true, "name": "通用论坛简版>>完整版4", "ruleType": "redirect", "matchType": "regexp", "pattern": "^https?:\/\/(.)/archive/index.php/t-(.)$", "exclude": "", "isFunction": false, "action": "redirect", "to": "http://$1/showthread.php?t=$2", "group": "CingList" }, { "enable": true, "name": "通用论坛简版>>完整版3", "ruleType": "redirect", "matchType": "regexp", "pattern": "^https?:\/\/(.+)/archiver/\?tid-(\d+).html", "exclude": "", "isFunction": false, "action": "redirect", "to": "http://$1/thread-$2-1-1.html", "group": "CingList" }, { "enable": true, "name": "通用论坛简版>>完整版2", "ruleType": "redirect", "matchType": "regexp", "pattern": "^https?:\/\/(.)/archiver/tid-(.)-page-.*.html", "exclude": "", "isFunction": false, "action": "redirect", "to": "http://$1/thread-$2-1.html", "group": "CingList" }, { "enable": true, "name": "通用论坛简版>>完整版1", "ruleType": "redirect", "matchType": "regexp", "pattern": "^https?:\/\/(.+)/archiver/tid-(\d+).html", "exclude": "", "isFunction": false, "action": "redirect", "to": "http://$1/viewthread.php?tid=$2", "group": "CingList" }, 大大您看看他这个规则.. 他这个好像还是无法匹配福利吧论坛...好像是archiver的问题??

panaAuthor
§
Posted: 2020-02-12

@EasyKevin 说道: { "request": [ { "enable": true, "name": "通用论坛简版>>完整版4", "ruleType": "redirect", "matchType": "regexp", "pattern": "^https?:\/\/(.)/archive/index.php/t-(.)$", "exclude": "", "isFunction": false, "action": "redirect", "to": "http://$1/showthread.php?t=$2", "group": "CingList" }, { "enable": true, "name": "通用论坛简版>>完整版3", "ruleType": "redirect", "matchType": "regexp", "pattern": "^https?:\/\/(.+)/archiver/\?tid-(\d+).html", "exclude": "", "isFunction": false, "action": "redirect", "to": "http://$1/thread-$2-1-1.html", "group": "CingList" }, { "enable": true, "name": "通用论坛简版>>完整版2", "ruleType": "redirect", "matchType": "regexp", "pattern": "^https?:\/\/(.)/archiver/tid-(.)-page-.*.html", "exclude": "", "isFunction": false, "action": "redirect", "to": "http://$1/thread-$2-1.html", "group": "CingList" }, { "enable": true, "name": "通用论坛简版>>完整版1", "ruleType": "redirect", "matchType": "regexp", "pattern": "^https?:\/\/(.+)/archiver/tid-(\d+).html", "exclude": "", "isFunction": false, "action": "redirect", "to": "http://$1/viewthread.php?tid=$2", "group": "CingList" }, 大大您看看他这个规则.. 他这个好像还是无法匹配福利吧论坛...好像是archiver的问题??

论坛动态链接转换成静态链接的方法和这套通用论坛规则有点不太一样,理论上得改一改才能用。

§
Posted: 2020-02-12

改动会很大吧?? 要是太麻烦就算了... :/

Post reply

Sign in to post a reply.