python爬虫——获取正文内容
2017-08-21 11:23
1031 查看
python爬虫——获取正文内容
import requests from bs4 import BeautifulSoup newsurl = "https://news.sina.cn/2017-08-21/detail-ifykcqaw0391535.d.html?from=wap" res = requests.get(newsurl) res.encoding = 'utf-8' #print(res.text) soup = BeautifulSoup(res.text, 'html.parser') article = [] for p in soup.select('.art_p')[:-1]: article.append(p.text.strip()) print(article) '\n'.join(article)
相关文章推荐
- Python爬虫如何获取动态内容-上
- Python 爬虫 —— 获取js渲染的内容
- Python爬虫之web内容获取(一)
- python 爬虫如何获取js里面的内容
- Python 爬虫模块 bs4 实战一:获取百度贴吧内容
- Python爬虫_获取贴吧内容
- 从零开始写Python爬虫 --- 1.5 爬虫实践: 获取百度贴吧内容
- python-70:使用BS4获取正文内容
- python爬虫获取网页内容
- Python爬虫实战入门五:获取JS动态内容—爬取今日头条
- Python爬虫如何获取动态内容-下
- Python爬虫实战入门五:获取JS动态内容—爬取今日头条
- python 爬虫爬取内容时, \xa0 、 \u3000 的含义
- python爬虫,获取百度贴吧图片
- 爬虫技术 -- 进阶学习(十一)【补充】获取html中meta标签中的content的内容
- C++和python如何获取百度搜索结果页面下信息对应的真实链接(百度搜索爬虫,可指定页数)
- Scrapy:Python实现scrapy框架爬虫两个网址下载网页内容信息——Jason niu
- 爬虫小探-Python3 urllib.request获取页面数据
- python3爬虫之入门和正则表达式,获取IP地址, 隐马尔可夫模型及其在分词中的简单应用
- Python爬虫:获取糗事百科笑话