Closed Tamshen closed 2 years ago
感谢大佬建议,通知方式已修改为青龙自带脚本。 考虑到后续可能会增加脚本,还是都使用同一份配置文件来管理比较合适。 这方面有好的建议可以说一下 : ) 有web端使用需求的朋友可以参考此issue
大佬请问这怎么解决
Traceback (most recent call last):
File "/ql/scripts/copartner.py", line 176, in
all_data = json.loads(f.read())
File "/usr/lib/python3.9/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.9/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid \escape: line 4 column 635 (char 665)
看log貌似是依赖出问题了 在qinglong依赖管理重装一下python的json依赖
大佬好,网易云cookie里没有找到_ns,UM_distinctid这两项的数据
大佬好,网易云cookie里没有找到_ns,UM_distinctid这两项的数据
只要cookie拿过去能正常用就行,不一定非得一抹一样
问一下 之前能运行 突然变成这样该怎么办
Traceback (most recent call last):
File "/ql/data/scripts/copartner.py", line 176, in
问一下 之前能运行 突然变成这样该怎么办 Traceback (most recent call last): File "/ql/data/scripts/copartner.py", line 176, in all_data = json.loads(f.read()) File "/usr/lib/python3.9/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/usr/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.9/json/decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Invalid \escape: line 4 column 467 (char 497)
更新库即可. #22 #20
运行后会这样子 Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, **kwargs) File "/usr/local/lib/python3.10/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/ql/data/scripts/copartner.py", line 178, in
运行后会这样子 Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, kwargs) File "/usr/local/lib/python3.10/json/init**.py", line 346, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/ql/data/scripts/copartner.py", line 178, in res = Copartner(_check_item).main() File "/ql/data/scripts/copartner.py", line 153, in main music_data, user_name = self.valid(session) File "/ql/data/scripts/copartner.py", line 127, in valid data = content.json() File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
大概率是json格式不对
Traceback (most recent call last):
File "/ql/data/scripts/copartner.py", line 178, in
建议
青龙根脚本目录自带了个
notify.py
在根目录,可以直接引用web端使用:
1.控制面板-脚本管理-右上角新建
文件名:
copartner.py
父目录:根
内容:复制下面代码并保存2.建立配置文件,配置好你的CK
文件名:
copartner_ck.json
父目录:根
内容:复制JSON配置文件模板修改成你的CK并保存
3.控制面板-依赖管理-Python3-增加依赖
PyExecJS
pycrypto
4.控制面板-定时任务-右上角添加任务
名称:
合伙人
命令:task copartner.py
定时:0 8 * * *
(每天八点)这个时候可以点击运行,然后查看日志是否成功了。
修改后的代码
from Crypto.Cipher import AES from notify import send
def to_16(key): while len(key) % 16 != 0: key += '\0' return str.encode(key)
def aes_encrypt(text, key, iv): bs = AES.block_size pad2 = lambda s: s + (bs - len(s) % bs) * chr(bs - len(s) % bs) encryptor = AES.new(to_16(key), AES.MODE_CBC, to_16(iv)) encrypt_aes = encryptor.encrypt(str.encode(pad2(text))) encrypt_text = str(base64.encodebytes(encrypt_aes), encoding='utf-8') return encrypt_text
def rsa_encrypt(text, pubKey, modulus): text = text[::-1] rs = int(codecs.encode(text.encode('utf-8'), 'hex_codec'), 16) ** int(pubKey, 16) % int(modulus, 16) return format(rs, 'x').zfill(256)
获取i值的函数,即随机生成长度为16的字符串
get_i = execjs.compile(r""" function a(a) { var d, e, b = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", c = ""; for (d = 0; a > d; d += 1) e = Math.random() * b.length, e = Math.floor(e), c += b.charAt(e); return c } """)
class Copartner(): name = "音乐合伙人"
if name == "main": with open("copartner_ck.json", "r", encoding="utf-8") as f: all_data = json.loads(f.read()) _check_item = all_data.get("MUSIC_COPARTNER", [])[0] res = Copartner(_check_item).main() print(res) send('网易音乐合伙人', res)