您的位置:首页 > 编程语言 > Python开发

python 任意新闻正文提取

2016-10-25 20:06 190 查看
在github上搜到一个正文提取程序,测试了一下基本可以对现在大多数大型新闻网站进行提取

后续我会分析一下这个程序的源码

使用非常简单 如下

# -*- coding: utf-8 -*-
import newspaper
url = 'http://news.haiwainet.cn/n/2015/0611/c3541083-28826526.html'
a = newspaper.Article(url,language='zh')
a.download()
a.parse()
print(a.text)

github:https://github.com/codelucas/newspaper
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: