Skip to content

Commit ff970c5

Browse files
authored
Merge pull request #14 from lifegpc/dev
v1.1.3 dev-2
2 parents 54d30d5 + f8a7910 commit ff970c5

4 files changed

Lines changed: 65 additions & 28 deletions

File tree

command.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
def ph() :
2222
h='''命令行帮助:
2323
start.py -h/-?/--help 显示命令行帮助信息
24-
start.py [-i <输入>] [-d <下载方式>] [-p <p数>] [-m <boolean>] [--ac <boolean>] [--dm <boolean>] [--ad <boolean>] [-r <boolean>] [-y/-n] [--yf/--nf] [--mc avc/hev] [--ar/--nar] [--ax <number>] [--as <number>] [--ak <number>] [--ab/--nab] [--fa none/prealloc/trunc/falloc] [--sv <boolean>] [--ma <boolean>] [--ms <speed>] [--da <boolean>] [--httpproxy <URI>] [--httpsproxy <URI>] [--jt <number>|a|b] [--jts <date>] [-F] [-v <id>] [-a <id>] [-o <dir>] [--af/--naf] [--afp <序号>] [-s] [--slt/--nslt]
24+
start.py [-i <输入>] [-d <下载方式>] [-p <p数>] [-m <boolean>] [--ac <boolean>] [--dm <boolean>] [--ad <boolean>] [-r <boolean>] [-y/-n] [--yf/--nf] [--mc avc/hev] [--ar/--nar] [--ax <number>] [--as <number>] [--ak <number>] [--ab/--nab] [--fa none/prealloc/trunc/falloc] [--sv <boolean>] [--ma <boolean>] [--ms <speed>] [--da <boolean>] [--httpproxy <URI>] [--httpsproxy <URI>] [--jt <number>|a|b] [--jts <date>] [-F] [-v <id>] [-a <id>] [-o <dir>] [--af/--naf] [--afp <序号>] [-s] [--slt/--nslt] [--te/--nte]
2525
start.py show c/w 显示许可证
2626
-i <输入> av/bv/ep/ss号或者视频链接
2727
-d <下载方式> 下载方式:1.当前弹幕2.全弹幕3.视频4.当前弹幕+视频5.全弹幕+视频
@@ -62,13 +62,15 @@ def ph() :
6262
-s 启用静默模式,关闭除版权声明和错误信息和进度信息(即内置下载器和aria2输出的信息,以及下载完成的信息)外的所有输出(若有重复文件,在不手动设置的情况下默认为覆盖)
6363
--slt 下载小视频时,放入文件名中的描述长度可以超过20字
6464
--nslt 下载小视频时,放入文件名中的描述长度无法超过20字,超出部分将被舍弃
65+
--te requests使用环境变量中的代理设置
66+
--nte requests不使用环境变量中的代理设置
6567
注1:如出现相同的选项,只有第一个会生效
6668
注2:命令行参数的优先级高于settings.json里的设置
6769
注3:ffmpeg和aria2c需要自行下载并确保放入当前文件夹或者放入环境变量PATH指定的目录中
6870
注4:当下载收藏夹/频道,除了-i和-p参数外,其他参数将被沿用至收藏夹/频道视频的下载设置,-i和-p参数只对收藏夹/频道起作用'''
6971
print(h)
7072
def gopt(args,d:bool=False) :
71-
re=getopt(args,'h?i:d:p:m:r:ynFv:a:o:s',['help','ac=','dm=','ad=','yf','nf','mc=','ar','nar','ax=','as=','ak=','ab','nab','fa=','sv=','ma=','ms=','da=','httpproxy=','httpsproxy=','jt=','jts=','af','naf','afp=','slt','nslt'])
73+
re=getopt(args,'h?i:d:p:m:r:ynFv:a:o:s',['help','ac=','dm=','ad=','yf','nf','mc=','ar','nar','ax=','as=','ak=','ab','nab','fa=','sv=','ma=','ms=','da=','httpproxy=','httpsproxy=','jt=','jts=','af','naf','afp=','slt','nslt','te','nte'])
7274
if d:
7375
print(re)
7476
rr=re[0]
@@ -200,6 +202,10 @@ def gopt(args,d:bool=False) :
200202
r['slt']=True
201203
if i[0]=='--nslt' and not 'slt' in r:
202204
r['slt']=False
205+
if i[0]=='--te' and not 'te' in r:
206+
r['te']=True
207+
if i[0]=='--nte' and not 'te' in r:
208+
r['nte']=True
203209
for i in re[1] :
204210
if i.lower()=="show":
205211
prc()

setsettings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,8 @@ def sk(se:dict,key:str,re:dict) :
201201
r=gk(se,'slt')
202202
print2('%s1.是\t%s2.否\t%s3.不设置(默认)',r)
203203
sk(ne,'slt',se)
204+
print('requests是否使用环境变量中的代理设置?(不设置情况下为是)')
205+
r=gk(se,'te')
206+
print2('%s1.是\t%s2.否\t%s3.不设置(默认)',r)
207+
sk(ne,'te',se)
204208
saveset(ne)

start.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ def main(ip={}):
4141
if not isinstance(se,dict) :
4242
se=None
4343
print('建议运行setsettings.py设置程序以减少不必要的询问。')
44+
nte=False
45+
if JSONParser.getset(se,'te')==False :
46+
nte=True
47+
if 'te' in ip:
48+
nte=not ip['te']
4449
if 'i' in ip :
4550
inp=ip['i']
4651
elif ns:
@@ -190,7 +195,8 @@ def main(ip={}):
190195
if 'httpsproxy' in ip:
191196
pr['https']=ip['httpsproxy']
192197
section.proxies=pr
193-
section.trust_env=False
198+
if nte:
199+
section.trust_env=False
194200
read=JSONParser.loadcookie(section)
195201
ud={}
196202
login=0
@@ -425,7 +431,8 @@ def main(ip={}):
425431
r=requests.Session()
426432
r.headers=copydict(section.headers)
427433
r.proxies=section.proxies
428-
r.trust_env=False
434+
if nte:
435+
r.trust_env=False
429436
read=JSONParser.loadcookie(r)
430437
if read!=0 :
431438
print("读取cookies.json出现错误")
@@ -720,7 +727,8 @@ def main(ip={}):
720727
r=requests.Session()
721728
r.headers=copydict(section.headers)
722729
r.proxies=section.proxies
723-
r.trust_env=False
730+
if nte:
731+
r.trust_env=False
724732
read=JSONParser.loadcookie(r)
725733
if read!=0 :
726734
print("读取cookies.json出现错误")

0 commit comments

Comments
 (0)