python爬虫小笔记/干货

获取网页内容:

我们可以利用Python的urllib2模块来抓取网页:

import urllib2  
response = urllib2.urlopen(‘http://www.laitaolun.com’)
html = response.read()
print(html)


实现网站自动登入:

import urllib,urllib2,httplib,cookielib

url = ‘http://www.yourwebsite.com/login.asp?action=chk’

values = {‘username’ : ‘admin’, ‘password’ : ‘admin’}

data = urllib.urlencode(values)

req = urllib2.Request(url, data)

response = urllib2.urlopen(req)

the_page = response.read()

print the_page

干货博客:http://www.elias.cn/Python/HomePage

python网络爬虫干货:http://www.aboutyun.com/thread-10626-1-1.html

批量干货连接:http://pan.gfsousou.cn/python%E7%BD%91%E7%BB%9C%E7%88%AC%E8%99%AB%E5%AE%9E%E6%88%98_%E8%B0%B7%E7%B2%89%E7%9B%98%E6%90%9C.html

爬虫范例:https://segmentfault.com/a/1190000000657305实现:


  1. 登录Coursera;

  2. 在课程资源页面里面找到资源链接;

  3. 根据资源链接选择合适的工具下载资源。

Python搜索爬虫视频教程:http://pan.baidu.com/s/1eQxQuNg
python爬取百度云盘资源:python爬取百度云盘资源
http://www.oschina.net/code/snippet_2391943_52647

python爬取百度云盘资源
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值