自动兼容json文件路径
This commit is contained in:
parent
7b0f68c08c
commit
7d7c629ae8
@ -1,5 +1,5 @@
|
||||
{
|
||||
"jsonDir": "C:/vWeChatFiles/rawlist/Dump-0805-15-00-45",
|
||||
"jsonDir": "C:/vWeChatFiles/rawlist/tmp1",
|
||||
"htmlDir": "c:/vWeChatFiles/html/",
|
||||
"pdfDir": "c:/vWeChatFiles/pdf/"
|
||||
}
|
||||
5
start.py
5
start.py
@ -32,6 +32,7 @@ def Timestamp2Datetime(stampstr):
|
||||
#初始化环境
|
||||
def GetJson():
|
||||
jstxt = ReadFile("config.json")
|
||||
jstxt = jstxt.replace("\\\\","/").replace("\\","/") #防止json中有 / 导致无法识别
|
||||
jsbd = json.loads(jstxt)
|
||||
return jsbd
|
||||
|
||||
@ -46,7 +47,7 @@ def DownLoadHtml(url):
|
||||
'Accept-Language':'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3'
|
||||
}
|
||||
|
||||
response = requests.get(url,headers = headers)
|
||||
response = requests.get(url,headers = headers,proxies=None)
|
||||
if response.status_code == 200:
|
||||
htmltxt = response.text #返回的网页正文
|
||||
return htmltxt
|
||||
@ -62,7 +63,7 @@ def DownImg(url,savepath):
|
||||
'Connection':'keep-alive',
|
||||
'Accept-Language':'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3'
|
||||
}
|
||||
r = requests.get(url,headers = headers)
|
||||
r = requests.get(url,headers = headers,proxies=None)
|
||||
with open(savepath, 'wb') as f:
|
||||
f.write(r.content)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user