mirror of
https://github.com/Sitoi/dailycheckin.git
synced 2024-11-17 13:48:03 +08:00
✨ 新增(dailycheckin/enshan/main.py):添加恩山无线论坛签到功能
This commit is contained in:
parent
771d4b8fa5
commit
b268d6dced
@ -168,7 +168,10 @@ class AcFun(CheckIn):
|
||||
throwbanana_msg,
|
||||
] + info_msg
|
||||
else:
|
||||
msg = [{"name": "帐号信息", "value": phone}, {"name": "错误信息", "value": res}]
|
||||
msg = [
|
||||
{"name": "帐号信息", "value": phone},
|
||||
{"name": "错误信息", "value": res},
|
||||
]
|
||||
msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg])
|
||||
return msg
|
||||
|
||||
|
@ -10,7 +10,7 @@ urllib3.disable_warnings()
|
||||
|
||||
|
||||
class AliYun(CheckIn):
|
||||
name = "AliYun"
|
||||
name = "阿里云盘"
|
||||
|
||||
def __init__(self, check_item: dict):
|
||||
self.check_item = check_item
|
||||
|
0
dailycheckin/enshan/__init__.py
Executable file
0
dailycheckin/enshan/__init__.py
Executable file
67
dailycheckin/enshan/main.py
Executable file
67
dailycheckin/enshan/main.py
Executable file
@ -0,0 +1,67 @@
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
|
||||
import requests
|
||||
import urllib3
|
||||
|
||||
from dailycheckin import CheckIn
|
||||
|
||||
urllib3.disable_warnings()
|
||||
|
||||
|
||||
class EnShan(CheckIn):
|
||||
name = "恩山无线论坛"
|
||||
|
||||
def __init__(self, check_item):
|
||||
self.check_item = check_item
|
||||
|
||||
@staticmethod
|
||||
def sign(cookie):
|
||||
msg = []
|
||||
headers = {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.125 Safari/537.36",
|
||||
"Cookie": cookie,
|
||||
}
|
||||
response = requests.get(
|
||||
url="https://www.right.com.cn/FORUM/home.php?mod=spacecp&ac=credit&showcredit=1",
|
||||
headers=headers,
|
||||
verify=False,
|
||||
)
|
||||
try:
|
||||
coin = re.findall("恩山币: </em>(.*?) ", response.text)[0]
|
||||
point = re.findall("<em>积分: </em>(.*?)<span", response.text)[0]
|
||||
msg = [
|
||||
{
|
||||
"name": "恩山币",
|
||||
"value": coin,
|
||||
},
|
||||
{
|
||||
"name": "积分",
|
||||
"value": point,
|
||||
},
|
||||
]
|
||||
except Exception as e:
|
||||
msg = [
|
||||
{
|
||||
"name": "签到失败",
|
||||
"value": str(e),
|
||||
}
|
||||
]
|
||||
return msg
|
||||
|
||||
def main(self):
|
||||
cookie = self.check_item.get("cookie")
|
||||
msg = self.sign(cookie=cookie)
|
||||
msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg])
|
||||
return msg
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(
|
||||
os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.json"),
|
||||
encoding="utf-8",
|
||||
) as f:
|
||||
datas = json.loads(f.read())
|
||||
_check_item = datas.get("ENSHAN", [])[0]
|
||||
print(EnShan(check_item=_check_item).main())
|
@ -13,7 +13,7 @@ urllib3.disable_warnings()
|
||||
|
||||
|
||||
class SMZDM(CheckIn):
|
||||
name = "SMZDM"
|
||||
name = "什么值得买"
|
||||
|
||||
def __init__(self, check_item: dict):
|
||||
self.check_item = check_item
|
||||
|
@ -4,7 +4,6 @@ import os
|
||||
import re
|
||||
|
||||
import requests
|
||||
from requests import utils
|
||||
|
||||
from dailycheckin import CheckIn
|
||||
|
||||
|
@ -4,7 +4,6 @@ import re
|
||||
|
||||
import requests
|
||||
import urllib3
|
||||
from requests import utils
|
||||
|
||||
from dailycheckin import CheckIn
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user