资源简介
采用爬虫(XPATH)进行高校专家信息(批量,某学院或学院为单位)检索,并将专家姓名,研究方向,邮箱等信息保存在.csv
代码片段和文件信息
import requests
import re
from lxml import etree
import json
import csv
#url = ‘http://zsy.jlu.edu.cn/info/1021/8364.htm‘ # jiayujiao1
csvfile =open(“吉林哲学.csv““w“newline=‘‘encoding=‘utf-8‘)
writer = csv.writer(csvfile)
#先写入columns_name
writer.writerow([“姓名““研究方向““邮箱“])
wangzhi_list = [‘info/1022/5251.htm‘ ‘info/1023/5199.htm‘ ‘info/1021/5191.htm‘ ‘info/1020/5093.htm‘ ‘info/1021/5261.htm‘ ‘info/1022/5171.htm‘ ‘info/1020/5092.htm‘ ‘info/1021/5259.htm‘ ‘info/1022/5242.htm‘ ‘info/1020/5061.htm‘ ‘info/1020/5105.htm‘ ‘info/1020/5103.htm‘ ‘info/1020/5098.htm‘ ‘info/1020/5100.htm‘ ‘info/1022/5265.htm‘ ‘info/1022/5264.htm‘ ‘info/1023/5201.htm‘ ‘info/1021/5189.htm‘ ‘info/1022/5184.htm‘ ‘info/1022/5268.htm‘ ‘info/1022/5269.htm‘ ‘info/1022/5267.htm‘ ‘info/1022/5270.htm‘ ‘info/1021/5204.htm‘ ‘info/1022/5196.htm‘ ‘info/1021/7131.htm‘ ‘info/1023/5271.htm‘ ‘info/1022/5198.htm‘ ‘info/1023/5182.htm‘ ‘info/1021/5173.htm‘ ‘info/1020/5106.htm‘ ‘info/1021/7580.htm‘ ‘info/1020/5091.htm‘ ‘info/1023/5200.htm‘ ‘info/1021/8364.htm‘ ‘info/1022/5197.htm‘ ‘info/1020/5099.htm‘ ‘info/1020/5104.htm‘ ‘info/1022/5266.htm‘ ‘info/1021/5260.htm‘ ‘info/1020/5080.htm‘ ‘info/1023/5202.htm‘ ‘info/1022/5195.htm‘ ‘info/1021/5193.htm‘ ‘info/1023/5177.htm‘ ‘info/1020/5058.htm‘ ‘info/1020/5079.htm‘ ‘info/1020/5169.htm‘ ‘info/1021/5186.htm‘ ‘info/1023/5172.htm‘ ‘info/1023/7348.htm‘ ‘info/1023/5174.htm‘ ‘info/1020/5053.htm‘ ‘info/1023/7344.htm‘ ‘info/1020/5095.htm‘ ‘info/1021/5187.htm‘ ‘info/1020/5090.htm‘ ‘info/1020/5097.htm‘ ‘info/1023/5203.htm‘ ‘info/1021/5181.htm‘ ‘info/1020/5096.htm‘ ‘info/1020/5101.htm‘ ‘info/1020/5081.htm‘ ‘info/1021/5188.htm‘ ‘info/1020/5082.htm‘ ‘info/1020/5258.htm‘ ‘info/1020/5088.htm‘ ‘info/1020/5085.htm‘ ‘info/1021/5178.htm‘ ‘info/1020/5089.htm‘ ‘info/1020/5059.htm‘ ‘info/1020/5062.htm‘ ‘info/1021/5194.htm‘ ‘info/1020/5094.htm‘ ‘info/1020/5077.htm‘ ‘info/1020/5087.htm‘ ‘info/1020/7448.htm‘ ‘info/1021/5190.htm‘ ‘info/1020/5108.htm‘ ‘info/1020/5107.htm‘ ‘info/1021/5263.htm‘ ‘info/1021/5262.htm‘ ‘info/1020/5056.htm‘ ‘info/1021/5179.htm‘ ‘info/1020/5066.htm‘ ‘info/1020/5170.htm‘ ‘info/1020/5102.htm‘ ‘info/1020/8365.htm‘ ‘info/1020/5074.htm‘ ‘info/1020/5180.htm‘ ‘info/1020/5183.htm‘]
for wangzhi in wangzhi_list:
url = ‘http://zsy.jlu.edu.cn/‘+wangzhi
#url = ‘http://zsy.jlu.edu.cn/info/1020/5061.htm‘
# url = ‘https://teachers.jlu.edu.cn/pyjslb.jsp?totalpage=11&PAGENUM=‘+str(i)+‘&urltype=tsites.PinYinTeacherList&wbtreeid=1001&py=‘+k+‘&lang=zh_CN‘
headers = {
‘User-Agent‘: ‘Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/73.0.3683.103 Safari/537.36 ‘
}
response = requests.get(url headers=headers verify=False)
data = response.content.decode()
xpath_data = etree.HTML(data)
links = xpath_data.xpath(‘//span/text()‘)
print(links)
try:
fenduan
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 8858 2019-05-11 12:27 爬虫代码实现\吉林哲学.csv
文件 5290 2019-05-11 12:27 爬虫代码实现\研究方向.py
文件 727 2019-05-11 11:34 爬虫代码实现\网址.py
文件 143 2019-05-15 17:34 爬虫代码实现\说明.txt
目录 0 2019-05-15 17:22 爬虫代码实现
----------- --------- ---------- ----- ----
15018 5
相关资源
-
集搜客-爬取数据xm
l转Excel - 蘑菇数据集
- pima印第安人糖尿病数据集
- KNN算法预测鸢尾花的种类,源码以及
- Tkinter代码195例-Tkinter编程代码
- 我自己做的一个基于Django的房屋出租
- 全球主要国家、省州、城市的数据库
- 基于.net的网络爬虫
- reportlab_userguide_pdf_高清含详细目录
- 2018年7月中科软与中航工业电子面试题
- Anaconda配套图标
- HttpHelper 爬虫应用类库 苏飞万能框架
- pyexcel技术文档
- AI项目-pacman
- setuptools
- PyPDF2模块和英文文档
- C超级爬虫.zip
- 股票查询工具(含前端页面)
- pandas入门实践教程--二十分钟轻松搞定
- SVR支持向量机回归原理解析.pdf
- svm实现是否带眼镜
- 爬取淘宝店铺商品销量,规格等参数
- 一个接糖果的pygame小游戏
-
WumpusWorld 使用 Knowledgeba
se的AI 实现 - glut搭建glut32bit和64bit
- firefoxxpath-checker
- 模拟Digest认证的登录demo
- 一个图片爬虫和音乐爬虫
-
xm
l - 实验(3) -- XPath & XSLT - 打字案例.zip
评论
共有 条评论