-
第三种方法下载网页查看全部
-
urllib2查看全部
-
URL管理器查看全部
-
Ctrl+1 提示导入re模块包 //import re查看全部
-
C:\Python27\Scripts>pip install beautifulsoup4 Collecting beautifulsoup4 Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x037B5B70>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/beautifulsoup4/ Downloading beautifulsoup4-4.5.1-py2-none-any.whl (83kB) 12% |████ | 10kB 43kB/s eta 0:0 24% |███████▉ | 20kB 68kB/s eta 36% |███████████▊ | 30kB 33kB/s 48% |███████████████▋ | 40kB 43 60% |███████████████████▌ | 51k 73% |███████████████████████▍ | 85% |███████████████████████████▎ 97% |████████████████████████████ 100% |████████████████████████████████| 92kB 66kB/s Installing collected packages: beautifulsoup4 Successfully installed beautifulsoup4-4.5.1查看全部
-
# coding:utf8 import urllib2 import cookielib url ="http://www.90xss.cn/" print "第一种方法" response1 = urllib2.urlopen(url) print response1.getcode() print len(response1.read()) print "第二种方法" request = urllib2.Request(url) request.add_header("user-agent", "Mozilla/5.0") respon2 = urllib2.urlopen(request) print respon2.getcode() print len(respon2.read()) print "第三种方法" cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) urllib2.install_opener(opener) response3 = urllib2.urlopen(url) print response3.getcode() print cj print response3.read()查看全部
-
网页下载器: urllib2:python官方,基础模块 requests:第三方包,更强大查看全部
-
爬虫 URL管理器实现方式: 内存(个人最好): Python内存 待爬取URL集合:set() 已爬取URL集合:set()查看全部
-
爬虫架构查看全部
-
爬虫简介查看全部
-
方法三代码查看全部
-
方法三查看全部
-
加强版查看全部
-
加强版查看全部
-
最简单的方法查看全部
举报
0/150
提交
取消