From 7d7c629ae889072b96e26e285fdfe987c83f3bb3 Mon Sep 17 00:00:00 2001 From: LeLe <251192913@qq.com> Date: Fri, 23 Aug 2019 15:19:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=85=BC=E5=AE=B9json?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.json | 2 +- start.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config.json b/config.json index 54eedf6..8aabe69 100644 --- a/config.json +++ b/config.json @@ -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/" } \ No newline at end of file diff --git a/start.py b/start.py index 3933a1a..353d0f3 100644 --- a/start.py +++ b/start.py @@ -31,7 +31,8 @@ def Timestamp2Datetime(stampstr): #初始化环境 def GetJson(): - jstxt =ReadFile("config.json") + 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)