qd-today / templates

基于开源新版 QD 框架站发布的公共har模板库,仅供示例
1.09k stars 295 forks source link

贴吧一键签到 评论区 #393

Open TigerCubDen opened 1 year ago

TigerCubDen commented 1 year ago

HAR 模板名称

贴吧一键签到

作者信息

qiandao.today,TigerCubDen

模板备注及说明

模拟网页端对用户已关注的所有贴吧一键自动签到 填入在百度贴吧登录后的cookie即可

HAR 文件名

贴吧一键签到cookie.har

其他信息

该模板曾来自qiandao.today下的公开模板;经过维护与更新后,去除了“非会员无法签到七级以下贴吧”的官方限制,并添加了日志信息。

HAR 模板内容

[{"comment":"初始化变量","request":{"method":"POST","url":"api://util/string/replace","headers":[],"cookies":[],"data":"r=text&p=&s=1&t="},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"page","re":".*","from":"content"},{"name":"pages","re":".*","from":"content"}]}},{"request":{"method":"GET","url":"http://tieba.baidu.com/f/user/json_userinfo?_=1407684256076","headers":[{"name":"Cookie","value":"{{ cookie }}"},{"name":"DNT","value":"1"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"},{"name":"Accept","value":"*/*"},{"name":"X-Requested-With","value":"XMLHttpRequest"},{"name":"Connection","value":"keep-alive"}],"cookies":[]},"rule":{"success_asserts":[{"re":"session_id","from":"content"}],"failed_asserts":[],"extract_variables":[]}},{"comment":"获取贴吧页数","request":{"method":"GET","url":"https://tieba.baidu.com/f/like/mylike","headers":[{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"Cache-Control","value":"no-cache"},{"name":"Connection","value":"keep-alive"},{"name":"Cookie","value":"{{cookie}}"},{"name":"DNT","value":"1"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"}],"cookies":[]},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"pages","re":"\\d+(?=\">尾页)","from":"content"}]}},{"comment":"For 循环开始","request":{"method":"GET","url":"{% for page in range(1, int(pages) +1) %}","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[]}},{"request":{"method":"GET","url":"https://tieba.baidu.com/f/like/mylike?pn={{page|urlencode}}","headers":[{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"Cache-Control","value":"no-cache"},{"name":"Connection","value":"keep-alive"},{"name":"Cookie","value":"{{cookie}}"},{"name":"DNT","value":"1"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"}],"cookies":[]},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"bar","re":"href=\"/f\\?kw=[^\"]+\" title=\"([^\"]+)\"","from":"content"},{"name":"bars","re":"/href=\"/f\\?kw=[^\"]+\" title=\"([^\"]+)\"/g","from":"content"}]}},{"request":{"method":"GET","url":"{% for bar in bars %}","headers":[],"cookies":[]},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[]}},{"request":{"method":"POST","url":"http://tieba.baidu.com/sign/add","headers":[{"name":"Origin","value":"http://tieba.baidu.com"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"},{"name":"Content-Type","value":"application/x-www-form-urlencoded; charset=UTF-8"},{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},{"name":"X-Requested-With","value":"XMLHttpRequest"},{"name":"Connection","value":"keep-alive"},{"name":"Referer","value":"http://tieba.baidu.com/f?kw={{ bar |urlencode}}"},{"name":"DNT","value":"1"}],"cookies":[],"data":"ie=utf-8&kw={{ bar |urlencode}}","mimeType":"application/x-www-form-urlencoded; charset=UTF-8"},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[]}},{"request":{"method":"GET","url":"{% endfor %}","headers":[],"cookies":[]},"rule":{"success_asserts":[],"failed_asserts":[],"extract_variables":[]}},{"comment":"延时3秒","request":{"method":"GET","url":"api://util/delay/3","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[]}},{"comment":"For 循环结束","request":{"method":"GET","url":"{% endfor %}","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[],"failed_asserts":[],"extract_variables":[]}},{"request":{"method":"GET","url":"http://tieba.baidu.com/dc/common/tbs","headers":[{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Host","value":"tieba.baidu.com"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"Upgrade-Insecure-Requests","value":"1"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"},{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},{"name":"Cookie","value":"{{cookie}}"},{"name":"Connection","value":"keep-alive"}],"cookies":[]},"rule":{"success_asserts":[{"re":"tbs","from":"content"}],"failed_asserts":[],"extract_variables":[{"re":"{\"tbs\":\"([\\s\\S]*?)\"","from":"content","name":"tbs"}]}},{"request":{"method":"POST","url":"http://tieba.baidu.com/tbmall/onekeySignin1","headers":[{"name":"Cookie","value":"{{cookie}}"},{"name":"Origin","value":"http://tieba.baidu.com"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Host","value":"tieba.baidu.com"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"},{"name":"Content-Type","value":"application/x-www-form-urlencoded; charset=UTF-8"},{"name":"Accept","value":"*/*"},{"name":"Referer","value":"http://tieba.baidu.com/"},{"name":"X-Requested-With","value":"XMLHttpRequest"},{"name":"Connection","value":"keep-alive"}],"cookies":[],"data":"ie=utf-8&tbs={{tbs|urlencode}}","mimeType":"application/x-www-form-urlencoded; charset=UTF-8"},"rule":{"success_asserts":[{"re":"success","from":"content"},{"re":"forums is signed","from":"content"},{"re":"there is no forum","from":"content"}],"failed_asserts":[],"extract_variables":[{"name":"signed","re":"\"signedForumAmount\":\\s?([0-9]*)","from":"content"},{"name":"failed","re":"\"signedForumAmountFail\":\\s?([0-9]*)","from":"content"},{"name":"unsigned","re":"\"unsignedForumAmount\":\\s?([0-9]*)","from":"content"}]}},{"request":{"method":"GET","url":"api://util/string/replace?r=text&p=&s=%E5%B7%B2%E7%AD%BE%E5%88%B0%EF%BC%9A{{signed|urlencode}}%20%E4%B8%AA%EF%BC%8C%E6%9C%AA%E7%AD%BE%E5%88%B0%EF%BC%9A{{unsigned|urlencode}}%20%E4%B8%AA%EF%BC%8C%E5%A4%B1%E8%B4%A5%E6%95%B0%EF%BC%9A{{failed|urlencode}}%20%E4%B8%AA%20&t=","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"__log__","re":".*","from":"content"}]}}]
x2287711259 commented 1 year ago

为什么不行啊,填入cookies之后,点击测试会报错 屏幕截图 2023-07-15 132329

TigerCubDen commented 1 year ago

为什么不行啊,填入cookies之后,点击测试会报错 屏幕截图 2023-07-15 132329

在已登录贴吧的浏览器上访问 http://tieba.baidu.com/tbmall/onekeySignin1 ,是否显示为 error": "forums is signed"

TigerCubDen commented 1 year ago

如果是,我会给模板再加一个判断,使其在这种情况下显示为“运行成功”

x2287711259 commented 1 year ago

显示的是其他的"error":"there is no forum"

TigerCubDen commented 1 year ago

显示的是其他的"error":"there is no forum"

我测试了下,百度贴吧一键签到api返回逻辑是这样的

  1. 当贴吧成功签到时,返回 "error": "success"
  2. 当所有贴吧已经签到过时,返回 "error": "forums is signed"
  3. 当其他贴吧都已签到且存在7级以下的未签到贴吧时,返回 "error": "there is no forum" 贴吧官方的自动签到功能只对七级以上的贴吧生效,除非开会员,这是百度的限制。

以下是样本(按123顺序):

{
    "no": 0,
    "error": "success",
    "data": {
        "signedForumAmount": 8,
        "signedForumAmountFail": 0,
        "unsignedForumAmount": 0,
        "vipExtraSignedForumAmount": 0,
        "forum_list": [
            {
                "forum_id": 77986,
                "forum_name": "狼",
                "is_sign_in": 1,
                "level_id": 10,
                "cont_sign_num": 1,
                "loyalty_score": {
                    "normal_score": 2,
                    "high_score": 14
                }
            }
        ],
        "gradeNoVip": 2,
        "gradeVip": 14
    }
}
{
    "no": 2280006,
    "error": "forums is signed",
    "data": {
        "signedForumAmount": 9,
        "signedForumAmountFail": 0,
        "unsignedForumAmount": 0,
        "vipExtraSignedForumAmount": 0,
        "forum_list": null,
        "gradeNoVip": 32,
        "gradeVip": 126,
        "lowlev_presign": 9
    }
}
{
    "no": 2500113,
    "error": "there is no forum",
    "data": {
        "signedForumAmount": 8,
        "signedForumAmountFail": 0,
        "unsignedForumAmount": 1,
        "vipExtraSignedForumAmount": 1,
        "forum_list": null,
        "gradeNoVip": 0,
        "gradeVip": 126
    }
}
EdisonCh4n commented 1 year ago

感谢分享!请大佬加一个判断,不然有时候签完第二次运行的时候会提示错误

TigerCubDen commented 1 year ago

感谢分享!请大佬加一个判断,不然有时候签完第二次运行的时候会提示错误

我目前打算重做一下,到时不再有7级以下贴吧无法自动签到的官方限制

x2287711259 commented 1 year ago

谢谢大佬

hecarli555 commented 1 year ago

请问大佬,问题修复好没呢?我测试了一下还是失败。。。

Failed at 2/2 request,Fail assert: {"re": "success", "from": "content"} from success_asserts,Request URL: http://tieba.baidu.com/tbmall/onekeySignin1 --
TigerCubDen commented 1 year ago

请问大佬,问题修复好没呢?我测试了一下还是失败。。。

Failed at 2/2 request,Fail assert: {"re": "success", "from": "content"} from success_asserts,Request URL: http://tieba.baidu.com/tbmall/onekeySignin1 --

新版本已发,等merge

zengwk2005 commented 1 year ago

Failed at 7/13 request, Fail assert: {"re": "200", "from": "status"} from success_asserts, Response Error : HTTP 500: The error occurred when rendering template value: http://tieba.baidu.com/f?kw={{ bar |urlencode}} TemplateSyntaxError("unexpected '%'"), Request URL: http://tieba.baidu.com/sign/add

Chidoudou commented 1 year ago

这个请求http://tieba.baidu.com/sign/add的Referer有问题吧,手动改成http://tieba.baidu.com/f?kw={{ bar |urlencode}} 后可以了

hecarli555 commented 1 year ago

实测还是不行,如下提示:

Failed at 7/13 request,Fail assert: {"re": "200", "from": "status"} from success_asserts,Response Error : HTTP 500: The error occurred when rendering template value: [http://tieba.baidu.com/f?kw={{ bar \|urlencode}}](http://tieba.baidu.com/f?kw={{%C2%A0bar%C2%A0\|urlencode}})TemplateSyntaxError("unexpected '%'"),Request URL: http://tieba.baidu.com/sign/add --
TigerCubDen commented 1 year ago

这个请求http://tieba.baidu.com/sign/add的Referer有问题吧,手动改成http://tieba.baidu.com/f?kw={{ bar |urlencode}}后可以了

不知道为什么我复制到github的编辑框就被莫名其妙的改了,我重新提交试试

17huiwei commented 1 year ago

2023-07-19 11:12:19 日志:Failed at 7/13 request, Fail assert: {"re": "200", "from": "status"} from success_asserts, Response Error : HTTP 500: The error occurred when rendering template value: http://tieba.baidu.com/f?kw={{ bar |urlencode}} TemplateSyntaxError("unexpected '%'"), Request URL: http://tieba.baidu.com/sign/add

TigerCubDen commented 1 year ago

2023-07-19 11:12:19

日志:Failed at 7/13 request,

Fail assert: {"re": "200", "from": "status"} from success_asserts,

Response Error : HTTP 500: The error occurred when rendering template value: http://tieba.baidu.com/f?kw={{ bar |urlencode}}

TemplateSyntaxError("unexpected '%'"),

Request URL: http://tieba.baidu.com/sign/add

模版更新推送存在延迟,你们可以参照Chidoudou的回答,在模版编辑界面里,把http://tieba.baidu.com/sign/addReferer改成http://tieba.baidu.com/f?kw={{ bar |urlencode}}应该就可用了。

zshvn commented 1 year ago

大佬这个失败是什么情况 Failed at 2/13 request, Fail assert: {"re": "session_id", "from": "content"} from success_asserts, Response Error : OK, Request URL: http://tieba.baidu.com/f/user/json_userinfo?_=1407684256076

zshvn commented 1 year ago

Failed at 4/13 request, Fail assert: {"re": "200", "from": "status"} from success_asserts, Response Error : HTTP 500: The error occurred when rendering template url: {% for page in range(1, int(pages) +1) %} TemplateSyntaxError("Unexpected end of template. Jinja was looking for the following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'."), Request URL: {% for page in range(1, int(pages) +1) %} 现在又是报这个错,纯小白看不懂。。。之前还成功一次啥也没改现在就这样了

TigerCubDen commented 1 year ago

现在在公共模板界面里重建缓存,重新订阅模板,并保持qd框架为最新版本,应该可以解决上述问题。

注:不要在每日 0:00-0:59 高峰期执行签到,否则会报错 {"no":340009,"error":"time error","data":[]}

zengwk2005 commented 1 year ago

偶尔会有几个吧漏签到是什么情况?我有63个吧要签

TigerCubDen commented 1 year ago

偶尔会有几个吧漏签到是什么情况?我有63个吧要签

经过测试,我怀疑是下述原因:

有些贴吧的名字不再使用或仅为别名,点进去会跳转至另一个名字。

以 “南望山 | 中国地质大学武汉” 为例:

执行 “贴吧一键签到” 任务后,日志显示有一个贴吧未签到 image 查看关注列表,发现有个名为 “南望山” 的贴吧未能被签到 image ↓ 点进或搜索 “南望山” 后,被跳转至 “中国地质大学武汉吧” image 无论 “中国地质大学武汉吧” 是否被关注,贴吧关注列表中 “南望山” 必须被移除。

否则,会导致以 “南望山” 吧名签到时,提示 “您还未加入此吧或等级不够”;并算入未签到数(onekeySignin1的返回信息)。

你需要做的,就是找出并移除这样的吧名。

zengwk2005 commented 1 year ago

谢谢解答,不过我这边不是贴吧名不同导致的问题,我现在是设成每天9点和10点各执行一遍,就没有缺漏了,之前只执行一次会出现漏的

hecarli555 commented 1 year ago

贴吧cookie签到.txt 大佬可以参考下这个旧版的,看有没有灵感改进一下,旧版这个没有出现过漏签的

qinchongdong commented 1 year ago

failed at 1/13 request, error:ValueError(u'Unsupported url scheme: api://util/string/replace',), api://util/string/replace

AWSOMEALEX commented 1 year ago

测试了下,可用,非常感谢

TigerCubDen commented 1 year ago

failed at 1/13 request, error:ValueError(u'Unsupported url scheme: api://util/string/replace',), api://util/string/replace

请更新qd框架至最新版本

TigerCubDen commented 1 year ago

贴吧cookie签到.txt 大佬可以参考下这个旧版的,看有没有灵感改进一下,旧版这个没有出现过漏签的

感谢帮助,我试了下发现签到执行时间大幅延长,因为每个贴吧要执行 https://tieba.baidu.com/f?ie=utf-8&kw={{bar|urlencode}} 获取tbs,我不确定 tbs 有无是否是漏签的罪魁祸首。

所以我打算先捕获到漏签贴吧的日志再做进一步决定;如果确定是该原因或者没有其他更好的办法,再采用上述旧模板。

TigerCubDen commented 1 year ago

谢谢解答,不过我这边不是贴吧名不同导致的问题,我现在是设成每天9点和10点各执行一遍,就没有缺漏了,之前只执行一次会出现漏的

运行下面这个用于调试的模板,它会将每一个贴吧的签到信息显示在日志里,如果出现漏签情况,将本次运行日志发送过来就行,谢谢。

使用方法:新建一个空的txt文件,复制以下内容并保存,然后修改后缀为 .har,再导入qd框架里。 运行时 results 参数一栏为空。

[{"comment":"初始化变量","request":{"method":"POST","url":"api://util/string/replace","headers":[],"cookies":[],"data":"r=text&p=&s=1&t="},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"page","re":".*","from":"content"},{"name":"pages","re":".*","from":"content"}]}},{"request":{"method":"GET","url":"http://tieba.baidu.com/f/user/json_userinfo?_=1407684256076","headers":[{"name":"Cookie","value":"{{ cookie }}"},{"name":"DNT","value":"1"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"},{"name":"Accept","value":"*/*"},{"name":"X-Requested-With","value":"XMLHttpRequest"},{"name":"Connection","value":"keep-alive"}],"cookies":[]},"rule":{"success_asserts":[{"re":"session_id","from":"content"}],"failed_asserts":[],"extract_variables":[]}},{"comment":"获取贴吧页数","request":{"method":"GET","url":"https://tieba.baidu.com/f/like/mylike","headers":[{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"Cache-Control","value":"no-cache"},{"name":"Connection","value":"keep-alive"},{"name":"Cookie","value":"{{cookie}}"},{"name":"DNT","value":"1"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"}],"cookies":[]},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"pages","re":"\\d+(?=\">尾页)","from":"content"}]}},{"comment":"For 循环开始","request":{"method":"GET","url":"{% for page in range(1, int(pages) +1) %}","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[]}},{"request":{"method":"GET","url":"https://tieba.baidu.com/f/like/mylike?pn={{page|urlencode}}","headers":[{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"Cache-Control","value":"no-cache"},{"name":"Connection","value":"keep-alive"},{"name":"Cookie","value":"{{cookie}}"},{"name":"DNT","value":"1"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"}],"cookies":[]},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"bar","re":"href=\"/f\\?kw=[^\"]+\" title=\"([^\"]+)\"","from":"content"},{"name":"bars","re":"/href=\"/f\\?kw=[^\"]+\" title=\"([^\"]+)\"/g","from":"content"}]}},{"request":{"method":"GET","url":"{% for bar in bars %}","headers":[],"cookies":[]},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[]}},{"request":{"method":"POST","url":"http://tieba.baidu.com/sign/add","headers":[{"name":"Origin","value":"http://tieba.baidu.com"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"},{"name":"Content-Type","value":"application/x-www-form-urlencoded; charset=UTF-8"},{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},{"name":"X-Requested-With","value":"XMLHttpRequest"},{"name":"Connection","value":"keep-alive"},{"name":"Referer","value":"http://tieba.baidu.com/f?kw={{ bar |urlencode}}"},{"name":"DNT","value":"1"}],"cookies":[],"data":"ie=utf-8&kw={{ bar |urlencode}}","mimeType":"application/x-www-form-urlencoded; charset=UTF-8"},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"result","re":".*","from":"content"}]}},{"comment":"字符串替换","request":{"method":"GET","url":"api://util/string/replace?r=text&p=&s={{results|urlencode}}%20%7C%20{{bar|urlencode}}%3A{{result|urlencode}}%20&t=","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"results","re":".*","from":"content"}]}},{"request":{"method":"GET","url":"{% endfor %}","headers":[],"cookies":[]},"rule":{"success_asserts":[],"failed_asserts":[],"extract_variables":[]}},{"comment":"延时3秒","request":{"method":"GET","url":"api://util/delay/3","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[]}},{"comment":"For 循环结束","request":{"method":"GET","url":"{% endfor %}","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[],"failed_asserts":[],"extract_variables":[]}},{"request":{"method":"GET","url":"http://tieba.baidu.com/dc/common/tbs","headers":[{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Host","value":"tieba.baidu.com"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"Upgrade-Insecure-Requests","value":"1"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"},{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},{"name":"Cookie","value":"{{cookie}}"},{"name":"Connection","value":"keep-alive"}],"cookies":[]},"rule":{"success_asserts":[{"re":"tbs","from":"content"}],"failed_asserts":[],"extract_variables":[{"re":"{\"tbs\":\"([\\s\\S]*?)\"","from":"content","name":"tbs"}]}},{"request":{"method":"POST","url":"http://tieba.baidu.com/tbmall/onekeySignin1","headers":[{"name":"Cookie","value":"{{cookie}}"},{"name":"Origin","value":"http://tieba.baidu.com"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Host","value":"tieba.baidu.com"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"},{"name":"Content-Type","value":"application/x-www-form-urlencoded; charset=UTF-8"},{"name":"Accept","value":"*/*"},{"name":"Referer","value":"http://tieba.baidu.com/"},{"name":"X-Requested-With","value":"XMLHttpRequest"},{"name":"Connection","value":"keep-alive"}],"cookies":[],"data":"ie=utf-8&tbs={{tbs|urlencode}}","mimeType":"application/x-www-form-urlencoded; charset=UTF-8"},"rule":{"success_asserts":[{"re":"success","from":"content"},{"re":"forums is signed","from":"content"},{"re":"there is no forum","from":"content"}],"failed_asserts":[],"extract_variables":[{"name":"signed","re":"\"signedForumAmount\":\\s?([0-9]*)","from":"content"},{"name":"failed","re":"\"signedForumAmountFail\":\\s?([0-9]*)","from":"content"},{"name":"unsigned","re":"\"unsignedForumAmount\":\\s?([0-9]*)","from":"content"}]}},{"request":{"method":"GET","url":"api://util/string/replace?r=text&p=&s=%E5%B7%B2%E7%AD%BE%E5%88%B0%EF%BC%9A{{signed|urlencode}}%20%E4%B8%AA%EF%BC%8C%E6%9C%AA%E7%AD%BE%E5%88%B0%EF%BC%9A{{unsigned|urlencode}}%20%E4%B8%AA%EF%BC%8C%E5%A4%B1%E8%B4%A5%E6%95%B0%EF%BC%9A{{failed|urlencode}}%20%E4%B8%AA%20-%20%E8%B0%83%E8%AF%95%E4%BF%A1%E6%81%AF%EF%BC%9A{{results|urlencode}}&t=","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"log","re":".*","from":"content"}]}},{"comment":"Unicode转换","request":{"method":"POST","url":"api://util/unicode","headers":[],"cookies":[],"data":"html_unescape=false&content={{log}}"},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"__log__","re":"\"转换后\": \"(.*)\"","from":"content"}]}}]
EdisonCh4n commented 1 year ago

谢谢解答,不过我这边不是贴吧名不同导致的问题,我现在是设成每天9点和10点各执行一遍,就没有缺漏了,之前只执行一次会出现漏的

运行下面这个用于调试的模板,它会将每一个贴吧的签到信息显示在日志里,如果出现漏签情况,将本次运行日志发送过来就行,谢谢。

使用方法:新建一个空的txt文件,复制以下内容并保存,然后修改后缀为 .har,再导入qd框架里。 运行时 results 参数一栏为空。

[{"comment":"初始化变量","request":{"method":"POST","url":"api://util/string/replace","headers":[],"cookies":[],"data":"r=text&p=&s=1&t="},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"page","re":".*","from":"content"},{"name":"pages","re":".*","from":"content"}]}},{"request":{"method":"GET","url":"http://tieba.baidu.com/f/user/json_userinfo?_=1407684256076","headers":[{"name":"Cookie","value":"{{ cookie }}"},{"name":"DNT","value":"1"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"},{"name":"Accept","value":"*/*"},{"name":"X-Requested-With","value":"XMLHttpRequest"},{"name":"Connection","value":"keep-alive"}],"cookies":[]},"rule":{"success_asserts":[{"re":"session_id","from":"content"}],"failed_asserts":[],"extract_variables":[]}},{"comment":"获取贴吧页数","request":{"method":"GET","url":"https://tieba.baidu.com/f/like/mylike","headers":[{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"Cache-Control","value":"no-cache"},{"name":"Connection","value":"keep-alive"},{"name":"Cookie","value":"{{cookie}}"},{"name":"DNT","value":"1"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"}],"cookies":[]},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"pages","re":"\\d+(?=\">尾页)","from":"content"}]}},{"comment":"For 循环开始","request":{"method":"GET","url":"{% for page in range(1, int(pages) +1) %}","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[]}},{"request":{"method":"GET","url":"https://tieba.baidu.com/f/like/mylike?pn={{page|urlencode}}","headers":[{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"Cache-Control","value":"no-cache"},{"name":"Connection","value":"keep-alive"},{"name":"Cookie","value":"{{cookie}}"},{"name":"DNT","value":"1"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"}],"cookies":[]},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"bar","re":"href=\"/f\\?kw=[^\"]+\" title=\"([^\"]+)\"","from":"content"},{"name":"bars","re":"/href=\"/f\\?kw=[^\"]+\" title=\"([^\"]+)\"/g","from":"content"}]}},{"request":{"method":"GET","url":"{% for bar in bars %}","headers":[],"cookies":[]},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[]}},{"request":{"method":"POST","url":"http://tieba.baidu.com/sign/add","headers":[{"name":"Origin","value":"http://tieba.baidu.com"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"},{"name":"Content-Type","value":"application/x-www-form-urlencoded; charset=UTF-8"},{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},{"name":"X-Requested-With","value":"XMLHttpRequest"},{"name":"Connection","value":"keep-alive"},{"name":"Referer","value":"http://tieba.baidu.com/f?kw={{ bar |urlencode}}"},{"name":"DNT","value":"1"}],"cookies":[],"data":"ie=utf-8&kw={{ bar |urlencode}}","mimeType":"application/x-www-form-urlencoded; charset=UTF-8"},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"result","re":".*","from":"content"}]}},{"comment":"字符串替换","request":{"method":"GET","url":"api://util/string/replace?r=text&p=&s={{results|urlencode}}%20%7C%20{{bar|urlencode}}%3A{{result|urlencode}}%20&t=","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"results","re":".*","from":"content"}]}},{"request":{"method":"GET","url":"{% endfor %}","headers":[],"cookies":[]},"rule":{"success_asserts":[],"failed_asserts":[],"extract_variables":[]}},{"comment":"延时3秒","request":{"method":"GET","url":"api://util/delay/3","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[]}},{"comment":"For 循环结束","request":{"method":"GET","url":"{% endfor %}","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[],"failed_asserts":[],"extract_variables":[]}},{"re
![QQ图片20230724183809](https://github.com/qd-today/templates/assets/126320405/37228ee0-74a6-416a-a6c8-d4199068a6da)
quest":{"method":"GET","url":"http://tieba.baidu.com/dc/common/tbs","headers":[{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Host","value":"tieba.baidu.com"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"Upgrade-Insecure-Requests","value":"1"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"},{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},{"name":"Cookie","value":"{{cookie}}"},{"name":"Connection","value":"keep-alive"}],"cookies":[]},"rule":{"success_asserts":[{"re":"tbs","from":"content"}],"failed_asserts":[],"extract_variables":[{"re":"{\"tbs\":\"([\\s\\S]*?)\"","from":"content","name":"tbs"}]}},{"request":{"method":"POST","url":"http://tieba.baidu.com/tbmall/onekeySignin1","headers":[{"name":"Cookie","value":"{{cookie}}"},{"name":"Origin","value":"http://tieba.baidu.com"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Host","value":"tieba.baidu.com"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"},{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82"},{"name":"Content-Type","value":"application/x-www-form-urlencoded; charset=UTF-8"},{"name":"Accept","value":"*/*"},{"name":"Referer","value":"http://tieba.baidu.com/"},{"name":"X-Requested-With","value":"XMLHttpRequest"},{"name":"Connection","value":"keep-alive"}],"cookies":[],"data":"ie=utf-8&tbs={{tbs|urlencode}}","mimeType":"application/x-www-form-urlencoded; charset=UTF-8"},"rule":{"success_asserts":[{"re":"success","from":"content"},{"re":"forums is signed","from":"content"},{"re":"there is no forum","from":"content"}],"failed_asserts":[],"extract_variables":[{"name":"signed","re":"\"signedForumAmount\":\\s?([0-9]*)","from":"content"},{"name":"failed","re":"\"signedForumAmountFail\":\\s?([0-9]*)","from":"content"},{"name":"unsigned","re":"\"unsignedForumAmount\":\\s?([0-9]*)","from":"content"}]}},{"request":{"method":"GET","url":"api://util/string/replace?r=text&p=&s=%E5%B7%B2%E7%AD%BE%E5%88%B0%EF%BC%9A{{signed|urlencode}}%20%E4%B8%AA%EF%BC%8C%E6%9C%AA%E7%AD%BE%E5%88%B0%EF%BC%9A{{unsigned|urlencode}}%20%E4%B8%AA%EF%BC%8C%E5%A4%B1%E8%B4%A5%E6%95%B0%EF%BC%9A{{failed|urlencode}}%20%E4%B8%AA%20-%20%E8%B0%83%E8%AF%95%E4%BF%A1%E6%81%AF%EF%BC%9A{{results|urlencode}}&t=","headers":[],"cookies":[],"data":""},"rule":{"success_asserts":[{"re":"200","from":"status"}],"failed_asserts":[],"extract_variables":[{"name":"__log__","re":".*","from":"content"}]}}]

大佬日志会生成乱码,

TigerCubDen commented 1 year ago

\u 开头的内容,只需要Unicode编码转中文。 @EdisonCh4n 我更新了上面的模板,做了自动编码转换,你重新导入运行就可以了

EdisonCh4n commented 1 year ago

太感谢了!

EdisonCh4n commented 1 year ago

\u 开头的内容,只需要Unicode编码转中文。 @EdisonCh4n 我更新了上面的模板,做了自动编码转换,你重新导入运行就可以了 大佬这个多出来的部分是啥? QQ图片20230724200257

TigerCubDen commented 1 year ago

\u 开头的内容,只需要Unicode编码转中文。 @EdisonCh4n 我更新了上面的模板,做了自动编码转换,你重新导入运行就可以了

大佬这个多出来的部分是啥?

QQ图片20230724200257

啊,这个模版是用来调试问题的,日常使用直接在qd框架的公共模版界面里订阅就行

yzliufujin commented 1 year ago

框架是20230228,是版本低了吗? 2023-07-25 15:03:46 日志:Failed at 4/13 request, Fail assert: {"re": "200", "from": "status"} from success_asserts, Response Error : HTTP 500: The error occurred when rendering template url: {% for page in range(1, int(pages) +1) %} TemplateSyntaxError("Unexpected end of template. Jinja was looking for the following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'."), Request URL: {% for page in range(1, int(pages) +1) %}

TigerCubDen commented 1 year ago

框架是20230228,是版本低了吗? 2023-07-25 15:03:46 日志:Failed at 4/13 request, Fail assert: {"re": "200", "from": "status"} from success_asserts, Response Error : HTTP 500: The error occurred when rendering template url: {% for page in range(1, int(pages) +1) %} TemplateSyntaxError("Unexpected end of template. Jinja was looking for the following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'."), Request URL: {% for page in range(1, int(pages) +1) %}

是的,请更新至最新版本。

Ansen commented 1 year ago

最新版本(20230718) 依然报错:

 Failed at 2/13 request,
Fail assert: {"re": "session_id", "from": "content"} from success_asserts,
Request URL: http://tieba.baidu.com/f/user/json_userinfo?_=1407684256076

image

hecarli555 commented 1 year ago

看来还是没弄好么?

TigerCubDen commented 1 year ago

最新版本(20230718) 依然报错:

 Failed at 2/13 request,
Fail assert: {"re": "session_id", "from": "content"} from success_asserts,
Request URL: http://tieba.baidu.com/f/user/json_userinfo?_=1407684256076

image

用浏览器访问 https://tieba.baidu.com/f/user/json_userinfo?_=1407684256076 如果能够返回一串 session_id,复制该页面使用的cookie到qd框架里,否则尝试重新登录。

zadishu commented 1 year ago

运行失败:request limit

zadishu commented 1 year ago

WeChat截图_20230802090103

TigerCubDen commented 1 year ago

WeChat截图_20230802090103

问一下你关注了多少个贴吧?我看了下qd框架的任务请求次数限制,默认为1500次。如果不是网站管理员修改了默认了配置,几乎不可能达到限额。

zadishu commented 1 year ago

微信截图_20230802090103

问一下你关注了多少个贴吧?我查看了下qd框架的任务请求次数限制,默认为1500次。如果不是网站管理员修改了默认配置,几乎不可能达到规避。

找到原因了,管理员把请求次数设置为50次了; 关注了60个贴吧,谢谢大佬

Ansen commented 1 year ago

最新版本(20230718) 依然报错:

 Failed at 2/13 request,
Fail assert: {"re": "session_id", "from": "content"} from success_asserts,
Request URL: http://tieba.baidu.com/f/user/json_userinfo?_=1407684256076

image

用浏览器访问 https://tieba.baidu.com/f/user/json_userinfo?_=1407684256076 如果能够返回一串 session_id,复制该页面使用的cookie到qd框架里,否则尝试重新登录。

谢谢指点

解决了,应该是登录的IP 引起的,在公司电信网络获取的Cookie没办法在家里的服务器上使用,我在家里使用docker运行了一个浏览器获取cookie后,签到就正常了

zj243 commented 1 year ago

大佬,只能签100个吧吗,我运行两次也还是没签剩下的

Snipaste_2023-10-30_10-14-55
DAVPanda commented 1 year ago

我这边自动签到只能签7级以上的吧,但是手动点击签到可以签所以的吧(无论是否达到7级),请问这是什么原因导致的,有解决办法吗?

TigerCubDen commented 1 year ago

大佬,只能签100个吧吗,我运行两次也还是没签剩下的 Snipaste_2023-10-30_10-14-55

参考我的这条回复,我需要日志来确定出了什么问题:https://github.com/qd-today/templates/issues/393#issuecomment-1647644589

wzgrx commented 1 year ago
2023-11-23 2:18:03 | 成功 | 已签到:100 个,未签到:100 个,失败数:0 个 -- | -- | --

只能签到100个是怎么回事

wzgrx commented 1 year ago

Failed at 7/13 request, Fail assert: {"re": "200", "from": "status"} from success_asserts, Response Error : HTTP 599: Connection timed out after 30000 milliseconds, Request URL: http://tieba.baidu.com/sign/add

wzgrx commented 1 year ago
2023-11-24 9:00:00 | 失败 | Failed at 7/13 request,Fail assert: {"re": "200", "from": "status"} from success_asserts,Response Error : HTTP 500: Internal Server Error,Request URL: http://tieba.baidu.com/sign/add -- | -- | -- 2023-11-24 8:55:28 | 失败 | Failed at 7/13 request,Fail assert: {"re": "200", "from": "status"} from success_asserts,Response Error : HTTP 302: Found,Request URL: http://tieba.baidu.com/sign/add复制 2023-11-24 2:18:25 | 成功 | 已签到:100 个,未签到:100 个,失败数:0 个
TigerCubDen commented 1 year ago

2023-11-23 2:18:03 | 成功 | 已签到:100 个,未签到:100 个,失败数:0 个 -- | -- | -- 只能签到100个是怎么回事

参考我的这条回复,我需要日志来确定出了什么问题:https://github.com/qd-today/templates/issues/393#issuecomment-1647644589