Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

好像已经失效了,请在仓库的文档上备注一下可用性 #17

Open
Fortytwoo opened this issue May 4, 2023 · 3 comments
Open

Comments

@Fortytwoo
Copy link

image
感谢

@RoadIsLong
Copy link
Owner

感谢提醒

@szc-sun
Copy link

szc-sun commented May 6, 2023

根据上面py写了个nodejs的

function main(){
  cookies.forEach((cookie, index)=>{
    url1 = "https://www.52pojie.cn/CSPDREL2hvbWUucGhwP21vZD10YXNrJmRvPWRyYXcmaWQ9Mg==?wzwscspd=MC4wLjAuMA=="
    url2 = 'https://www.52pojie.cn/home.php?mod=task&do=apply&id=2&referer=%2F'
    url3 = 'https://www.52pojie.cn/home.php?mod=task&do=draw&id=2'
    cookie = decodeURIComponent(cookie);
    let cookie_list = cookie.split(";");
    cookie = ''
    for(let i in cookie_list){
      let item = cookie_list[i]
      if(item.includes("htVC_2132_saltkey",0)){
        cookie += "htVC_2132_saltkey=" + encodeURIComponent(item.split("=")[1]) + "; "
      }
      if(item.includes("htVC_2132_auth",0)){
        cookie += "htVC_2132_auth=" + encodeURIComponent(item.split("=")[1]) + "; "
      }
    }
    if(!(cookie.includes("htVC_2132_saltkey",0)|| cookie.includes("htVC_2132_auth",0))){
      console.log(`第${index}cookie中未包含htVC_2132_saltkey或htVC_2132_auth字段,请检查cookie`)
      return 
    }

    let headers = {
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
      "Accept-Encoding": "gzip, deflate, br",
      "Accept-Language": "zh-CN,zh;q=0.9",
      "Cache-Control": "no-cache",
      "Connection": "keep-alive",
      "Cookie": cookie,
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
    }
    
    axios({url:url1, method: 'get',headers, maxRedirects: 0}).then(res=>{
    }).catch(err=>{
      let s_cookie = err.response.headers['set-cookie'].join(';')
      let cookie1 = cookie + ';' +s_cookie
      headers['Cookie'] = cookie1
      axios({url:url2, method: 'get',headers, maxRedirects: 0}).then(res2=>{
        let s_cookie2 = res2.headers['set-cookie'].join(';')
        let cookie2 = cookie1 + ';' +s_cookie2
        headers['Cookie'] = cookie2
        axios({
          url:url3, 
          method: 'get',
          headers,
          responseType: "arraybuffer", // 关键步骤
          responseEncoding: "utf8",
        }).then(res=>{
          let res_html = res.data
          let utf8decoder = new TextDecoder("GBK"); // 关键步骤
          res_html = utf8decoder.decode(res_html);
          if(res_html.includes("您需要先登录才能继续本操作",0)){
            console.log(`第${index}个账号Cookie 失效`)
          }else if(res_html.includes("恭喜",0)){
            console.log(`第${index}个账号 签到成功`)
          }else if(res_html.includes("不是进行中的任务",0)){
            console.log(`第${index}个账号 今日已签到`)
          }else{
            console.log(`第${index}个账号 签到失败`)
          }
        })
      }).catch(err2=>{
        
      })
    })
  })
}

@szc-sun
Copy link

szc-sun commented May 6, 2023

# -*- coding: utf-8 -*-
# cron "20 9 * * *" script-path=xxx.py,tag=my
# const $ = new Env('吾爱破解');
import os
import sys
import tools.notify as notify 
import urllib.parse
import requests
from bs4 import BeautifulSoup

# 多cookie使用&分割
cookies = ""
if cookies == "":
    if os.environ.get("POJIE"):
        cookies = os.environ.get("POJIE")
    else:
        print("请在环境变量填写POJIE的值")
        sys.exit()
n = 1
for cookie in cookies.split("&"):
    url1 = "https://www.52pojie.cn/CSPDREL2hvbWUucGhwP21vZD10YXNrJmRvPWRyYXcmaWQ9Mg==?wzwscspd=MC4wLjAuMA=="
    url2 = 'https://www.52pojie.cn/home.php?mod=task&do=apply&id=2&referer=%2F'
    url3 = 'https://www.52pojie.cn/home.php?mod=task&do=draw&id=2'
    cookie = urllib.parse.unquote(cookie)
    cookie_list = cookie.split(";")
    cookie = ''
    for i in cookie_list:
        key = i.split("=")[0]
        if "htVC_2132_saltkey" in key:
            cookie += "htVC_2132_saltkey=" + urllib.parse.quote(i.split("=")[1]) + "; "
        if "htVC_2132_auth" in key:
            cookie += "htVC_2132_auth=" + urllib.parse.quote(i.split("=")[1]) + ";"
    if not ('htVC_2132_saltkey' in cookie or 'htVC_2132_auth' in cookie):
        print("第{n}cookie中未包含htVC_2132_saltkey或htVC_2132_auth字段,请检查cookie")
        sys.exit()
    headers = {
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,""application/signed-exchange;v=b3;q=0.9",
        "Accept-Encoding": "gzip, deflate, br",
        "Accept-Language": "zh-CN,zh;q=0.9",
        "Cache-Control": "no-cache",
        "Connection": "keep-alive",
        "Cookie": cookie,
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
                    "Chrome/109.0.0.0 Safari/537.36",
    }
    print(f"111,{cookie}\n")
    print(f"111,{headers}\n")
    r = requests.get(url1, headers=headers, allow_redirects=False)
    print(f"111,{r}\n")
    s_cookie = r.headers['Set-Cookie']
    cookie = cookie + s_cookie
    print(f"123,{r.headers}\n")
    print(f"123,{cookie}\n")
    headers['Cookie'] = cookie
    r = requests.get(url2, headers=headers, allow_redirects=False)
    s_cookie = r.headers['Set-Cookie']
    cookie = cookie + s_cookie
    print(f"456,{s_cookie}\n")
    print(f"456,{cookie}\n")
    headers['Cookie'] = cookie
    r = requests.get(url3, headers=headers)
    r_data = BeautifulSoup(r.text, "html.parser")
    jx_data = r_data.find("div", id="messagetext").find("p").text
    if "您需要先登录才能继续本操作" in jx_data:
        print(f"第{n}个账号Cookie 失效")
        message = f"第{n}个账号 Cookie 失效\n"
    elif "恭喜" in jx_data:
        print(f"第{n}个账号签到成功")
        message = f"第{n}个账号 签到成功\n"
    elif "不是进行中的任务" in jx_data:
        print(f"第{n}个账号今日已签到")
        message = f"第{n}个账号 今日已签到\n"
    else:
        print(f"第{n}个账号签到失败")
        message = f"第{n}个账号 签到失败\n"
    n += 1
    print(message)
    notify.send("吾爱签到", message)


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants