linkpreview

package
v0.154.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: MPL-2.0, MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetURLs

func GetURLs(text string) []string

GetURLs returns only what we consider unfurleable URLs.

func UnfurlURLs

func UnfurlURLs(logger *zap.Logger, urls []string) ([]common.LinkPreview, error)

UnfurlURLs assumes clients pass URLs verbatim that were validated and processed by GetURLs.

Types

type LinkPreview

type LinkPreview struct {
	common.LinkPreview
}

type OpenGraphMetadata

type OpenGraphMetadata struct {
	Title        string `json:"title" meta:"og:title"`
	Description  string `json:"description" meta:"og:description"`
	ThumbnailURL string `json:"thumbnailUrl" meta:"og:image"`
}

type OpenGraphUnfurler

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

OpenGraphUnfurler can be used either as the default unfurler for some websites (e.g. GitHub), or as a fallback strategy. It parses HTML and extract OpenGraph meta tags. If an oEmbed endpoint is available, it should be preferred.

type UnfurlError

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

UnfurlError means a non-critical error, and that processing of the preview should be interrupted and the preview probably ignored.

func (UnfurlError) Error

func (ue UnfurlError) Error() string

func (UnfurlError) Unwrap

func (ue UnfurlError) Unwrap() error

type Unfurler

type Unfurler interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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