From 4de9cdd1a99dbf7e8fabf1de271919e52dfd1295 Mon Sep 17 00:00:00 2001 From: wd210010 <76995206+wd210010@users.noreply.github.com> Date: Wed, 4 Oct 2023 16:21:36 +0800 Subject: [PATCH] Create enshan.py --- enshan.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 enshan.py diff --git a/enshan.py b/enshan.py new file mode 100644 index 0000000..ec7eacd --- /dev/null +++ b/enshan.py @@ -0,0 +1,37 @@ +#!/usr/bin/python3 +# -- coding: utf-8 -- +# ------------------------------- +# @Author : github@wd210010 https://github.com/wd210010/only_for_happly +# @Time : 2023/10/4 16:23 +# ------------------------------- +# cron "0 0 2 * * *" script-path=xxx.py,tag=匹配cron用 +# const $ = new Env('恩山签到') +import requests,re,os + +#配置恩山的cookie 到配置文件config.sh export enshanck='' 需要推送配置推送加token export plustoken='' +enshanck = os.getenv("enshanck") + +#推送加 token +plustoken = os.getenv("plustoken") + +def Push(contents): + # 推送加 + headers = {'Content-Type': 'application/json'} + json = {"token": plustoken, 'title': '恩山签到', 'content': contents.replace('\n', '
'), "template": "json"} + resp = requests.post(f'http://www.pushplus.plus/send', json=json, headers=headers).json() + print('push+推送成功' if resp['code'] == 200 else 'push+推送失败') + +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": enshanck, +} +session = requests.session() +response = session.get('https://www.right.com.cn/FORUM/home.php?mod=spacecp&ac=credit&showcredit=1', headers=headers) +try: + coin = re.findall("恩山币: (.*?)nb  ", response.text)[0] + point = re.findall("积分: (.*?)