百度贴吧小爬虫.v0.1,百度贴吧爬虫.v0.1,Python语言: 百度
文章由Byrx.net分享于2019-03-23 07:03:07
百度贴吧小爬虫.v0.1,百度贴吧爬虫.v0.1,Python语言: 百度
Python语言: 百度贴吧小爬虫.v0.1#coding:utf-8#---------------------------------------# 百度贴吧小爬虫 # 编程语言 : Python 2.5#---------------------------------------# 简介 : 偶尔看百度贴吧,想保存下来慢慢看,于是有了这个小软件# 输入带分页的地址,去掉最后面的数字,设置一下起、末贴数即可下载。#---------------------------------------import string, urllib#定义 bd(百度)函数def bd(url,PostBegin,PostEnd): for i in range(PostBegin, PostEnd ,50): sName = string.zfill(i,6) + '.html' print 'working..... ' + sName f = open( string.zfill(sName,6),'w+') m = urllib.urlopen(url + str(i)).read() f.write(m) f.close()#-------- 在这里输入参数 ------------------# 这个是《青囊尸衣》百度贴吧的地址。bdurl = '<a href="http://tieba.baidu.com/f?z=360426363&ct=335544320&lm=0&sc=0&rn=50&tn=baiduPostBrowser&word=%C7%E0%C4%D2%CA%AC%D2%C2&pn=">http://tieba.baidu.com/f?z=360426363&ct=335544320&lm=0&sc=0&rn=50&tn=baiduPostBrowser&word=%C7%E0%C4%D2%CA%AC%D2%C2&pn='iPostBegin = 1150iPostEnd = 1200#-------- 在这里输入参数 ------------------#调用bd(bdurl,iPostBegin,iPostEnd)#该片段来自于http://byrx.net
相关内容
- rocksdb的python用法,rocksdbpython用法,rocksdb是一个封装
- RocksDB, pyrocksdb 的安装与使用,rocksdbpyrocksdb,RocksDB是FB基
- 批量修整文件名,修整文件名,下载了评书《贺龙传奇》
- Python 数据导入,python数据导入,import cx_Or
- 打印python进程堆栈,python进程堆栈,import threa
- Python urldecode 函数,pythonurldecode,import urlli
- Python 随机产生大量md5,python产生md5,import strin
- python 的datetime.timedelta表示成可读的时间段,,def getWor
- Rock-paper-scissors-lizard-Spock Game,,# The key id
- getEncodedRange 方法一例,,import chilk
评论关闭