cappuccino

package module
v0.0.0-...-27ef569 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Cappuccino

A Golang package which used to generate Website Preview with URL.

一个通过链接获取网页摘要的Golang包

Demo: URL

Import

go get -u github.com/MisakiCoca/Cappuccino

Sample

package main

import (
	cappuccino "github.com/MisakiCoca/Cappuccino"
)

func main() {
	lp, _ := cappuccino.Init("https://www.bilibili.com")
	println(lp.Title)
	println(lp.Author)
	println(lp.Description)
	println(lp.MediaURL[0])
}

Todo

  • Optimize the typesetting of mixed strings with Chinese and English.

  • Improve the conciseness of the description.

  • Redirect with cookie.

  • Identificate non-standard meta.

  • Convert non-utf-8 encoding text.

  • 优化中英文混排问题

  • 提升描述的简练程度 停用词处理

  • 携带Cookie的自动跳转

  • 识别不标准meta

  • 转换非utf-8编码信息

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinkPreview

type LinkPreview struct {
	URL string `json:"url"` // URL of the page to preview

	Type        string   `json:"type"`        // twitter card type of the page
	Author      string   `json:"author"`      // author of the page
	Title       string   `json:"title"`       // title of the page
	Description string   `json:"description"` // description of the page
	MediaURL    []string `json:"media_url"`   // media URLs of the page
	// contains filtered or unexported fields
}

LinkPreview contains brief information about a web page.

func Init

func Init(url string) (lp LinkPreview, err error)

Init returns the brief information of the page given.

func (*LinkPreview) ShowHTML

func (lp *LinkPreview) ShowHTML() string

ShowHTML will return HTML content of the page Just for debug

Jump to

Keyboard shortcuts

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