-
Notifications
You must be signed in to change notification settings - Fork 97
/
main.py
40 lines (35 loc) · 1.1 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
import os
import requests
from bs4 import BeautifulSoup
def sign(cookie):
result = ""
headers = {
"Cookie": cookie,
"ContentType": "text/html;charset=gbk",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36",
}
requests.session().put(
"https://www.52pojie.cn/home.php?mod=task&do=apply&id=2", headers=headers
)
fa = requests.session().put(
"https://www.52pojie.cn/home.php?mod=task&do=draw&id=2", headers=headers
)
fb = BeautifulSoup(fa.text, "html.parser")
fc = fb.find("div", id="messagetext").find("p").text
if "您需要先登录才能继续本操作" in fc:
result += "Cookie 失效"
elif "恭喜" in fc:
result += "签到成功"
elif "不是进行中的任务" in fc:
result += "今日已签到"
else:
result += "签到失败"
return result
def main():
b = os.environ['POJIE']
cookie = b
sign_msg = sign(cookie=cookie)
print(sign_msg)
if __name__ == "__main__":
main()