readability

package module
v0.0.0-...-3001f2f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2019 License: MIT Imports: 16 Imported by: 0

README

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)
}

Documentation

Overview

改自 https://github.com/kingwkb/readability python版本 于2016-11-10 by: ying32

改自 https://github.com/kingwkb/readability python版本 于2016-11-10 by: ying32

改自 https://github.com/kingwkb/readability python版本 于2016-11-10 by: ying32

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashStr

func HashStr(node *goquery.Selection) string

Types

type TCandidateItem

type TCandidateItem struct {
	// contains filtered or unexported fields
}

type TReadability

type TReadability struct {
	Title   string
	Content string
	// contains filtered or unexported fields
}

func NewReadability

func NewReadability(url string) (*TReadability, error)

func (*TReadability) Parse

func (self *TReadability) Parse()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL