很久没更新博客了,最近自学Python,写个在百度上爬算法题题解的爬虫,第一次写爬虫..纯当练手

慢慢来..

#coding:utf-8
'''
Created on 2016年11月22日 @author: liyinggang
'''
from link_crawler_baidu import link_crawler_baidu
import urllib
baseUrl = 'http://www.baidu.com/s'
page = 1 #第几页
ojname = 'hdu'
problemnum = ''
word = ojname + problemnum
data = {'wd':word,'pn':str(page-1)+'','tn':'baidurt','ie':'utf-8','bsst':''}
data = urllib.urlencode(data)
url = baseUrl+'?'+data
print url
link_crawler_baidu(url,'lyg',ojname,problemnum)

首先是进入百度主页,main.py

然后我将博客园和csdn的链接筛选出来(编码问题好难弄,最后百度了个笨方法).

#coding:utf-8
'''
Created on 2016年11月22日 @author: liyinggang
'''
import re,lxml.html,urlparse
from download import download
import sys
from link_crawler_cnblogs import link_crawler_cnblogs
from link_crawler_csdn import link_crawler_csdn
reload(sys)
def link_crawler_baidu(seed_url,user_agent=None,ojname='hdu',problemnum=''):
html = download(seed_url,user_agent=user_agent)
url1 = "http://www.cnblogs.com/";
url2 = "http://blog.csdn.net/";
regex1 = re.compile(url1)
regex2 = re.compile(url2)
cnt1 = 0
cnt2 = 0
links = [link for link in get_links(html) if \
re.match(regex1,link) or re.match(regex2, link)]
for link in links:
link = union(seed_url,link)
html = download(link,user_agent=user_agent)
html = unicode(html, "utf-8") #只能用这个笨方法了
tree = lxml.html.fromstring(html)
text = tree.cssselect('title')[0].text_content()
regex1 = re.compile(u'%s([\s\S]*)%s([\s\S]*)博客园'%(ojname,problemnum),re.IGNORECASE)
regex2 = re.compile(u'%s([\s\S]*)%s([\s\S]*)CSDN.NET'%(ojname,problemnum),re.IGNORECASE)
if(re.search(regex1,text)):
filename = ojname+problemnum+'_'+str(cnt1)
if(link_crawler_cnblogs(link,user_agent=user_agent,filename=filename)):
cnt1+=1
if(re.search(regex2,text)):
filename = ojname+problemnum+'_'+str(cnt2)
if(link_crawler_csdn(link,user_agent=user_agent,filename=filename)):
cnt2+=1 def union(seed_url,link):
"""
将seed_url 与 link 拼接
"""
link, _ = urlparse.urldefrag(link) #将link分解成去掉fragment的新url和去掉的fragment的二元组
return urlparse.urljoin(seed_url, link) def get_links(html):
"""
获取html中的外链链接
"""
webpage_regex = re.compile('href=["\'](.*?)["\']', re.IGNORECASE) #忽略大小写
# return all links list
return webpage_regex.findall(html)

博客园的代码的获取.

#coding:utf-8
'''
Created on 2016年11月22日 @author: liyinggang
'''
from download import download
import lxml.html
import re
from fileinput import filename
def link_crawler_cnblogs(url,user_agent=None,filename='filename'):
html = download(url,user_agent=user_agent)
html = unicode(html,"utf-8")
tree = lxml.html.fromstring(html)
texts = tree.cssselect('pre')
regex = re.compile('^(#include|import)([\s\S]*)main()') #如果是代码里面一定包含 mian() 函数
flag = False
for text in texts:
text = text.text_content()
if(re.search(regex, text)):
flag = True
f = open("D:\\download\\cnblogs\\%s.txt"%filename,"w")
f.write(text)
f.close()
break
return flag

csdn代码的获取:

#coding:utf-8
'''
Created on 2016年11月22日 @author: liyinggang
'''
from download import download
import lxml.html
import re
def link_crawler_csdn(url,user_agent=None,filename='filename'):
html = download(url,user_agent=user_agent)
html = unicode(html,"utf-8")
tree = lxml.html.fromstring(html)
texts = tree.cssselect('pre')
texts.extend(tree.cssselect('p > textarea.cpp'))
flag = False
regex = re.compile('^(#include|import)([\s\S]*)main()') #如果是代码里面一定包含 mian() 函数
for text in texts:
text = text.text_content()
if(re.search(regex, text)):
flag = True
f = open("D:\\download\\csdn\\%s.txt"%filename,"w")
f.write(text)
f.close()
break
return flag

下载网页的代码:

#coding:utf-8
'''
Created on 2016-11-20 @author: admin
'''
import urllib2
import urlparse
def download(url,user_agent='lyg',proxy=None,retest=5):
#user_agent是设置代理用户,proxy代表是否使用代理,retest是代表测试多少次
"""
This method is to download the website source code
"""
print 'Downloading:',url
headers = {'User-agent':user_agent} #设置用户代理,默认Python-urllib/2.7有可能被一些网站封禁
request = urllib2.Request(url,headers=headers) opener = urllib2.build_opener()
if proxy:
proxy_params = {urlparse.urlparse(url).schema: proxy}
opener.add_handler(urllib2.ProxyHandler(proxy_params))
try:
html = opener.open(request).read()
except urllib2.URLError as e:
print 'Downlaod error:',e.reason
html = None
if retest>0:
if hasattr(e, 'code') and 500<= e.code <=600:
#如果错误代码在 500- 600 之间就重新试,404这种就没必要尝试了
download(url, retest-1)
return html

得到的结果:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAj8AAAH3CAIAAADbnakkAAAgAElEQVR4nO3d248sx2Ef4Pm39rwrrwIiIO9+WQR5CwzERgzDASI7MBRrj+RIgZTIdiBHshPFQmR4Y0cOI1qURF0O7+ShzvJOihQpUhJtAwGcSJOH3TPb011VXdXTPd3V8304IGaqq6uqe7n12+rund387Ct3/PPPP//886+uf5stANRGegFQH+kFQH2kFwD1kV4A1Ed6AVCf3PT6rd//fOK/AHBM/en1lQdv/aN//E8e/9H7H/noxx557d2PfPRj//3qRx/56Mf++PnXP/LRj/3bx5//vceeevqxLx9hrABwrSe9/t8vf/m5p19+6ad/d//9D59692ffffuDR9/8yV+++uOvXv3oP7/w+heeeeXjjz7xiW8++amP/8pxhntyLs/v3L2aexAAi9OTXu/8/f/58v3XH3zw4fPvffjEOz/99lvvP/L6u3/x8tv/7cGbX3zhtc8/9fK/+l/f/8IP7ofS6/J80zfxZlRZlau7d84vt9vtdnt5vuk6v4xs2NM5Y1d375zUWQTY9qbXd9/+4Ouv/fjxV9785stvPPLgtcsXXvnqs1dffvLFP7z3wmcff/YT33zyn//Z1//k3vNTptfleXvG3s3wzeJgYayF9tbIjuOLJ83l+eYm2VrFvcOSXsAJ6kmvrzx463vvfPDMez+/9+OffuftD77xxrv/49V3vnr11pfuv/6FZ1/91L2rX/3zv3nqxx9Mk15Xd+9sNpvz871aV3fvPHx7eb65mfGDhXutRPpJ7Xi9NRQpOVsTewV3aqTX9YhDbo+2bHkGsDY96fW5p19+/icfPvrSG3/9w9cuX3jlz569+pMnf/hH9+5/9vHnLr71zL/+xr1/+qW/ePXd9ye9crhXay8yHr4JFu7e3bl7N9ZPYsdwSf7WUvvptWu3sfYK595NlI03EIAapNLrH37xi889/fJT7/3se+988K23fvLI6+9evvLOVx+89aX7r//Bs6985smXf+c7z/3a5WO/+OUvo+l19+FludvZdf/OzvXc3AyCTijspdf+BbabTcHCRlvRlIzuuD/OO3cv797ZHcPl+fWCsHSl83DJdN1M4AZXdEO8q6u7d87vXge0/AJOSSq9Xvn53//pi29+750P/urFV7/2/MtfeebBl5588Q9+8MJnH3/u4rGnf/tvnviXl9/6ja/9759++GEkvboX9vYuz93ej8pOr9bG603BwuCLltiOwe23SXlTadDaa5eX7RtaGfe9OvfArve5ue/l6UTglKTS6xtvvvdXr77z7bd+8uhb7/3P13785y+9/V8fvPnHL7z2H5959fefuPrd77/4W4/c+8x3nt1ut31XDh8+WNDKh93bKdZejd0Grb26Q7leFcWStFUtsiiLpld75971V/PkpUMaYH1S6fXFF1771ls/efSN97763Ev/5ekHX3zi/n/4wfOfefzZ33vs6d9+9Inf+Osf/OpXH/lPjz8dX3tNk17dm2CBwtCTDcGnESO31EIlmemVlEiv4LOD4bVX42GT/f0Cj54ArFEqvf7dky99+0fvf/21dy9fefvPHrz15ftv/OFzr/37p166uPfg33z3xd987Llfu/zW9996b5u/9tqbXa/u3mleOWxcj0ukVzMzghfxQguQ+KIktOPtYAJXDlsjHZZeV3fP794NpVffb3ztTmKk4s2aU4ABqxdNr7/7h//7+Wde+faP3n/kjfeu73j90b37n/ve85/+9jOfeOzp33n0id985Pv/7MuXP3z73YK117Y55+49C7hbK905P0+tvZpVm9WChbEWmro7tqP0ZqTdeN1tLbhad33410+SdBZ6gZaS971SOwKsWjS97n/wtx9//IXf/d6LF/cefOqJq7v3ru7ee/DJew8++YMffvqJq08/cfXJ7//wX/zld64r+6SoTMEY34Ry97L7tGZ/mwCnIusz5q9eee2nH36Y+Ce9ADimrPT62p9+6lMf/5XEv0o+Y7693HF7CKBS/jolAPWRXgDUR3oBUB/pBUB9pBcA9ZFeANRHegFQH+kFQH2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dRGeq3WpAEjvYB5Sa/V6v0t4EMSSHoB85JeK1QaUemafjUYWCDptVqlATN1fYARSa/VKr1y6KkNoCLSa7UmXUtJL2Be0mu1pBewYtJrtRJ/giRdf/TKAKOTXmtW+sxhsL5nDoEFkl706D7cIbqA2UkvesgqYIGkFwD1kV4A1Ed6AVAf6QVAfaQXAPWRXgDUR3oBUB/pBUB9pBcA9ZFeANRHegFQH+kFQH2kFwD1kV4A1Ed6AVCfm/T6OQDUQ3oBUJ//D4Yh5aiIAdsYAAAAAElFTkSuQmCC" alt="" />

Python练手之爬虫的更多相关文章

  1. Python练手项目:20行爬取全王者全英雄皮肤

    引言    王者荣耀大家都玩过吧,没玩过的也应该听说过,作为时下最火的手机MOBA游戏,咳咳,好像跑题了.我们今天的重点是爬取王者荣耀所有英雄的所有皮肤,而且仅仅使用20行Python代码即可完成. ...

  2. 【Python精华】100个Python练手小程序

    100个Python练手小程序,学习python的很好的资料,覆盖了python中的每一部分,可以边学习边练习,更容易掌握python. [程序1] 题目:有1.2.3.4个数字,能组成多少个互不相同 ...

  3. 整理了适合新手的20个Python练手小程序

    100个Python练手小程序,学习python的很好的资料,覆盖了python中的每一部分,可以边学习边练习,更容易掌握python. 本文附带基础视频教程:私信回复[基础]就可以获取的 [程序1] ...

  4. Python练手项目实例汇总(附源码下载)

    今天给大家分享几个有趣的Python练手项目实例,希望对Python初学者有帮助哈~ 一.经典的俄罗斯方块   1. 绑定功能 1 # 绑定功能 2 class App(Frame): 3 def _ ...

  5. 80个Python练手项目列表

    80个Python练手项目列表   我若将死,给孩子留遗言,只留一句话:Repetition is the mother of all learning重复是学习之母.他们将来长大,学知识,技巧.爱情 ...

  6. 70个Python练手项目列表(都有完整教程)

    前言: 不管学习那门语言都希望能做出实际的东西来,这个实际的东西当然就是项目啦,不用多说大家都知道学编程语言一定要做项目才行. 这里整理了70个Python实战项目列表,都有完整且详细的教程,你可以从 ...

  7. 【转载】【python】python练手项目

    入门篇 1.Python - Python 图片转字符画 50 行 Python 代码完成图片转字符画小工具. &lt;img src="https://pic3.zhimg.com ...

  8. 别再说找不到Python练手项目了,这80个拿去过冬

    开头真的很重要!!!一个吻,一部小说,一篇文章......好的开头就像一个漂亮女孩的问候,问完了,你还期待着她接下来会对你说些什么甜蜜的话呢. 真可惜!我不是漂亮女孩,我的这个开头也不好.但开头不好, ...

  9. Python练手例子(4)

    16.一个数如果恰好等于它的因子之和,这个数就称为"完数".例如6=1+2+3.编程找出1000以内的所有完数. 程序分析:请参照程序Python 100例中的第14个例子 #py ...

随机推荐

  1. OpenStack介绍(一)

    官方网站:http://www.openstack.org/ 介绍 OpenStack是一个由NASA(美国国家航空航天局)和Rackspace合作研发并发起的,以Apache许可证授权的自由软件和开 ...

  2. day15 接口与异常

    接口 是一种独立于类的新机制,它关注的是行为. 接口的意义就体现在——让没有继承关系的类共享这些行为,各有各的具体实现. 设计上:当我们发现一个或多个类的方法相同,又没有继承关系,则考虑接口. 命名: ...

  3. git 提交模板配置

    1.创建模板文件,比如gitTemplate.txt,内容如下: ABSTRACT:修改自测发现的多度数据同步相关问题. Bug Fix [Y/N]:NBug ID:New Feature [Y/N] ...

  4. js加载超时 nginx静态资源

    server { listen ; server_name www.example.com; client_max_body_size 20M; root /xxx/xxx;//项目路径 locati ...

  5. Java并发编程原理与实战三:多线程与多进程的联系以及上下文切换所导致资源浪费问题

    一.进程 考虑一个场景:浏览器,网易云音乐以及notepad++ 三个软件只能顺序执行是怎样一种场景呢?另外,假如有两个程序A和B,程序A在执行到一半的过程中,需要读取大量的数据输入(I/O操作),而 ...

  6. Nginx+tomcat 负载均衡

      一.系统版本 Nginx使用版本.tomcat使用版本: Nginx:nginx-1.10.2.tar.gz Java :Java version: 1.8.0_60, vendor: Oracl ...

  7. 给Ubuntu替换阿里的源

    1. 阿里巴巴镜像源站点 有所有linux的源的镜像加速. 点击查看介绍 2. 具体配置方法在这里 copy: ubuntu 18.04(bionic) 配置如下 创建自己的配置文件,比如创建文件 / ...

  8. 洛谷P3953 [NOIP2017]逛公园

    K<=50,感觉可以DP 先建反图求出从n到各个点的最短路,然后在正图上DP 设f[当前点][比最短路多走的距离]=方案数 转移显然是 $f[v][res]=\sum f[u][res+tmp] ...

  9. 微服务深入浅出(5)-- 声明式调用Feign

    Feign的使用 Feign采用了声明式的API接口的风格,将Java Http客户端绑定到它的内部,从而调用过程变的简单. 配置文件: spring: application: name: eure ...

  10. Uva 11549 - Calculator Conundrum 找规律加map

    题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...