import urllib.request import http.cookiejar from lxml import etree head = { 'Connection': 'Keep-Alive', 'Accept': 'text/html, application/xhtml+xml, *... ...
分类:
其他好文 时间:
2017-11-11 13:20:37
阅读次数:
171
#通过登录去爬虫 #首先要有用户名和密码 import urllib.request import http.cookiejar from lxml import etree head = { 'Connection': 'Keep-Alive', 'Accept': 'text/html, app... ...
分类:
其他好文 时间:
2017-11-11 13:11:17
阅读次数:
150
一、首先安装插件 1、安装Package Control,这是为了安装其他插件做基础,它可以方便我们下载其他插件 (1)、按Ctrl+`调出console(注:避免热键冲突) (2)、粘贴以下代码到命令行并回车: import urllib.request,os; pf = 'Package Con ...
分类:
其他好文 时间:
2017-11-10 15:54:45
阅读次数:
198
sslv3 alert handshake failure错误,参考https://stackoverflow.com/questions/31730819/python-sslerror-using-requests-for-surveymonkey-com requests.exceptions ...
分类:
Web程序 时间:
2017-11-09 21:01:23
阅读次数:
362
如果学会了python的基本语法,我认为入门爬虫是很容易的。 我写的第一个爬虫大概只需要10分钟,自学的 scrapyd , 看官方文档花了20分钟,因为我英文不是很好,很多单词需要搜索一下。 (scrapy 并不是入门必须的) 再接触到了 requests , lxml ,配合基本库 urllib ...
分类:
其他好文 时间:
2017-11-09 15:05:07
阅读次数:
160
import reimport urllib.request#(http://\S*?)[\"] 提取不带"#http://\S*?[\"] 提取的时候带"#\S非空字符 *0-多个 ?非贪婪 \"|>|)三个符号其中之一为结束httpre=re.compile(r"(http://\S*?)[\" ...
分类:
编程语言 时间:
2017-11-08 00:56:03
阅读次数:
216
代理的IP通过去网上找# -*- coding: utf-8 -*- import re import _thread from time import sleep, ctime from urllib.request import urlopen from urllib.request impor... ...
分类:
其他好文 时间:
2017-11-07 22:04:47
阅读次数:
181
Python的urllib和urllib2模块都做与请求URL相关的操作,但他们提供不同的功能。他们两个最显着的差异如下: urllib2可以接受一个Request对象,并以此可以来设置一个URL的headers,但是urllib只接收一个URL。这意味着,你不能伪装你的用户代理字符串等。urlli ...
分类:
编程语言 时间:
2017-11-07 14:24:28
阅读次数:
198
1.指定博客的地址 周国平的博客地址:http://blog.sina.com.cn/s/articlelist_1193111400_0_1.html 打开上述链接,然后按F12,找到<a title="" target="_blank" href="http://blog.sina.com.cn ...
分类:
其他好文 时间:
2017-11-07 01:38:23
阅读次数:
189
1.什么是Urllib 它是Python内置的Http请求库 urllib.request 请求模块 urllib.error 异常处理模块 urllib.parse url解析模块 urllib.robotparser robots.txt解析模块 2.urlopen 帮助我们发送request请 ...
分类:
Web程序 时间:
2017-11-07 00:17:24
阅读次数:
219