青龙脚本分享(不断更新完善)

目录

开篇

当你们打开这篇文章的时候,大概率是已经配置好环境了,如果没有配置好青龙环境,看我之前的文章,安装docker、青龙和青龙卸载更新lxc安装docker青龙安装ubuntu-server系统等。

脚本合集

因为jd脚本失效快,所以暂时不记录jd脚本的情况

🟢: 正常运行 🔴: 脚本暂不可用

序号脚本名称脚本状态备注
1阿里云签到🟢获取一定的空间,签到会赠送会员
2哔哩哔哩签到🟢直播签到,漫画签到,每日经验任务,自动投币,成长任务,大会员权益等
3天翼云盘签到🟢获取一定的空间,每天空间都不一样
4有道云签到🟢每日签到获取存储空间
5什么值得买签到🟢每天自动抽奖、签到任务、获取金币、碎银、补签卡等
6恩山签到🔴自动签到,获取积分
7每日天气提醒🟢每天天气通知,近一周的天气状况
8下一个节假日提醒🟢节假日提醒
9每天60s🟢每天60s获取新闻信息
10小米社区签到🔴自动签到获取积分、自动挖萝卜
11epic消息提醒🟢每周提醒可以查看免费游戏,白嫖epic每周免费游戏
12贴吧签到🟢贴吧关注的吧一键签到
13爱奇艺签到🟢① 满签得 7 天会员;② 日常任务 4 成长值;③ 爱奇艺刷时长任务,10 成长值;④ 每日签到随机成长值;⑤ 抽白金会员 5 次;⑥ 摇一摇抽奖 3 次;⑦ 抽奖 3 次

详细的使用教程可以往下看其他签到脚本

青龙京东脚本分享

脚本库-Hi科技玩家

6dylan6(集合库)【√可用】

github地址


拉库指令
国内机用下面指令(带代理):

ql repo https://js.nbplay.site/https://github.com/6dylan6/jdpro.git "jd_|jx_|jddj_" "backUp" "^jd[^_]|USER|JD|function|sendNotify"

国外机(无需代理)用下面指令:

ql repo https://github.com/6dylan6/jdpro.git "jd_|jx_|jddj_" "backUp" "^jd[^_]|USER|JD|function|sendNotify"

使用流程

1、青龙部署。
2、登录青龙配置管理config.sh修改,差不多在17行(特别注意,没有修改此配置,任务拉不全,一键部署可忽略此处);
RepoFileExtensions="js py"修改为 RepoFileExtensions=“js py sh ts” 保存;
3、新建拉库任务或订阅,并执行,刷新浏览器即可看到添加的任务;
4、添加CK环境变量,多CK不要写在一起,每个都新建JD_COOKIE变量;
5,通知key变量请添加到配置管理config.sh文件,否则收不到通知;


支持的通知方式

server酱,go-cqhttp,pushdeer,Bark App,tg bot,钉钉bot,企业微信bot,企业微信应用消息,飞书,iGot,push plus,WxPusher,gotify
请在配置管理config文件里写变量

gys619(集合库)【√可用】

github地址
评价:脚本很多,但是好多失效脚本


拉库指令

ql repo https://github.com/gys619/Absinthe.git “jd_|jx_|jddj_|gua_|jddj_|getJDCookie|wskey” “activity|backUp” “^jd[^_]|USER|utils|ZooFaker|JDJRValidator_|^sign|jddj_cookie|function|ql” “main”

fake2助力池版(集合库)【√可用】

github地址


拉库指令

ql repo https://github.com/shufflewzc/faker2.git “jd_|jx_|gua_|jddj_|jdCookie” “activity|backUp” “^jd[^_]|USER|function|utils|sendNotify|ZooFaker_Necklace.js|JDJRValidator_|sign_graphics_validate|ql|JDSignValidator” “main”

助力池版
日常任务带有助力池,助力池助力量充足,相互助力。

Faker3 纯净版【√可用】

github地址


拉库指令

ql repo https://github.com/shufflewzc/faker3.git “jd_|jx_|gua_|jddj_|jdCookie” “activity|backUp” “^jd[^_]|USER|function|utils|sendNotify|ZooFaker_Necklace.js|JDJRValidator_|sign_graphics_validate|ql|JDSignValidator” “main”

纯净版
无任何自带助力码。

Akali5【√可用】

github地址


拉库指令

ql repo https://github.com/Akali5/jd-depot.git "jd_|jx_|jddj_|gua_|getJDCookie|wskey" "activity|backUp" "^jd[^_]|USER|utils|ZooFaker_Necklace|JDJRValidator_|sign_graphics_validate|jddj_cookie|function|ql|magic|JDJR|sendNotify|depend|h5|jdspider"

KingRan 【√可用】

github地址


拉库指令

ql repo https://github.com/KingRan/KR.git "jd_|jx_|jdCookie" "activity|backUp" "^jd[^_]|USER|utils|function|sign|sendNotify|ql|JDJR"

zero205【√可用】

smiek2121【√可用】

github地址

curtinlv【√可用】

github地址


青龙其他签到脚本

准备工作

新建脚本

签到脚本的使用教程:
可以在青龙脚本下面新建新的文件夹
在这里插入图片描述

消息通知pushplus

copy一个notify.py,主要用于pushplus推送消息用

设置环境变量

脚本需要的环境变量,在环境变量里面设置
在这里插入图片描述

安装依赖

重点:确保import 的库依赖已经安装,否则会报错,没有安装去依赖里面安装即可

定时任务

在这里插入图片描述
命令必须task开头 后面跟着是现金脚本的路径

定时规则

在线Cron表达式生成器
讲解【csdn】

一、阿里云签到(只签到不领取奖励)

大概一个多月就得重新更新一次token,会显示签到失败

#!/usr/bin/python3
# -- coding: utf-8 --
# @Time : 2023/4/8 10:23
# -------------------------------
# cron "30 5 * * *" script-path=xxx.py,tag=匹配cron用
# const $ = new Env('阿里云盘签到');

import json
import  requests
import  os
import notify

##变量export ali_refresh_token=''
ali_refresh_token=os.getenv("ali_refresh_token").split('&')
#refresh_token是一成不变的呢,我们使用它来更新签到需要的access_token
#refresh_token获取教程:https://github.com/bighammer-link/Common-scripts/wiki/%E9%98%BF%E9%87%8C%E4%BA%91%E7%9B%98refresh_token%E8%8E%B7%E5%8F%96%E6%96%B9%E6%B3%95
# ali_refresh_token = os.getenv("ali_refresh_token")




#签到函数
for i in range(len(ali_refresh_token)):
    print(f'开始帐号{i+1}签到')
    def daily_check(access_token):
        url = 'https://member.aliyundrive.com/v1/activity/sign_in_list'
        headers = {
            'Authorization': access_token
        }
        response = requests.post(url=url, headers=headers, json={}).text
        result = json.loads(response)
        if 'success' in result:
            print('签到成功')
            for i, j in enumerate(result['result']['signInLogs']):
                if j['status'] == 'miss':
                    day_json = result['result']['signInLogs'][i-1]
                    # print(day_json)
                    if not day_json['isReward']:
                        contents = '签到成功,今日未获得奖励'
                    else:
                        contents = '本月累计签到{}天,今日签到获得{}{}'.format(result['result']['signInCount'],
                                                                         day_json['reward']['name'],
                                                                         day_json['reward']['description'])
                    print(contents)

                    return contents


    # 使用refresh_token更新access_token
    def update_token(refresh_token):
        url = 'https://auth.aliyundrive.com/v2/account/token'
        data = {
            'grant_type': 'refresh_token',
            'refresh_token': ali_refresh_token[i]
        }
        response = requests.post(url=url, json=data).json()
        access_token = response['access_token']
#         print('获取的access_token为{}'.format(access_token))
        return access_token


    def main():
#         print('更新access_token')
        access_token = update_token(ali_refresh_token)
#         print('更新成功,开始进行签到')
        content = daily_check(access_token)
        notify.send("阿里云盘签到", content)

    if __name__ == '__main__':
        main()

在环境变量里面设置ali_refresh_toke

获取阿里云盘的ali_refresh_toke教程:
方法一:

网页登录阿里云盘,键盘F12,刷新一下网页,然后找到如下:
在这里插入图片描述

方法二
F12下找到控制台,输入命令,弹窗显示refresh_token

alert(JSON.parse(localStorage.token).refresh_token)

在这里插入图片描述

效果展示

在这里插入图片描述

一、阿里云盘签到(js文件,有时候不推送消息bug,但是领取奖励)

采用订阅的方式,订阅地址如下:

https://github.com/mrabit/aliyundriveDailyCheck.git

二、bilbil签到

采用的是BiliBiliToolPro,来源github

1. 步骤

1.1. 登录青龙面板并修改配置

青龙面板,配置文件页。

修改 RepoFileExtensions=“js py” 为 RepoFileExtensions=“js py sh”

保存配置。

1.2. 在青龙面板中添加拉库定时任务

两种方式:

1.2.1. 订阅管理

名称:Bilibili
类型:公开仓库
链接:https://github.com/RayWangQvQ/BiliBiliToolPro.git
定时类型:crontab
定时规则:2 2 28 * *
白名单:bili_task_.+.sh
文件后缀:sh
没提到的不要动。

保存后,点击运行按钮,运行拉库。

1.2.2. 定时任务拉库

青龙面板,定时任务页,右上角添加任务,填入以下信息:

名称:拉取Bili库
命令:ql repo https://github.com/RayWangQvQ/BiliBiliToolPro.git “bili_task_”
定时规则:2 2 28 * *
点击确定。

保存成功后,找到该定时任务,点击运行按钮,运行拉库。

如果正常,拉库成功后,同时也会自动添加bilibili相关的task任务。

1.3. 登录

在青龙定时任务中,点击运行bili扫码登录任务,查看运行日志,扫描日志中的二维码进行登录。
登录成功后,会将cookie保存到青龙的环境变量中:

首次运行会自动安装dotnet环境,时间久点,之后就不需要重复安装了。

说明,采用的方式为订阅,会每天自动拉取脚本,第一次运行会比较慢,等待即可。需要配置通知,默认不发送通知

这里讲解配置pushplus的方式,如果采用其他推送方式可以自行查阅文档地址,或者找我一起学习。

PushPlus的Token,参考pushplus的官网
TITLECONTENT
配置KeySerilog:WriteTo:9:Args:token
值域一串字符串
默认值
环境变量Ray_Serilog__WriteTo__9__Args__token
GitHub SecretsPUSHPLUSTOKEN
PushPlus的Topic,参考pushplus的官网
TITLECONTENT
配置KeySerilog:WriteTo:9:Args:topic
值域一串字符串
默认值
环境变量Ray_Serilog__WriteTo__9__Args__topic
GitHub SecretsPUSHPLUSTOPIC

一般来说,这两个配置就够用了,如果需要更详细的配置,可以自行查阅文档。

在这里插入图片描述
配置完成的截图如上。

效果展示

在这里插入图片描述

三、天翼云盘签到(不需要环境变量版)

# 来自吾爱论坛,在原作者的基础上把推送消息换成了青龙自带的通知,如有侵权请告知,将立即删除。
# @author Sten
# 我的仓库:https://github.com/aefa6/QinglongScript.git
# 觉得不错麻烦点个star谢谢
import notify
import time
import re
import json
import base64
import hashlib
import urllib.parse,hmac
import rsa
import requests
import random
 
BI_RM = list("0123456789abcdefghijklmnopqrstuvwxyz")
 
B64MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
 
s = requests.Session()
 
# 在下面两行的引号内贴上账号(仅支持手机号)和密码
username = "xxxxxx"
password = "xxxxxx"
 
_ = """
if(username == "" or password == ""):
    username = input("账号:")
    password = input("密码:")
# """
 
assert username and password, "在第23、24行填入有效账号和密码"

def int2char(a):
    return BI_RM[a]
 
 
def b64tohex(a):
    d = ""
    e = 0
    c = 0
    for i in range(len(a)):
        if list(a)[i] != "=":
            v = B64MAP.index(list(a)[i])
            if 0 == e:
                e = 1
                d += int2char(v >> 2)
                c = 3 & v
            elif 1 == e:
                e = 2
                d += int2char(c << 2 | v >> 4)
                c = 15 & v
            elif 2 == e:
                e = 3
                d += int2char(c)
                d += int2char(v >> 2)
                c = 3 & v
            else:
                e = 0
                d += int2char(c << 2 | v >> 4)
                d += int2char(15 & v)
    if e == 1:
        d += int2char(c << 2)
    return d
 
 
def rsa_encode(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 = b64tohex((base64.b64encode(rsa.encrypt(f'{string}'.encode(), pubkey))).decode())
    return result
 
 
def calculate_md5_sign(params):
    return hashlib.md5('&'.join(sorted(params.split('&'))).encode('utf-8')).hexdigest()
 
 
def login(username, password):
    #https://m.cloud.189.cn/login2014.jsp?redirectURL=https://m.cloud.189.cn/zhuanti/2021/shakeLottery/index.html
    url=""
    urlToken="https://m.cloud.189.cn/udb/udb_login.jsp?pageId=1&pageKey=default&clientType=wap&redirectURL=https://m.cloud.189.cn/zhuanti/2021/shakeLottery/index.html"
    s = requests.Session()
    r = s.get(urlToken)
    pattern = r"https?://[^\s'\"]+"  # 匹配以http或https开头的url
    match = re.search(pattern, r.text)  # 在文本中搜索匹配
    if match:  # 如果找到匹配
        url = match.group()  # 获取匹配的字符串
        # print(url)  # 打印url
    else:  # 如果没有找到匹配
        print("没有找到url")
 
    r = s.get(url)
    # print(r.text)
    pattern = r"<a id=\"j-tab-login-link\"[^>]*href=\"([^\"]+)\""  # 匹配id为j-tab-login-link的a标签,并捕获href引号内的内容
    match = re.search(pattern, r.text)  # 在文本中搜索匹配
    if match:  # 如果找到匹配
        href = match.group(1)  # 获取捕获的内容
        # print("href:" + href)  # 打印href链接
    else:  # 如果没有找到匹配
        print("没有找到href链接")
 
    r = s.get(href)
    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]
    s.headers.update({"lt": lt})
 
    username = rsa_encode(j_rsakey, username)
    password = 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 = s.post(url, data=data, headers=headers, timeout=5)
    if (r.json()['result'] == 0):
        print(r.json()['msg'])
    else:
        print(r.json()['msg'])
    redirect_url = r.json()['toUrl']
    r = s.get(redirect_url)
    return s
 
 
def main():
    s=login(username, password)
    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 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN&activityId=ACT_SIGNIN'
    url2 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN_PHOTOS&activityId=ACT_SIGNIN'
    url3 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_2022_FLDFS_KJ&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 = s.get(surl, headers=headers)
    netdiskBonus = response.json()['netdiskBonus']
    if (response.json()['isSign'] == "false"):
        print(f"未签到,签到获得{netdiskBonus}M空间")
        res1 = f"未签到,签到获得{netdiskBonus}M空间"
    else:
        print(f"已经签到过了,签到获得{netdiskBonus}M空间")
        res1 = f"已经签到过了,签到获得{netdiskBonus}M空间"
 
    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 = s.get(url, headers=headers)
    if ("errorCode" in response.text):
        print(response.text)
        res2 = ""
    else:
        description = response.json()['description']
        print(f"抽奖获得{description}")
        res2 = f"抽奖获得{description}"
    response = s.get(url2, headers=headers)
    if ("errorCode" in response.text):
        print(response.text)
        res3 = ""
    else:
        description = response.json()['description']
        print(f"抽奖获得{description}")
        res3 = f"抽奖获得{description}"
 
    response = s.get(url3, headers=headers)
    if ("errorCode" in response.text):
        print(response.text)
        res4 = ""
    else:
        description = response.json()['description']
        print(f"链接3抽奖获得{description}")
        res4 = f"链接3抽奖获得{description}"

    title = "天翼云签到"
    content = f"""
    {res1}
    {res2}
    {res3}
    {res4}
    """
    notify.send(title, content)

def lambda_handler(event, context):  # aws default
    main()
 
 
def main_handler(event, context):  # tencent default
    main()
 
 
def handler(event, context):  # aliyun default
    main()
 
 
if __name__ == "__main__":
    # time.sleep(random.randint(5, 30))
    main()

效果展示

在这里插入图片描述

三、天翼云盘签到(修改版,环境变量版)

# 来自吾爱论坛,在原作者的基础上把推送消息换成了青龙自带的通知,如有侵权请告知,将立即删除。
# @author Sten
# 我的仓库:https://github.com/aefa6/QinglongScript.git
# 觉得不错麻烦点个star谢谢
import notify
import time
import re
import json
import base64
import hashlib
import urllib.parse,hmac
import rsa
import requests
import random
import os
 
BI_RM = list("0123456789abcdefghijklmnopqrstuvwxyz")
 
B64MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
 
s = requests.Session()
 
# 在下面两行的引号内贴上账号(仅支持手机号)和密码
# username = "15612510963"
# password = "Gao15227020648an"
username  = os.getenv("cloud189_username")
password = os.getenv("cloud189_password")
 
_ = """
if(username == "" or password == ""):
    username = input("账号:")
    password = input("密码:")
# """
 
assert username and password, "在第23、24行填入有效账号和密码"

def int2char(a):
    return BI_RM[a]
 
 
def b64tohex(a):
    d = ""
    e = 0
    c = 0
    for i in range(len(a)):
        if list(a)[i] != "=":
            v = B64MAP.index(list(a)[i])
            if 0 == e:
                e = 1
                d += int2char(v >> 2)
                c = 3 & v
            elif 1 == e:
                e = 2
                d += int2char(c << 2 | v >> 4)
                c = 15 & v
            elif 2 == e:
                e = 3
                d += int2char(c)
                d += int2char(v >> 2)
                c = 3 & v
            else:
                e = 0
                d += int2char(c << 2 | v >> 4)
                d += int2char(15 & v)
    if e == 1:
        d += int2char(c << 2)
    return d
 
 
def rsa_encode(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 = b64tohex((base64.b64encode(rsa.encrypt(f'{string}'.encode(), pubkey))).decode())
    return result
 
 
def calculate_md5_sign(params):
    return hashlib.md5('&'.join(sorted(params.split('&'))).encode('utf-8')).hexdigest()
 
 
def login(username, password):
    #https://m.cloud.189.cn/login2014.jsp?redirectURL=https://m.cloud.189.cn/zhuanti/2021/shakeLottery/index.html
    url=""
    urlToken="https://m.cloud.189.cn/udb/udb_login.jsp?pageId=1&pageKey=default&clientType=wap&redirectURL=https://m.cloud.189.cn/zhuanti/2021/shakeLottery/index.html"
    s = requests.Session()
    r = s.get(urlToken)
    pattern = r"https?://[^\s'\"]+"  # 匹配以http或https开头的url
    match = re.search(pattern, r.text)  # 在文本中搜索匹配
    if match:  # 如果找到匹配
        url = match.group()  # 获取匹配的字符串
        # print(url)  # 打印url
    else:  # 如果没有找到匹配
        print("没有找到url")
 
    r = s.get(url)
    # print(r.text)
    pattern = r"<a id=\"j-tab-login-link\"[^>]*href=\"([^\"]+)\""  # 匹配id为j-tab-login-link的a标签,并捕获href引号内的内容
    match = re.search(pattern, r.text)  # 在文本中搜索匹配
    if match:  # 如果找到匹配
        href = match.group(1)  # 获取捕获的内容
        # print("href:" + href)  # 打印href链接
    else:  # 如果没有找到匹配
        print("没有找到href链接")
 
    r = s.get(href)
    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]
    s.headers.update({"lt": lt})
 
    username = rsa_encode(j_rsakey, username)
    password = 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 = s.post(url, data=data, headers=headers, timeout=5)
    if (r.json()['result'] == 0):
        print(r.json()['msg'])
    else:
        print(r.json()['msg'])
    redirect_url = r.json()['toUrl']
    r = s.get(redirect_url)
    return s
 
 
def main():
    s=login(username, password)
    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 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN&activityId=ACT_SIGNIN'
    url2 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN_PHOTOS&activityId=ACT_SIGNIN'
    url3 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_2022_FLDFS_KJ&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 = s.get(surl, headers=headers)
    netdiskBonus = response.json()['netdiskBonus']
    if (response.json()['isSign'] == "false"):
        print(f"未签到,签到获得{netdiskBonus}M空间")
        res1 = f"未签到,签到获得{netdiskBonus}M空间"
    else:
        print(f"已经签到过了,签到获得{netdiskBonus}M空间")
        res1 = f"已经签到过了,签到获得{netdiskBonus}M空间"
 
    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 = s.get(url, headers=headers)
    if ("errorCode" in response.text):
        print(response.text)
        res2 = ""
    else:
        description = response.json()['description']
        print(f"抽奖获得{description}")
        res2 = f"抽奖获得{description}"
    response = s.get(url2, headers=headers)
    if ("errorCode" in response.text):
        print(response.text)
        res3 = ""
    else:
        description = response.json()['description']
        print(f"抽奖获得{description}")
        res3 = f"抽奖获得{description}"
 
    response = s.get(url3, headers=headers)
    if ("errorCode" in response.text):
        print(response.text)
        res4 = ""
    else:
        description = response.json()['description']
        print(f"链接3抽奖获得{description}")
        res4 = f"链接3抽奖获得{description}"

    title = "天翼云签到"
    content = f"""
    {res1}
    {res2}
    {res3}
    {res4}
    """
    notify.send(title, content)

def lambda_handler(event, context):  # aws default
    main()
 
 
def main_handler(event, context):  # tencent default
    main()
 
 
def handler(event, context):  # aliyun default
    main()
 
 
if __name__ == "__main__":
    # time.sleep(random.randint(5, 30))
    main()

四、有道云签到(获取空间)

代码

代码借鉴github开源的代码,在此基础上自己进行了修改,可以自用。开源代码

import json
import os
import requests
import notify



class YouDao():
    name = "有道云笔记"

    def __init__(self, check_item):
        self.check_item = check_item

    @staticmethod
    def sign(cookies):
        ad_space = 0
        refresh_cookies_res = requests.get(
            "http://note.youdao.com/login/acc/pe/getsess?product=YNOTE", cookies=cookies
        )
        cookies = dict(refresh_cookies_res.cookies)
        url = "https://note.youdao.com/yws/api/daupromotion?method=sync"
        res = requests.post(url=url, cookies=cookies)
        if "error" not in res.text:
            checkin_response = requests.post(
                url="https://note.youdao.com/yws/mapi/user?method=checkin",
                cookies=cookies,
            )
            for i in range(3):
                ad_response = requests.post(
                    url="https://note.youdao.com/yws/mapi/user?method=adRandomPrompt",
                    cookies=cookies,
                )
                ad_space += ad_response.json().get("space", 0) // 1048576
            if "reward" in res.text:
                sync_space = res.json().get("rewardSpace", 0) // 1048576
                checkin_space = checkin_response.json().get("space", 0) // 1048576
                space = sync_space + checkin_space + ad_space
                youdao_message = f"+{space}M"
            else:
                youdao_message = "获取失败"
        else:
            youdao_message = "Cookie 可能过期"
        return youdao_message

    def main(self):
        youdao_cookie = {
            item.split("=")[0]: item.split("=")[1]
            for item in self.check_item.get("cookie").split("; ")
        }
        try:
            ynote_pers = youdao_cookie.get("YNOTE_PERS", "")
            uid = ynote_pers.split("||")[-2]
        except Exception as e:
            print(f"获取账号信息失败: {e}")
            uid = "未获取到账号信息"
        msg = self.sign(cookies=youdao_cookie)
        msg = [
            {"name": "帐号信息", "value": uid},
            {"name": "获取空间", "value": msg},
        ]
        msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg])
        notify.send("有道云签到", msg)
        return msg


if __name__ == "__main__":
    datas_env = os.getenv("youdao_cookie")
    _check_item = {'cookie':datas_env}
    print(_check_item)
    print(YouDao(check_item=_check_item).main())

代码讲解:
datas_env = os.getenv(“youdao_cookie”) 获取环境变量,名称为youdao_cookie

通知方式采用的pushplus,如果需要其他方式自行修改如下代码:
notify.send(“有道云签到”, msg)

获取cookie

登录有道云,打开F12,选择网络—>全部---->搜索push,复制所有的cookie
在这里插入图片描述

青龙创建环境变量

名称为:上一步代码中的youdao_cookie
在这里插入图片描述

创建定时任务

在这里插入图片描述

效果演示

在这里插入图片描述

提示

可能cookie需要一个月或者20天进行更新一次。

五、什么值得买签到

脚本内容

每日签到
每日抽奖
生活频道转盘抽奖
值会员转盘抽奖
每日任务(指的是签到页面中的任务)
浏览文章
收藏文章
点赞文章
评论文章
分享
抽奖
免费抽奖
5 碎银子抽奖
关注用户
关注栏目
关注品牌
限时累计活动

青龙拉库脚本

ql repo https://github.com/hex-ci/smzdm_script.git "" "env.js|bot.js|sendNotify.js" "env.js|bot.js|sendNotify.js"

NodeJS 依赖

crypto-js

抓包

建议使用 Android 手机抓包(iOS 也可以)域名为 user-api.smzdm.com 的任意链接,把所有 Cookie 取出来放到青龙面板的 SMZDM_COOKIE 环境变量中,多用户请添加多个同名环境变量或者用 & 符号分隔。
如果手机实在抓不到,也可以用浏览器的 Cookie,但是强烈建议使用手机端的 Cookie。
抓包教程
以下教程请大家自行尝试,本人没有亲自尝试,如有问题可以进群交流。
https://www.jianshu.com/p/5e5524868442
https://www.zqh.plus/2022/03/19/Android-Capture/
https://jishuin.proginn.com/p/763bfbd5f92e
https://juejin.cn/post/7091524392005566471
https://www.caq98i.top/article/?page=38

青龙环境变量

环境变量请使用环境变量列表直接添加,不要使用 export xxx=""这种方式添加环境变量。

SMZDM_COOKIE: 抓包抓到的 Cookie 内容,需要所有 Cookie 内容,多用户可以用 & 分隔,或者使用多个同名环境变量。
SMZDM_SK: 这个值是可选值,会自动计算,如果你一定想用自己的,可以抓取,是从安卓 App 的 https://user-api.smzdm.com/checkin 请求参数中抓包抓到的,多用户可以用 & 分隔,或者使用多个同名环境变量,顺序要保持与 SMZDM_COOKIE 多用户顺序一致。
SMZDM_USER_AGENT_APP: 这个值是可选值,是指 APP 的 User-Agent,从 APP 的 API 请求头中抓包得到,建议抓取 Android 的 User-Agent,不填使用脚本默认值。
SMZDM_USER_AGENT_WEB: 这个值是可选值,是指 APP 中访问网页的 User-Agent,一般在 APP 内的转盘网页中抓包得到,建议抓取 Android 的 User-Agent,不填使用脚本默认值。
SMZDM_COMMENT: 如果要完成评论文章的任务请设置这个环境变量,环境变量的内容是评论的文案,文案要大于 10 个汉字,建议用比较个性化的文案,脚本发布评论后会删除这条评论,但是为防止删除失败的情况,请尽量用好一点的文案,防止被判定为恶意灌水。
SMZDM_CROWD_SILVER_5: 每日抽奖任务默认只进行免费抽奖,如要进行 5 碎银子的抽奖,请设置这个环境变量的值为 yes
SMZDM_CROWD_KEYWORD: 抽奖关键词,执行非免费抽奖时,会优先选择包含此关键词的抽奖,如果未找到包含此关键词的抽奖,则会随机选择一个。

效果展示

在这里插入图片描述
在这里插入图片描述

六、恩山签到

#!/usr/bin/python3
# -- coding: utf-8 -- 
# const $ = new Env('恩山签到')
import requests,re,os
import notify

#配置恩山的cookie 到配置文件config.sh export enshanck='' 需要推送配置推送加token export plustoken=''
enshanck = os.getenv("enshanck")

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.125 Safari/537.36",
    "Cookie": enshanck,
}
session = requests.session()
response = session.get('https://www.right.com.cn/FORUM/home.php?mod=spacecp&ac=credit&showcredit=1', headers=headers)
try:
    coin = re.findall("恩山币: </em>(.*?)nb &nbsp;", response.text)[0]
    point = re.findall("<em>积分: </em>(.*?)<span", response.text)[0]
    res = f"恩山币:{coin}\n积分:{point}"
    print(res)
    notify.send("恩山签到", res)
except Exception as e:
    res = str(e)

说明:配置恩山的环境变量,enshanck,把获取到的cookies全部复制。

七、每日天气提醒

#!/usr/bin/python3
# -- coding: utf-8 --
# -------------------------------
# @Author : github@wd210010 https://github.com/wd210010/just_for_happy
# @Time : 2023/2/27 13:23
# -------------------------------
# cron "30 7 * * *" script-path=xxx.py,tag=匹配cron用
# const $ = new Env('天气推送')

import requests, json ,os,notify

# 城市code 自己城市的code https://fastly.jsdelivr.net/gh/Oreomeow/checkinpanel@master/city.json 这个网址查看
# city_code = ''

# 青龙变量 city_code
city_code = os.getenv("city_code")


r = requests.get(
    f"http://t.weather.itboy.net/api/weather/city/{city_code}"
)
d = json.loads(r.text)
result2 = json.loads(r.text)['cityInfo']

msg = (
    f' 城市:{d["cityInfo"]["parent"]} {d["cityInfo"]["city"]}\n'
    f' 日期:{d["data"]["forecast"][0]["ymd"]} {d["data"]["forecast"][0]["week"]}\n'
    f' 天气:{d["data"]["forecast"][0]["type"]}\n'
    f' 温度:{d["data"]["forecast"][0]["high"]} {d["data"]["forecast"][0]["low"]}\n'
    f' 湿度:{d["data"]["shidu"]}\n'
    f' 空气质量:{d["data"]["quality"]}\n'
    f' PM2.5:{d["data"]["pm25"]}\n'
    f' PM10:{d["data"]["pm10"]}\n'
    f' 风力风向 {d["data"]["forecast"][0]["fx"]} {d["data"]["forecast"][0]["fl"]}\n'
    f' 感冒指数:{d["data"]["ganmao"]}\n'
    f' 温馨提示:{d["data"]["forecast"][0]["notice"]}\n'
    f' 更新时间:{d["time"]}'
)


w_list = []
for i in range(7):
    list = [
        d['data']['forecast'][i]['ymd'],
        d['data']['forecast'][i]['week'],
        d['data']['forecast'][i]['type'],
        d['data']['forecast'][i]['low'],
        d['data']['forecast'][i]['high'],
        d['data']['forecast'][i]['notice']
    ]
    w_list.append(list)
seven_days_weather = str(w_list).replace('], [','\n').replace(', ','').replace('[','').replace(']','').replace('\'',' ')
msg_total = (msg + '\n\n'+ seven_days_weather)
print(msg_total)
notify.send("保定天气", msg_total)

说明需要配置环境变量cityInfo查看自己城市代码地址

效果展示

在这里插入图片描述

八、下一个节假日

# @author Sten
# 作者仓库:https://github.com/aefa6/QinglongScript.git
# 觉得不错麻烦点个star谢谢

import requests
import json
import notify

title = "下个节假日" 

dateurl = 'https://date.appworlds.cn/next'
date1url = 'https://date.appworlds.cn/next/days'
holiday = requests.get(dateurl)
holiday1 = requests.get(date1url)

desc = json.loads(holiday.text)
desc1 = json.loads(holiday1.text)

daytime = desc['data']['date']
dayname = desc['data']['name']
Remain = desc1['data']

info = f"""
下个节假日是{Remain}天后的{dayname}{daytime})
"""
print(info)
notify.send(title, info)

九、每天60s

# @author Sten
# 作者仓库:https://github.com/aefa6/QinglongScript.git
# 觉得不错麻烦点个star谢谢
# 使用青龙自带的通知
import requests
import json
import notify

url = 'https://60s.viki.moe/?encoding=text'
resp = requests.get(url)

# 分片处理
pieces = resp.text.split('\n', 8)
content1 = '\n'.join(pieces[:8])  
content2 = '\n'.join(pieces[8:])

info1 = f"""
{content1}   
"""
info2 = f"""
{content2}   
"""

# 发送分片推送  
notify.send("每天60s读懂世界", info1 + "\n\n")
notify.send("每天60s读懂世界", info2)

十、小米社区签到

github地址
截止到2023.11.12,问题出现:人机校验失败
在这里插入图片描述
在这里插入图片描述
问题等待大佬解决中。。。
2023.11.14问题解决,这就是效率!!!
在这里插入图片描述

代码

在这里插入图片描述
打开requirement.txt文件,按照里面的需求安装对应的依赖

requests>=2.25.1
python-dotenv>=0.19.2
PyYAML>=6.0
onepush

文件只需要utils包、config.yml、miuitask.py下载
查看代码默认的推行方式好像是onepush,如果想更改为pushplus,进行如下的代码修改:

  1. 复制一个notify.py文件到最外面文件,即跟utils在同一个包下。【这个只要用来消息提醒的】
  2. import notifyuntils.py中引入
  3. 代码修改:在这里插入图片描述
    在这里插入图片描述
    去掉x部分,然后添加代码notify.send(“标题”,content)

十一、epic消息提醒

暂时只找到epic的每周消息提醒,没找到自动签到领取,需要手动进行领取。
github地址
只需要下载mian.py即可

import json
import requests
from datetime import datetime


def get_free_games() -> dict:
    timestamp = datetime.timestamp(datetime.now())
    games = {'timestamp': timestamp, 'free_now': [], 'free_next': []}
    base_store_url = 'https://store.epicgames.com'
    api_url = 'https://store-site-backend-static.ak.epicgames.com/freeGamesPromotions?country=CN'
    resp = requests.get(api_url)
    for element in resp.json()['data']['Catalog']['searchStore']['elements']:
        if promotions := element['promotions']:
            game = {}
            game['title'] = element['title']
            game['images'] = element['keyImages']
            game['origin_price'] = element['price']['totalPrice']['fmtPrice']['originalPrice']
            game['discount_price'] = element['price']['totalPrice']['fmtPrice']['discountPrice']
            game['store_url'] = f"{base_store_url}/p/{element['catalogNs']['mappings'][0]['pageSlug']}" if element['catalogNs']['mappings'] else base_store_url
            if offers := promotions['promotionalOffers']:
                game['start_date'] = offers[0]['promotionalOffers'][0]['startDate']
                game['end_date'] = offers[0]['promotionalOffers'][0]['endDate']
                games['free_now'].append(game)
            if offers := promotions['upcomingPromotionalOffers']:
                game['start_date'] = offers[0]['promotionalOffers'][0]['startDate']
                game['end_date'] = offers[0]['promotionalOffers'][0]['endDate']
                games['free_next'].append(game)
    return games


def generate_json(games: dict, filename: str):
    with open(filename, 'w') as f:
        json.dump(games, f)
        # json.dump(obj=games, fp=f, ensure_ascii=False, indent=4)


def generate_markdown(games: dict, filename: str):
    images = {}
    data = games['free_now'] + games['free_next']
    for game in data:
        for image in game['images']:
            if image['type'] in ['OfferImageWide', 'VaultClosed']:
                images[game['title']] = image['url']
                break

    content = '''# Epic 每周限免

- ## 本周限免

'''

    for game in games['free_now']:
        content += f'''
  - ### [{game['title']}]({game['store_url']} "{game['title']}")

    原价: {game['origin_price']}

    购买链接: [{game['store_url']}]({game['store_url']} "{game['title']}")

    ![{game['title']}]({images[game['title']]})

'''

    content += f'''
- ## 下周限免

'''

    for game in games['free_next']:
        content += f'''
  - ### [{game['title']}]({game['store_url']} "{game['title']}")

    原价: {game['origin_price']}

    购买链接: [{game['store_url']}]({game['store_url']} "{game['title']}")

    ![{game['title']}]({images[game['title']]})

'''

    with open(filename, 'w') as f:
        f.write(content)


if __name__ == '__main__':
    games = get_free_games()
    generate_json(games, './epic_free_games.json')
    generate_markdown(games, './README.md')

代码优化:

  1. import notify引入到main.py中【消息提醒】
  2. 修改代码:最后加上
    file = open(‘help.md’,‘r’,encoding=‘utf-8’).read()
    html = markdown(file)
    notify.send(“标题”,html)

效果图:
在这里插入图片描述

md转html链接【csdn】

十二、贴吧签到

代码

import hashlib
import json
import os
import re

import requests
import notify


class Tieba():
    name = "百度贴吧"

    def __init__(self, check_item):
        self.check_item = check_item

    @staticmethod
    def login_info(session):
        return session.get(url="https://zhidao.baidu.com/api/loginInfo").json()

    def valid(self, session):
        try:
            content = session.get(url="https://tieba.baidu.com/dc/common/tbs")
        except Exception as e:
            return False, f"登录验证异常,错误信息: {e}"
        data = json.loads(content.text)
        if data["is_login"] == 0:
            return False, "登录失败,cookie 异常"
        tbs = data["tbs"]
        user_name = self.login_info(session=session)["userName"]
        return tbs, user_name

    @staticmethod
    def tieba_list_more(session):
        content = session.get(
            url="https://tieba.baidu.com/f/like/mylike?&pn=1",
            timeout=(5, 20),
            allow_redirects=False,
        )
        try:
            pn = int(
                re.match(
                    r".*/f/like/mylike\?&pn=(.*?)\">尾页.*", content.text, re.S | re.I
                ).group(1)
            )
        except Exception:
            pn = 1
        next_page = 1
        pattern = re.compile(r".*?<a href=\"/f\?kw=.*?title=\"(.*?)\">")
        while next_page <= pn:
            tbname = pattern.findall(content.text)
            yield from tbname
            next_page += 1
            content = session.get(
                url=f"https://tieba.baidu.com/f/like/mylike?&pn={next_page}",
                timeout=(5, 20),
                allow_redirects=False,
            )

    def get_tieba_list(self, session):
        tieba_list = list(self.tieba_list_more(session=session))
        return tieba_list

    @staticmethod
    def sign(session, tb_name_list, tbs):
        success_count, error_count, exist_count, shield_count = 0, 0, 0, 0
        for tb_name in tb_name_list:
            md5 = hashlib.md5(
                f"kw={tb_name}tbs={tbs}tiebaclient!!!".encode()
            ).hexdigest()
            data = {"kw": tb_name, "tbs": tbs, "sign": md5}
            try:
                response = session.post(
                    url="https://c.tieba.baidu.com/c/c/forum/sign",
                    data=data,
                    verify=False,
                ).json()
                if response["error_code"] == "0":
                    success_count += 1
                elif response["error_code"] == "160002":
                    exist_count += 1
                elif response["error_code"] == "340006":
                    shield_count += 1
                else:
                    error_count += 1
            except Exception as e:
                print(f"贴吧 {tb_name} 签到异常,原因{str(e)}")
        msg = [
            {"name": "贴吧总数", "value": len(tb_name_list)},
            {"name": "签到成功", "value": success_count},
            {"name": "已经签到", "value": exist_count},
            {"name": "被屏蔽的", "value": shield_count},
            {"name": "签到失败", "value": error_count},
        ]
        return msg

    def main(self):
        tieba_cookie = {
            item.split("=")[0]: item.split("=")[1]
            for item in self.check_item.get("cookie").split("; ")
        }
        session = requests.session()
        requests.packages.urllib3.disable_warnings()
        requests.utils.add_dict_to_cookiejar(session.cookies, tieba_cookie)
        session.headers.update({"Referer": "https://www.baidu.com/"})
        tbs, user_name = self.valid(session=session)
        if tbs:
            tb_name_list = self.get_tieba_list(session=session)
            msg = self.sign(session=session, tb_name_list=tb_name_list, tbs=tbs)
            msg = [{"name": "帐号信息", "value": user_name}] + msg
        else:
            msg = [
                {"name": "帐号信息", "value": user_name},
                {"name": "签到信息", "value": "Cookie 可能过期"},
            ]
        msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg])
        notify.send("贴吧签到", msg)
        return msg


if __name__ == "__main__":
   
    datas_env = os.getenv("tieba_cookie")
    _check_item = {'cookie':datas_env}
    print(_check_item)
    print(Tieba(check_item=_check_item).main())

配置环境变量

环境变量的名称为:tieba_cookie

获取贴吧的cookie

在这里插入图片描述

效果展示

在这里插入图片描述

十三、爱奇艺签到

import json
import os
import re
import time
from hashlib import md5
from random import randint
from urllib.parse import unquote
from uuid import uuid4

import requests
import notify



class IQIYI():
    name = "爱奇艺"

    def __init__(self, check_item):
        self.check_item = check_item

    @staticmethod
    def parse_cookie(cookie):
        p00001 = (
            re.findall(r"P00001=(.*?);", cookie)[0]
            if re.findall(r"P00001=(.*?);", cookie)
            else ""
        )
        p00002 = (
            re.findall(r"P00002=(.*?);", cookie)[0]
            if re.findall(r"P00002=(.*?);", cookie)
            else ""
        )
        p00003 = (
            re.findall(r"P00003=(.*?);", cookie)[0]
            if re.findall(r"P00003=(.*?);", cookie)
            else ""
        )
        __dfp = (
            re.findall(r"__dfp=(.*?);", cookie)[0]
            if re.findall(r"__dfp=(.*?);", cookie)
            else ""
        )
        return p00001, p00002, p00003, __dfp

    @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)
                growthvalue = res_data.get("growthvalue", 0)
                distance = res_data.get("distance", 0)
                deadline = res_data.get("deadline", "非 VIP 用户")
                today_growth_value = res_data.get("todayGrowthValue", 0)
                msg = [
                    {"name": "VIP 等级", "value": level},
                    {"name": "当前成长", "value": growthvalue},
                    {"name": "今日成长", "value": today_growth_value},
                    {"name": "升级还需", "value": distance},
                    {"name": "VIP 到期", "value": deadline},
                ]
            except Exception as e:
                msg = [
                    {"name": "账号信息", "value": str(e)},
                ]
        else:
            msg = [
                {"name": "账号信息", "value": res.get("msg")},
            ]
        return msg

    def sign(self, p00001, p00003):
        """
        VIP 签到
        """
        qyid = uuid4().hex[:16]
        time_stamp = int(time.time() * 1000)
        data = f"agentType=1|agentversion=1|appKey=basic_pcw|authCookie={p00001}|qyid={qyid}|task_code=natural_month_sign|timestamp={time_stamp}|typeCode=point|userId={p00003}|UKobMjDMsDoScuWOfp6F"
        sign = md5(data.encode(encoding="utf-8")).hexdigest()
        url = f"https://community.iqiyi.com/openApi/task/execute?agentType=1&agentversion=1&appKey=basic_pcw&authCookie={p00001}&qyid={qyid}&sign={sign}&task_code=natural_month_sign&timestamp={time_stamp}&typeCode=point&userId={p00003}"
        body = {
            "natural_month_sign": {
                "taskCode": "iQIYI_mofhr",
                "agentType": 1,
                "agentversion": 1,
                "authCookie": p00001,
                "qyid": qyid,
                "verticalCode": "iQIYI",
            }
        }
        res = requests.post(
            url=url,
            data=json.dumps(body),
            headers={"Cookie": f"P00001={p00001}", "Content-Type": "application/json"},
        ).json()
        if res["code"] == "A00000":
            _msg = res["data"]["msg"]
            if _msg:
                msg = [{"name": "签到天数", "value": _msg}]
            else:
                try:
                    msg = [{"name": "签到天数", "value": res["data"]["data"]["signDays"]}]
                except Exception as e:
                    msg = [{"name": "签到天数", "value": str(e)}]
        else:
            msg = [{"name": "签到天数", "value": 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"].get("tasks", {}).get("daily", []):
                task_list.append(
                    {
                        "taskTitle": item["taskTitle"],
                        "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:
                params["taskCode"] = item.get("taskCode")
                requests.get(
                    url="https://tc.vip.iqiyi.com/taskCenter/task/notify", params=params
                )
                requests.get(url=url, params=params)
            elif item["status"] == 1:
                growth_task += item["taskReward"]
        msg = {"name": "任务奖励", "value": f"+{growth_task}成长值"}
        return msg

    def lottery(self, p00001, award_list=[]):
        url = "https://act.vip.iqiyi.com/shake-api/lottery"
        params = {
            "P00001": p00001,
            "lotteryType": "0",
            "actCode": "0k9GkUcjqqj4tne8",
        }
        params = {
            "P00001": p00001,
            "deviceID": str(uuid4()),
            "version": "15.3.0",
            "platform": str(uuid4())[:16],
            "lotteryType": "0",
            "actCode": "0k9GkUcjqqj4tne8",
            "extendParams": json.dumps(
                {
                    "appIds": "iqiyi_pt_vip_iphone_video_autorenew_12m_348yuan_v2",
                    "supportSk2Identity": True,
                    "testMode": "0",
                    "iosSystemVersion": "17.4",
                    "bundleId": "com.qiyi.iphone",
                }
            ),
        }
        res = requests.get(url, params=params).json()
        msgs = []
        if res.get("code") == "A00000":
            award_info = res.get("data", {}).get("title")
            award_list.append(award_info)
            time.sleep(3)
            return self.lottery(p00001=p00001, award_list=award_list)
        elif res.get("msg") == "抽奖次数用完":
            if award_list:
                msgs = [{"name": "每天摇一摇", "value": "、".join(award_list)}]
            else:
                msgs = [{"name": "每天摇一摇", "value": res.get("msg")}]
        else:
            msgs = [{"name": "每天摇一摇", "value": res.get("msg")}]
        return msgs

    @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 get_watch_time(self, p00001):
        url = "https://tc.vip.iqiyi.com/growthAgency/watch-film-duration"
        data = requests.get(
            url=url,
            headers={
                "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0",
                "Cookie": f"P00001={p00001}",
                "Content-Type": "application/json",
            },
        ).json()
        watch_time = data["data"]["viewtime"]["time"]
        return watch_time

    def level_right(self, p00001):
        data = {"code": "k8sj74234c683f", "P00001": p00001}
        res = requests.post(
            url="https://act.vip.iqiyi.com/level-right/receive", data=data
        ).json()
        msg = res["msg"]
        return [{"name": "V7 免费升级星钻", "value": msg}]

    def start_watch(self, p00001, p00003, dfp):
        total_time = self.get_watch_time(p00001=p00001)
        print(f"现在已经刷到了 {total_time}秒, 数据同步有延迟, 仅供参考")
        if total_time >= 7200:
            return {
                "name": "视频时长",
                "value": f"已经刷了 {total_time}秒, 数据同步有延迟, 仅供参考",
            }
        for _ in range(150):
            tm = randint(60, 120)
            watch_time_url = "https://msg.qy.net/b"
            params = {
                "u": "f600a23f03c26507f5482e6828cfc6c5",
                "pu": p00003,
                "p1": "1_10_101",
                "v": "5.2.66",
                "ce": uuid4().hex,
                "de": "1616773143.1639632721.1639653680.29",
                "c1": "2",
                "ve": uuid4().hex,
                "ht": "0",
                "pt": randint(1000000000, 9999999999) / 1000000,
                "isdm": "0",
                "duby": "0",
                "ra": "5",
                "clt": "",
                "ps2": "DIRECT",
                "ps3": "",
                "ps4": "",
                "br": "mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/96.0.4664.110 safari/537.36",
                "mod": "cn_s",
                "purl": "https://www.iqiyi.com/v_1eldg8u3r08.html?vfrm=pcw_home&vfrmblk=712211_cainizaizhui&vfrmrst=712211_cainizaizhui_image1&r_area=rec_you_like&r_source=62%40128&bkt=MBA_PW_T3_53&e=b3ec4e6c74812510c7719f7ecc8fbb0f&stype=2",
                "tmplt": "2",
                "ptid": "01010031010000000000",
                "os": "window",
                "nu": "0",
                "vfm": "",
                "coop": "",
                "ispre": "0",
                "videotp": "0",
                "drm": "",
                "plyrv": "",
                "rfr": "https://www.iqiyi.com/",
                "fatherid": f"{randint(1000000000000000, 9999999999999999)}",
                "stauto": "1",
                "algot": "abr_v12-rl",
                "vvfrom": "",
                "vfrmtp": "1",
                "pagev": "playpage_adv_xb",
                "engt": "2",
                "ldt": "1",
                "krv": "1.1.85",
                "wtmk": "0",
                "duration": f"{randint(1000000, 9999999)}",
                "bkt": "",
                "e": "",
                "stype": "",
                "r_area": "",
                "r_source": "",
                "s4": f"{randint(100000, 999999)}_dianshiju_tbrb_image2",
                "abtest": "1707_B,1550_B",
                "s3": f"{randint(100000, 999999)}_dianshiju_tbrb",
                "vbr": f"{randint(100000, 999999)}",
                "mft": "0",
                "ra1": "2",
                "wint": "3",
                "s2": "pcw_home",
                "bw": "10",
                "ntwk": "18",
                "dl": f"{randint(10, 999)}.27999999999997",
                "rn": f"0.{randint(1000000000000000, 9999999999999999)}",
                "dfp": dfp,
                "stime": str(time.time() * 1000),
                "r": f"{randint(1000000000000000, 9999999999999999)}",
                "hu": "1",
                "t": "2",
                "tm": str(tm),
                "_": str(time.time() * 1000),
            }
            requests.get(
                url=watch_time_url,
                headers={
                    "User-Agent": "mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/96.0.4664.110 safari/537.36",
                    "Cookie": f"P00001={p00001}",
                    "Content-Type": "application/json",
                },
                params=params,
            )
            total_time += tm
            print(f"现在已经刷到了 {total_time}秒, 数据同步有延迟, 仅供参考")
            if total_time >= 7600:
                break
        return {
            "name": "视频时长",
            "value": f"已经刷了 {total_time}秒, 数据同步有延迟, 仅供参考",
        }

    def give_times(self, p00001):
        url = "https://pcell.iqiyi.com/lotto/giveTimes"
        times_code_list = ["browseWeb", "browseWeb", "bookingMovie"]
        for times_code in times_code_list:
            params = {
                "actCode": "bcf9d354bc9f677c",
                "timesCode": times_code,
                "P00001": p00001,
            }
            response = requests.get(url, params=params)
            print(response.json())

    def lotto_lottery(self, p00001):
        self.give_times(p00001=p00001)
        gift_list = []
        for _ in range(5):
            url = "https://pcell.iqiyi.com/lotto/lottery"
            params = {"actCode": "bcf9d354bc9f677c", "P00001": p00001}
            response = requests.get(url, params=params)
            gift_name = response.json()["data"]["giftName"]
            if gift_name and "未中奖" not in gift_name:
                gift_list.append(gift_name)
        if gift_list:
            return [{"name": "白金抽奖", "value": "、".join(gift_list)}]
        else:
            return [{"name": "白金抽奖", "value": "未中奖"}]

    def main(self):
        p00001, p00002, p00003, dfp = self.parse_cookie(self.check_item.get("cookie"))
        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 字段"
        sign_msg = self.sign(p00001=p00001, p00003=p00003)
        _user_msg = self.user_information(p00001=p00001)
        lotto_lottery_msg = self.lotto_lottery(p00001=p00001)
        if _user_msg[4].get("value") != "非 VIP 用户":
            watch_msg = self.start_watch(p00001=p00001, p00003=p00003, dfp=dfp)
            level_right_msg = self.level_right(p00001=p00001)
        else:
            watch_msg = {"name": "视频时长", "value": "非 VIP 用户"}
            level_right_msg = [
                {
                    "name": "V7 免费升级星钻",
                    "value": "非 VIP 用户",
                }
            ]
        chance = self.draw(draw_type=0, p00001=p00001, p00003=p00003)["chance"]
        lottery_msgs = self.lottery(p00001=p00001, award_list=[])
        if chance:
            draw_msg = ""
            for _ in range(chance):
                ret = self.draw(draw_type=1, p00001=p00001, p00003=p00003)
                draw_msg += ret["msg"] + ";" if ret["status"] else ""
        else:
            draw_msg = "抽奖机会不足"
        task_msg = ""
        for _ in range(3):
            task_list = self.query_user_task(p00001=p00001)
            self.join_task(p00001=p00001, task_list=task_list)
            task_msg = self.get_task_rewards(p00001=p00001, task_list=task_list)

        user_msg = self.user_information(p00001=p00001)

        msg = (
            [
                {"name": "用户账号", "value": user_name},
                {"name": "用户昵称", "value": nickname},
            ]
            + user_msg
            + sign_msg
            + [
                task_msg,
                {"name": "抽奖奖励", "value": draw_msg},
            ]
            + [watch_msg]
            + lottery_msgs
            + level_right_msg
            + lotto_lottery_msg
        )
        msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg])
        notify.send("爱奇艺签到", msg)
        return msg


if __name__ == "__main__":
    datas_env = os.getenv("iqiyi_cookie")
    _check_item = {'cookie':datas_env}
    print(_check_item)
    print(IQIYI(check_item=_check_item).main())

获取cookie

在这里插入图片描述

配置环境变量

变量的名称为:iqiyi_cookie

效果展示

在这里插入图片描述


欢迎大家投稿

  • 35
    点赞
  • 315
    收藏
    觉得还不错? 一键收藏
  • 24
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 24
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值