diff --git a/bilibili.py b/bilibili.py index 31dc072..fd88e4e 100644 --- a/bilibili.py +++ b/bilibili.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import json import os -import time + import requests from requests import utils -from checksendNotify import send +from getENV import getENv class BiliBiliCheckIn(object): # TODO 待测试,需要大会员账号测试领取福利 @@ -112,7 +112,7 @@ class BiliBiliCheckIn(object): @staticmethod def get_followings( - session, uid: int, pn: int = 1, ps: int = 50, order: str = "desc", order_type: str = "attention" + session, uid: int, pn: int = 1, ps: int = 50, order: str = "desc", order_type: str = "attention" ) -> dict: """ 获取指定用户关注的up主 @@ -135,7 +135,7 @@ class BiliBiliCheckIn(object): @staticmethod def space_arc_search( - session, uid: int, pn: int = 1, ps: int = 100, tid: int = 0, order: str = "pubdate", keyword: str = "" + session, uid: int, pn: int = 1, ps: int = 100, tid: int = 0, order: str = "pubdate", keyword: str = "" ) -> dict: """ 获取指定up主空间视频投稿信息 @@ -330,12 +330,6 @@ class BiliBiliCheckIn(object): if __name__ == "__main__": - str = { """bilibili_cookie": "CURRENT_FNVAL=80; _uuid=E78B9867-686F-3A27-313E-BFEDFEE09F3000008infoc; buvid3=8EAD6FC6-F814-4B01-AE8F-DFD3075CD609138370infoc; blackside_state=1; LIVE_BUVID=AUTO7415999020731979; rpdid=|(J~Rk|)kukJ0J'ulmmm|k|)R; buvid_fp=8EAD6FC6-F814-4B01-AE8F-DFD3075CD609138370infoc; buvid_fp_plain=8EAD6FC6-F814-4B01-AE8F-DFD3075CD609138370infoc; SESSDATA=e1e3d896%2C1636977456%2C2c051%2A51; bili_jct=ed3d260fa764e41ee7af53437dad8245; DedeUserID=104387005; DedeUserID__ckMd5=777721dee5d2cbba; sid=8nutoc6o; fingerprint3=bd483e5d53116cffede088c3f95b4033; fingerprint=9242077640b48d939b5ba29986fe30d4; fingerprint_s=e67c1fa987ff6289b4d7ec89ba606618; PVID=1; bp_video_offset_104387005=546313440551706948""","coin_num": 0, "coin_type": 1, "silver2coin": true } - if 'bilibili' in os.environ: - print('哔哩哔哩签到开始') - _check_item=json.loads(os.environ.get('bilibili')) - msg=BiliBiliCheckIn(check_item=_check_item).main() - localtime = time.asctime(time.localtime(time.time())) - result=f'当前时间{localtime}\n结果:{msg}' - send('哔哩哔哩签到',result) - else:print('未找到变量请填入') + datas = json.loads(getENv().read()) + _check_item = datas.get("BILIBILI_COOKIE_LIST", [])[0] + BiliBiliCheckIn(check_item=_check_item).main() diff --git a/getENV.py b/getENV.py new file mode 100644 index 0000000..6f79e1e --- /dev/null +++ b/getENV.py @@ -0,0 +1,19 @@ +import os + + +def getENv(): + ql_new = '/ql/config/env.sh' + config_file = '/ql/config/check.json' + print('尝试检查环境\n') + if os.path.exists(ql_new): + print('成功 当前环境为青龙面板继续执行') + if os.path.exists(config_file): + print('已找到配置文件') + with open(config_file, 'r', encoding='utf8') as f: + return f + else: + print('未找到配置文件\n') + print('请添加/ql/config/check.json') + else: + print('失败 请检查环境') + exit(0)