第一个BeautifulSoup爬虫
来源:互联网 发布:手机剪辑视频软件知乎 编辑:程序博客网 时间:2024/05/21 12:54
利用BeautifulSoup抓取网易评论的文章标题,时间,链接
使用BeautifulSoup,request模块,在虚拟的Python2.7下运行
# coding=utf-8import requestsfrom bs4 import BeautifulSouphtml = requests.get('http://money.163.com/special/pinglun/')text = html.textsoup = BeautifulSoup(text, "lxml")# h2 = soup.find('h2')# print h2#搜索div标签下所有class为item_top的内容for link in soup.find_all('div', class_='item_top'): #获得a标签下的文字 print(link.a.get_text()) #获得a标签下href print(link.a.get('href')) #获得span标签下的文字,即时间 print(link.span.get_text())
0 0
- 第一个BeautifulSoup爬虫
- 使用beautifulsoup写的第一个小爬虫程序
- Python爬虫第一讲:初识beautifulsoup
- 爬虫:BeautifulSoup
- BeautifulSoup 爬虫
- BeautifulSoup爬虫
- BeautifulSoup 爬虫
- 第一个爬虫程序
- 第一个小爬虫
- python第一个爬虫
- 第一个智能爬虫
- 第一个Python爬虫
- 第一个python爬虫
- 第一个网路爬虫
- 第一个python爬虫
- 第一个爬虫
- 第一个爬虫脚本
- 第一个python爬虫
- 例题5-2 木块问题 UVa101
- 指针的知识要点
- MySQL从入门到精通_9多表数据记录查询
- Redis集群管理之Redis Cluster集群节点增减
- acm 1406
- 第一个BeautifulSoup爬虫
- ADAMS笔记
- Unity3D使用Native Plugins(快速便捷接入SDK) —— Java篇
- Hokuyo,UST-10LX,网口类激光雷达使用
- 你真的了解Android ListView吗?
- 八仙数(并行计算)
- spring boot (三) 集成dubbo
- linux开发工具的使用(二)
- ACM-ICPC 大四退役