From b5f82f77a188b2b43ac76ec71c8e1cf94e94b106 Mon Sep 17 00:00:00 2001 From: wenead99 <42309414+wenead99@users.noreply.github.com> Date: Wed, 29 May 2019 12:10:16 +0800 Subject: [PATCH] =?UTF-8?q?0.3.2=20Beta=20=E5=AE=8C=E5=96=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core.py b/core.py index 1604b45..dd6e2aa 100644 --- a/core.py +++ b/core.py @@ -12,13 +12,11 @@ import time #=====================爬虫核心部分========================== def get_html(url):#网页请求核心 headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'} - getweb = requests.get(str(url),proxies={"http": "http://127.0.0.1:2334","https": "https://127.0.0.1:2334"},timeout=5,headers=headers).text + getweb = requests.get(str(url),timeout=5,headers=headers).text try: return getweb - except Exception as e: - print(e) - except IOError as e1: - print(e1) + except: + print("[-]Connect Failed! Please check your Proxy.") def getTitle(htmlcode): #获取标题 doc = pq(htmlcode)