diff --git a/README.md b/README.md index d5421d2..fec333b 100644 --- a/README.md +++ b/README.md @@ -32,51 +32,78 @@ > ***您使用或者复制了本仓库且本人制作的任何脚本,则视为 `已接受` 此声明,请仔细阅读*** +## 支持的签到列表 + +可以在各文件夹查看 + +#### 1.dailycheckin_scripts: + +该文件夹下是https://github.com/sitoi/dailycheckin该项目的全部支持脚本[具体查看](https://github.com/yuxian158/check/dailycheckin_scripts/README.md) + ## 使用方法 +**进入容器后运行以下命令**(docker exec -it ql bash)修改ql为你的青龙容器名字 + +以下命令全部都是进入容器后输入 + ### 1.拉取仓库 -**进入容器后运行以下命令**(docker exec -it ql bash)修改ql为你的青龙容器名字 +只使用dailycheckin_scripts: ``` -pip3 install requests rsa -ql repo https://github.com/yuxian158/check.git "ck_" "" "checksendNotify|getENV" -cp /ql/repo/yuxian158_check/config.json /ql/config/check.json +ql repo https://github.com/yuxian158/check.git "ck_" "" "checksend|utils" ``` -### 2.配置 +只使用others_scripts: + +``` +ql repo https://github.com/yuxian158/check.git "oc_" "" "checksend|utils" +``` -然后不出意外的话你可以在青龙面板的配置文件下找到check.json文件 +我全都要: -然后根据原文档修改配置[这里](https://sitoi.gitee.io/dailycheckin/settings/) +``` +ql repo https://github.com/yuxian158/check.git "" "" "checksend|utils" +``` -## 修改说明 +### 2.配置 -### 1.**添加了葫芦侠的签到配置** +``` +cp /ql/repo/yuxian158_check/check.sample.toml /ql/config/check.toml +``` -​ 参数说明:`HLX.user`:用户名 `HLX.password`:密码的MD532位小写加密[生成](https://md5jiami.bmcx.com/) +或使用json格式(不推荐) +``` +cp /ql/repo/yuxian158_check/check.sample.json /ql/config/check.json +``` -### 2。**添加了网易云游戏的签到配置** +然后不出意外的话你可以在青龙面板的配置文件下找到check.toml或check.json文件 -[官网](https://cg.163.com/#/mobile) +然后根据文件夹下REDEME修改配置[这里](https://sitoi.gitee.io/dailycheckin/settings/) -参数说明:`163game.Authorization` +### 3.说明 -登录后抓取签到请求(一般请求的请求头也有这个字段) +1.本仓库在12.21日的更新中同时支持了json和toml两种格式的配置文件,但是推荐使用toml格式配置文件 -[![fMdyEq.png](https://z3.ax1x.com/2021/08/07/fMdyEq.png)](https://imgtu.com/i/fMdyEq) +2.当toml和json配置文件共存时优先使用toml文件 -## 其他说明 +### 4.其他 -1.本库直接使用了青龙的通知配置 +#### 1.关于 toml 的语法参考: -2.请自行修改执行时间 +* [toml-lang/toml](https://github.com/toml-lang/toml) +* [中文知乎介绍](https://zhuanlan.zhihu.com/p/50412485) +* [TOML 教程中文版](https://toml.io/cn/v1.0.0) +#### 2.排错指引 +1.在sitoi/dailycheckin的某次更新中修改了键名,请尽量删除原配置文件后重新配置 +2.本库找配置文件时使用了正则表达式,在最外层配置时可以不区分大小写,且只要包含字段就可以,甚至可以写中文(强烈不建议这么写,貌似toml不支持) +3.很多脚本并没有测试 +4.本库所有脚本都未加运行时间提示,可以拉取后所有脚本运行时间都一样 ## 致谢 [@Wenmoux](https://github.com/Wenmoux/) -[@MayoBlueSky](https://github.com/MayoBlueSky) - [@Sitoi](https://github.com/Sitoi) +[@Oreomeow](https://github.com/Oreomeow) \ No newline at end of file diff --git a/check.sample.json b/check.sample.json new file mode 100644 index 0000000..074e979 --- /dev/null +++ b/check.sample.json @@ -0,0 +1,292 @@ +{ + "IQIYI": [ + { + "cookie": "__dfp=xxxxxx; QP0013=xxxxxx; QP0022=xxxxxx; QYABEX=xxxxxx; P00001=xxxxxx; P00002=xxxxxx; P00003=xxxxxx; P00007=xxxxxx; QC163=xxxxxx; QC175=xxxxxx; QC179=xxxxxx; QC170=xxxxxx; P00010=xxxxxx; P00PRU=xxxxxx; P01010=xxxxxx; QC173=xxxxxx; QC180=xxxxxx; P00004=xxxxxx; QP0030=xxxxxx; QC006=xxxxxx; QC007=xxxxxx; QC008=xxxxxx; QC010=xxxxxx; nu=xxxxxx; __uuid=xxxxxx; QC005=xxxxxx;" + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "VQQ": [ + { + "auth_refresh": "https://access.video.qq.com/user/auth_refresh?vappid=xxxxxx&vsecret=xxxxxx&type=qq&g_tk=&g_vstk=xxxxxx&g_actk=xxxxxx&callback=xxxxxx&_=xxxxxx", + "cookie": "pgv_pvid=xxxxxx; pac_uid=xxxxxx; RK=xxxxxx; ptcz=xxxxxx; tvfe_boss_uuid=xxxxxx; video_guid=xxxxxx; video_platform=xxxxxx; pgv_info=xxxxxx; main_login=xxxxxx; vqq_access_token=xxxxxx; vqq_appid=xxxxxx; vqq_openid=xxxxxx; vqq_vuserid=xxxxxx; vqq_refresh_token=xxxxxx; login_time_init=xxxxxx; uid=xxxxxx; vqq_vusession=xxxxxx; vqq_next_refresh_time=xxxxxx; vqq_login_time_init=xxxxxx; login_time_last=xxxxxx;" + }, + { + "auth_refresh": "多账号 refresh url,请参考上面,以实际获取为准", + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "YOUDAO": [ + { + "cookie": "JSESSIONID=xxxxxx; __yadk_uid=xxxxxx; OUTFOX_SEARCH_USER_ID_NCOO=xxxxxx; YNOTE_SESS=xxxxxx; YNOTE_PERS=xxxxxx; YNOTE_LOGIN=xxxxxx; YNOTE_CSTK=xxxxxx; _ga=xxxxxx; _gid=xxxxxx; _gat=xxxxxx; PUBLIC_SHARE_18a9dde3de846b6a69e24431764270c4=xxxxxx;" + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "KGQQ": [ + { + "cookie": "muid=xxxxxx; uid=xxxxxx; userlevel=xxxxxx; openid=xxxxxx; openkey=xxxxxx; opentype=xxxxxx; qrsig=xxxxxx; pgv_pvid=xxxxxx;" + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "MUSIC163": [ + { + "password": "Sitoi", + "phone": "18888xxxxxx" + }, + { + "password": "多账号 密码", + "phone": "多账号 手机号" + } + ], + "ONEPLUSBBS": [ + { + "cookie": "acw_tc=xxxxxx; qKc3_0e8d_saltkey=xxxxxx; qKc3_0e8d_lastvisit=xxxxxx; bbs_avatar=xxxxxx; qKc3_0e8d_sendmail=xxxxxx; opcid=xxxxxx; opcct=xxxxxx; oppt=xxxxxx; opsid=xxxxxx; opsct=xxxxxx; opbct=xxxxxx; UM_distinctid=xxxxxx; CNZZDATA1277373783=xxxxxx; www_clear=xxxxxx; ONEPLUSID=xxxxxx; qKc3_0e8d_sid=xxxxxx; bbs_uid=xxxxxx; bbs_uname=xxxxxx; bbs_grouptitle=xxxxxx; opuserid=xxxxxx; bbs_sign=xxxxxx; bbs_formhash=xxxxxx; qKc3_0e8d_ulastactivity=xxxxxx; opsertime=xxxxxx; qKc3_0e8d_lastact=xxxxxx; qKc3_0e8d_checkpm=xxxxxx; qKc3_0e8d_noticeTitle=xxxxxx; optime_browser=xxxxxx; opnt=xxxxxx; opstep=xxxxxx; opstep_event=xxxxxx; fp=xxxxxx;" + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "BAIDU": [ + { + "data_url": "https://cdn.jsdelivr.net/gh/Sitoi/Sitoi.github.io/baidu_urls.txt", + "submit_url": "http://data.zz.baidu.com/urls?site=https://sitoi.cn&token=xxxxxx", + "times": 10 + }, + { + "data_url": "多账号 data_url 链接地址,以实际获取为准", + "submit_url": "多账号 submit_url 链接地址,以实际获取为准", + "times": 10 + } + ], + "FMAPP": [ + { + "blackbox": "eyJlcnJxxxxxx", + "cookie": "sensorsdata2015jssdkcross=xxxxxx", + "device_id": "xxxxxx-xxxx-xxxx-xxxx-xxxxxx", + "fmversion": "xxxxxx", + "os": "xxxxxx", + "token": "xxxxxx.xxxxxx-xxxxxx-xxxxxx.xxxxxx-xxxxxx", + "useragent": "xxxxxx" + }, + { + "blackbox": "多账号 blackbox 填写,请参考上面,blackbox 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)", + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)", + "device_id": "多账号 device_id 填写,请参考上面,以实际获取为准", + "fmversion": "多账号 fmVersion 填写,请参考上面,以实际获取为准", + "os": "多账号 os 填写,请参考上面,以实际获取为准", + "token": "多账号 token 填写,请参考上面,以实际获取为准", + "useragent": "多账号 User-Agent 填写,请参考上面,以实际获取为准" + } + ], + "TIEBA": [ + { + "cookie": "BIDUPSID=xxxxxx; PSTM=xxxxxx; BAIDUID=xxxxxx; BAIDUID_BFESS=xxxxxx; delPer=xxxxxx; PSINO=xxxxxx; H_PS_PSSID=xxxxxx; BA_HECTOR=xxxxxx; BDORZ=xxxxxx; TIEBA_USERTYPE=xxxxxx; st_key_id=xxxxxx; BDUSS=xxxxxx; BDUSS_BFESS=xxxxxx; STOKEN=xxxxxx; TIEBAUID=xxxxxx; ab_sr=xxxxxx; st_data=xxxxxx; st_sign=xxxxxx;" + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "BILIBILI": [ + { + "cookie": "_uuid=xxxxxx; rpdid=xxxxxx; LIVE_BUVID=xxxxxx; PVID=xxxxxx; blackside_state=xxxxxx; CURRENT_FNVAL=xxxxxx; buvid3=xxxxxx; fingerprint3=xxxxxx; fingerprint=xxxxxx; buivd_fp=xxxxxx; buvid_fp_plain=xxxxxx; DedeUserID=xxxxxx; DedeUserID__ckMd5=xxxxxx; SESSDATA=xxxxxx; bili_jct=xxxxxx; bsource=xxxxxx; finger=xxxxxx; fingerprint_s=xxxxxx;", + "coin_num": 0, + "coin_type": 1, + "silver2coin": true + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)", + "coin_num": 0, + "coin_type": 1, + "silver2coin": true + } + ], + "V2EX": [ + { + "cookie": "_ga=xxxxxx; __cfduid=xxxxxx; PB3_SESSION=xxxxxx; A2=xxxxxx; V2EXSETTINGS=xxxxxx; V2EX_REFERRER=xxxxxx; V2EX_LANG=xxxxxx; _gid=xxxxxx; V2EX_TAB=xxxxxx;", + "proxy": "使用代理的信息,无密码例子: http://127.0.0.1:1080 有密码例子: http://username:password@127.0.0.1:1080" + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)", + "proxy": "使用代理的信息,无密码例子: http://127.0.0.1:1080 有密码例子: http://username:password@127.0.0.1:1080" + } + ], + "WWW2NZZ": [ + { + "cookie": "YPx9_2132_saltkey=xxxxxx; YPx9_2132_lastvisit=xxxxxx; YPx9_2132_sendmail=xxxxxx; YPx9_2132_con_request_uri=xxxxxx; YPx9_2132_sid=xxxxxx; YPx9_2132_client_created=xxxxxx; YPx9_2132_client_token=xxxxxx; YPx9_2132_ulastactivity=xxxxxx; YPx9_2132_auth=xxxxxx; YPx9_2132_connect_login=xxxxxx; YPx9_2132_connect_is_bind=xxxxxx; YPx9_2132_connect_uin=xxxxxx; YPx9_2132_stats_qc_login=xxxxxx; YPx9_2132_checkpm=xxxxxx; YPx9_2132_noticeTitle=xxxxxx; YPx9_2132_nofavfid=xxxxxx; YPx9_2132_lastact=xxxxxx;" + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "SMZDM": [ + { + "cookie": "__jsluid_s=xxxxxx; __ckguid=xxxxxx; device_id=xxxxxx; homepage_sug=xxxxxx; r_sort_type=xxxxxx; _zdmA.vid=xxxxxx; sajssdk_2015_cross_new_user=xxxxxx; sensorsdata2015jssdkcross=xxxxxx; footer_floating_layer=xxxxxx; ad_date=xxxxxx; ad_json_feed=xxxxxx; zdm_qd=xxxxxx; sess=xxxxxx; user=xxxxxx; _zdmA.uid=xxxxxx; smzdm_id=xxxxxx; userId=xxxxxx; bannerCounter=xxxxxx; _zdmA.time=xxxxxx;" + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "MIMOTION": [ + { + "max_step": "20000", + "min_step": "10000", + "password": "Sitoi", + "phone": "18888xxxxxx" + }, + { + "max_step": "多账号 最大步数填写,请参考上面", + "min_step": "多账号 最小步数填写,请参考上面", + "password": "多账号 密码填写,请参考上面", + "phone": "多账号 手机号填写,请参考上面" + } + ], + "ACFUN": [ + { + "password": "Sitoi", + "phone": "18888xxxxxx" + }, + { + "password": "多账号 密码填写,请参考上面", + "phone": "多账号 手机号填写,请参考上面" + } + ], + "CLOUD189": [ + { + "password": "Sitoi", + "phone": "18888xxxxxx" + }, + { + "password": "多账号 密码填写,请参考上面", + "phone": "多账号 手机号填写,请参考上面" + } + ], + "POJIE": [ + { + "cookie": "htVD_2132_client_token=xxxxxx; htVD_2132_connect_is_bind=xxxxxx; htVD_2132_connect_uin=xxxxxx; htVD_2132_nofavfid=xxxxxx; htVD_2132_smile=xxxxxx; Hm_lvt_46d556462595ed05e05f009cdafff31a=xxxxxx; htVD_2132_saltkey=xxxxxx; htVD_2132_lastvisit=xxxxxx; htVD_2132_client_created=xxxxxx; htVD_2132_auth=xxxxxx; htVD_2132_connect_login=xxxxxx; htVD_2132_home_diymode=xxxxxx; htVD_2132_visitedfid=xxxxxx; htVD_2132_viewid=xxxxxx; KF4=xxxxxx; htVD_2132_st_p=xxxxxx; htVD_2132_lastcheckfeed=xxxxxx; htVD_2132_sid=xxxxxx; htVD_2132_ulastactivity=xxxxxx; htVD_2132_noticeTitle=xxxxxx;" + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "MGTV": [ + { + "params": "uuid=xxxxxx&uid=xxxxxx&ticket=xxxxxx&token=xxxxxx&device=iPhone&did=xxxxxx&deviceId=xxxxxx&appVersion=6.8.2&osType=ios&platform=iphone&abroad=0&aid=xxxxxx&nonce=xxxxxx×tamp=xxxxxx&appid=xxxxxx&type=1&sign=xxxxxx&callback=xxxxxx" + }, + { + "params": "多账号 请求参数填写,请参考上面" + } + ], + "PICACOMIC": [ + { + "email": "Sitoi", + "password": "xxxxxx" + }, + { + "email": "多账号 账号填写,请参考上面", + "password": "多账号 密码填写,请参考上面" + } + ], + "MEIZU": [ + { + "draw_count": "1", + "cookie": "aliyungf_tc=xxxxxx; logined_uid=xxxxxx; acw_tc=xxxxxx; LT=xxxxxx; MZBBS_2132_saltkey=xxxxxx; MZBBS_2132_lastvisit=xxxxxx; MZBBSUC_2132_auth=xxxxxx; MZBBSUC_2132_loginmember=xxxxxx; MZBBSUC_2132_ticket=xxxxxx; MZBBS_2132_sid=xxxxxx; MZBBS_2132_ulastactivity=xxxxxx; MZBBS_2132_auth=xxxxxx; MZBBS_2132_loginmember=xxxxxx; MZBBS_2132_lastcheckfeed=xxxxxx; MZBBS_2132_checkfollow=xxxxxx; MZBBS_2132_lastact=xxxxxx;" + }, + { + "draw_count": "多账号 抽奖次数设置", + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "ZHIYOO": [ + { + "cookie": "ikdQ_9242_saltkey=xxxxxx; ikdQ_9242_lastvisit=xxxxxx; ikdQ_9242_onlineusernum=xxxxxx; ikdQ_9242_sendmail=1; ikdQ_9242_seccode=xxxxxx; ikdQ_9242_ulastactivity=xxxxxx; ikdQ_9242_auth=xxxxxx; ikdQ_9242_connect_is_bind=xxxxxx; ikdQ_9242_nofavfid=xxxxxx; ikdQ_9242_checkpm=xxxxxx; ikdQ_9242_noticeTitle=1; ikdQ_9242_sid=xxxxxx; ikdQ_9242_lip=xxxxxx; ikdQ_9242_lastact=xxxxxx" + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "WEIBO": [ + { + "url": "https://api.weibo.cn/2/users/show?wm=xxxxxx&launchid=xxxxxx&b=xxxxxx&from=xxxxxx&c=xxxxxx&networktype=xxxxxx&v_p=xxxxxx&skin=xxxxxx&v_f=xxxxxx&lang=xxxxxx&sflag=xxxxxx&ua=xxxxxx&ft=xxxxxx&aid=xxxxxx&has_extend=xxxxxx&uid=xxxxxx&gsid=xxxxxx&sourcetype=&get_teenager=xxxxxx&s=xxxxxx&has_profile=xxxxxx" + }, + { + "url": "多账号 show_url 填写,请参考上面,show_url 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "DUOKAN": [ + { + "cookie": "user_id=xxxxxx; token=xxxxxx; user_gender=xxxxxx; device_id=xxxxxx; app_id=xxxxxx; build=xxxxxx; short_version=xxxxxx" + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "CSDN": [ + { + "cookie": "uuid_tt_dd=xxxxxx; _ga=xxxxxx; UserName=xxxxxx; UserInfo=xxxxxx; UserToken=xxxxxx; UserNick=xxxxxx; AU=768; UN=xxxxxx; BT=xxxxxx; p_uid=xxxxxx; Hm_up_6bcd52f51e9b3dce32bec4a3997715ac=xxxxxx; Hm_ct_6bcd52f51e9b3dce32bec4a3997715ac=xxxxxx; Hm_lvt_6bcd52f51e9b3dce32bec4a3997715ac=xxxxxx dc_sid=xxxxxx; c_segment=xxxxxx; dc_session_id=xxxxxx; csrfToken=xxxxxx; c_first_ref=xxxxxx; c_first_page=xxxxxx; c_page_id=xxxxxx; announcement-new=xxxxxx; log_Id_click=xxxxxx; c_pref=xxxxxx; c_ref=xxxxxx; dc_tos=xxxxxx; log_Id_pv=xxxxxx; log_Id_view=xxxxxx" + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "WZYD": [ + { + "data": "areaId=xxxxxx&roleId=xxxxxx&gameId=xxxxxx&serverId=xxxxxx&gameOpenid=xxxxxx&userId=xxxxxx&appVersion=xxxxxx&cClientVersionName=xxxxxx&platid=xxxxxx&source=xxxxxx&algorithm=xxxxxx&version=xxxxxx×tamp=xxxxxx&appid=xxxxxx&openid=xxxxxx&sig=xxxxxx&encode=2&msdkEncodeParam=xxxxxx&cSystem=xxxxxx&h5Get=xxxxxx&msdkToken=&appOpenid=xxxxxx" + }, + { + "data": "多账号 data 填写,请参考上面,data 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } + ], + "WOMAIL": [ + { + "url": "https://nyan.mail.wo.cn/cn/sign/index/index?mobile=xxxxxx&userName=&openId=xxxxxx", + "pause21days": true, + "password": "Sitoi", + "phone": "18888xxxxxx" + }, + { + "url": "多账号 url 填写,请参考上面,url 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)", + "pause21days": true, + "password": "多账号 密码填写,请参考上面", + "phone": "多账号 手机号填写,请参考上面" + } + ], + "HEYTAP": [ + { + "cookie": "sa_distinct_id=xxxxxx;Personalized=xxxxxx;s_channel=xxxxxx;source_type=xxxxxx;app_param=xxxxxx;ENCODE_TOKENSID=xxxxxx;scene_id=xxxxxx;apkPkg=xxxxxx;exp_id=;app_utm=xxxxxx;TOKENSID=xxxxxx;strategy_id=xxxxxx;referer=;experiment_id=xxxxxx;section_id=;s_version=xxxxxx;app_innerutm=xxxxxx;retrieve_id=;log_id=;", + "useragent": "xxxxxx", + "draw": false + }, + { + "cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)", + "useragent": "多账号 User-Agent 填写,请参考上面,以实际获取为准", + "draw": false + } + ], + "UNICOM": [ + { + "mobile": "18888xxxxxx", + "password": "xxxxxx", + "app_id": "xxxxxx" + }, + { + "mobile": "多账号 手机号", + "password": "多账号 密码", + "app_id": "多账号 appId" + } + ], + "EVERPHOTO": [ + { + "mobile": "+8618888xxxxxx", + "password": "xxxxxx" + }, + { + "mobile": "多账号 手机号", + "password": "多账号 密码" + } + ] +} \ No newline at end of file diff --git a/check.sample.toml b/check.sample.toml new file mode 100644 index 0000000..e69de29 diff --git a/checksendNotify.py b/checksendNotify.py index 9bdafe3..a431547 100644 --- a/checksendNotify.py +++ b/checksendNotify.py @@ -1,285 +1,352 @@ #!/usr/bin/env python3 # _*_ coding:utf-8 _*_ - -import sys -import os, re - -cur_path = os.path.abspath(os.path.dirname(__file__)) -root_path = os.path.split(cur_path)[0] -sys.path.append(root_path) -import requests +import base64 +import hashlib +import hmac import json +import os +import re +import threading import time -import hmac -import hashlib -import base64 import urllib.parse -from requests.adapters import HTTPAdapter -from urllib3.util import Retry + +import requests + +# 原先的 print 函数和主线程的锁 +_print = print +mutex = threading.Lock() + + +# 定义新的 print 函数 +def print(text, *args, **kw): + """ + 使输出有序进行,不出现多线程同一时间输出导致错乱的问题。 + """ + with mutex: + _print(text, *args, **kw) + # 通知服务 -BARK = '' # bark服务,自行搜索;,此参数如果以http或者https开头则判定为自建bark服务;secrets可填; -SCKEY = '' # Server酱的SCKEY; secrets可填 -TG_BOT_TOKEN = '' # tg机器人的TG_BOT_TOKEN; secrets可填1407203283:AAG9rt-6RDaaX0HBLZQq0laNOh898iFYaRQ -TG_USER_ID = '' # tg机器人的TG_USER_ID; secrets可填 1434078534 -TG_API_HOST = '' # tg 代理api -TG_PROXY_IP = '' # tg机器人的TG_PROXY_IP; secrets可填 -TG_PROXY_PORT = '' # tg机器人的TG_PROXY_PORT; secrets可填 -DD_BOT_ACCESS_TOKEN = '' # 钉钉机器人的DD_BOT_ACCESS_TOKEN; secrets可填 -DD_BOT_SECRET = '' # 钉钉机器人的DD_BOT_SECRET; secrets可填 -QQ_SKEY = '' # qq机器人的QQ_SKEY; secrets可填 -QQ_MODE = '' # qq机器人的QQ_MODE; secrets可填 -QYWX_AM = '' # 企业微信 -PUSH_PLUS_TOKEN = '' # 微信推送Plus+ -GOBOT_URL = "" # go-cqhttp 例如:推送到个人QQ: http://127.0.0.1/send_private_msg 群:http://127.0.0.1/send_group_msg -GOBOT_TOKEN = "" # go-cqhttp的access_token 可不填 -GOBOT_QQ = "" # go-cqhttp的推送群或者用户 GOBOT_URL设置 /send_private_msg 则需要填入 user_id=个人QQ 相反如果是 /send_group_msg 则需要填入 group_id=QQ群 -notify_mode = [] - -message_info = '''''' - -# GitHub action运行需要填写对应的secrets -if "BARK" in os.environ and os.environ["BARK"]: - BARK = os.environ["BARK"] -if "SCKEY" in os.environ and os.environ["SCKEY"]: - SCKEY = os.environ["SCKEY"] -if "TG_BOT_TOKEN" in os.environ and os.environ["TG_BOT_TOKEN"] and "TG_USER_ID" in os.environ and os.environ[ - "TG_USER_ID"]: - TG_BOT_TOKEN = os.environ["TG_BOT_TOKEN"] - TG_USER_ID = os.environ["TG_USER_ID"] -if "TG_API_HOST" in os.environ and os.environ["TG_API_HOST"]: - TG_API_HOST = os.environ["TG_API_HOST"] -if "DD_BOT_ACCESS_TOKEN" in os.environ and os.environ["DD_BOT_ACCESS_TOKEN"] and "DD_BOT_SECRET" in os.environ and \ - os.environ["DD_BOT_SECRET"]: - DD_BOT_ACCESS_TOKEN = os.environ["DD_BOT_ACCESS_TOKEN"] - DD_BOT_SECRET = os.environ["DD_BOT_SECRET"] -if "QQ_SKEY" in os.environ and os.environ["QQ_SKEY"] and "QQ_MODE" in os.environ and os.environ["QQ_MODE"]: - QQ_SKEY = os.environ["QQ_SKEY"] - QQ_MODE = os.environ["QQ_MODE"] -# 获取pushplus+ PUSH_PLUS_TOKEN -if "PUSH_PLUS_TOKEN" in os.environ: - if len(os.environ["PUSH_PLUS_TOKEN"]) > 1: - PUSH_PLUS_TOKEN = os.environ["PUSH_PLUS_TOKEN"] - # print("已获取并使用Env环境 PUSH_PLUS_TOKEN") -# 获取企业微信应用推送 QYWX_AM -if "QYWX_AM" in os.environ: - if len(os.environ["QYWX_AM"]) > 1: - QYWX_AM = os.environ["QYWX_AM"] - # print("已获取并使用Env环境 QYWX_AM") -# 获取go-cqhttp -if "GOBOT_URL" in os.environ and os.environ["GOBOT_URL"]: - GOBOT_URL = os.environ["GOBOT_URL"] - GOBOT_TOKEN = os.environ["GOBOT_TOKEN"] - GOBOT_QQ = os.environ["GOBOT_QQ"] - -if BARK: - notify_mode.append('bark') - # print("BARK 推送打开") -if SCKEY: - notify_mode.append('sc_key') - # print("Server酱 推送打开") -if TG_BOT_TOKEN and TG_USER_ID: - notify_mode.append('telegram_bot') - # print("Telegram 推送打开") -if DD_BOT_ACCESS_TOKEN and DD_BOT_SECRET: - notify_mode.append('dingding_bot') - # print("钉钉机器人 推送打开") -if QQ_SKEY and QQ_MODE: - notify_mode.append('coolpush_bot') - # print("QQ机器人 推送打开") -if GOBOT_URL and GOBOT_QQ: - notify_mode.append('go_cqhttp') - # print("go-cqhttp机器人 推送打开") -if PUSH_PLUS_TOKEN: - notify_mode.append('pushplus_bot') - # print("微信推送Plus机器人 推送打开") -if QYWX_AM: - notify_mode.append('wecom_app') - # print("企业微信机器人 推送打开") - - -def message(str_msg): - global message_info - print(str_msg) - message_info = "{}\n{}".format(message_info, str_msg) - sys.stdout.flush() - - -def bark(title, content): - print("\n") - if not BARK: - print("bark服务的bark_token未设置!!\n取消推送") +# fmt: off +push_config = { + 'HITOKOTO': True, # 启用一言(随机句子) + + 'BARK_PUSH': '', # bark IP 或设备码,例:https://api.day.app/DxHcxxxxxRxxxxxxcm/ + 'BARK_ARCHIVE': '', # bark 推送是否存档 + 'BARK_GROUP': '', # bark 推送分组 + 'BARK_SOUND': '', # bark 推送声音 + + 'CONSOLE': False, # 控制台输出 + + 'DD_BOT_SECRET': '', # 钉钉机器人的 DD_BOT_SECRET + 'DD_BOT_TOKEN': '', # 钉钉机器人的 DD_BOT_TOKEN + + 'FSKEY': '', # 飞书机器人的 FSKEY + + 'GOBOT_URL': '', # go-cqhttp + # 推送到个人QQ:http://127.0.0.1/send_private_msg + # 群:http://127.0.0.1/send_group_msg + 'GOBOT_QQ': '', # go-cqhttp 的推送群或用户 + # GOBOT_URL 设置 /send_private_msg 时填入 user_id=个人QQ + # /send_group_msg 时填入 group_id=QQ群 + 'GOBOT_TOKEN': '', # go-cqhttp 的 access_token + + 'GOTIFY_URL': '', # gotify地址,如https://push.example.de:8080 + 'GOTIFY_TOKEN': '', # gotify的消息应用token + 'GOTIFY_PRIORITY': 0, # 推送消息优先级,默认为0 + + 'IGOT_PUSH_KEY': '', # iGot 聚合推送的 IGOT_PUSH_KEY + + 'PUSH_KEY': '', # server 酱的 PUSH_KEY,兼容旧版与 Turbo 版 + + 'PUSH_PLUS_TOKEN': '', # push+ 微信推送的用户令牌 + 'PUSH_PLUS_USER': '', # push+ 微信推送的群组编码 + + 'QMSG_KEY': '', # qmsg 酱的 QMSG_KEY + 'QMSG_TYPE': '', # qmsg 酱的 QMSG_TYPE + + 'QYWX_AM': '', # 企业微信应用 + + 'QYWX_KEY': '', # 企业微信机器人 + + 'TG_BOT_TOKEN': '', # tg 机器人的 TG_BOT_TOKEN,例:1407203283:AAG9rt-6RDaaX0HBLZQq0laNOh898iFYaRQ + 'TG_USER_ID': '', # tg 机器人的 TG_USER_ID,例:1434078534 + 'TG_API_HOST': '', # tg 代理 api + 'TG_PROXY_AUTH': '', # tg 代理认证参数 + 'TG_PROXY_HOST': '', # tg 机器人的 TG_PROXY_HOST + 'TG_PROXY_PORT': '', # tg 机器人的 TG_PROXY_PORT +} +notify_function = [] +# fmt: on + +# 首先读取 面板变量 或者 github action 运行变量 +for k in push_config: + if os.getenv(k): + v = os.getenv(k) + push_config[k] = v + + +def bark(title: str, content: str) -> None: + """ + 使用 bark 推送消息。 + """ + if not push_config.get("BARK_PUSH"): + print("bark 服务的 BARK_PUSH 未设置!!\n取消推送") return - print("bark服务启动") - url = None - if BARK.startswith('http'): - url = f"""{BARK}/{title}/{content}""" + print("bark 服务启动") + + if push_config.get("BARK_PUSH").startswith("http"): + url = f'{push_config.get("BARK_PUSH")}/{urllib.parse.quote_plus(title)}/{urllib.parse.quote_plus(content)}' else: - url = f"""https://api.day.app/{BARK}/{title}/{content}""" + url = f'https://api.day.app/{push_config.get("BARK_PUSH")}/{urllib.parse.quote_plus(title)}/{urllib.parse.quote_plus(content)}' + + bark_params = { + "BARK_ARCHIVE": "isArchive", + "BARK_GROUP": "group", + "BARK_SOUND": "sound", + } + params = "" + for pair in filter( + lambda pairs: pairs[0].startswith("BARK_") + and pairs[0] != "BARK_PUSH" + and pairs[1] + and bark_params.get(pairs[0]), + push_config.items(), + ): + params += f"{bark_params.get(pair[0])}={pair[1]}&" + if params: + url = url + "?" + params.rstrip("&") response = requests.get(url).json() - if response['code'] == 200: - print('推送成功!') + + if response["code"] == 200: + print("bark 推送成功!") + else: + print("bark 推送失败!") + + +def console(title: str, content: str) -> None: + """ + 使用 控制台 推送消息。 + """ + print(f"{title}\n\n{content}") + + +def dingding_bot(title: str, content: str) -> None: + """ + 使用 钉钉机器人 推送消息。 + """ + if not push_config.get("DD_BOT_SECRET") or not push_config.get("DD_BOT_TOKEN"): + print("钉钉机器人 服务的 DD_BOT_SECRET 或者 DD_BOT_TOKEN 未设置!!\n取消推送") + return + print("钉钉机器人 服务启动") + + timestamp = str(round(time.time() * 1000)) + secret_enc = push_config.get("DD_BOT_SECRET").encode("utf-8") + string_to_sign = "{}\n{}".format(timestamp, push_config.get("DD_BOT_SECRET")) + string_to_sign_enc = string_to_sign.encode("utf-8") + hmac_code = hmac.new( + secret_enc, string_to_sign_enc, digestmod=hashlib.sha256 + ).digest() + sign = urllib.parse.quote_plus(base64.b64encode(hmac_code)) + url = f'https://oapi.dingtalk.com/robot/send?access_token={push_config.get("DD_BOT_TOKEN")}×tamp={timestamp}&sign={sign}' + headers = {"Content-Type": "application/json;charset=utf-8"} + data = {"msgtype": "text", "text": {"content": f"{title}\n\n{content}"}} + response = requests.post( + url=url, data=json.dumps(data), headers=headers, timeout=15 + ).json() + + if not response["errcode"]: + print("钉钉机器人 推送成功!") else: - print('推送失败!') + print("钉钉机器人 推送失败!") -# go-cqhttp -def go_cqhttp(title, content): - print("\n") - if not GOBOT_URL or not GOBOT_QQ: - print("go-cqhttp服务的GOBOT_URL或GOBOT_QQ未设置!!\n取消推送") +def feishu_bot(title: str, content: str) -> None: + """ + 使用 飞书机器人 推送消息。 + """ + if not push_config.get("FSKEY"): + print("飞书 服务的 FSKEY 未设置!!\n取消推送") return - print("go-cqhttp服务启动") - url = f"""{GOBOT_URL}?access_token={GOBOT_TOKEN}&{GOBOT_QQ}&message=标题:{title}\n内容:{content}""" + print("飞书 服务启动") + + url = f'https://open.feishu.cn/open-apis/bot/v2/hook/{push_config.get("FSKEY")}' + data = {"msg_type": "text", "content": {"text": f"{title}\n\n{content}"}} + response = requests.post(url, data=json.dumps(data)).json() + + if response.get("StatusCode") == 0: + print("飞书 推送成功!") + else: + print("飞书 推送失败!错误信息如下:\n", response) + + +def go_cqhttp(title: str, content: str) -> None: + """ + 使用 go_cqhttp 推送消息。 + """ + if not push_config.get("GOBOT_URL") or not push_config.get("GOBOT_QQ"): + print("go-cqhttp 服务的 GOBOT_URL 或 GOBOT_QQ 未设置!!\n取消推送") + return + print("go-cqhttp 服务启动") + + url = f'{push_config.get("GOBOT_URL")}?access_token={push_config.get("GOBOT_TOKEN")}&{push_config.get("GOBOT_QQ")}&message=标题:{title}\n内容:{content}' response = requests.get(url).json() - if response['status'] == 'ok': - print('推送成功!') + + if response["status"] == "ok": + print("go-cqhttp 推送成功!") else: - print('推送失败!') + print("go-cqhttp 推送失败!") -def serverJ(title, content): - print("\n") - if not SCKEY: - print("server酱服务的SCKEY未设置!!\n取消推送") +def gotify(title:str,content:str) -> None: + """ + 使用 gotify 推送消息。 + """ + if not push_config.get("GOTIFY_URL") or not push_config.get("GOTIFY_TOKEN"): + print("gotify 服务的 GOTIFY_URL 或 GOTIFY_TOKEN 未设置!!\n取消推送") return - print("serverJ服务启动") - data = { - "text": title, - "desp": content.replace("\n", "\n\n") - } - response = requests.post(f"https://sc.ftqq.com/{SCKEY}.send", data=data).json() - if response['errno'] == 0: - print('推送成功!') + print("gotify 服务启动") + + url = f'{push_config.get("GOTIFY_URL")}/message?token={push_config.get("GOTIFY_TOKEN")}' + data = {"title": title,"message": content,"priority": push_config.get("GOTIFY_PRIORITY")} + response = requests.post(url,data=data).json() + + if response.get("id"): + print("gotify 推送成功!") else: - print('推送失败!') + print("gotify 推送失败!") -# tg通知 -def telegram_bot(title, content): - try: - print("\n") - bot_token = TG_BOT_TOKEN - user_id = TG_USER_ID - if not bot_token or not user_id: - print("tg服务的bot_token或者user_id未设置!!\n取消推送") - return - print("tg服务启动") - if TG_API_HOST: - url = f"https://{TG_API_HOST}/bot{TG_BOT_TOKEN}/sendMessage" - else: - url = f"https://api.telegram.org/bot{TG_BOT_TOKEN}/sendMessage" - - headers = {'Content-Type': 'application/x-www-form-urlencoded'} - payload = {'chat_id': str(TG_USER_ID), 'text': f'{title}\n\n{content}', 'disable_web_page_preview': 'true'} - proxies = None - if TG_PROXY_IP and TG_PROXY_PORT: - proxyStr = "http://{}:{}".format(TG_PROXY_IP, TG_PROXY_PORT) - proxies = {"http": proxyStr, "https": proxyStr} - try: - response = requests.post(url=url, headers=headers, params=payload, proxies=proxies).json() - except: - print('推送失败!') - if response['ok']: - print('推送成功!') - else: - print('推送失败!') - except Exception as e: - print(e) - - -def dingding_bot(title, content): - timestamp = str(round(time.time() * 1000)) # 时间戳 - secret_enc = DD_BOT_SECRET.encode('utf-8') - string_to_sign = '{}\n{}'.format(timestamp, DD_BOT_SECRET) - string_to_sign_enc = string_to_sign.encode('utf-8') - hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest() - sign = urllib.parse.quote_plus(base64.b64encode(hmac_code)) # 签名 - print('开始使用 钉钉机器人 推送消息...', end='') - url = f'https://oapi.dingtalk.com/robot/send?access_token={DD_BOT_ACCESS_TOKEN}×tamp={timestamp}&sign={sign}' - headers = {'Content-Type': 'application/json;charset=utf-8'} +def iGot(title: str, content: str) -> None: + """ + 使用 iGot 推送消息。 + """ + if not push_config.get("IGOT_PUSH_KEY"): + print("iGot 服务的 IGOT_PUSH_KEY 未设置!!\n取消推送") + return + print("iGot 服务启动") + + url = f'https://push.hellyw.com/{push_config.get("IGOT_PUSH_KEY")}' + data = {"title": title, "content": content} + headers = {"Content-Type": "application/x-www-form-urlencoded"} + response = requests.post(url, data=data, headers=headers).json() + + if response["ret"] == 0: + print("iGot 推送成功!") + else: + print(f'iGot 推送失败!{response["errMsg"]}') + + +def serverJ(title: str, content: str) -> None: + """ + 通过 serverJ 推送消息。 + """ + if not push_config.get("PUSH_KEY"): + print("serverJ 服务的 PUSH_KEY 未设置!!\n取消推送") + return + print("serverJ 服务启动") + + data = {"text": title, "desp": content.replace("\n", "\n\n")} + if push_config.get("PUSH_KEY").index("SCT") != -1: + url = f'https://sctapi.ftqq.com/{push_config.get("PUSH_KEY")}.send' + else: + url = f'https://sc.ftqq.com/${push_config.get("PUSH_KEY")}.send' + response = requests.post(url, data=data).json() + + if response.get("errno") == 0 or response.get("code") == 0: + print("serverJ 推送成功!") + else: + print(f'serverJ 推送失败!错误码:{response["message"]}') + + +def pushplus_bot(title: str, content: str) -> None: + """ + 通过 push+ 推送消息。 + """ + if not push_config.get("PUSH_PLUS_TOKEN"): + print("PUSHPLUS 服务的 PUSH_PLUS_TOKEN 未设置!!\n取消推送") + return + print("PUSHPLUS 服务启动") + + url = "http://www.pushplus.plus/send" data = { - 'msgtype': 'text', - 'text': {'content': f'{title}\n\n{content}'} + "token": push_config.get("PUSH_PLUS_TOKEN"), + "title": title, + "content": content, + "topic": push_config.get("PUSH_PLUS_USER"), } - response = requests.post(url=url, data=json.dumps(data), headers=headers, timeout=15).json() - if not response['errcode']: - print('推送成功!') + body = json.dumps(data).encode(encoding="utf-8") + headers = {"Content-Type": "application/json"} + response = requests.post(url=url, data=body, headers=headers).json() + + if response["code"] == 200: + print("PUSHPLUS 推送成功!") + else: - print('推送失败!') + url_old = "http://pushplus.hxtrip.com/send" + headers["Accept"] = "application/json" + response = requests.post(url=url_old, data=body, headers=headers).json() + + if response["code"] == 200: + print("PUSHPLUS(hxtrip) 推送成功!") -def coolpush_bot(title, content): - print("\n") - if not QQ_SKEY or not QQ_MODE: - print("qq服务的QQ_SKEY或者QQ_MODE未设置!!\n取消推送") + else: + print("PUSHPLUS 推送失败!") + + +def qmsg_bot(title: str, content: str) -> None: + """ + 使用 qmsg 推送消息。 + """ + if not push_config.get("QMSG_KEY") or not push_config.get("QMSG_TYPE"): + print("qmsg 的 QMSG_KEY 或者 QMSG_TYPE 未设置!!\n取消推送") return - print("qq服务启动") - url = f"https://qmsg.zendee.cn/{QQ_MODE}/{QQ_SKEY}" - payload = {'msg': f"{title}\n\n{content}".encode('utf-8')} + print("qmsg 服务启动") + + url = f'https://qmsg.zendee.cn/{push_config.get("QMSG_TYPE")}/{push_config.get("QMSG_KEY")}' + payload = {"msg": f'{title}\n\n{content.replace("----", "-")}'.encode("utf-8")} response = requests.post(url=url, params=payload).json() - if response['code'] == 0: - print('推送成功!') - else: - print('推送失败!') + if response["code"] == 0: + print("qmsg 推送成功!") + else: + print(f'qmsg 推送失败!{response["reason"]}') -# push推送 -def pushplus_bot(title, content): - try: - print("\n") - if not PUSH_PLUS_TOKEN: - print("PUSHPLUS服务的token未设置!!\n取消推送") - return - print("PUSHPLUS服务启动") - url = 'http://www.pushplus.plus/send' - data = { - "token": PUSH_PLUS_TOKEN, - "title": title, - "content": content - } - body = json.dumps(data).encode(encoding='utf-8') - headers = {'Content-Type': 'application/json'} - response = requests.post(url=url, data=body, headers=headers).json() - if response['code'] == 200: - print('推送成功!') - else: - print('推送失败!') - except Exception as e: - print(e) +def wecom_app(title: str, content: str) -> None: + """ + 通过 企业微信 APP 推送消息。 + """ + if not push_config.get("QYWX_AM"): + print("QYWX_AM 未设置!!\n取消推送") + return + QYWX_AM_AY = re.split(",", push_config.get("QYWX_AM")) + if 4 < len(QYWX_AM_AY) > 5: + print("QYWX_AM 设置错误!!\n取消推送") + return + print("企业微信 APP 服务启动") -# 企业微信 APP 推送 -def wecom_app(title, content): + corpid = QYWX_AM_AY[0] + corpsecret = QYWX_AM_AY[1] + touser = QYWX_AM_AY[2] + agentid = QYWX_AM_AY[3] try: - if not QYWX_AM: - print("QYWX_AM 并未设置!!\n取消推送") - return - QYWX_AM_AY = re.split(',', QYWX_AM) - if 4 < len(QYWX_AM_AY) > 5: - print("QYWX_AM 设置错误!!\n取消推送") - return - corpid = QYWX_AM_AY[0] - corpsecret = QYWX_AM_AY[1] - touser = QYWX_AM_AY[2] - agentid = QYWX_AM_AY[3] - try: - media_id = QYWX_AM_AY[4] - except: - media_id = '' - wx = WeCom(corpid, corpsecret, agentid) - # 如果没有配置 media_id 默认就以 text 方式发送 - if not media_id: - message = title + '\n\n' + content - response = wx.send_text(message, touser) - else: - response = wx.send_mpnews(title, content, media_id, touser) - if response == 'ok': - print('推送成功!') - else: - print('推送失败!错误信息如下:\n', response) - except Exception as e: - print(e) + media_id = QYWX_AM_AY[4] + except IndexError: + media_id = "" + wx = WeCom(corpid, corpsecret, agentid) + # 如果没有配置 media_id 默认就以 text 方式发送 + if not media_id: + message = title + "\n\n" + content + response = wx.send_text(message, touser) + else: + response = wx.send_mpnews(title, content, media_id, touser) + + if response == "ok": + print("企业微信推送成功!") + else: + print("企业微信推送失败!错误信息如下:\n", response) class WeCom: @@ -289,32 +356,37 @@ class WeCom: self.AGENTID = agentid def get_access_token(self): - url = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken' - values = {'corpid': self.CORPID, - 'corpsecret': self.CORPSECRET, - } + url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken" + values = { + "corpid": self.CORPID, + "corpsecret": self.CORPSECRET, + } req = requests.post(url, params=values) data = json.loads(req.text) return data["access_token"] def send_text(self, message, touser="@all"): - send_url = 'https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=' + self.get_access_token() + send_url = ( + "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=" + + self.get_access_token() + ) send_values = { "touser": touser, "msgtype": "text", "agentid": self.AGENTID, - "text": { - "content": message - }, - "safe": "0" + "text": {"content": message}, + "safe": "0", } - send_msges = (bytes(json.dumps(send_values), 'utf-8')) + send_msges = bytes(json.dumps(send_values), "utf-8") respone = requests.post(send_url, send_msges) respone = respone.json() return respone["errmsg"] def send_mpnews(self, title, message, media_id, touser="@all"): - send_url = 'https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=' + self.get_access_token() + send_url = ( + "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=" + + self.get_access_token() + ) send_values = { "touser": touser, "msgtype": "mpnews", @@ -326,93 +398,144 @@ class WeCom: "thumb_media_id": media_id, "author": "Author", "content_source_url": "", - "content": message.replace('\n', '
'), - "digest": message + "content": message.replace("\n", "
"), + "digest": message, } ] - } + }, } - send_msges = (bytes(json.dumps(send_values), 'utf-8')) + send_msges = bytes(json.dumps(send_values), "utf-8") respone = requests.post(send_url, send_msges) respone = respone.json() return respone["errmsg"] -def one(): - url = 'https://v1.hitokoto.cn/' - res = requests.get(url).json() - # noinspection PyBroadException - try: - result = res['hitokoto'] + ' ---' + res['from'] - except: - return '出错了请检查' - return result +def wecom_bot(title: str, content: str) -> None: + """ + 通过 企业微信机器人 推送消息。 + """ + if not push_config.get("QYWX_KEY"): + print("企业微信机器人 服务的 QYWX_KEY 未设置!!\n取消推送") + return + print("企业微信机器人服务启动") -def send(title, content): + url = f"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={push_config.get('QYWX_KEY')}" + headers = {"Content-Type": "application/json;charset=utf-8"} + data = {"msgtype": "text", "text": {"content": f"{title}\n\n{content}"}} + response = requests.post( + url=url, data=json.dumps(data), headers=headers, timeout=15 + ).json() + + if response["errcode"] == 0: + print("企业微信机器人推送成功!") + else: + print("企业微信机器人推送失败!") + + +def telegram_bot(title: str, content: str) -> None: + """ + 使用 telegram 机器人 推送消息。 """ - 使用 bark, telegram bot, dingding bot, serverJ 发送手机推送 - :param title: - :param content: + if not push_config.get("TG_BOT_TOKEN") or not push_config.get("TG_USER_ID"): + print("tg 服务的 bot_token 或者 user_id 未设置!!\n取消推送") + return + print("tg 服务启动") + + if push_config.get("TG_API_HOST"): + url = f"https://{push_config.get('TG_API_HOST')}/bot{push_config.get('TG_BOT_TOKEN')}/sendMessage" + else: + url = ( + f"https://api.telegram.org/bot{push_config.get('TG_BOT_TOKEN')}/sendMessage" + ) + headers = {"Content-Type": "application/x-www-form-urlencoded"} + payload = { + "chat_id": str(push_config.get("TG_USER_ID")), + "text": f"{title}\n\n{content}", + "disable_web_page_preview": "true", + } + proxies = None + if push_config.get("TG_PROXY_HOST") and push_config.get("TG_PROXY_PORT"): + if push_config.get("TG_PROXY_AUTH") is not None and "@" not in push_config.get( + "TG_PROXY_HOST" + ): + push_config["TG_PROXY_HOST"] = ( + push_config.get("TG_PROXY_AUTH") + + "@" + + push_config.get("TG_PROXY_HOST") + ) + proxyStr = "http://{}:{}".format( + push_config.get("TG_PROXY_HOST"), push_config.get("TG_PROXY_PORT") + ) + proxies = {"http": proxyStr, "https": proxyStr} + response = requests.post( + url=url, headers=headers, params=payload, proxies=proxies + ).json() + + if response["ok"]: + print("tg 推送成功!") + else: + print("tg 推送失败!") + + +def one() -> str: + """ + 获取一条一言。 :return: """ - text = one() - content += '\n\n\n'+text - for i in notify_mode: - if i == 'bark': - if BARK: - bark(title=title, content=content) - else: - print('未启用 bark') - continue - if i == 'sc_key': - if SCKEY: - serverJ(title=title, content=content) - else: - print('未启用 Server酱') - continue - elif i == 'go_cqhttp': - if GOBOT_URL and GOBOT_QQ: - go_cqhttp(title=title, content=content) - else: - print('未启用 go-cqhttp') - continue - elif i == 'dingding_bot': - if DD_BOT_ACCESS_TOKEN and DD_BOT_SECRET: - dingding_bot(title=title, content=content) - else: - print('未启用 钉钉机器人') - continue - elif i == 'telegram_bot': - if TG_BOT_TOKEN and TG_USER_ID: - telegram_bot(title=title, content=content) - else: - print('未启用 telegram机器人') - continue - elif i == 'coolpush_bot': - if QQ_SKEY and QQ_MODE: - coolpush_bot(title=title, content=content) - else: - print('未启用 QQ机器人') - continue - elif i == 'pushplus_bot': - if PUSH_PLUS_TOKEN: - pushplus_bot(title=title, content=content) - else: - print('未启用 PUSHPLUS机器人') - continue - elif i == 'wecom_app': - if QYWX_AM: - wecom_app(title=title, content=content) - else: - print('未启用企业微信应用消息推送') - continue - else: - print('此类推送方式不存在') + url = "https://v1.hitokoto.cn/" + res = requests.get(url).json() + return res["hitokoto"] + " ----" + res["from"] + + +if push_config.get("BARK_PUSH"): + notify_function.append(bark) +if push_config.get("CONSOLE"): + notify_function.append(console) +if push_config.get("DD_BOT_TOKEN") and push_config.get("DD_BOT_SECRET"): + notify_function.append(dingding_bot) +if push_config.get("FSKEY"): + notify_function.append(feishu_bot) +if push_config.get("GOBOT_URL") and push_config.get("GOBOT_QQ"): + notify_function.append(go_cqhttp) +if push_config.get("GOTIFY_URL") and push_config.get("GOTIFY_TOKEN"): + notify_function.append(gotify) +if push_config.get("IGOT_PUSH_KEY"): + notify_function.append(iGot) +if push_config.get("PUSH_KEY"): + notify_function.append(serverJ) +if push_config.get("PUSH_PLUS_TOKEN"): + notify_function.append(pushplus_bot) +if push_config.get("QMSG_KEY") and push_config.get("QMSG_TYPE"): + notify_function.append(qmsg_bot) +if push_config.get("QYWX_AM"): + notify_function.append(wecom_app) +if push_config.get("QYWX_KEY"): + notify_function.append(wecom_bot) +if push_config.get("TG_BOT_TOKEN") and push_config.get("TG_USER_ID"): + notify_function.append(telegram_bot) + + +def send(title: str, content: str) -> None: + if not content: + print(f"{title} 推送内容为空!") + return + + hitokoto = push_config.get("HITOKOTO") + + text = one() if hitokoto else "" + content += "\n\n" + text + + ts = [ + threading.Thread(target=mode, args=(title, content), name=mode.__name__) + for mode in notify_function + ] + [t.start() for t in ts] + [t.join() for t in ts] def main(): - send('title', 'content') + send("title", "content") -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/ck_163game.py b/ck_163game.py deleted file mode 100644 index 9ae0e7e..0000000 --- a/ck_163game.py +++ /dev/null @@ -1,35 +0,0 @@ -import requests -import json -from getENV import getENv -from checksendNotify import send - -""" -建议cron: 20 8 * * * -new Env('网易云游戏'); -""" - -def game163(Authorization): - headers = { - 'user-agent': 'Mozilla/5.0 (Linux; Android 10; Redmi K30 Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/85.0.4183.127 Mobile Safari/537.36', - ## 下面填抓包来的参数######## - 'Authorization': Authorization - } - url = 'http://n.cg.163.com/api/v2/sign-today' - r = requests.post(url, headers=headers).text - if r[0] == "{": - return "cookie已失效" - else: - return "签到成功" - - -def start(): - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("163game", []) - res = game163(_check_item.get('Authorization')) - print(res) - send("网易云游戏", res) - -if __name__ == "__main__": - start() \ No newline at end of file diff --git a/ck_acfun.py b/ck_acfun.py deleted file mode 100644 index 5d11108..0000000 --- a/ck_acfun.py +++ /dev/null @@ -1,150 +0,0 @@ -# -*- coding: utf-8 -*- -""" -建议cron: 31 7 * * * -new Env('AcFun'); -""" -import json -import requests -import urllib3 -from getENV import getENv -from checksendNotify import send - -urllib3.disable_warnings() - - -class AcFunCheckIn: - def __init__(self, check_item: dict): - self.check_item = check_item - self.contentid = "27259341" - - @staticmethod - def get_cookies(session, phone, password): - url = "https://id.app.acfun.cn/rest/app/login/signin" - headers = { - "Host": "id.app.acfun.cn", - "user-agent": "AcFun/6.39.0 (iPhone; iOS 14.3; Scale/2.00)", - "devicetype": "0", - "accept-language": "zh-Hans-CN;q=1, en-CN;q=0.9, ja-CN;q=0.8, zh-Hant-HK;q=0.7, io-Latn-CN;q=0.6", - "accept": "application/json", - "content-type": "application/x-www-form-urlencoded", - } - data = f"password={password}&username={phone}" - response = session.post(url=url, data=data, headers=headers, verify=False) - acpasstoken = response.json().get("acPassToken") - auth_key = str(response.json().get("auth_key")) - if acpasstoken and auth_key: - cookies = {"acPasstoken": acpasstoken, "auth_key": auth_key} - return cookies - else: - return False - - @staticmethod - def get_token(session, cookies): - url = "https://id.app.acfun.cn/rest/web/token/get" - headers = { - "Content-Type": "application/x-www-form-urlencoded", - } - response = session.post(url=url, cookies=cookies, data="sid=acfun.midground.api", headers=headers, verify=False) - return response.json().get("acfun.midground.api_st") - - def get_video(self, session): - url = "https://api-ipv6.acfunchina.com/rest/app/rank/channel" - data = "channelId=0&rankPeriod=DAY" - headers = { - "Content-Type": "application/x-www-form-urlencoded", - } - response = session.post(url=url, data=data, headers=headers, verify=False) - self.contentid = response.json().get("rankList")[0].get("contentId") - return self.contentid - - @staticmethod - def sign(session, cookies): - headers = {"acPlatform": "IPHONE"} - response = session.post( - url="https://api-ipv6.acfunchina.com/rest/app/user/signIn", headers=headers, cookies=cookies, verify=False - ) - return response.json().get("msg") - - @staticmethod - def danmu(session, cookies): - url = "https://api-ipv6.acfunchina.com/rest/app/new-danmaku/add" - body = "body=sitoi&color=16777215&id=27259341&mode=1&position=5019&size=25&subChannelId=84&subChannelName=%E4" \ - "%B8%BB%E6%9C%BA%E5%8D%95%E6%9C%BA&type=douga&videoId=22898696 " - headers = { - "Content-Type": "application/x-www-form-urlencoded", - } - response = session.post(url=url, headers=headers, cookies=cookies, data=body, verify=False) - if response.json().get("result") == 0: - msg = "弹幕成功" - else: - msg = "弹幕失败" - return msg - - def throwbanana(self, session, cookies): - url = "https://api-ipv6.acfunchina.com/rest/app/banana/throwBanana" - body = f"count=1&resourceId={self.contentid}&resourceType=2" - headers = { - "Content-Type": "application/x-www-form-urlencoded", - } - response = session.post(url=url, headers=headers, cookies=cookies, data=body, verify=False) - if response.json().get("result") == 0: - msg = "香蕉成功" - else: - msg = "香蕉失败" - return msg - - def like(self, session, token): - like_url = "https://api.kuaishouzt.com/rest/zt/interact/add" - unlike_url = "https://api.kuaishouzt.com/rest/zt/interact/delete" - headers = { - "Content-Type": "application/x-www-form-urlencoded", - } - cookies = {"acfun.midground.api_st": token, "kpn": "ACFUN_APP"} - body = f"interactType=1&objectId={self.contentid}&objectType=2&subBiz=mainApp" - response = session.post(url=like_url, headers=headers, cookies=cookies, data=body, verify=False) - session.post(url=unlike_url, headers=headers, cookies=cookies, data=body, verify=False) - if response.json().get("result") == 1: - msg = "点赞成功" - else: - msg = "点赞失败" - return msg - - def share(self, session, cookies): - url = "https://api-ipv6.acfunchina.com/rest/app/task/reportTaskAction?taskType=1&market=tencent&product=ACFUN_APP&appMode=0" - headers = { - "Content-Type": "application/x-www-form-urlencoded", - } - response = session.get(url=url, headers=headers, cookies=cookies, verify=False) - if response.json().get("result") == 0: - msg = "分享成功" - else: - msg = "分享失败" - return msg - - def main(self): - phone = self.check_item.get("acfun_phone") - password = self.check_item.get("acfun_password") - session = requests.session() - self.get_video(session=session) - cookies = self.get_cookies(session=session, phone=phone, password=password) - token = self.get_token(session=session, cookies=cookies) - sign_msg = self.sign(session=session, cookies=cookies) - like_msg = self.like(session=session, token=token) - share_msg = self.share(session=session, cookies=cookies) - danmu_msg = self.danmu(session=session, cookies=cookies) - throwbanana_msg = self.throwbanana(session=session, cookies=cookies) - msg = ( - f"帐号信息: {phone}\n签到状态: {sign_msg}\n点赞任务: {like_msg}\n" - f"弹幕任务: {danmu_msg}\n香蕉任务: {throwbanana_msg}\n分享任务: {share_msg}" - ) - return msg - - -if __name__ == "__main__": - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("ACFUN_ACCOUNT_LIST", [])[0] - res = AcFunCheckIn(check_item=_check_item).main() - print(res) - send('AcFun', res) diff --git a/ck_baidu_url_submit.py b/ck_baidu_url_submit.py deleted file mode 100644 index 74ace27..0000000 --- a/ck_baidu_url_submit.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -""" -建议cron: 32 7 * * * -new Env('百度搜索资源平台'); -""" -import json -from urllib import parse -import requests -from getENV import getENv -from checksendNotify import send - - -class BaiduUrlSubmit: - def __init__(self, check_item: dict): - self.check_item = check_item - - @staticmethod - def url_submit(data_url: str, submit_url: str, times: int = 100) -> str: - site = parse.parse_qs(parse.urlsplit(submit_url).query).get("site")[0] - urls_data = requests.get(url=data_url) - remian = 100000 - success_count = 0 - error_count = 0 - for one in range(times): - try: - response = requests.post(url=submit_url, data=urls_data) - if response.json().get("success"): - remian = response.json().get("remain") - success_count += response.json().get("success") - else: - error_count += 1 - except Exception as e: - print(e) - error_count += 1 - msg = ( - f"站点地址: {site}\n当天剩余的可推送 url 条数: {remian}\n成功推送的 url 条数: {success_count}\n" - f"成功推送的 url 次数: {times - error_count}\n失败推送的 url 次数: {error_count}" - ) - return msg - - def main(self): - data_url = self.check_item.get("data_url") - submit_url = self.check_item.get("submit_url") - times = int(self.check_item.get("times", 100)) - if data_url and submit_url: - msg = self.url_submit(data_url=data_url, submit_url=submit_url, times=times) - else: - msg = "配置错误" - return msg - - -if __name__ == "__main__": - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("BAIDU_URL_SUBMIT_LIST", [])[0] - res = BaiduUrlSubmit(check_item=_check_item).main() - print(res) - send("百度搜索资源平台", res) diff --git a/ck_bilibili.py b/ck_bilibili.py deleted file mode 100644 index 4a0c1f2..0000000 --- a/ck_bilibili.py +++ /dev/null @@ -1,345 +0,0 @@ -# -*- coding: utf-8 -*- -""" -建议cron: 30 8 * * * -new Env('哔哩哔哩'); -""" -import json -import os - -import requests -from requests import utils -from getENV import getENv -from checksendNotify import send - - -class BiliBiliCheckIn(object): - # TODO 待测试,需要大会员账号测试领取福利 - def __init__(self, check_item: dict): - self.check_item = check_item - - @staticmethod - def get_nav(session): - url = "https://api.bilibili.com/x/web-interface/nav" - ret = session.get(url=url).json() - uname = ret.get("data", {}).get("uname") - uid = ret.get("data", {}).get("mid") - is_login = ret.get("data", {}).get("isLogin") - coin = ret.get("data", {}).get("money") - vip_type = ret.get("data", {}).get("vipType") - current_exp = ret.get("data", {}).get("level_info", {}).get("current_exp") - return uname, uid, is_login, coin, vip_type, current_exp - - @staticmethod - def reward(session) -> dict: - """取B站经验信息""" - url = "https://account.bilibili.com/home/reward" - ret = session.get(url=url).json() - return ret - - @staticmethod - def live_sign(session) -> dict: - """B站直播签到""" - try: - url = "https://api.live.bilibili.com/xlive/web-ucenter/v1/sign/DoSign" - ret = session.get(url=url).json() - if ret["code"] == 0: - msg = f'签到成功,{ret["data"]["text"]},特别信息:{ret["data"]["specialText"]},本月已签到{ret["data"]["hadSignDays"]}天' - elif ret["code"] == 1011040: - msg = "今日已签到过,无法重复签到" - else: - msg = f'签到失败,信息为: {ret["message"]}' - except Exception as e: - msg = f"签到异常,原因为{str(e)}" - print(msg) - return msg - - @staticmethod - def manga_sign(session, platform="android") -> dict: - """ - 模拟B站漫画客户端签到 - """ - try: - url = "https://manga.bilibili.com/twirp/activity.v1.Activity/ClockIn" - post_data = {"platform": platform} - ret = session.post(url=url, data=post_data).json() - if ret["code"] == 0: - msg = "签到成功" - elif ret["msg"] == "clockin clockin is duplicate": - msg = "今天已经签到过了" - else: - msg = f'签到失败,信息为({ret["msg"]})' - print(msg) - except Exception as e: - msg = f"签到异常,原因为: {str(e)}" - print(msg) - return msg - - @staticmethod - def vip_privilege_receive(session, bili_jct, receive_type: int = 1) -> dict: - """ - 领取B站大会员权益 - receive_type int 权益类型,1为B币劵,2为优惠券 - """ - url = "https://api.bilibili.com/x/vip/privilege/receive" - post_data = {"type": receive_type, "csrf": bili_jct} - ret = session.post(url=url, data=post_data).json() - return ret - - @staticmethod - def vip_manga_reward(session) -> dict: - """获取漫画大会员福利""" - url = "https://manga.bilibili.com/twirp/user.v1.User/GetVipReward" - ret = session.post(url=url, json={"reason_id": 1}).json() - return ret - - @staticmethod - def report_task(session, bili_jct, aid: int, cid: int, progres: int = 300) -> dict: - """ - B站上报视频观看进度 - aid int 视频av号 - cid int 视频cid号 - progres int 观看秒数 - """ - url = "http://api.bilibili.com/x/v2/history/report" - post_data = {"aid": aid, "cid": cid, "progres": progres, "csrf": bili_jct} - ret = session.post(url=url, data=post_data).json() - return ret - - @staticmethod - def share_task(session, bili_jct, aid) -> dict: - """ - 分享指定av号视频 - aid int 视频av号 - """ - url = "https://api.bilibili.com/x/web-interface/share/add" - post_data = {"aid": aid, "csrf": bili_jct} - ret = session.post(url=url, data=post_data).json() - return ret - - @staticmethod - def get_followings( - session, uid: int, pn: int = 1, ps: int = 50, order: str = "desc", order_type: str = "attention" - ) -> dict: - """ - 获取指定用户关注的up主 - uid int 账户uid,默认为本账户,非登录账户只能获取20个*5页 - pn int 页码,默认第一页 - ps int 每页数量,默认50 - order str 排序方式,默认desc - order_type 排序类型,默认attention - """ - params = { - "vmid": uid, - "pn": pn, - "ps": ps, - "order": order, - "order_type": order_type, - } - url = f"https://api.bilibili.com/x/relation/followings" - ret = session.get(url=url, params=params).json() - return ret - - @staticmethod - def space_arc_search( - session, uid: int, pn: int = 1, ps: int = 100, tid: int = 0, order: str = "pubdate", keyword: str = "" - ) -> dict: - """ - 获取指定up主空间视频投稿信息 - uid int 账户uid,默认为本账户 - pn int 页码,默认第一页 - ps int 每页数量,默认50 - tid int 分区 默认为0(所有分区) - order str 排序方式,默认pubdate - keyword str 关键字,默认为空 - """ - params = { - "mid": uid, - "pn": pn, - "ps": ps, - "tid": tid, - "order": order, - "keyword": keyword, - } - url = f"https://api.bilibili.com/x/space/arc/search" - ret = session.get(url=url, params=params).json() - data_list = [ - {"aid": one.get("aid"), "cid": 0, "title": one.get("title"), "owner": one.get("author")} - for one in ret.get("data", {}).get("list", {}).get("vlist", []) - ] - return data_list - - @staticmethod - def elec_pay(session, bili_jct, uid: int, num: int = 50) -> dict: - """ - 用B币给up主充电 - uid int up主uid - num int 充电电池数量 - """ - url = "https://api.bilibili.com/x/ugcpay/trade/elec/pay/quick" - post_data = {"elec_num": num, "up_mid": uid, "otype": "up", "oid": uid, "csrf": bili_jct} - ret = session.post(url=url, data=post_data).json() - return ret - - @staticmethod - def coin_add(session, bili_jct, aid: int, num: int = 1, select_like: int = 1) -> dict: - """ - 给指定 av 号视频投币 - aid int 视频av号 - num int 投币数量 - select_like int 是否点赞 - """ - url = "https://api.bilibili.com/x/web-interface/coin/add" - post_data = { - "aid": aid, - "multiply": num, - "select_like": select_like, - "cross_domain": "true", - "csrf": bili_jct, - } - ret = session.post(url=url, data=post_data).json() - - return ret - - @staticmethod - def live_status(session) -> dict: - """B站直播获取金银瓜子状态""" - url = "https://api.live.bilibili.com/pay/v1/Exchange/getStatus" - ret = session.get(url=url).json() - data = ret.get("data") - silver = data.get("silver", 0) - gold = data.get("gold", 0) - coin = data.get("coin", 0) - msg = f"银瓜子数量: {silver}\n金瓜子数量: {gold}\n硬币数量: {coin}" - return msg - - @staticmethod - def silver2coin(session, bili_jct) -> dict: - """银瓜子兑换硬币""" - url = "https://api.live.bilibili.com/pay/v1/Exchange/silver2coin" - post_data = {"csrf_token": bili_jct} - ret = session.post(url=url, data=post_data).json() - return ret - - @staticmethod - def get_region(session, rid=1, num=6) -> dict: - """ - 获取 B站分区视频信息 - rid int 分区号 - num int 获取视频数量 - """ - url = "https://api.bilibili.com/x/web-interface/dynamic/region?ps=" + str(num) + "&rid=" + str(rid) - ret = session.get(url=url).json() - data_list = [ - { - "aid": one.get("aid"), - "cid": one.get("cid"), - "title": one.get("title"), - "owner": one.get("owner", {}).get("name"), - } - for one in ret.get("data", {}).get("archives", []) - ] - return data_list - - def main(self): - bilibili_cookie = { - item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("bilibili_cookie").split("; ") - } - bili_jct = bilibili_cookie.get("bili_jct") - coin_num = self.check_item.get("coin_num", 0) - coin_type = self.check_item.get("coin_type", 1) - silver2coin = self.check_item.get("silver2coin", True) - session = requests.session() - requests.utils.add_dict_to_cookiejar(session.cookies, bilibili_cookie) - session.headers.update( - { - "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.64", - "Referer": "https://www.bilibili.com/", - "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", - "Connection": "keep-alive", - } - ) - success_count = 0 - uname, uid, is_login, coin, vip_type, current_exp = self.get_nav(session=session) - if is_login: - manhua_msg = self.manga_sign(session=session) - live_msg = self.live_sign(session=session) - aid_list = self.get_region(session=session) - reward_ret = self.reward(session=session) - coins_av_count = reward_ret.get("data", {}).get("coins_av") // 10 - coin_num = coin_num - coins_av_count - coin_num = coin_num if coin_num < coin else coin - if coin_type == 1 and coin_num: - following_list = self.get_followings(session=session, uid=uid) - for following in following_list.get("data", {}).get("list"): - mid = following.get("mid") - if mid: - aid_list += self.space_arc_search(session=session, uid=mid) - if coin_num > 0: - for aid in aid_list[::-1]: - ret = self.coin_add(session=session, aid=aid.get("aid"), bili_jct=bili_jct) - if ret["code"] == 0: - coin_num -= 1 - print(f'成功给{aid.get("title")}投一个币') - success_count += 1 - elif ret["code"] == 34005: - print(f'投币{aid.get("title")}失败,原因为{ret["message"]}') - continue - # -104 硬币不够了 -111 csrf 失败 34005 投币达到上限 - else: - print(f'投币{aid.get("title")}失败,原因为{ret["message"]},跳过投币') - break - if coin_num <= 0: - break - coin_msg = f"今日成功投币{success_count + coins_av_count}/{self.check_item.get('coin_num', 5)}个" - else: - coin_msg = f"今日成功投币{coins_av_count}/{self.check_item.get('coin_num', 5)}个" - aid = aid_list[0].get("aid") - cid = aid_list[0].get("cid") - title = aid_list[0].get("title") - report_ret = self.report_task(session=session, bili_jct=bili_jct, aid=aid, cid=cid) - if report_ret.get("code") == 0: - report_msg = f"观看《{title}》300秒" - else: - report_msg = f"任务失败" - print(report_msg) - share_ret = self.share_task(session=session, bili_jct=bili_jct, aid=aid) - if share_ret.get("code") == 0: - share_msg = f"分享《{title}》成功" - else: - share_msg = f"分享失败" - print(share_msg) - if silver2coin: - silver2coin_ret = self.silver2coin(session=session, bili_jct=bili_jct) - if silver2coin_ret["code"] == 0: - silver2coin_msg = f"成功将银瓜子兑换为1个硬币" - else: - silver2coin_msg = silver2coin_ret["message"] - else: - silver2coin_msg = f"未开启银瓜子兑换硬币功能" - live_stats = self.live_status(session=session) - uname, uid, is_login, new_coin, vip_type, new_current_exp = self.get_nav(session=session) - reward_ret = self.reward(session=session) - login = reward_ret.get("data", {}).get("login") - watch_av = reward_ret.get("data", {}).get("watch_av") - coins_av = reward_ret.get("data", {}).get("coins_av", 0) - share_av = reward_ret.get("data", {}).get("share_av") - today_exp = len([one for one in [login, watch_av, share_av] if one]) * 5 - today_exp += coins_av - update_data = (28800 - new_current_exp) // (today_exp if today_exp else 1) - msg = ( - f"帐号信息: {uname}\n漫画签到: {manhua_msg}\n直播签到: {live_msg}\n" - f"登陆任务: 今日已登陆\n观看视频: {report_msg}\n分享任务: {share_msg}\n投币任务: {coin_msg}\n" - f"银瓜子兑换硬币: {silver2coin_msg}\n今日获得经验: {today_exp}\n当前经验: {new_current_exp}\n" - f"按当前速度升级还需: {update_data}天\n{live_stats}" - ) - return msg - - -if __name__ == "__main__": - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("BILIBILI_COOKIE_LIST", [])[0] - res = BiliBiliCheckIn(check_item=_check_item).main() - print(res) - send('哔哩哔哩', res) diff --git a/ck_cloud189.py b/ck_cloud189.py deleted file mode 100644 index ef967d1..0000000 --- a/ck_cloud189.py +++ /dev/null @@ -1,159 +0,0 @@ -# -*- coding: utf-8 -*- -""" -建议cron: 30 9 * * * -new Env('天翼网盘'); -""" -# 修改来自于 https://github.com/MayoBlueSky/My-Actions/blob/master/function/cloud189/checkin.py -import base64 -import json -import os -import re -import time - -import requests - -import rsa -from getENV import getENv -from checksendNotify import send - - -class Cloud189CheckIn: - def __init__(self, check_item: dict): - self.check_item = check_item - self.b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" - - @staticmethod - def int2char(a): - return list("0123456789abcdefghijklmnopqrstuvwxyz")[a] - - def b64tohex(self, a): - d = "" - e = 0 - c = 0 - for i in range(len(a)): - if list(a)[i] != "=": - v = self.b64map.index(list(a)[i]) - if 0 == e: - e = 1 - d += self.int2char(v >> 2) - c = 3 & v - elif 1 == e: - e = 2 - d += self.int2char(c << 2 | v >> 4) - c = 15 & v - elif 2 == e: - e = 3 - d += self.int2char(c) - d += self.int2char(v >> 2) - c = 3 & v - else: - e = 0 - d += self.int2char(c << 2 | v >> 4) - d += self.int2char(15 & v) - if e == 1: - d += self.int2char(c << 2) - return d - - def rsa_encode(self, j_rsakey, string): - rsa_key = f"-----BEGIN PUBLIC KEY-----\n{j_rsakey}\n-----END PUBLIC KEY-----" - pubkey = rsa.PublicKey.load_pkcs1_openssl_pem(rsa_key.encode()) - result = self.b64tohex((base64.b64encode(rsa.encrypt(f"{string}".encode(), pubkey))).decode()) - return result - - def login(self, session, username, password): - url = "https://cloud.189.cn/api/portal/loginUrl.action?redirectURL=https://cloud.189.cn/web/redirect.html" - r = session.get(url=url) - captchatoken = re.findall(r"captchaToken' value='(.+?)'", r.text)[0] - lt = re.findall(r'lt = "(.+?)"', r.text)[0] - returnurl = re.findall(r"returnUrl = '(.+?)'", r.text)[0] - paramid = re.findall(r'paramId = "(.+?)"', r.text)[0] - j_rsakey = re.findall(r'j_rsaKey" value="(\S+)"', r.text, re.M)[0] - session.headers.update({"lt": lt}) - - username = self.rsa_encode(j_rsakey, username) - password = self.rsa_encode(j_rsakey, password) - url = "https://open.e.189.cn/api/logbox/oauth2/loginSubmit.do" - headers = { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/76.0", - "Referer": "https://open.e.189.cn/", - } - data = { - "appKey": "cloud", - "accountType": "01", - "userName": f"{{RSA}}{username}", - "password": f"{{RSA}}{password}", - "validateCode": "", - "captchaToken": captchatoken, - "returnUrl": returnurl, - "mailSuffix": "@189.cn", - "paramId": paramid, - } - r = session.post(url, data=data, headers=headers, timeout=5) - if r.json()["result"] == 0: - redirect_url = r.json()["toUrl"] - session.get(url=redirect_url) - return True - else: - return "登陆状态: " + r.json()["msg"] - - @staticmethod - def sign(session): - rand = str(round(time.time() * 1000)) - surl = f"https://api.cloud.189.cn/mkt/userSign.action?rand={rand}&clientType=TELEANDROID&version=8.6.3&model=SM-G930K" - url = "https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN&activityId=ACT_SIGNIN" - url2 = "https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN_PHOTOS&activityId=ACT_SIGNIN" - headers = { - "User-Agent": "Mozilla/5.0 (Linux; Android 5.1.1; SM-G930K Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Ecloud/8.6.3 Android/22 clientId/355325117317828 clientModel/SM-G930K imsi/460071114317824 clientChannelId/qq proVersion/1.0.6", - "Referer": "https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1", - "Host": "m.cloud.189.cn", - "Accept-Encoding": "gzip, deflate", - } - response = session.get(url=surl, headers=headers) - netdiskbonus = response.json().get("netdiskBonus") - if response.json().get("isSign") == "false": - msg = f"签到结果: 未签到,签到获得 {netdiskbonus}M 空间" - else: - msg = f"签到结果: 已经签到过了,签到获得 {netdiskbonus}M 空间" - response = session.get(url=url, headers=headers) - if "errorCode" in response.text: - msg += f"\n第一次抽奖: {response.json().get('errorCode')}" - else: - description = response.json().get("description", "") - if description in ["1", 1]: - description = "50M空间" - msg += f"\n第一次抽奖: 获得{description}" - response = session.get(url=url2, headers=headers) - if "errorCode" in response.text: - msg += f"\n第二次抽奖: {response.json().get('errorCode')}" - else: - description = response.json().get("description", "") - if description in ["1", 1]: - description = "50M空间" - msg += f"\n第二次抽奖: 获得{description}" - return msg - - def main(self): - cloud189_phone = self.check_item.get("cloud189_phone") - cloud189_password = self.check_item.get("cloud189_password") - session = requests.Session() - flag = self.login(session=session, username=cloud189_phone, password=cloud189_password) - if flag is True: - sign_msg = self.sign(session=session) - else: - sign_msg = flag - msg = f"帐号信息: {cloud189_phone}\n{sign_msg}" - return msg - - -def start(): - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("CLOUD189_ACCOUNT_LIST", [])[0] - res = Cloud189CheckIn(check_item=_check_item).main() - print(res) - send('天翼网盘', res) - - -if __name__ == "__main__": - start() diff --git a/ck_csdn.py b/ck_csdn.py deleted file mode 100644 index 0508421..0000000 --- a/ck_csdn.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -""" -建议cron: 30 10 * * * -new Env('CSDN'); -""" -import json -import requests -from getENV import getENv -from checksendNotify import send - - -class CSDNCheckIn: - def __init__(self, check_item): - self.check_item = check_item - self.headers = { - "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) " - "Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74", - } - - def sign(self, cookies): - response = requests.get( - url="https://me.csdn.net/api/LuckyDraw_v2/signIn", headers=self.headers, cookies=cookies - ).json() - if response.get("code") == 200: - msg = response.get("data").get("msg") - else: - msg = "签到失败" - print(response) - return msg - - def draw(self, cookies): - response = requests.get( - url="https://me.csdn.net/api/LuckyDraw_v2/goodluck", headers=self.headers, cookies=cookies - ).json() - if response.get("code") == 200: - msg = response.get("data").get("msg") - else: - msg = "抽奖失败" - return msg - - def main(self): - csdn_cookie = { - item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("csdn_cookie").split("; ") - } - try: - user_name = csdn_cookie.get("UserName", "") - except Exception as e: - print(f"获取用户信息失败: {e}") - user_name = "未获取到用户信息" - sign_msg = self.sign(cookies=csdn_cookie) - draw_msg = self.draw(cookies=csdn_cookie) - msg = f"帐号信息: {user_name}\n签到信息: {sign_msg}\n抽奖结果: {draw_msg}" - return msg - - -if __name__ == "__main__": - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("CSDN_COOKIE_LIST", [])[0] - res = CSDNCheckIn(check_item=_check_item).main() - print(res) - send("CSDN", res) diff --git a/ck_duokan.py b/ck_duokan.py deleted file mode 100644 index ec92034..0000000 --- a/ck_duokan.py +++ /dev/null @@ -1,368 +0,0 @@ -# -*- coding: utf-8 -*- -""" -建议cron: 30 20 * * * -new Env('多看阅读'); -""" -import json -import time -import requests -from getENV import getENv -from checksendNotify import send - - -class DuoKanCheckIn: - def __init__(self, check_item): - self.check_item = check_item - self.gift_code_list = [ - "d16ad58199c69518a4afd87b5cf0fe67", - "828672d6bc39ccd25e1f6ad34e00b86c", - "f0ccc1bb1cecea673c197b928fb8dbd9", - "6b86c490d92a138de9a0ae6847781caa", - "c707047e8b820ba441d29cf87dff341e", - "82b2c012a956b18cff2388d24f2574a6", - "87d6b5183a361ee1f6ea8cece1ee83c3", - "9d42576f7e99c94bb752fde06e6770a5", - "e58d1f67a82a539d9331baaa3785a943", - "52c95192ebcb1d0113a748df58a72055", - "511f33e481fe4504d2637aaf6cbbbaff", - "6e986f36f4a45cadf61d2f246b27cdc6", - "f27797a6a1d7fe495b0f4de05f799327", - "4bd335e899fa665f15eea2f215156321", - "9355df762183f084473432b5c6900c44", - "4fb21fb04cbbae9d65556c3958603674", - "2d02ceb4f1bc916510c7407ce4eca5a5", - "ef314bf665af0b51294e624244acd7d6", - "1b441a2ab8e9e7dcf11a55b85931132f", - "005d2345782ab456e5af167336b70623", - "51ac508a4d494654035f17f1d646779b", - "0f6579670f1081f1bcba89dd64645b48", - "0cd858abe26f0d3db561185fe26bbb75", - "b5f5fd5b47fd587cb003807e97bed783", - "6ac9509a5cb799efeb1bb877c505f7e3", - "b5dd986ffc84762429901ffe633d82a0", - "f98a436cc2c85943d23d986a8d84c3bd", - "6fc387f2a17b8564ca212e2b16544cc3", - "12ead6a62411402378c6311199a0b2ef", - "7d8dcf31e2e69fcf6bd8af4f48831e92", - "446c3d0303b0dbd6bc2157844f1222ad", - "439890227d823ff57bed8ad351fa1b75", - "645acf3107722ab26b9d3194ecd156ff", - "afcb41dd9bc54d752c26ace985b49960", - "1100ab94ccd2e8373af70326c194d8ea", - "373d73c0c0975cf959eb4c40dc82b27c", - "2167ac28833149e9ad4ca217bcfa1a62", - "80547afccc42f34e4c8c4083e00a41a6", - "b604dda473644bd8157bafdf4ae518dc", - "15eaa8f727b595d512b82f55364b53b9", - "8fb656937fd613ccbbcacdc384595b03", - "dd8410da0b5144ba4aba5a618723b72e", - "204208386b056a2288e541110bfeeec3", - "c5b2e7344efd4128bcab5840fa427103", - "0168601e4335095c502e2e550ca53114", - "dfa12fe056a8deee35da18613173560f", - "ed945efdef9c7b2de41249a4fed3945e", - "b9ece5964ab62d51f8b70ffd35191e9d", - "f0e0ca4ca0b8afd766821a4922a2873c", - "5c687b8c6bd641f3f2c0d6aaeceafff6", - "c983be6420027231d77b748f9d02c1f2", - "7c53358df8156d979cb6cbb74e15877b", - "a58058035f73628a7c0847c66c350e88", - "79dd039ca5cf401993801710f9900d6b", - "5aff116c2cec01fcc69b389034f456a2", - "d006927cd9bfd620a6af4f76ee3c4100", - "410fe62830eeb91ca48be24ffe596364", - "9d18226ff144a72812d0104ce59fb34e", - "de439c7f75ca80b1d5b8aba619ee200d", - "00d1a0479590793294bfdd5c427643aa", - "d57176b1ce88135243bd501e448b8559", - "7c500eff681637b97dd526bb11737abb", - "3e197e47aaac926ccd50c37eb2828311", - "7db084ea5987f841ad77240bcbb8ce54", - "cce74f0facc50d47c0dd0e3e2f7435fb", - "f8bb53fbeb9b2d45db8aca1401817599", - "5baf7f0f355db11eeb0e936b675cdb82", - "4478a3354de6bcd7e91b49e28a2b2b3f", - "66a0338d93af82e956122288b08d2b4b", - "9f598b2b1c9cd0f2b20e335831cce366", - "9f4a45fec88b2820653abba179759eb6", - "41086649c9a39ec977ba42f9ce81f828", - "06ccca6fd73a6e38f65638ab8abbab76", - "0cfa0a034a203bb3a22be499e74906f4", - "c0d1da35a8878b7e4dcdf44bf3cd6b96", - "f34921e16f6518c1149cc083bd8e1ad7", - "ed0be3c70075d1d8f1a412f9e59a12e7", - "eb4d6324bae7db952bd220cb4d57a3de", - "5ba65d9f8ad735681b594f5092f6ab37", - "2fa6e0b612962937edb37ed7043923fd", - "baa8268c7d85d793011c5f5b977f8d4b", - "f4842a465e4583646abf7df67d8e2915", - "12c6332c8c9ded3d58d45f2dae7de8da", - "f56609232205692acf6b6a5d337b0965", - "3e4eed15387843c668fba53641599d07", - "d1b9d9ede145b5d426130986245cb66e", - "2979e43f6ab786f5d68cc262105f3c45", - "118a18ed578c78f4855b416f8271b29a", - "9122e158d034f094627c70ed6c3d0c33", - "dd5413c17253e86cc4247984f3bb77e5", - "b36bb0124b962efccbb601486665ce9e", - "6afb3a719f8b0a0b2f744b3dad8b15ab", - "faf18d64268402ed2975a3f60bc9e651", - "9f4081944d4ca3fa7b831d7c3b6c289d", - "367d7a3d77a9f96cbd7903b33c30b61f", - "605276cf621ff9ba34a99e3675a006f6", - "a50a734c1a3a749918e20205505ef91d", - "271ff14ba5edfe89a80a3430227bc11b", - "3bae338062b4bb3a5087eb13cbcc6efe", - "9b443d60178a9bcb08bae62c41970abf", - "a4f6e97741054f3567ab6a7257c63ab1", - "e06a82cc1f05eda4947e5fa0927d89c5", - "4fa3b4fc274c283efb02c0a1ddd133e7", - "4aa59e16a3961ed1ebd12b7f15d79547", - "f75fe88eaa24fc28ac57d963d8b90f2d", - "42cbe52b6f74761a5a7a79bf370c30ef", - "7d4571b5c9710e3b5481330bc7123ecc", - "fcf2f7ec42086809991de5aed5e7ef0d", - "bb7de9aaf68a83ac1ddbe75ba913b8af", - "a9bd964b97e785fffb641edb9b402d3f", - "6a815be6f537b2351e947ed66f74e209", - "27ae4e4d71395c6255bf7ea57c496507", - "2b07f369e90f4fc34ef419d891a2906f", - "7a2dc8a5b3fc0c7ecddb97ed1ce2c833", - "e7ad152ef27beb80c5d343f41f885b21", - "ba21758aed15a3a20a27f63bc0d84626", - "3820f7b8e1ece2614a11264501b5c93e", - "c3c41c87e6bf752f5237b4fffa33f08b", - "ed21086ff6682ab8495ecbfbb697af4a", - "5a2585ff3524f319dfd1f6b735c9a18d", - "0e61444507f0a780a1c83b612eb5fb9b", - "b105aa5c696648c0f7aae9e3933f8fe0", - "fec8f729e9e1d02248b949ce17674e0c", - "d3323d5560d15d4bc03575dcd0f53ae9", - "15fbf9d24dd05d9d64a18a8fd28f4dcc", - "ac0f3bda53081eee547882b2cdc8b04f", - "5dd3fadcd4ea6b922e1462431966c2bf", - "4acb71816dad0ce9a53d8fee301d857c", - "4c7e173f3a046919587db5b2640896e7", - "8407dc0459d0b367eaced7e5dfdef8ed", - "17e02409659223ff4e32cabd9ad352d9", - "c49edc07086b27769eddb981359f56b2", - "344822f5d8d53fe9aa7a1c7328cd2c59", - "92259343c65ac0feab5cb56b2e851783", - "e1e537b0bd37091c0ba4d5f614af9160", - "dff1116c175ddaaa20f3985a3d88abc6", - "3b1131a7c7273aa61cbd71b044e9beca", - "431aab37ef168c383f078b9244008cee", - "96c3bb8355d7e3ed7265095374f1c090", - "c3a7d304cdb307f073bef5003d1b8b78", - "627d884fc905cc353d0028076e39846b", - "36ce0d88a6bb2d10e0dc0a697f64df4e", - "dc8dbd035d42a5d8170976d5f532dab0", - "01c2665e7ea15bc56cca6d955c2e8ae1", - "c54ae7eeedc87ac52249684f012d3805", - "2df9b3b8f21a682b20d9d77669087a7a", - "fded473150a783586c12692fd57d0825", - "580499e69f42c0ccba0d1f87a83e41e9", - "99433cb83f1cd7176b7cdeaa7be49cd8", - "fbd76e8265547376905b3b6004150064", - "362768496052ae0dfbe909a9b5c6f54e", - "4f33581089c90944e5ad950646b17712", - "bffe93cdfe4b8833190e0a59c779e027", - "78e042b792c3af7faf7a6ebfedf6af9e", - "51a59c881726c2887efe9752bd9db715", - "a46ecf03d3f4038ba3de4ae4ac28170f", - "48d025f7cc34ac29c21d03b2c1f36449", - "8c9ceb77d61c20cb96ee652eb7b838c9", - "47a5882c89671429ae532339b7f333ce", - "a0b735557416ff3d08d3d8440393061a", - "976d3b3a8fbdf33d525075a9288455ab", - "636ca4c1db1c4450431ecd7e10a5e671", - "8c5cd12180027ee6535a837bd4f0259a", - "b82315333974c76793b3c7f517fe977c", - "6143d1f3472cd7cf08e3780918019158", - "20d032426fd66d49bec4f99579252cfa", - "398ee715d1dfd058a912bc7768d35f82", - "1f678678966444fb53d118b8134ceb94", - "d6641f3ed9444eae2b77ba68d3552f6a", - "ab2babaa19539895a5285c1ded6de8c6", - "5bc61d3cd53582b859db9cf04fc7e250", - "5deb619ed27c2754df4f9c7e3ce16b82", - "b81a322830fee59c75985626f7e0a8b5", - "e2313ad53d58e181c5fbaef29e5772c3", - "70d2aa99ef48b6cf1c0e8c107c0e121d", - "0633cdb06253a2b11e9a9ca234a3e9c3", - "bd1cbb9764fba94e8f1c0d1c024487af", - "301cbdbf26210596f9b22123abff0ca8", - "1fc2448ee192a1d0806ae1eb6fcc81fe", - "306247030d0b6442c3ded42e9ca99872", - "1c8f9a0786a01db1d06989345887967e", - "256ec3a54aaae719aae88d8f9c7f9b5f", - "45645896cccec48191916fec482979d9", - "c3a19c728d6fd39925bd63abe15aa446", - "15f45c4cd8fd4a6c0a3fae14ccafff47", - "a082c46b09772739af41f01676e1d0d1", - "14928418f94f5d35b182001ae0160455", - "dfbc5bc946c72650adaaf570f11a1e80", - "8a312e3e30d2e8fd1cf8873c3abe1d8c", - "ef425403acaabfb2a5b3f6ab0aafce8c", - "c78d471822dd961a53afe23e6c2dfa61", - "a40f670d8de3784b54784daf63095d88", - "49a72ace7fd54d8d0833bb2590db58aa", - "38e3808d28de73af3578f6d64020e1fc", - "a8be6ab39263d2edf61acafc60949921", - "d9c16bf0032800916e948ea26624a253", - "dbf3a62ff403c3ba94d5ab1e6219f5bc", - "3a6415de684e2978ce17543d66d523f6", - "2f69a681ee1ff927df1bdbd5431ced1d", - "e55c0390872735ec285dad8ebdd939e0", - ] - self.code_list = [ - "K7S36GFSZC", - "A2AMBFHP6C", - "K5HHKUU14D", - "J18UK6YYAY", - "1BJGW140U5", - ] - self.headers = {"Content-Type": "application/x-www-form-urlencoded; charset=utf-8"} - - @staticmethod - def get_data(cookies): - device_id = cookies.get("device_id") - t = int(time.time()) - t_device_id = f"{device_id}&{t}" - c = 0 - for index, one in enumerate(t_device_id): - c = (c * 131 + ord(one)) % 65536 - data = f"_t={t}&_c={c}" - return data - - def sign(self, cookies): - url = "https://www.duokan.com/checkin/v0/checkin" - data = self.get_data(cookies=cookies) - response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) - result = response.json() - msg = result.get("msg") - return msg - - def info(self, cookies): - url = "https://www.duokan.com/store/v0/award/coin/list" - data = f"sandbox=0&{self.get_data(cookies=cookies)}&withid=1" - response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) - result = response.json() - if "尚未登录" not in result.get("msg"): - coin = sum([one.get('coin') for one in result.get("data", {}).get("award")]) - msg = f"当前书豆: {coin}\n" + "\n".join( - [f"{one.get('expire')} 到期,{one.get('coin')} 书豆" for one in result.get("data", {}).get("award")]) - return msg - else: - return "账号异常: Cookie 失效" - - def free(self, cookies): - url = "https://www.duokan.com/hs/v4/channel/query/2027" - response = requests.get(url=url, cookies=cookies, headers=self.headers) - bid = response.json().get("items")[0].get("data").get("book_id") - data = f"payment_name=BC&ch=VSZUVB&book_id={bid}&price=0&allow_discount=1" - free_url = "https://www.duokan.com/store/v0/payment/book/create" - response = requests.post(url=free_url, data=data, cookies=cookies, headers=self.headers) - result = response.json() - if "尚未登录" not in result.get("msg"): - book_title = result.get("book").get("title") - book_msg = result.get("msg") - msg = f"今日限免: {book_title} · {book_msg}" - return msg - else: - return "今日限免: Cookie 失效" - - def gift(self, cookies): - url = "https://www.duokan.com/events/common_task_gift_check" - data = f"code=KYKJF7LL0G&{self.get_data(cookies=cookies)}&withid=1" - response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) - result = response.json() - if result.get("chances") == 0: - msg = "体验任务: 已经做完啦" - elif result.get("chances"): - num = 0 - for gift_code in self.gift_code_list: - url = "https://www.duokan.com/events/common_task_gift" - data = f"code=KYKJF7LL0G&chances=1&sign={gift_code}&{self.get_data(cookies=cookies)}&withid=1" - response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) - result = response.json() - if result.get("msg") == "成功": - num += 30 - print("体验任务完成啦!豆子 +30") - else: - print(result.get("data")) - msg = f"体验任务: 获得 {num} 豆子" - else: - msg = f"体验任务: {response.text}" - return msg - - def add_draw(self, cookies): - success_count = 0 - for one in range(6): - url = "https://www.duokan.com/store/v0/event/chances/add" - data = f"code=8ulcky4bknbe_f&count=1&{self.get_data(cookies=cookies)}&withid=1" - response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) - result = response.json() - if result.get("result") == 0: - success_count += 1 - msg = f"添加抽奖: {success_count} 次" - return msg - - def draw(self, cookies): - success_count = 0 - for one in range(6): - url = "https://www.duokan.com/store/v0/event/drawing" - data = f"code=8ulcky4bknbe_f&{self.get_data(cookies=cookies)}&withid=1" - response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) - result = response.json() - if result.get("result") == 0: - success_count += 1 - msg = f"成功抽奖: {success_count} 次" - return msg - - def download(self, cookies): - url = "https://www.duokan.com/events/common_task_gift" - data = f"code=J18UK6YYAY&chances=17&{self.get_data(cookies=cookies)}&withid=1" - response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) - result = response.json() - msg = "下载任务: " + result.get("msg") - return msg - - def task(self, cookies): - success_count = 0 - url = "https://www.duokan.com/events/tasks_gift" - for code in self.code_list: - data = f"code={code}&chances=3&{self.get_data(cookies=cookies)}&withid=1" - response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) - result = response.json() - if result.get("result") == 0: - success_count += 1 - return f"其他任务: 完成 {success_count} 个" - - def main(self): - duokan_cookie = { - item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("duokan_cookie").split("; ") - } - sign_msg = self.sign(cookies=duokan_cookie) - free_msg = self.free(cookies=duokan_cookie) - gift_msg = self.gift(cookies=duokan_cookie) - add_draw_msg = self.add_draw(cookies=duokan_cookie) - draw_msg = self.draw(cookies=duokan_cookie) - download_msg = self.download(cookies=duokan_cookie) - task_msg = self.task(cookies=duokan_cookie) - info_msg = self.info(cookies=duokan_cookie) - msg = ( - f"每日签到: {sign_msg}\n{free_msg}\n{gift_msg}\n" - f"{add_draw_msg}\n{draw_msg}\n{download_msg}\n{task_msg}\n{info_msg}" - ) - return msg - - -if __name__ == "__main__": - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("DUOKAN_COOKIE_LIST", [])[2] - res = DuoKanCheckIn(check_item=_check_item).main() - print(res) - send("多看阅读",res) diff --git a/ck_fmapp.py b/ck_fmapp.py deleted file mode 100644 index 6a4ff9e..0000000 --- a/ck_fmapp.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- -""" -建议cron: 30 14 * * * -new Env('米家'); -""" -import json -import requests -from getENV import getENv -from checksendNotify import send - - -class FMAPPCheckIn: - def __init__(self, check_item): - self.check_item = check_item - - @staticmethod - def sign(headers): - try: - url = "https://fmapp.chinafamilymart.com.cn/api/app/market/member/signin/sign" - response = requests.post(url=url, headers=headers).json() - code = response.get("code") - if code == "200": - data = response.get("data", {}) - msg = ( - f"在坚持{data.get('nextDay')}天即可获得{data.get('nextNumber')}个发米粒\n" - f"签到{data.get('lastDay')}天可获得{data.get('lastNumber')}个发米粒" - ) - else: - msg = response.get("message") - except Exception as e: - print("错误信息", str(e)) - msg = "未知错误,检查日志" - return msg - - @staticmethod - def user_info(headers): - try: - url = "https://fmapp.chinafamilymart.com.cn/api/app/member/info" - response = requests.post(url=url, headers=headers).json() - code = response.get("code") - if code == "200": - data = response.get("data", {}) - msg = data.get("nickName") - else: - msg = response.get("message") - except Exception as e: - print("错误信息", str(e)) - msg = "未知错误,检查日志" - return msg - - @staticmethod - def mili_count(headers): - try: - url = "https://fmapp.chinafamilymart.com.cn/api/app/member/v1/mili/service/detail" - response = requests.post(url=url, headers=headers, data=json.dumps({"pageSize": 10, "pageNo": 1})).json() - code = response.get("code") - if code == "200": - data = response.get("data", {}) - msg = data.get("miliNum") - else: - msg = response.get("message") - except Exception as e: - print("错误信息", str(e)) - msg = "未知错误,检查日志" - return msg - - def main(self): - fmapp_token = self.check_item.get("fmapp_token") - fmapp_cookie = self.check_item.get("fmapp_cookie") - fmapp_blackbox = self.check_item.get("fmapp_blackbox") - fmapp_device_id = self.check_item.get("fmapp_device_id") - fmapp_fmversion = self.check_item.get("fmapp_fmversion", "2.2.3") - fmapp_os = self.check_item.get("fmapp_os", "ios") - fmapp_useragent = self.check_item.get("fmapp_useragent", "Fa") - headers = { - "Accept": "*/*", - "Accept-Language": "zh-Hans;q=1.0", - "Accept-Encoding": "br;q=1.0, gzip;q=0.9, deflate;q=0.8", - "Host": "fmapp.chinafamilymart.com.cn", - "Content-Type": "application/json", - "loginChannel": "app", - "token": fmapp_token, - "fmVersion": fmapp_fmversion, - "deviceId": fmapp_device_id, - "User-Agent": fmapp_useragent, - "os": fmapp_os, - "cookie": fmapp_cookie, - "blackBox": fmapp_blackbox, - } - sign_msg = self.sign(headers=headers) - name_msg = self.user_info(headers=headers) - mili_msg = self.mili_count(headers=headers) - msg = f"帐号信息: {name_msg}\n签到状态: {sign_msg}\n米粒数量: {mili_msg}" - return msg - - -if __name__ == "__main__": - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("FMAPP_ACCOUNT_LIST", [])[0] - res = FMAPPCheckIn(check_item=_check_item).main() - print(res) - send("米家APP", res) diff --git a/ck_hlx.py b/ck_hlx.py deleted file mode 100644 index a190bb8..0000000 --- a/ck_hlx.py +++ /dev/null @@ -1,115 +0,0 @@ -""" - -建议cron: 30 7 * * * python3 ck_hlx.py -new Env('葫芦侠签到'); - -""" -import requests -import os -from getENV import getENv -from checksendNotify import send -import json -r = requests.Session() - - -def login(user, passwd): - url = 'http://floor.huluxia.com/account/login/ANDROID/4.0?platform=2&gkey=000000&app_version=4.0.0.6.2' \ - '&versioncode=20141433&market_id=floor_baidu&_key=&device_code=%5Bw%5D02%3A00%3A00%3A00%3A00%3A00 ' - params = { - 'account': user, - 'login_type': '2', - 'password': passwd - } - login_res = r.post(url=url, data=params) - login_res = login_res.json() - nick = login_res['user']['nick'] - key = login_res['_key'] - s_key = login_res['session_key'] - return nick, key, s_key - - -def check(key): - url1 = 'http://floor.huluxia.com/user/status/ANDROID/2.1' - params = { - 'platform': '2', - 'gkey': '000000', - 'app_version': '4.0.0.6.3', - 'versioncode': '20141434', - 'market_id': 'floor_baidu', - '_key': key, - 'device_code': '%5Bw%5D02%3A00%3A00%3A00%3A00%3A00', - } - check_req = r.get(url=url1, params=params) - check_req = check_req.json() - status = check_req['status'] - if status == 0: - raise Exception("令牌验证失败") - elif status == 1: - pass - return status - - -def category(key): - global experienceVal - titles = [] - categoryIDs = [] - category_url = 'http://floor.huluxia.com/category/list/ANDROID/2.0' - params = { - 'platform': '2', - 'gkey': '000000', - 'app_version': '4.0.0.6.3', - 'versioncode': '20141434', - 'market_id': 'floor_huluxia', - '_key': key, - 'device_code': '%5Bw%5D02%3A00%3A00%3A00%3A00%3A00', - 'is_hidden': '1' - } - category_res = r.get(url=category_url, params=params) - category_res = category_res.json() - category_res = category_res["categories"] - for i in range(3, len(category_res)): - res = category_res[i] - titles.append(res['title']) - categoryIDs.append(res['categoryID']) - # print(res) - url = f'http://floor.huluxia.com/user/signin/ANDROID/4.0' - all_experienceVal = 0 - for i in range(0, len(categoryIDs)): - IDS = str(categoryIDs[i]) - params = { - 'platform': '2', - 'gkey': '000000', - 'app_version': '4.0.0.6.3', - 'versioncode': '20141434', - 'market_id': 'floor_baidu', - '_key': key, - 'device_code': '%5Bw%5D02%3A00%3A00%3A00%3A00%3A00', - 'cat_id': IDS - } - try: - experienceVal = r.get(url=url, params=params).json()['experienceVal'] - except: - experienceVal = 0 - finally: - all_experienceVal = all_experienceVal + experienceVal - return '签到成功 共获得{}点经验'.format(all_experienceVal) - - -def hlx(user, passwd): - nick, key, s_key = login(user, passwd) - check(key) - return "用户名:" + nick + category(key) - - -def start(): - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("HLX", []) - res = hlx(user=_check_item.get('user'),passwd=_check_item.get('password')) - print(res) - send('葫芦侠', res) - - -if __name__ == '__main__': - start() diff --git a/ck_iqiyi.py b/ck_iqiyi.py deleted file mode 100644 index d80cadb..0000000 --- a/ck_iqiyi.py +++ /dev/null @@ -1,219 +0,0 @@ -# -*- coding: utf-8 -*- -""" -建议cron: 55 23 * * * -new Env('爱奇艺'); -""" -import json -import os -import re -import time -from urllib.parse import unquote - -import requests -from getENV import getENv -from checksendNotify import send - - -class IQIYICheckIn: - def __init__(self, check_item): - self.check_item = check_item - - @staticmethod - def parse_cookie(cookie): - p00001 = re.findall(r"P00001=(.*?);", cookie)[0] - p00002 = re.findall(r"P00002=(.*?);", cookie)[0] if re.findall(r"P00002=(.*?);", cookie) else "" - p00003 = re.findall(r"P00003=(.*?);", cookie)[0] - return p00001, p00002, p00003 - - @staticmethod - def user_information(p00001): - """ - 用户信息查询 - """ - time.sleep(3) - url = "http://serv.vip.iqiyi.com/vipgrowth/query.action" - params = {"P00001": p00001} - res = requests.get(url=url, params=params).json() - if res["code"] == "A00000": - try: - res_data = res.get("data", {}) - level = res_data.get("level", 0) # VIP 等级 - growthvalue = res_data.get("growthvalue", 0) # 当前 VIP 成长值 - distance = res_data.get("distance", 0) # 升级需要成长值 - deadline = res_data.get("deadline", "非 VIP 用户") # VIP 到期时间 - today_growth_value = res_data.get("todayGrowthValue", 0) # 今日成长值 - msg = ( - f"VIP 等级: {level}\n当前成长值: {growthvalue}\n" - f"升级需成长值: {distance}\n今日成长值: +{today_growth_value}\nVIP 到期时间: {deadline}" - ) - except Exception as e: - msg = str(e) - print(msg) - else: - msg = res.get("msg") - return msg - - @staticmethod - def sign(p00001): - """ - VIP 签到 - """ - url = "https://tc.vip.iqiyi.com/taskCenter/task/queryUserTask" - params = {"P00001": p00001, "autoSign": "yes"} - res = requests.get(url=url, params=params).json() - if res["code"] == "A00000": - try: - growth = res["data"]["signInfo"]["data"]["rewardMap"]["growth"] - continue_sign_days_sum = res["data"]["signInfo"]["data"]["continueSignDaysSum"] - reward_day = ( - 7 if continue_sign_days_sum % 28 <= 7 else (14 if continue_sign_days_sum % 28 <= 14 else 28) - ) - rouund_day = 28 if continue_sign_days_sum % 28 == 0 else continue_sign_days_sum % 28 - msg = f"+{growth}成长值\n连续签到: {continue_sign_days_sum}天\n签到周期: {rouund_day}天/{reward_day}天" - except Exception as e: - print(e) - msg = res["data"]["signInfo"].get("msg") - else: - msg = res.get("msg") - return msg - - @staticmethod - def query_user_task(p00001): - """ - 获取 VIP 日常任务 和 taskCode(任务状态) - """ - url = "https://tc.vip.iqiyi.com/taskCenter/task/queryUserTask" - params = {"P00001": p00001} - task_list = [] - res = requests.get(url=url, params=params).json() - if res["code"] == "A00000": - for item in res["data"]["tasks"]["daily"]: - task_list.append( - { - "name": item["name"], - "taskCode": item["taskCode"], - "status": item["status"], - "taskReward": item["taskReward"]["task_reward_growth"], - } - ) - return task_list - - @staticmethod - def join_task(p00001, task_list): - """ - 遍历完成任务 - """ - url = "https://tc.vip.iqiyi.com/taskCenter/task/joinTask" - params = {"P00001": p00001, "taskCode": "", "platform": "bb136ff4276771f3", "lang": "zh_CN"} - for item in task_list: - if item["status"] == 2: - params["taskCode"] = item["taskCode"] - requests.get(url=url, params=params) - - @staticmethod - def get_task_rewards(p00001, task_list): - """ - 获取任务奖励 - :return: 返回信息 - """ - url = "https://tc.vip.iqiyi.com/taskCenter/task/getTaskRewards" - params = {"P00001": p00001, "taskCode": "", "platform": "bb136ff4276771f3", "lang": "zh_CN"} - growth_task = 0 - for item in task_list: - if item["status"] == 0: - params["taskCode"] = item.get("taskCode") - requests.get(url=url, params=params) - elif item["status"] == 4: - requests.get(url="https://tc.vip.iqiyi.com/taskCenter/task/notify", params=params) - params["taskCode"] = item.get("taskCode") - requests.get(url=url, params=params) - elif item["status"] == 1: - growth_task += item["taskReward"] - msg = f"+{growth_task}成长值" - return msg - - @staticmethod - def draw(draw_type, p00001, p00003): - """ - 查询抽奖次数(必),抽奖 - :param draw_type: 类型。0 查询次数;1 抽奖 - :param p00001: 关键参数 - :param p00003: 关键参数 - :return: {status, msg, chance} - """ - url = "https://iface2.iqiyi.com/aggregate/3.0/lottery_activity" - params = { - "lottery_chance": 1, - "app_k": "b398b8ccbaeacca840073a7ee9b7e7e6", - "app_v": "11.6.5", - "platform_id": 10, - "dev_os": "8.0.0", - "dev_ua": "FRD-AL10", - "net_sts": 1, - "qyid": "2655b332a116d2247fac3dd66a5285011102", - "psp_uid": p00003, - "psp_cki": p00001, - "psp_status": 3, - "secure_v": 1, - "secure_p": "GPhone", - "req_sn": round(time.time() * 1000), - } - if draw_type == 1: - del params["lottery_chance"] - res = requests.get(url=url, params=params).json() - if not res.get("code"): - chance = int(res.get("daysurpluschance")) - msg = res.get("awardName") - return {"status": True, "msg": msg, "chance": chance} - else: - try: - msg = res.get("kv", {}).get("msg") - except Exception as e: - print(e) - msg = res["errorReason"] - return {"status": False, "msg": msg, "chance": 0} - - def main(self): - p00001, p00002, p00003 = self.parse_cookie(self.check_item.get("iqiyi_cookie")) - sign_msg = self.sign(p00001=p00001) - chance = self.draw(0, p00001=p00001, p00003=p00003)["chance"] - if chance: - draw_msg = "" - for i in range(chance): - ret = self.draw(1, p00001=p00001, p00003=p00003) - draw_msg += ret["msg"] + ";" if ret["status"] else "" - else: - draw_msg = "抽奖机会不足" - task_msg = "" - for one in range(6): - task_list = self.query_user_task(p00001=p00001) - self.join_task(p00001=p00001, task_list=task_list) - time.sleep(10) - task_msg = self.get_task_rewards(p00001=p00001, task_list=task_list) - try: - user_info = json.loads(unquote(p00002, encoding="utf-8")) - user_name = user_info.get("user_name") - user_name = user_name.replace(user_name[3:7], "****") - nickname = user_info.get("nickname") - except Exception as e: - print(f"获取用户信息失败,错误信息: {e}") - nickname = "未获取到,请检查 Cookie 中 P00002 字段" - user_name = "未获取到,请检查 Cookie 中 P00002 字段" - user_msg = self.user_information(p00001=p00001) - msg = f"用户账号: {user_name}\n用户昵称: {nickname}\n{user_msg}\n" \ - f"签到奖励: {sign_msg}\n任务奖励: {task_msg}\n抽奖奖励: {draw_msg}" - return msg - - -def start(): - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("IQIYI_COOKIE_LIST", [])[0] - res = IQIYICheckIn(check_item=_check_item).main() - print(res) - send('爱奇艺', res) - - -if __name__ == "__main__": - start() diff --git a/ck_kgqq.py b/ck_kgqq.py deleted file mode 100644 index de1b472..0000000 --- a/ck_kgqq.py +++ /dev/null @@ -1,139 +0,0 @@ -# -*- coding: utf-8 -*- -""" -建议cron: 55 14 * * * -new Env('全民k歌'); -""" -import json -import requests -from getENV import getENv -from checksendNotify import send - - -class KGQQCheckIn: - def __init__(self, check_item): - self.check_item = check_item - - @staticmethod - def sign(kgqq_cookie): - headers = {"Cookie": kgqq_cookie} - uid = kgqq_cookie.split("; ") - t_uuid = "" - for i in uid: - if i.find("uid=") >= 0: - t_uuid = i.split("=")[1] - proto_profile_url = "https://node.kg.qq.com/webapp/proxy?ns=proto_profile&cmd=profile.getProfile&mapExt=JTdCJTIyZmlsZSUyMiUzQSUyMnByb2ZpbGVfd2ViYXBwSmNlJTIyJTJDJTIyY21kTmFtZSUyMiUzQSUyMlByb2ZpbGVHZXQlMjIlMkMlMjJhcHBpZCUyMiUzQTEwMDA2MjYlMkMlMjJkY2FwaSUyMiUzQSU3QiUyMmludGVyZmFjZUlkJTIyJTNBMjA1MzU5NTk3JTdEJTJDJTIybDVhcGklMjIlM0ElN0IlMjJtb2RpZCUyMiUzQTI5NDAxNyUyQyUyMmNtZCUyMiUzQTI2MjE0NCU3RCUyQyUyMmlwJTIyJTNBJTIyMTAwLjExMy4xNjIuMTc4JTIyJTJDJTIycG9ydCUyMiUzQSUyMjEyNDA2JTIyJTdE&t_uUid={0}".format( - t_uuid - ) - - url_list = ( - [ - "https://node.kg.qq.com/webapp/proxy?ns=KG_TASK&cmd=task.getLottery&ns_inbuf=&mapExt=JTdCJTIyZmlsZSUyMiUzQSUyMnRhc2tKY2UlMjIlMkMlMjJjbWROYW1lJTIyJTNBJTIyTG90dGVyeVJlcSUyMiUyQyUyMnduc0NvbmZpZyUyMiUzQSU3QiUyMmFwcGlkJTIyJTNBMTAwMDU1NyU3RCUyQyUyMmw1YXBpJTIyJTNBJTdCJTIybW9kaWQlMjIlM0E1MDM5MzclMkMlMjJjbWQlMjIlM0E1ODk4MjQlN0QlN0Q%3D&t_uid={0}&t_iShowEntry=1&t_type={1}".format( - t_uuid, one - ) - for one in ["1", "2"] - ] - + [ - "https://node.kg.qq.com/webapp/proxy?ns=KG_TASK&cmd=task.signinGetAward&mapExt=JTdCJTIyZmlsZSUyMiUzQSUyMnRhc2tKY2UlMjIlMkMlMjJjbWROYW1lJTIyJTNBJTIyR2V0U2lnbkluQXdhcmRSZXElMjIlMkMlMjJ3bnNDb25maWclMjIlM0ElN0IlMjJhcHBpZCUyMiUzQTEwMDA2MjYlN0QlMkMlMjJsNWFwaSUyMiUzQSU3QiUyMm1vZGlkJTIyJTNBNTAzOTM3JTJDJTIyY21kJTIyJTNBNTg5ODI0JTdEJTdE&t_uid={0}&t_iShowEntry={1}".format( - t_uuid, one - ) - for one in ["1", "2", "4", "16", "128", "512"] - ] - + [ - "https://node.kg.qq.com/webapp/proxy?ns=KG_TASK&cmd=task.getLottery&mapExt=JTdCJTIyZmlsZSUyMiUzQSUyMnRhc2tKY2UlMjIlMkMlMjJjbWROYW1lJTIyJTNBJTIyTG90dGVyeVJlcSUyMiUyQyUyMnduc0NvbmZpZyUyMiUzQSU3QiUyMmFwcGlkJTIyJTNBMTAwMDU1NyU3RCUyQyUyMmw1YXBpJTIyJTNBJTdCJTIybW9kaWQlMjIlM0E1MDM5MzclMkMlMjJjbWQlMjIlM0E1ODk4MjQlN0QlN0Q&t_uid={0}&t_iShowEntry=4&t_type=104".format( - t_uuid - ), - "https://node.kg.qq.com/webapp/proxy?ns=KG_TASK&cmd=task.getLottery&mapExt=JTdCJTIyZmlsZSUyMiUzQSUyMnRhc2tKY2UlMjIlMkMlMjJjbWROYW1lJTIyJTNBJTIyTG90dGVyeVJlcSUyMiUyQyUyMmw1YXBpJTIyJTNBJTdCJTIybW9kaWQlMjIlM0E1MDM5MzclMkMlMjJjbWQlMjIlM0E1ODk4MjQlN0QlMkMlMjJsNWFwaV9leHAxJTIyJTNBJTdCJTIybW9kaWQlMjIlM0E4MTcwODklMkMlMjJjbWQlMjIlM0EzODAxMDg4JTdEJTdE&t_uid={0}&t_type=103".format( - t_uuid - ), - ] - ) - - proto_music_station_url = "https://node.kg.qq.com/webapp/proxy?ns=proto_music_station&cmd=message.batch_get_music_cards&mapExt=JTdCJTIyY21kTmFtZSUyMiUzQSUyMkdldEJhdGNoTXVzaWNDYXJkc1JlcSUyMiUyQyUyMmZpbGUlMjIlM0ElMjJwcm90b19tdXNpY19zdGF0aW9uSmNlJTIyJTJDJTIyd25zRGlzcGF0Y2hlciUyMiUzQXRydWUlN0Q&t_uUid={0}&g_tk_openkey=".format( - t_uuid - ) - - url_10 = "https://node.kg.qq.com/webapp/proxy?t_stReward%3Aobject=%7B%22uInteractiveType%22%3A1%2C%22uRewardType%22%3A0%2C%22uFlowerNum%22%3A15%7D&ns=proto_music_station&cmd=message.get_reward&mapExt=JTdCJTIyY21kTmFtZSUyMiUzQSUyMkdldFJld2FyZFJlcSUyMiUyQyUyMmZpbGUlMjIlM0ElMjJwcm90b19tdXNpY19zdGF0aW9uSmNlJTIyJTJDJTIyd25zRGlzcGF0Y2hlciUyMiUzQXRydWUlN0Q&t_uUid={0}&t_strUgcId=".format( - t_uuid - ) - - url_15 = "https://node.kg.qq.com/webapp/proxy?t_stReward%3Aobject=%7B%22uInteractiveType%22%3A0%2C%22uRewardType%22%3A0%2C%22uFlowerNum%22%3A10%7D&ns=proto_music_station&cmd=message.get_reward&mapExt=JTdCJTIyY21kTmFtZSUyMiUzQSUyMkdldFJld2FyZFJlcSUyMiUyQyUyMmZpbGUlMjIlM0ElMjJwcm90b19tdXNpY19zdGF0aW9uSmNlJTIyJTJDJTIyd25zRGlzcGF0Y2hlciUyMiUzQXRydWUlN0Q&t_uUid={0}&t_strUgcId=".format( - t_uuid - ) - try: - old_proto_profile_response = requests.get(url=proto_profile_url, headers=headers) - old_num = old_proto_profile_response.json()["data"]["profile.getProfile"]["uFlowerNum"] - nickname = old_proto_profile_response.json()["data"]["profile.getProfile"]["stPersonInfo"]["sKgNick"] - for url in url_list: - try: - requests.get(url=url, headers=headers) - except Exception as e: - print(e) - for g_tk_openkey in range(16): - try: - proto_music_station_resp = requests.get( - url=proto_music_station_url + str(g_tk_openkey), headers=headers - ) - if proto_music_station_resp.json().get("code") in [1000]: - return proto_music_station_resp.json().get("msg") - vct_music_cards = proto_music_station_resp.json()["data"]["message.batch_get_music_cards"][ - "vctMusicCards" - ] - vct_music_cards_list = sorted( - vct_music_cards, key=lambda x: x["stReward"]["uFlowerNum"], reverse=True - )[0] - str_ugc_id = vct_music_cards_list["strUgcId"] - str_key = vct_music_cards_list["strKey"] - url = str_ugc_id + "&t_strKey=" + str_key - u_flower_num = vct_music_cards_list["stReward"]["uFlowerNum"] - if u_flower_num > 10: - requests.get(url=url_10 + url, headers=headers) - elif 1 < u_flower_num < 10: - requests.get(url=url_15 + url, headers=headers) - except Exception as e: - print(e) - # VIP 签到 - try: - getinfourl = ( - "https://node.kg.qq.com/webapp/proxy?ns=proto_vip_webapp&cmd=vip.get_vip_info&t_uUid=" - + t_uuid - + "&t_uWebReq=1&t_uGetDataFromC4B=1" - ) - inforequest = requests.get(url=getinfourl, headers=headers) - vip_status = inforequest.json()["data"]["vip.get_vip_info"]["stVipCoreInfo"]["uStatus"] - if vip_status == 1: - vipurl = ( - "https://node.kg.qq.com/webapp/proxy?t_uUid=" - + t_uuid - + "&ns=proto_vip_webapp&cmd=vip.get_vip_day_reward&ns_inbuf=&nocache=1613719349184&mapExt=JTdCJTIyY21kTmFtZSUyMiUzQSUyMkdldFZpcERheVJld2FyZCUyMiU3RA%3D%3D&g_tk_openkey=642424811" - ) - viprequest = requests.get(url=vipurl, headers=headers) - str_tips = viprequest.json()["data"]["vip.get_vip_day_reward"]["strTips"] - u_cur_reward_num = viprequest.json()["data"]["vip.get_vip_day_reward"]["uCurRewardNum"] - vip_message = f"{str_tips} 获取VIP福利道具:{u_cur_reward_num}个" - else: - vip_message = "非 VIP 用户" - except Exception as e: - print(e) - vip_message = "VIP 签到失败" - new_proto_profile_response = requests.get(url=proto_profile_url, headers=headers) - new_num = new_proto_profile_response.json()["data"]["profile.getProfile"]["uFlowerNum"] - get_num = int(new_num) - int(old_num) - kg_message = f"帐号信息: {nickname}\n获取鲜花: {get_num}朵\n当前鲜花: {new_num}朵\nVIP签到: {vip_message}" - except Exception as e: - kg_message = str(e) - return kg_message - - def main(self): - kgqq_cookie = self.check_item.get("kgqq_cookie") - msg = self.sign(kgqq_cookie=kgqq_cookie) - return msg - - -if __name__ == "__main__": - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("KGQQ_COOKIE_LIST", [])[0] - res = KGQQCheckIn(check_item=_check_item).main() - print(res) - send("全民K歌", res) diff --git a/ck_meizu.py b/ck_meizu.py deleted file mode 100644 index 96e2ca0..0000000 --- a/ck_meizu.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- -""" -建议cron: 55 15 * * * -new Env('魅族社区'); -""" -import json -import time -import requests -from getENV import getENv -from checksendNotify import send - - -class MeizuCheckIn: - def __init__(self, check_item): - self.check_item = check_item - - @staticmethod - def sign(cookie): - headers = { - "authority": "bbs-act.meizu.cn", - "pragma": "no-cache", - "cache-control": "no-cache", - "accept": "application/json, text/javascript, */*; q=0.01", - "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74", - "origin": "https://bbs.meizu.cn", - "referer": "https://bbs.meizu.cn/", - "accept-language": "zh-CN,zh;q=0.9,en;q=0.8", - "cookie": cookie, - } - params = ( - ("mod", "signin"), - ("action", "sign"), - ) - response = requests.get(url="https://bbs-act.meizu.cn/index.php", headers=headers, params=params).json() - msg = response.get("message") - return msg - - @staticmethod - def draw(cookie, count: int = 0): - headers = { - "authority": "bbs-act.meizu.cn", - "accept": "application/json, text/javascript, */*; q=0.01", - "x-requested-with": "XMLHttpRequest", - "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74", - "content-type": "application/x-www-form-urlencoded", - "origin": "https://bbs-act.meizu.cn", - "referer": "https://bbs-act.meizu.cn/2/index.html", - "accept-language": "zh-CN,zh;q=0.9", - "cookie": cookie, - } - data = {"mod": "index", "action": "draw", "id": "2"} - award_list = [] - success_count = 0 - error_count = 0 - if count: - for i in range(count): - try: - data = requests.post(url="https://bbs-act.meizu.cn/index.php", headers=headers, data=data).json() - if data["code"] == 200: - one_msg = data.get("data", {}).get("award_name") - award_list.append(one_msg) - success_count += 1 - else: - error_count += 1 - print(data.get("code"), data.get("message")) - one_msg = "抽奖失败" - except Exception as e: - one_msg = f"抽奖失败: {e}" - error_count += 1 - print(f"第{i + 1}次抽奖结果:" + str(one_msg)) - time.sleep(5) - msg = f"成功抽奖 {success_count} 次" - draw_msg = "抽奖状态: " + str(msg) - draw_msg += f"\n抽奖结果: {';'.join(award_list)}" - else: - draw_msg = "抽奖结果: 未开启抽奖" - data = {"mod": "index", "action": "get_user_count", "id": "2"} - user_info = requests.post("https://bbs-act.meizu.cn/index.php", headers=headers, data=data).json() - uid = user_info.get("data", {}).get("uid") - return draw_msg, uid - - def main(self): - meizu_cookie = self.check_item.get("meizu_cookie") - try: - draw_count = int(self.check_item.get("draw_count", 0)) - except Exception as e: - print("初始化抽奖次数失败: 重置为 0 ", str(e)) - draw_count = 0 - sign_msg = self.sign(cookie=meizu_cookie) - draw_msg, uid = self.draw(cookie=meizu_cookie, count=draw_count) - msg = f"帐号信息: {uid}\n签到信息: {sign_msg}\n{draw_msg}" - return msg - - -if __name__ == "__main__": - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("MEIZU_COOKIE_LIST", [])[0] - res = MeizuCheckIn(check_item=_check_item).main() - print(res) - send("MEIZU 社区",res) diff --git a/ck_mgtv.py b/ck_mgtv.py deleted file mode 100644 index b19a7da..0000000 --- a/ck_mgtv.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- -""" -建议cron: 23 14 * * * -new Env('芒果TV'); -""" -import json -import os -import time -from urllib import parse -from getENV import getENv -from checksendNotify import send -import requests - - -class MgtvCheckIn: - def __init__(self, check_item): - self.check_item = check_item - - @staticmethod - def sign(params): - url = "https://credits.bz.mgtv.com/user/creditsTake" - user_params = { - "abroad": params.get("abroad"), - "ageMode": "0", - "appVersion": params.get("appVersion"), - "artistId": params.get("uuid"), - "device": params.get("device"), - "did": params.get("did"), - "mac": params.get("did"), - "osType": params.get("osType"), - "src": "mgtv", - "testversion": "", - "ticket": params.get("ticket"), - "uuid": params.get("uuid"), - } - try: - user_info = requests.get(url="https://homepage.bz.mgtv.com/v2/user/userInfo", params=user_params).json() - username = user_info.get("data", {}).get("nickName") - except Exception as e: - print("获取用户信息失败", e) - username = params.get("uuid") - res = requests.get(url=url, params=params) - res_json = json.loads(res.text.replace(f"{params.get('callback')}(", "").replace(");", "")) - if res_json["code"] == 200: - cur_day = res_json["data"]["curDay"] - _credits = res_json["data"]["credits"] - msg = f"帐号信息: {username}\n签到积分: +{_credits}积分\n已经签到: {cur_day}天/21天" - else: - msg = f"帐号信息: {username}\n签到状态: 已完成签到 or 签到失败" - return msg - - def main(self): - mgtv_params = self.check_item.get("mgtv_params") - params = parse.parse_qs(mgtv_params) - params["timestamp"] = [round(time.time())] - params = {key: value[0] for key, value in params.items()} - msg = self.sign(params=params) - return msg - - -if __name__ == "__main__": - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("MGTV_PARAMS_LIST", [])[0] - res = MgtvCheckIn(check_item=_check_item).main() - print(res) - send("芒果 TV",res) diff --git a/ck_mimotion.py b/ck_mimotion.py deleted file mode 100644 index 9cfddaf..0000000 --- a/ck_mimotion.py +++ /dev/null @@ -1,114 +0,0 @@ -# -*- coding: utf8 -*- -""" -建议cron: 55 13 * * * -new Env('小米运动'); -""" -import json -import os -import random -import re -import time -from getENV import getENv -from checksendNotify import send -import requests - - -class MiMotion: - def __init__(self, check_item): - self.check_item = check_item - self.headers = {"User-Agent": "Dalvik/2.1.0 (Linux; U; Android 9; MI 6 MIUI/20.6.18)"} - - def get_time(self): - url = "http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp" - response = requests.get(url, headers=self.headers).json() - t = response["data"]["t"] - return t - - def get_app_token(self, login_token): - url = f"https://account-cn.huami.com/v1/client/app_tokens?app_name=com.xiaomi.hm.health&dn=api-user.huami.com%2Capi-mifit.huami.com%2Capp-analytics.huami.com&login_token={login_token}" - response = requests.get(url=url, headers=self.headers).json() - app_token = response["token_info"]["app_token"] - return app_token - - @staticmethod - def login(phone, password): - url1 = f"https://api-user.huami.com/registrations/+86{phone}/tokens" - headers = { - "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", - "User-Agent": "MiFit/4.6.0 (iPhone; iOS 14.0.1; Scale/2.00)", - } - data1 = { - "client_id": "HuaMi", - "password": f"{password}", - "redirect_uri": "https://s3-us-west-2.amazonaws.com/hm-registration/successsignin.html", - "token": "access", - } - r1 = requests.post(url=url1, data=data1, headers=headers, allow_redirects=False) - location = r1.headers["Location"] - try: - code_pattern = re.compile("(?<=access=).*?(?=&)") - code = code_pattern.findall(location)[0] - except Exception as e: - print(e) - return 0, 0 - url2 = "https://account.huami.com/v2/client/login" - data2 = { - "app_name": "com.xiaomi.hm.health", - "app_version": "4.6.0", - "code": f"{code}", - "country_code": "CN", - "device_id": "2C8B4939-0CCD-4E94-8CBA-CB8EA6E613A1", - "device_model": "phone", - "grant_type": "access_token", - "third_name": "huami_phone", - } - r2 = requests.post(url=url2, data=data2, headers=headers).json() - login_token = r2["token_info"]["login_token"] - userid = r2["token_info"]["user_id"] - return login_token, userid - - def main(self): - phone = str(self.check_item.get("mimotion_phone")) - password = str(self.check_item.get("mimotion_password")) - try: - min_step = int(self.check_item.get("mimotion_min_step", 10000)) - except Exception as e: - print("初始化步数失败: 已将最小值设置为 19999", e) - min_step = 10000 - try: - max_step = int(self.check_item.get("mimotion_max_step", 19999)) - except Exception as e: - print("初始化步数失败: 已将最大值设置为 19999", e) - max_step = 19999 - step = str(random.randint(min_step, max_step)) - login_token, userid = self.login(phone, password) - if login_token == 0: - msg = f"帐号信息: {phone}\n修改状态: 登陆失败" - else: - t = self.get_time() - app_token = self.get_app_token(login_token) - today = time.strftime("%F") - data_json = "%5B%7B%22data_hr%22%3A%22%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F9L%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2FVv%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F0v%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5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gAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAA%22%2C%22tz%22%3A32%2C%22did%22%3A%22DA932FFFFE8816E7%22%2C%22src%22%3A24%7D%5D%2C%22summary%22%3A%22%7B%5C%22v%5C%22%3A6%2C%5C%22slp%5C%22%3A%7B%5C%22st%5C%22%3A1597349880%2C%5C%22ed%5C%22%3A1597369860%2C%5C%22dp%5C%22%3A39%2C%5C%22lt%5C%22%3A294%2C%5C%22wk%5C%22%3A0%2C%5C%22usrSt%5C%22%3A-1440%2C%5C%22usrEd%5C%22%3A-1440%2C%5C%22wc%5C%22%3A0%2C%5C%22is%5C%22%3A169%2C%5C%22lb%5C%22%3A10%2C%5C%22to%5C%22%3A23%2C%5C%22dt%5C%22%3A0%2C%5C%22rhr%5C%22%3A58%2C%5C%22ss%5C%22%3A69%2C%5C%22stage%5C%22%3A%5B%7B%5C%22start%5C%22%3A1698%2C%5C%22stop%5C%22%3A1711%2C%5C%22mode%5C%22%3A4%7D%2C%7B%5C%22start%5C%22%3A1712%2C%5C%22stop%5C%22%3A1728%2C%5C%22mode%5C%22%3A5%7D%2C%7B%5C%22start%5C%22%3A1729%2C%5C%22stop%5C%22%3A1818%2C%5C%22mode%5C%22%3A4%7D%2C%7B%5C%22start%5C%22%3A1819%2C%5C%22stop%5C%22%3A1832%2C%5C%22mode%5C%22%3A5%7D%2C%7B%5C%22start%5C%22%3A1833%2C%5C%22stop%5C%22%3A1920%2C%5C%22mode%5C%22%3A4%7D%2C%7B%5C%22start%5C%22%3A1921%2C%5C%22stop%5C%22%3A1928%2C%5C%22mode%5C%22%3A5%7D%2C%7B%5C%22start%5C%22%3A1929%2C%5C%22stop%5C%22%3A2030%2C%5C%22mode%5C%22%3A4%7D%5D%7D%2C%5C%22stp%5C%22%3A%7B%5C%22ttl%5C%22%3A125%2C%5C%22dis%5C%22%3A82%2C%5C%22cal%5C%22%3A5%2C%5C%22wk%5C%22%3A7%2C%5C%22rn%5C%22%3A0%2C%5C%22runDist%5C%22%3A23%2C%5C%22runCal%5C%22%3A3%7D%2C%5C%22goal%5C%22%3A8000%2C%5C%22tz%5C%22%3A%5C%2228800%5C%22%2C%5C%22sn%5C%22%3A%5C%22e716882f93da%5C%22%7D%22%2C%22source%22%3A24%2C%22type%22%3A0%7D%5D" - finddate = re.compile(r".*?date%22%3A%22(.*?)%22%2C%22data.*?") - findstep = re.compile(r".*?ttl%5C%22%3A(.*?)%2C%5C%22dis.*?") - data_json = re.sub(finddate.findall(data_json)[0], today, str(data_json)) - data_json = re.sub(findstep.findall(data_json)[0], step, str(data_json)) - url = f"https://api-mifit-cn.huami.com/v1/data/band_data.json?&t={t}" - headers = {"apptoken": app_token, "Content-Type": "application/x-www-form-urlencoded"} - data = f"userid={userid}&last_sync_data_time=1597306380&device_type=0&last_deviceid=DA932FFFFE8816E7&data_json={data_json}" - response = requests.post(url=url, data=data, headers=headers).json() - msg = f"帐号信息: {phone}\n修改状态: {response['message']}\n修改步数: {step}" - return msg - -def start(): - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("MIMOTION_ACCOUNT_LIST", [])[0] - res=MiMotion(check_item=_check_item).main() - print(res) - send('小米运动', res) - - -if __name__ == "__main__": - start() diff --git a/ck_smzdm.py b/ck_smzdm.py deleted file mode 100644 index 679bd56..0000000 --- a/ck_smzdm.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- -import json -import os - -import requests -from requests import utils -from getENV import getENv -from checksendNotify import send - -""" -建议cron: 51 9 * * * -new Env('什么值得买'); -""" - -class SmzdmCheckIn: - def __init__(self, check_item): - self.check_item = check_item - - @staticmethod - def sign(session): - try: - current = session.get(url="https://zhiyou.smzdm.com/user/info/jsonp_get_current").json() - if current["checkin"]["has_checkin"]: - msg = ( - f"用户信息: {current.get('nickname', '')}\n目前积分: {current.get('point', '')}\n" - f"经验值: {current.get('exp', '')}\n金币: {current.get('gold', '')}\n" - f"碎银子: {current.get('silver', '')}\n威望: {current.get('prestige', '')}\n" - f"等级: {current.get('level', '')}\n" - f"已经签到: {current.get('checkin', {}).get('daily_checkin_num', '')} 天" - ) - else: - response = session.get(url="https://zhiyou.smzdm.com/user/checkin/jsonp_checkin").json().get("data", {}) - msg = ( - f"用户信息: {current.get('nickname', '')}\n目前积分: {response.get('point', '')}\n" - f"增加积分: {response.get('add_point', '')}\n经验值: {response.get('exp', '')}\n" - f"金币: {response.get('gold', '')}\n威望: {response.get('prestige', '')}\n" - f"等级: {response.get('rank', '')}\n" - f"已经签到: {response.get('checkin_num', {})} 天" - ) - except Exception as e: - msg = f"签到状态: 签到失败\n错误信息: {e}" - return msg - - def main(self): - smzdm_cookie = { - item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("smzdm_cookie").split("; ") - } - session = requests.session() - requests.utils.add_dict_to_cookiejar(session.cookies, smzdm_cookie) - session.headers.update( - { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate, br", - "Accept-Language": "zh-CN,zh;q=0.9", - "Connection": "keep-alive", - "Host": "zhiyou.smzdm.com", - "Referer": "https://www.smzdm.com/", - "Sec-Fetch-Dest": "script", - "Sec-Fetch-Mode": "no-cors", - "Sec-Fetch-Site": "same-site", - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36", - } - ) - sign_msg = self.sign(session=session) - msg = f"{sign_msg}" - return msg - - -if __name__ == "__main__": - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("SMZDM_COOKIE_LIST", [])[0] - res = SmzdmCheckIn(check_item=_check_item).main() - print(res) - send('什么值得买',res) diff --git a/ck_vqq.js b/ck_vqq.js deleted file mode 100644 index 79e4244..0000000 --- a/ck_vqq.js +++ /dev/null @@ -1,328 +0,0 @@ -/**** - * - * @description 腾讯视频好莱坞会员V力值签到,手机签到和领取任务及奖励。 - * @author BlueSkyClouds - * @create_at 2021-01-10 - */ - -/* - -[task_local] -#腾讯视频会员签到 -55 23 * * * ck_vqq.js - - */ - -const $ = new Env('腾讯视频会员签到'); -const notify = $.isNode() ? require('./sendNotify') : ''; -const fs = require('fs'); - -let rawdata = fs.readFileSync('/ql/config/check.json'); -let config = JSON.parse(rawdata); -let VQQ_COOKIE_LIST = config.VQQ_COOKIE_LIST[0] -const _cookie = VQQ_COOKIE_LIST.vqq_cookie -const ref_url = VQQ_COOKIE_LIST.auth_refresh - -const auth = getAuth() -const axios = require('axios') -const UTC8 = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000; -notice = timeFormat(UTC8) + "\n" - -const headers = { - 'Referer': 'https://v.qq.com', - 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.204 Safari/537.36', - 'Cookie': _cookie -} - -/** - * @description 拼接REF_URL - */ -ref_url_ver() - -/** - * @description 封装一个解析setCookie的方法 - * @returns obj - * @param c_list - */ -function parseSet(c_list) { - let obj = {} - c_list.map(t=>{ - const obj = {} - t.split(', ')[0].split(';').forEach(item=>{ - const [key, val] = item.split('=') - obj[key] = val - }) - return obj - }).forEach(t=>obj = { ...obj, ...t }) - return obj -} - -/** - * @description 获取有效的cookie参数 - * @param {*} [c=_cookie] - * @returns obj - */ -function getAuth(c = _cookie) { - let needParams = [""] - //适配微信登录 - if(_cookie){ - if (_cookie.includes("main_login=wx")) { - needParams = ["tvfe_boss_uuid","video_guid","video_platform","pgv_pvid","pgv_info","pgv_pvi","pgv_si","_qpsvr_localtk","RK","ptcz","ptui_loginuin","main_login","access_token","appid","openid","vuserid","vusession"] - } else if (_cookie.includes("main_login=qq")){ - needParams = ["tvfe_boss_uuid","video_guid","video_platform","pgv_pvid","pgv_info","pgv_pvi","pgv_si","_qpsvr_localtk","RK","ptcz","ptui_loginuin","main_login","vqq_access_token","vqq_appid","vqq_openid","vqq_vuserid","vqq_vusession"] - } else { - console.log("getAuth - 无法提取有效cookie参数") - } - } - const obj = {} - if(c){ - c.split('; ').forEach(t=>{ - const [key, val] = t.split(/\=(.*)$/,2) - needParams.indexOf(key) !==-1 && ( obj[key] = val) - }) - } - return obj -} - -/** - * @description 刷新每天更新cookie参数 - * @returns - */ -function refCookie(url = ref_url) { - return new Promise((resovle, reject)=>{ - axios({ url, headers }).then(e =>{ - const { vusession } = parseSet(e.headers['set-cookie']) - const { vqq_vusession } = parseSet(e.headers['set-cookie']) - const { access_token } = parseSet(e.headers['set-cookie']) - //微信多一个access_token - if (vusession) { - auth['vusession'] = vusession - auth['access_token'] = access_token - } else { - auth['vqq_vusession'] = vqq_vusession - } - // 刷新cookie后去签到 - resovle({ - ...headers, Cookie: Object.keys(auth).map(i => i + '=' + auth[i]).join('; '), - 'Referer': 'https://m.v.qq.com' - }) - }).catch(reject) - }) -} - -/** - * @description 验证ref_url是否正确 - */ -function ref_url_ver(url = ref_url,_cookie) { - $.get({ - url, headers - }, function(error, response, data) { - if (error) { - $.log(error); - console.log("腾讯视频会员签到", "验证ref_url请求失败 ‼️‼️", error) - } else { - if (data.match(/nick/)) { //通过验证获取QQ昵称参数来判断是否正确 - console.log("验证成功,执行主程序") - exports.main() - } else { - console.log("验证ref_url失败,无法获取个人资料 ref_url或Cookie失效 ‼️‼️") - notify.sendNotify("腾讯视频会员签到", '验证ref_url失败,无法获取个人资料 ref_url或Cookie失效 ‼️‼️'); - } - } - }) -} - -// 手机端签到 -function txVideoSignIn(headers) { - $.get({ - url: `https://vip.video.qq.com/fcgi-bin/comm_cgi?name=hierarchical_task_system&cmd=2&_=${ parseInt(Math.random()*1000) }`,headers - }, function(error, response, data) { - if (error) { - $.log(error); - console.log("腾讯视频会员签到", "签到请求失败 ‼️‼️", error) - } else { - if (data.match(/Account Verify Error/)) { - notice += "腾讯视频会员签到:签到失败-Cookie失效 ‼️‼️"+ "\n" - console.log("腾讯视频会员签到:签到失败, Cookie失效 ‼️‼️") - } else if (data.match(/checkin_score/)) { - msg = data.match(/checkin_score": (.+?),"msg/)[1] - //通过分数判断是否重复签到 - if(msg == '0'){ - console.log("腾讯视频会员手机端签到失败:重复签到 ‼️‼️") - notice += "腾讯视频会员手机端签到失败:重复签到 ‼️‼️" + "\n" - }else{ - notice += "腾讯视频会员手机端签到成功:签到分数:" + msg + "分 🎉"+ "\n" - console.log("腾讯视频会员手机端签到成功:签到分数:" + msg + "分 🎉") - } - } else if (data.match(/Not VIP/)) { - notice += "腾讯视频会员签到:非会员无法签到" - console.log("腾讯视频会员签到:非会员无法签到" ) - } else { - console.log("腾讯视频会员签到:脚本待更新 ‼️‼️") - //输出日志查找原因 - console.log(data) - } - } - }) -} - -// 签到2 -function txVideoCheckin(headers){ - $.get({ - url: `http://v.qq.com/x/bu/mobile_checkin?isDarkMode=0&uiType=REGULAR`,headers - }, function(error, response, data) { - if (error) { - $.log(error); - console.log("腾讯视频会员二次签到", "签到请求失败 ‼️‼️", error) - } else { - if (data.match(/Unauthorized/)) { - notice += "腾讯视频会员二次签到失败:Cookie失效 ‼️‼️"+ "\n" - console.log("腾讯视频会员签到:二次签到失败, Cookie失效 ‼️‼️") - } else if (data.match(/isMultiple/)) { - console.log("腾讯视频会员二次签到:二次签到成功" ) - notice += "腾讯视频会员二次签到:二次签到成功" + "\n" - } else { - console.log("腾讯视频会员二次签到:签到失败,自行在腾讯视频APP内登录网址签到http://v.qq.com/x/bu/mobile_checkin (基本每周都需要手动签到一次才可以.)") - console.log("腾讯视频会员二次签到相关教程:https://cdn.jsdelivr.net/gh/BlueskyClouds/Script@master/img/2021/01/15/img/v_2sign.jpg") - notice += "腾讯视频会员二次签到:签到失败,自行在腾讯视频APP内部登录网址签到http://v.qq.com/x/bu/mobile_checkin"+ "\n" + "基本每周都需要手动签到一次第二天才会自动运行\n" - //输出日志查找原因 - //console.log(data) - } - } - }) -} - -//下载任务签到请求 -function txVideoDownTask1(headers) { - $.get({ - url: `https://vip.video.qq.com/fcgi-bin/comm_cgi?name=spp_MissionFaHuo&cmd=4&task_id=7&_=${ parseInt(Math.random()*1000) }`, headers - }, function(error, response, data) { - if (error) { - $.log(error); - console.log("腾讯视频会员签到", "下载任务签到请求 ‼️‼️", error) - } else { - if (data.match(/已发过货/)) { - console.log("腾讯视频会员下载任务签到:签到失败, 请勿重复领取任务 ‼️‼️") - notice += "腾讯视频会员下载任务签到:签到失败, 请勿重复领取任务 ‼️‼️" + "\n" - } else if (data.match(/score/)) { - msg = data.match(/score":(.*?)}/)[1] - console.log("腾讯视频会员下载任务签到:签到成功,签到分数:" + msg + "分 🎉") - notice += "腾讯视频会员下载任务签到:签到成功,签到分数:" + msg + "分 🎉" + "\n" - } else { - //console.log("腾讯视频会员下载任务签到", "", "签到失败, 任务未完成 ‼️‼️") - console.log("腾讯视频会员下载任务签到:", data) - notice += "腾讯视频会员下载任务签到:" + data.match(/msg":"(.*?)"/)[1] + "\n" - } - } - }) -} - -//赠送任务签到请求 -function txVideoDownTask2(headers) { - $.get({ - url: `https://vip.video.qq.com/fcgi-bin/comm_cgi?name=spp_MissionFaHuo&cmd=4&task_id=6&_=${ parseInt(Math.random()*1000) }`, headers - }, function(error, response, data) { - if (error) { - $.log(error); - console.log("腾讯视频会员签到", "赠送任务签到请求 ‼️‼️", error) - } else { - if (data.match(/已发过货/)) { - console.log("腾讯视频会员赠送任务签到:签到失败, 请勿重复领取任务 ‼️‼️") - notice += "腾讯视频会员赠送任务签到:签到失败, 请勿重复领取任务 ‼️‼️" + "\n" - } else if (data.match(/score/)) { - msg = data.match(/score":(.*?)}/)[1] - console.log("腾讯视频会员赠送任务签到:签到成功,签到分数:" + msg + "分 🎉") - notice += "腾讯视频会员赠送任务签到:签到成功,签到分数:" + msg + "分 🎉" + "\n" - } else { - //console.log("腾讯视频会员赠送任务签到", "", "签到失败, 任务未完成 ‼️‼️") - console.log("腾讯视频会员赠送任务签到:", data) - notice += "腾讯视频会员赠送任务签到:" + data.match(/msg":"(.*?)"/)[1] + "\n" - } - } - }) -} - -//弹幕任务签到请求 -function txVideoDownTask3(headers) { - $.get({ - url: `https://vip.video.qq.com/fcgi-bin/comm_cgi?name=spp_MissionFaHuo&cmd=4&task_id=3&_=${ parseInt(Math.random()*1000) }`, headers - }, function(error, response, data) { - if (error) { - $.log(error); - console.log("腾讯视频会员签到", "弹幕任务签到请求 ‼️‼️", error) - } else { - if (data.match(/已发过货/)) { - console.log("腾讯视频会员弹幕任务签到:签到失败, 请勿重复领取任务 ‼️‼️") - notice += "腾讯视频会员弹幕任务签到:签到失败, 请勿重复领取任务 ‼️‼️" + "\n" - } else if (data.match(/score/)) { - msg = data.match(/score":(.*?)}/)[1] - console.log("腾讯视频会员弹幕任务签到:签到成功,签到分数:" + msg + "分 🎉") - notice += "腾讯视频会员弹幕任务签到:签到成功,签到分数:" + msg + "分 🎉" + "\n" - } else { - //console.log("腾讯视频会员弹幕任务签到", "", "签到失败, 任务未完成 ‼️‼️") - console.log("腾讯视频会员弹幕任务签到:", data) - notice += "腾讯视频会员弹幕任务签到:" + data.match(/msg":"(.*?)"/)[1] + "\n" - } - } - }) -} - -//观看60分钟任务签到请求 -function txVideoDownTask4(headers) { - $.get({ - url: `https://vip.video.qq.com/fcgi-bin/comm_cgi?name=spp_MissionFaHuo&cmd=4&task_id=1&_=${ parseInt(Math.random()*1000) }`, headers - }, function(error, response, data) { - if (error) { - $.log(error); - console.log("腾讯视频会员签到", "观看任务签到请求 ‼️‼️", error) - } else { - if (data.match(/已发过货/)) { - console.log("腾讯视频会员观看任务签到:签到失败, 请勿重复领取任务 ‼️‼️") - notice += "腾讯视频会员观看任务签到:签到失败, 请勿重复领取任务 ‼️‼️" + "\n" - } else if (data.match(/score/)) { - msg = data.match(/score":(.*?)}/)[1] - console.log("腾讯视频会员观看任务签到:签到成功,签到分数:" + msg + "分 🎉") - notice += "腾讯视频会员观看任务签到:签到成功,签到分数:" + msg + "分 🎉" + "\n" - } else { - //console.log("腾讯视频会员观看任务签到", "", "签到失败, 任务未完成 ‼️‼️") - console.log("腾讯视频会员观看任务签到:", data) - notice += "腾讯视频会员观看任务签到:" + data.match(/msg":"(.*?)"/)[1] + "\n" - } - } - }) -} - -//推送 -function sendNotify() { - notify.sendNotify("腾讯视频会员签到", notice) -} -//主程序入口 -exports.main = () => new Promise( - (resovle, reject) => refCookie() - .then(params=>Promise.all([ - txVideoSignIn(params), - txVideoCheckin(params), - setTimeout(() => {txVideoDownTask1(params)},1000), - setTimeout(() => {txVideoDownTask2(params)},2000), - setTimeout(() => {txVideoDownTask3(params)},3000), - setTimeout(() => {txVideoDownTask4(params)},4000), - setTimeout(() => {sendNotify()},10000) - ]) - .then(e=>resovle()) - .catch(e=>reject()) - ).catch(e=>{ - console.log(e) - }) -) - -function timeFormat(time) { - let date; - if (time) { - date = new Date(time) - } else { - date = new Date(); - } - return date.getFullYear() + '年' + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)) + '月' + (date.getDate() >= 10 ? date.getDate() : '0' + date.getDate()) + '日'; -} -// prettier-ignore -function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}isShadowrocket(){return"undefined"!=typeof $rocket}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){const s=t.method?t.method.toLocaleLowerCase():"post";if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient[s](t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method=s,this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:i,...r}=t;this.got[s](i,r).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} diff --git a/ck_wzyd.py b/ck_wzyd.py deleted file mode 100644 index e1d978d..0000000 --- a/ck_wzyd.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -""" -建议cron: 00 8 * * * -new Env('王者营地'); -""" -import json -import os -from urllib import parse - -import requests -from getENV import getENv -from checksendNotify import send - - -class WZYDCheckIn: - def __init__(self, check_item): - self.check_item = check_item - - @staticmethod - def sign(data): - response = requests.post(url="https://ssl.kohsocialapp.qq.com:10001/play/h5sign", data=data).json() - try: - if response["result"] == 0: - msg = "签到成功" - else: - msg = response["returnMsg"] - except: - msg = "请求失败,请检查接口" - return msg - - def main(self): - wzyd_data = self.check_item.get("wzyd_data") - data = {k: v[0] for k, v in parse.parse_qs(wzyd_data).items()} - try: - user_id = data.get("userId", "") - except Exception as e: - print(f"获取用户信息失败: {e}") - user_id = "未获取到用户信息" - sign_msg = self.sign(data=data) - msg = f"帐号信息: {user_id}\n签到信息: {sign_msg}" - return msg - - -if __name__ == "__main__": - getENv() - with open("/ql/config/check.json", "r", encoding="utf-8") as f: - datas = json.loads(f.read()) - _check_item = datas.get("WZYD_DATA_LIST", [])[0] - res = WZYDCheckIn(check_item=_check_item).main() - print(res) - send('王者营地', res) diff --git a/config.json b/config.json deleted file mode 100644 index 305875a..0000000 --- a/config.json +++ /dev/null @@ -1,265 +0,0 @@ -{ - "CITY_NAME_LIST": [ - "上海" - ], - "MOTTO": true, - "IQIYI_COOKIE_LIST": [ - { - "iqiyi_cookie": "__dfp=xxxxxx; QP0013=xxxxxx; QP0022=xxxxxx; QYABEX=xxxxxx; P00001=xxxxxx; P00002=xxxxxx; P00003=xxxxxx; P00007=xxxxxx; QC163=xxxxxx; QC175=xxxxxx; QC179=xxxxxx; QC170=xxxxxx; P00010=xxxxxx; P00PRU=xxxxxx; P01010=xxxxxx; QC173=xxxxxx; QC180=xxxxxx; P00004=xxxxxx; QP0030=xxxxxx; QC006=xxxxxx; QC007=xxxxxx; QC008=xxxxxx; QC010=xxxxxx; nu=xxxxxx; __uuid=xxxxxx; QC005=xxxxxx;" - }, - { - "iqiyi_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "VQQ_COOKIE_LIST": [ - { - "auth_refresh": "https://access.video.qq.com/user/auth_refresh?vappid=xxxxxx&vsecret=xxxxxx&type=qq&g_tk=&g_vstk=xxxxxx&g_actk=xxxxxx&callback=xxxxxx&_=xxxxxx", - "vqq_cookie": "pgv_pvid=xxxxxx; pac_uid=xxxxxx; RK=xxxxxx; ptcz=xxxxxx; tvfe_boss_uuid=xxxxxx; video_guid=xxxxxx; video_platform=xxxxxx; pgv_info=xxxxxx; main_login=xxxxxx; vqq_access_token=xxxxxx; vqq_appid=xxxxxx; vqq_openid=xxxxxx; vqq_vuserid=xxxxxx; vqq_refresh_token=xxxxxx; login_time_init=xxxxxx; uid=xxxxxx; vqq_vusession=xxxxxx; vqq_next_refresh_time=xxxxxx; vqq_login_time_init=xxxxxx; login_time_last=xxxxxx;" - }, - { - "auth_refresh": "多账号 refresh url,请参考上面,以实际获取为准", - "vqq_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "YOUDAO_COOKIE_LIST": [ - { - "youdao_cookie": "JSESSIONID=xxxxxx; __yadk_uid=xxxxxx; OUTFOX_SEARCH_USER_ID_NCOO=xxxxxx; YNOTE_SESS=xxxxxx; YNOTE_PERS=xxxxxx; YNOTE_LOGIN=xxxxxx; YNOTE_CSTK=xxxxxx; _ga=xxxxxx; _gid=xxxxxx; _gat=xxxxxx; PUBLIC_SHARE_18a9dde3de846b6a69e24431764270c4=xxxxxx;" - }, - { - "youdao_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "KGQQ_COOKIE_LIST": [ - { - "kgqq_cookie": "muid=xxxxxx; uid=xxxxxx; userlevel=xxxxxx; openid=xxxxxx; openkey=xxxxxx; opentype=xxxxxx; qrsig=xxxxxx; pgv_pvid=xxxxxx;" - }, - { - "kgqq_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "MUSIC163_ACCOUNT_LIST": [ - { - "music163_phone": "18888xxxxxx", - "music163_password": "Sitoi" - }, - { - "music163_phone": "多账号 手机号", - "music163_password": "多账号 密码" - } - ], - "ONEPLUSBBS_COOKIE_LIST": [ - { - "oneplusbbs_cookie": "acw_tc=xxxxxx; qKc3_0e8d_saltkey=xxxxxx; qKc3_0e8d_lastvisit=xxxxxx; bbs_avatar=xxxxxx; qKc3_0e8d_sendmail=xxxxxx; opcid=xxxxxx; opcct=xxxxxx; oppt=xxxxxx; opsid=xxxxxx; opsct=xxxxxx; opbct=xxxxxx; UM_distinctid=xxxxxx; CNZZDATA1277373783=xxxxxx; www_clear=xxxxxx; ONEPLUSID=xxxxxx; qKc3_0e8d_sid=xxxxxx; bbs_uid=xxxxxx; bbs_uname=xxxxxx; bbs_grouptitle=xxxxxx; opuserid=xxxxxx; bbs_sign=xxxxxx; bbs_formhash=xxxxxx; qKc3_0e8d_ulastactivity=xxxxxx; opsertime=xxxxxx; qKc3_0e8d_lastact=xxxxxx; qKc3_0e8d_checkpm=xxxxxx; qKc3_0e8d_noticeTitle=xxxxxx; optime_browser=xxxxxx; opnt=xxxxxx; opstep=xxxxxx; opstep_event=xxxxxx; fp=xxxxxx;" - }, - { - "oneplusbbs_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "BAIDU_URL_SUBMIT_LIST": [ - { - "data_url": "https://cdn.jsdelivr.net/gh/Sitoi/Sitoi.github.io/baidu_urls.txt", - "submit_url": "http://data.zz.baidu.com/urls?site=https://sitoi.cn&token=xxxxxx", - "times": 10 - }, - { - "data_url": "多账号 data_url 链接地址,以实际获取为准", - "submit_url": "多账号 submit_url 链接地址,以实际获取为准", - "times": 10 - } - ], - "FMAPP_ACCOUNT_LIST": [ - { - "fmapp_token": "xxxxxx.xxxxxx-xxxxxx-xxxxxx.xxxxxx-xxxxxx", - "fmapp_cookie": "sensorsdata2015jssdkcross=xxxxxx", - "fmapp_blackbox": "eyJlcnJxxxxxx", - "fmapp_device_id": "xxxxxx-xxxx-xxxx-xxxx-xxxxxx", - "fmapp_fmversion": "xxxxxx", - "fmapp_os": "xxxxxx", - "fmapp_useragent": "xxxxxx" - }, - { - "fmapp_token": "多账号 token 填写,请参考上面,以实际获取为准", - "fmapp_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)", - "fmapp_blackbox": "多账号 blackbox 填写,请参考上面,blackbox 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)", - "fmapp_device_id": "多账号 device_id 填写,请参考上面,以实际获取为准", - "fmapp_fmversion": "多账号 fmVersion 填写,请参考上面,以实际获取为准", - "fmapp_os": "多账号 os 填写,请参考上面,以实际获取为准", - "fmapp_useragent": "多账号 User-Agent 填写,请参考上面,以实际获取为准" - } - ], - "TIEBA_COOKIE_LIST": [ - { - "tieba_cookie": "BIDUPSID=xxxxxx; PSTM=xxxxxx; BAIDUID=xxxxxx; BAIDUID_BFESS=xxxxxx; delPer=xxxxxx; PSINO=xxxxxx; H_PS_PSSID=xxxxxx; BA_HECTOR=xxxxxx; BDORZ=xxxxxx; TIEBA_USERTYPE=xxxxxx; st_key_id=xxxxxx; BDUSS=xxxxxx; BDUSS_BFESS=xxxxxx; STOKEN=xxxxxx; TIEBAUID=xxxxxx; ab_sr=xxxxxx; st_data=xxxxxx; st_sign=xxxxxx;" - }, - { - "tieba_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "BILIBILI_COOKIE_LIST": [ - { - "bilibili_cookie": "_uuid=xxxxxx; rpdid=xxxxxx; LIVE_BUVID=xxxxxx; PVID=xxxxxx; blackside_state=xxxxxx; CURRENT_FNVAL=xxxxxx; buvid3=xxxxxx; fingerprint3=xxxxxx; fingerprint=xxxxxx; buivd_fp=xxxxxx; buvid_fp_plain=xxxxxx; DedeUserID=xxxxxx; DedeUserID__ckMd5=xxxxxx; SESSDATA=xxxxxx; bili_jct=xxxxxx; bsource=xxxxxx; finger=xxxxxx; fingerprint_s=xxxxxx;", - "coin_num": 0, - "coin_type": 1, - "silver2coin": true - }, - { - "bilibili_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)", - "coin_num": 0, - "coin_type": 1, - "silver2coin": true - } - ], - "V2EX_COOKIE_LIST": [ - { - "v2ex_cookie": "_ga=xxxxxx; __cfduid=xxxxxx; PB3_SESSION=xxxxxx; A2=xxxxxx; V2EXSETTINGS=xxxxxx; V2EX_REFERRER=xxxxxx; V2EX_LANG=xxxxxx; _gid=xxxxxx; V2EX_TAB=xxxxxx;", - "v2ex_proxy": "使用代理的信息,无密码例子: http://127.0.0.1:1080 有密码例子: http://username:password@127.0.0.1:1080" - }, - { - "v2ex_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)", - "v2ex_proxy": "使用代理的信息,无密码例子: http://127.0.0.1:1080 有密码例子: http://username:password@127.0.0.1:1080" - } - ], - "WWW2NZZ_COOKIE_LIST": [ - { - "www2nzz_cookie": "YPx9_2132_saltkey=xxxxxx; YPx9_2132_lastvisit=xxxxxx; YPx9_2132_sendmail=xxxxxx; YPx9_2132_con_request_uri=xxxxxx; YPx9_2132_sid=xxxxxx; YPx9_2132_client_created=xxxxxx; YPx9_2132_client_token=xxxxxx; YPx9_2132_ulastactivity=xxxxxx; YPx9_2132_auth=xxxxxx; YPx9_2132_connect_login=xxxxxx; YPx9_2132_connect_is_bind=xxxxxx; YPx9_2132_connect_uin=xxxxxx; YPx9_2132_stats_qc_login=xxxxxx; YPx9_2132_checkpm=xxxxxx; YPx9_2132_noticeTitle=xxxxxx; YPx9_2132_nofavfid=xxxxxx; YPx9_2132_lastact=xxxxxx;" - }, - { - "www2nzz_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "SMZDM_COOKIE_LIST": [ - { - "smzdm_cookie": "__jsluid_s=xxxxxx; __ckguid=xxxxxx; device_id=xxxxxx; homepage_sug=xxxxxx; r_sort_type=xxxxxx; _zdmA.vid=xxxxxx; sajssdk_2015_cross_new_user=xxxxxx; sensorsdata2015jssdkcross=xxxxxx; footer_floating_layer=xxxxxx; ad_date=xxxxxx; ad_json_feed=xxxxxx; zdm_qd=xxxxxx; sess=xxxxxx; user=xxxxxx; _zdmA.uid=xxxxxx; smzdm_id=xxxxxx; userId=xxxxxx; bannerCounter=xxxxxx; _zdmA.time=xxxxxx;" - }, - { - "smzdm_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "MIMOTION_ACCOUNT_LIST": [ - { - "mimotion_phone": "18888xxxxxx", - "mimotion_password": "Sitoi", - "mimotion_min_step": "10000", - "mimotion_max_step": "20000" - }, - { - "mimotion_phone": "多账号 手机号填写,请参考上面", - "mimotion_password": "多账号 密码填写,请参考上面", - "mimotion_min_step": "多账号 最小步数填写,请参考上面", - "mimotion_max_step": "多账号 最大步数填写,请参考上面" - } - ], - "ACFUN_ACCOUNT_LIST": [ - { - "acfun_phone": "18888xxxxxx", - "acfun_password": "Sitoi" - }, - { - "acfun_phone": "多账号 手机号填写,请参考上面", - "acfun_password": "多账号 密码填写,请参考上面" - } - ], - "CLOUD189_ACCOUNT_LIST": [ - { - "cloud189_phone": "18888xxxxxx", - "cloud189_password": "Sitoi" - }, - { - "cloud189_phone": "多账号 手机号填写,请参考上面", - "cloud189_password": "多账号 密码填写,请参考上面" - } - ], - "POJIE_COOKIE_LIST": [ - { - "pojie_cookie": "htVD_2132_client_token=xxxxxx; htVD_2132_connect_is_bind=xxxxxx; htVD_2132_connect_uin=xxxxxx; htVD_2132_nofavfid=xxxxxx; htVD_2132_smile=xxxxxx; Hm_lvt_46d556462595ed05e05f009cdafff31a=xxxxxx; htVD_2132_saltkey=xxxxxx; htVD_2132_lastvisit=xxxxxx; htVD_2132_client_created=xxxxxx; htVD_2132_auth=xxxxxx; htVD_2132_connect_login=xxxxxx; htVD_2132_home_diymode=xxxxxx; htVD_2132_visitedfid=xxxxxx; htVD_2132_viewid=xxxxxx; KF4=xxxxxx; htVD_2132_st_p=xxxxxx; htVD_2132_lastcheckfeed=xxxxxx; htVD_2132_sid=xxxxxx; htVD_2132_ulastactivity=xxxxxx; htVD_2132_noticeTitle=xxxxxx;" - }, - { - "pojie_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "MGTV_PARAMS_LIST": [ - { - "mgtv_params": "uuid=xxxxxx&uid=xxxxxx&ticket=xxxxxx&token=xxxxxx&device=iPhone&did=xxxxxx&deviceId=xxxxxx&appVersion=6.8.2&osType=ios&platform=iphone&abroad=0&aid=xxxxxx&nonce=xxxxxx×tamp=xxxxxx&appid=xxxxxx&type=1&sign=xxxxxx&callback=xxxxxx" - }, - { - "mgtv_params": "多账号 请求参数填写,请参考上面" - } - ], - "PICACOMIC_ACCOUNT_LIST": [ - { - "picacomic_email": "Sitoi", - "picacomic_password": "xxxxxx" - }, - { - "picacomic_email": "多账号 账号填写,请参考上面", - "picacomic_password": "多账号 密码填写,请参考上面" - } - ], - "MEIZU_COOKIE_LIST": [ - { - "meizu_cookie": "aliyungf_tc=xxxxxx; logined_uid=xxxxxx; acw_tc=xxxxxx; LT=xxxxxx; MZBBS_2132_saltkey=xxxxxx; MZBBS_2132_lastvisit=xxxxxx; MZBBSUC_2132_auth=xxxxxx; MZBBSUC_2132_loginmember=xxxxxx; MZBBSUC_2132_ticket=xxxxxx; MZBBS_2132_sid=xxxxxx; MZBBS_2132_ulastactivity=xxxxxx; MZBBS_2132_auth=xxxxxx; MZBBS_2132_loginmember=xxxxxx; MZBBS_2132_lastcheckfeed=xxxxxx; MZBBS_2132_checkfollow=xxxxxx; MZBBS_2132_lastact=xxxxxx;", - "draw_count": "1" - }, - { - "meizu_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)", - "draw_count": "多账号 抽奖次数设置" - } - ], - "ZHIYOO_COOKIE_LIST": [ - { - "zhiyoo_cookie": "ikdQ_9242_saltkey=xxxxxx; ikdQ_9242_lastvisit=xxxxxx; ikdQ_9242_onlineusernum=xxxxxx; ikdQ_9242_sendmail=1; ikdQ_9242_seccode=xxxxxx; ikdQ_9242_ulastactivity=xxxxxx; ikdQ_9242_auth=xxxxxx; ikdQ_9242_connect_is_bind=xxxxxx; ikdQ_9242_nofavfid=xxxxxx; ikdQ_9242_checkpm=xxxxxx; ikdQ_9242_noticeTitle=1; ikdQ_9242_sid=xxxxxx; ikdQ_9242_lip=xxxxxx; ikdQ_9242_lastact=xxxxxx" - }, - { - "zhiyoo_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "WEIBO_COOKIE_LIST": [ - { - "weibo_show_url": "https://api.weibo.cn/2/users/show?wm=xxxxxx&launchid=xxxxxx&b=xxxxxx&from=xxxxxx&c=xxxxxx&networktype=xxxxxx&v_p=xxxxxx&skin=xxxxxx&v_f=xxxxxx&lang=xxxxxx&sflag=xxxxxx&ua=xxxxxx&ft=xxxxxx&aid=xxxxxx&has_extend=xxxxxx&uid=xxxxxx&gsid=xxxxxx&sourcetype=&get_teenager=xxxxxx&s=xxxxxx&has_profile=xxxxxx" - }, - { - "weibo_show_url": "多账号 show_url 填写,请参考上面,show_url 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "DUOKAN_COOKIE_LIST": [ - { - "duokan_cookie": "user_id=xxxxxx; token=xxxxxx; user_gender=xxxxxx; device_id=xxxxxx; app_id=xxxxxx; build=xxxxxx; short_version=xxxxxx" - }, - { - "duokan_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "CSDN_COOKIE_LIST": [ - { - "csdn_cookie": "uuid_tt_dd=xxxxxx; _ga=xxxxxx; UserName=xxxxxx; UserInfo=xxxxxx; UserToken=xxxxxx; UserNick=xxxxxx; AU=768; UN=xxxxxx; BT=xxxxxx; p_uid=xxxxxx; Hm_up_6bcd52f51e9b3dce32bec4a3997715ac=xxxxxx; Hm_ct_6bcd52f51e9b3dce32bec4a3997715ac=xxxxxx; Hm_lvt_6bcd52f51e9b3dce32bec4a3997715ac=xxxxxx dc_sid=xxxxxx; c_segment=xxxxxx; dc_session_id=xxxxxx; csrfToken=xxxxxx; c_first_ref=xxxxxx; c_first_page=xxxxxx; c_page_id=xxxxxx; announcement-new=xxxxxx; log_Id_click=xxxxxx; c_pref=xxxxxx; c_ref=xxxxxx; dc_tos=xxxxxx; log_Id_pv=xxxxxx; log_Id_view=xxxxxx" - }, - { - "csdn_cookie": "多账号 cookie 填写,请参考上面,cookie 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "WZYD_DATA_LIST": [ - { - "wzyd_data": "areaId=xxxxxx&roleId=xxxxxx&gameId=xxxxxx&serverId=xxxxxx&gameOpenid=xxxxxx&userId=xxxxxx&appVersion=xxxxxx&cClientVersionName=xxxxxx&platid=xxxxxx&source=xxxxxx&algorithm=xxxxxx&version=xxxxxx×tamp=xxxxxx&appid=xxxxxx&openid=xxxxxx&sig=xxxxxx&encode=2&msdkEncodeParam=xxxxxx&cSystem=xxxxxx&h5Get=xxxxxx&msdkToken=&appOpenid=xxxxxx" - }, - { - "wzyd_data": "多账号 data 填写,请参考上面,data 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "WOMAIL_URL_LIST": [ - { - "womail_url": "https://nyan.mail.wo.cn/cn/sign/index/index?mobile=xxxxxx&userName=&openId=xxxxxx" - }, - { - "womail_url": "多账号 url 填写,请参考上面,url 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" - } - ], - "HLX": - { - "user": "", - "password": "" - }, - "163game": - { - "Authorization": "" - } -} \ No newline at end of file diff --git a/getENV.py b/getENV.py deleted file mode 100644 index 31d8252..0000000 --- a/getENV.py +++ /dev/null @@ -1,18 +0,0 @@ -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('已找到配置文件') - else: - print('未找到配置文件\n') - print('请添加/ql/config/check.json') - exit(1) - else: - print('失败 请检查环境') - exit(0) diff --git a/utils.py b/utils.py new file mode 100644 index 0000000..a507ac1 --- /dev/null +++ b/utils.py @@ -0,0 +1,245 @@ +import json +import os +import random +import re +import time +import traceback +# import tomli_w +from functools import wraps + +import tomli + +from checksendNotify import send + + +def toml_to_json(toml_path, to_json_path): + """ + :param toml_path: 需要转换的toml文件的路径 + :param to_json_path: 需要输出的json文件路径 + :return: NONE + """ + with open(toml_path, "rb") as f: + toml_dict = tomli.load(f) + json_date = json.dumps(toml_dict, indent=4, ensure_ascii=False) + with open(to_json_path, 'w', encoding="utf8") as s: + s.write(json_date) + + +# def json_to_toml(json_path, to_toml_path): +# with open(json_path, "r", encoding="utf8") as f: +# json_dict = json.load(f) +# with open(to_toml_path, "wb") as f: +# tomli_w.dump(json_dict, f) + +class config_get(object): + def __init__(self, config_path=None): + """ + config_path: 自定义配置文件路径 + config_file: 实际使用的配置文件路径 + config_format: 实际使用的配置文件格式 + """ + self.config_path = config_path + self.config_file = self.get_config_file() + self.config_format = self.get_config_format() + + def get_config_format(self): + if self.config_file.endswith('.toml'): + return "toml" + else: + return "json" + + def get_config_file(self): + ql_new = '/ql/config/env.sh' + json_config_file = '/ql/config/check.json' + toml_config_file = '/ql/config/check.toml' + print('开始检查环境\n') + if os.path.exists(ql_new): + print('成功 当前环境为青龙面板继续执行\n') + if self.config_path is not None: + print("使用了自定义路径的配置文件") + return self.config_path + elif os.path.exists(toml_config_file): + print("未使用自定义配置文件,开始从ql/config中检测") + print("检测到toml格式配置文件\n") + return toml_config_file + elif os.path.exists(json_config_file): + print("检测到json格式配置文件\n") + return json_config_file + else: + print("未检测到配置文件,程序退出") + exit(1) + else: + print('失败 请检查环境') + exit(0) + return 0 + + def get_real_key(self, expression): + """ + 从配置文件中获取,re表达式想要的KEY + :return: + """ + pattern = re.compile(expression, re.I) + real_key = '' + if self.config_format == "toml": + for key in self.get_key_for_toml(self.config_file): + if pattern.match(key) is not None: + real_key = key + else: + for key in self.get_key_for_json(self.config_file): + if pattern.match(key) is not None: + real_key = key + if real_key is not '': + return real_key + else: + print("啊哦没有找到") + exit(1) + + def get_value(self, expression): + real_key = self.get_real_key(expression) + if self.config_format == "toml": + return self.get_value_for_toml(self.config_file, real_key) + else: + return self.get_value_for_json(self.config_file, real_key) + + @staticmethod + def get_value_for_toml(toml_path, key): + with open(toml_path, "rb") as f: + try: + toml_dict = tomli.load(f) + return toml_dict.get(key) + except tomli.TOMLDecodeError: + print( + f"错误:配置文件 {toml_path} 格式不对,请学习 https://toml.io/cn/v1.0.0\n错误信息:\n{traceback.format_exc()}" + ) + exit(1) + + @staticmethod + def get_value_for_json(json_path, key): + with open(json_path, "r", encoding="utf8") as f: + try: + json_dict = json.load(f) + return json_dict.get(key) + except json.decoder.JSONDecodeError: + print(f"错误:配置文件 {json_path} 格式不对,错误信息{traceback.format_exc()}") + + @staticmethod + def get_key_for_toml(toml_path): + with open(toml_path, "rb") as f: + try: + toml_dict = tomli.load(f) + return toml_dict.keys() + except tomli.TOMLDecodeError: + print( + f"错误:配置文件 {toml_path} 格式不对,请学习 https://toml.io/cn/v1.0.0\n错误信息:\n{traceback.format_exc()}" + ) + exit(1) + + @staticmethod + def get_key_for_json(json_path): + with open(json_path, "r", encoding="utf8") as f: + try: + json_dict = json.load(f) + return json_dict.keys() + except json.decoder.JSONDecodeError: + print(f"错误:配置文件 {json_path} 格式不对,错误信息{traceback.format_exc()}") + + +class check(object): + def __init__(self, run_script_name, run_script_expression, Configuration_flag=False): + """ + :param run_script_name: 执行脚本的说明 + :param run_script_expression: 需要获取的配置键的re表达式 + :param Configuration_flag: 是否只检测True或False(默认为False) + """ + self.run_script_name = run_script_name + self.run_script_expression = run_script_expression + self.Configuration_flag = Configuration_flag + + @staticmethod + def other_task(): + change_db() + + def __call__(self, func): + @wraps(func) + def wrapper(*args, **kwargs): + if not self.Configuration_flag: + config = config_get() + value_list = config.get_value(self.run_script_expression) + Push_message = "" + num = 1 + for value in value_list: + print(f"<----------------账号【{num}】---------------->") + print(f"获取到的账号信息为:{value}\n") + num += 1 + try: + result = func(value=value) + print(f"执行结果:\n{result}") + Push_message += result + except IndexError: + print("可能是示例格式被运行\n错误信息:") + print(f"{traceback.format_exc()}") + Push_message += '' + except AttributeError: + print("可能是配置文件的键名出现问题\n" + "例如:在此次更新中什么值得买的键名从smzdm_cookie变成了cookie\n") + print(f"{traceback.format_exc()}") + Push_message += '' + except TypeError: + print(f"{traceback.format_exc()}") + Push_message += '' + send(self.run_script_name, Push_message) + else: + config = config_get() + flag = config.get_value(self.run_script_expression) + if flag is not None and flag: + print(f"开始执行{self.run_script_name}") + func() + else: + print(f"设置为不执行{self.run_script_name}") + + return wrapper + + +@check(run_script_name="随机定时", run_script_expression="QL_RANDOM_TIME", Configuration_flag=True) +def change_db(): + lines = [] + first = True + with open("/ql/db/crontab.db", "r", encoding="UTF-8") as f: + for i in f.readlines(): + if ( + i.find("yuxian158_check_master") != -1 + and i.find("ran_time") == -1 + ): + record = json.loads(i) + if record.get("isDisabled") == 0: + if ( + i.find("motto") != -1 + or i.find("leetcode") != -1 + or i.find("weather") != -1 + or i.find("news") != -1 + ): + record["schedule"] = change_time(record["schedule"], True) + else: + record["schedule"] = change_time(record["schedule"], first) + if first: + first = False + lines.append(json.dumps(record, ensure_ascii=False) + "\n") + else: + lines.append(i) + + time_str = time.strftime("%Y-%m-%d", time.localtime()) + os.system(f"copy /ql/db/crontab.db /ql/db/crontab.db.{time_str}.back") + + with open("/ql/db/crontab.db", "w", encoding="UTF-8") as f: + f.writelines(lines) + + +def change_time(time_str: str, first: bool): + words = re.sub("\\s+", " ", time_str).split() + if first: + words[0] = str(random.randrange(0, 60, step=5)) + words[1] = str(random.randrange(8, 9)) + else: + words[0] = str(random.randrange(60)) + words[1] = str(random.randrange(22)) + return " ".join(words)