Skip to content
readability for golang. 网页文章标题和正文抽取工具
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
http.go
main_test.go
read.go
regex.go

README.md

readability

readability for golang

Golang版本是根据readabiliity for node.js以及readability for python所改写,并加入了些自己的,比如支持gzip等。

引用的第三方包

github.com/PuerkitoBio/goquery
github.com/axgle/mahonia

使用方法

package main

import (
	"fmt"

	"github.com/ying32/readability"
)

func main() {
    test, err := readability.NewReadability("http://wd.leiting.com/home/news/news_detail.php?id=599")
    if err != nil {
	fmt.Println("failed.", err)
	return
    }
    test.Parse()
    fmt.Println(test.Title)
    fmt.Println(test.Content)
}
You can’t perform that action at this time.