拉钩网
来源:互联网 发布:r2r梯形网络 编辑:程序博客网 时间:2024/04/28 18:08
import requests,re,time,random,os,pinyin
from bs4 import BeautifulSoup
m=requests.get('http://www.lagou.com/').content.decode('utf-8')
bs=BeautifulSoup(m,'lxml')
n=bs.find("div","mainNavs").text
n=re.split(r'\s+',n)
n=n[2:]
for l in n:
if not os.path.isfile('d://lg//%s.txt'%l):
L=pinyin.get(l, format="strip")
urls=['http://www.lagou.com/zhaopin/%s/%d/?filterOption=%d'%(L,i,i) for i in range(1,31)]
for url in urls:
print(url)
time.sleep(random.randint(1,3))
data=requests.get(url).content.decode('utf-8')
print('得到数据')
bs=BeautifulSoup(data,'lxml')
a=bs.find_all("div","p_top")
b=bs.find_all("div","li_b_l")
c=bs.find_all("div","company_name")
if a :
for i,j,k in zip(a,b,c):
i=re.sub(r'\s+',',',i.text).lstrip(',')
j=re.sub(r'\s+',',',j.text).lstrip(',')
k=re.sub(r'\s+',',',k.text).lstrip(',')
l=re.sub(r'\/|\\|\*|\>|\<|\?|\:|\"|\|','',l)
with open('d://lg//%s.txt'%l,'a',errors='replace') as f:
f.write(i+j+k+'\n')
time.sleep(1)
else:
break
else:
print('已存在')
continue
from bs4 import BeautifulSoup
m=requests.get('http://www.lagou.com/').content.decode('utf-8')
bs=BeautifulSoup(m,'lxml')
n=bs.find("div","mainNavs").text
n=re.split(r'\s+',n)
n=n[2:]
for l in n:
if not os.path.isfile('d://lg//%s.txt'%l):
L=pinyin.get(l, format="strip")
urls=['http://www.lagou.com/zhaopin/%s/%d/?filterOption=%d'%(L,i,i) for i in range(1,31)]
for url in urls:
print(url)
time.sleep(random.randint(1,3))
data=requests.get(url).content.decode('utf-8')
print('得到数据')
bs=BeautifulSoup(data,'lxml')
a=bs.find_all("div","p_top")
b=bs.find_all("div","li_b_l")
c=bs.find_all("div","company_name")
if a :
for i,j,k in zip(a,b,c):
i=re.sub(r'\s+',',',i.text).lstrip(',')
j=re.sub(r'\s+',',',j.text).lstrip(',')
k=re.sub(r'\s+',',',k.text).lstrip(',')
l=re.sub(r'\/|\\|\*|\>|\<|\?|\:|\"|\|','',l)
with open('d://lg//%s.txt'%l,'a',errors='replace') as f:
f.write(i+j+k+'\n')
time.sleep(1)
else:
break
else:
print('已存在')
continue
0 0
- 拉钩网
- 拉钩网采集
- 产品体验之拉钩网
- python数据爬虫---拉钩网
- 蹿红的拉钩网存在的6个弊端
- 第一个爬虫(拉钩网的所有职位信息)
- 用Python爬取拉钩网招聘职位信息
- python requests用接口爬拉钩网职位信息
- Python 简单爬虫的样例(获取拉钩网Python的职位)
- 使用scrapy+IP代理+多线程爬虫对拉钩网在杭州互联网职位信息的抓取
- 仿拉钩登录界面
- 拉钩求职那些困惑
- 拉钩异步数据抓取
- 爬取拉钩
- Python selenium 拉钩爬虫
- python scrapy爬虫 CrawlSpider 拉钩招聘网302重定向问题解决方案 , 修改setting信息,添加cookie请求
- 拉钩的方向感知demo
- 仿51拉钩登录界面
- 牛仔网股评
- 操作系统内存管理——分区、页式、段式管理
- JDK各个版本的新特性jdk1.5-jdk8
- 01背包问题
- 大项目二
- 拉钩网
- 机器学习
- SQL子句执行顺序和Join的一点总结
- MySQL数据库重命名存储过程
- 猎聘
- AIX系统ksh到bash互切
- python subprocess 读取进程logging info ( Run subprocess and print output to logging )
- 蓝桥杯(java)入门训练 序列求和
- 代理IP