获取网页文章内容一例

光庆 2月前 476

import console; 

import godking.http
import zlib

var htm,h = godking.http({
	url = "http://www.xinbqg.la/80/80145/34584488.html"; /*完整网址*/
	ungzip = true; /*进行gzip解压缩。false:不解压。true:自动根据响应头识别解压缩。"all":一律解压缩。需zlib库支持,请先 import zlib*/
})
//console.dump(htm)

import string.html
var html = string.html(htm)
//console.dump(html)

for ele in html.eachQuery(tagName="div";id="content"){
	for(i=1;#ele;1){
		var t = string.html.ncr(ele[i]["text"]:ele[i][[1]][["text"]]:"");
		if #t console.dump(t);
	}
}

console.pause(true);

最新回复 (6)
  • tanzh 2月前
    0 2
    大佬东西就是好,学习学习
  • Viewer8122 2月前
    0 3
    学习,学习。
  • dsp2138 2月前
    0 4
    https://gitee.com/mirrors/GNE?_from=gitee_search 这个项目,源自于一篇关于自动化抽取新闻类网站正文的算法论文——《基于文本及符号密度的网页正文提取方法》) 这篇论文中描述的算法看起来简洁清晰,并且符合逻辑。但由于论文中只讲了算法原理,并没有具体的语言实现,所以我使用 Python 根据论文实现了这个抽取器。并分别使用今日头条、网易新闻、游民星空、观察者网、凤凰网、腾讯新闻、ReadHub、新浪新闻做了测试,发现提取效果非常出色,几乎能够达到100%的准确率
  • 光庆 2月前
    0 5
    dsp2138 https://gitee.com/mirrors/GNE?_from=gitee_search 这个项目,源自于一篇关于自动化抽取新闻类网站正文的算法论文——《基于文本及符号密度的网页正文提取方法 ...
    有没有aardio代码学一下
  • dsp2138 2月前
    0 6
    学了,试着重写了下
  • 瞌睡蟲子 2月前
    0 7
    此楼层已删除
返回