This commit is contained in:
dylan 2022-10-02 20:03:52 +08:00
parent 77e7f1952c
commit 84ae29117d
2 changed files with 23 additions and 5 deletions

View File

@ -14,22 +14,25 @@ import os
import random import random
import sys import sys
import time import time
import requests
try: try:
import jieba # just for linting import jieba # just for linting
import jieba.analyse import jieba.analyse
#import yaml #import yaml
from lxml import etree from lxml import etree
except: except:
print('解决依赖问题...稍等')
os.system('pip3 install lxml &> /dev/null') os.system('pip3 install lxml &> /dev/null')
os.system('pip3 install jieba &> /dev/null') os.system('pip3 install jieba &> /dev/null')
os.system('pip3 install zhon &> /dev/null') os.system('pip3 install zhon &> /dev/null')
os.system('pip3 install requests &> /dev/null')
import jieba import jieba
import jieba.analyse import jieba.analyse
#import yaml #import yaml
from lxml import etree from lxml import etree
import requests
@ -620,9 +623,9 @@ if __name__ == '__main__':
if len(os.environ["PC_COOKIE"]) > 1: if len(os.environ["PC_COOKIE"]) > 1:
ck = os.environ["PC_COOKIE"] ck = os.environ["PC_COOKIE"]
logger.info ("已获取环境变量 CK") logger.info ("已获取环境变量 CK")
else: else:
logger.info("请添加电脑端CK变量PC_COOKIE") logger.info("没有设置变量PC_COOKIE请添加电脑端CK到环境变量")
sys.exit(1) sys.exit(1)
headers = { headers = {
'cookie': ck.encode("utf-8"), 'cookie': ck.encode("utf-8"),
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36',

15
jd_pjdeps.py Normal file
View File

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
'''
new Env('评价依赖安装');
8 8 2 10 * https://raw.githubusercontent.com/6dylan6/auto_comment/main/jd_pjdeps.py
'''
import os
from time import sleep
print('第一次运行评价出错才运行此程序,如果没有问题请勿运行,以免弄出问题!!!')
print('10s后开始安装依赖......')
sleep(10)
os.system('apk add --no-cache libxml2-dev libxslt-dev')
os.system('pip install -U --force-reinstall pip')
os.system('pip3 install lxml')