oembed

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

oEmbed

GoDoc Version Build Status Go Report Card Codecov

Portions of this code inspired or duplicated from:

Documentation

Index

Constants

View Source
const TypeLink = "link"
View Source
const TypePhoto = "photo"
View Source
const TypeRich = "rich"
View Source
const TypeVideo = "video"

Variables

This section is empty.

Functions

func LookupWithURI

func LookupWithURI(uri string) (string, error)

LookupWithURI uses a URI to find the oEmbed endpoint

Types

type OEmbed

type OEmbed struct {
	Version      string `json:"version,omitempty"`
	Type         string `json:"type,omitempty"`
	ProviderName string `json:"provider_name,omitempty"`
	ProviderURL  string `json:"provider_url,omitempty"`
	Width        int    `json:"width,omitempty"`
	Height       int    `json:"height,omitempty"`
	Title        string `json:"title,omitempty"`
	AuthorName   string `json:"author_name,omitempty"`
	AuthorURL    string `json:"author_url,omitempty"`
	HTML         string `json:"html,omitempty"`
}

func ParseGoQuery

func ParseGoQuery(goquery *goquery.Document) (OEmbed, error)

ParseGoQuery searches a goquery document for oEmbed metadata. This is provided as a shortcut for use cases where the caller has already parsed the HTML document into a goquery object.

func ParseResponse

func ParseResponse(response *http.Response) (OEmbed, error)

ParseResponse searches an http.Response for oEmbed medadata

type Provider

type Provider struct {
	Name      string             `json:"provider_name"`
	URL       string             `json:"provider_url"`
	Endpoints []ProviderEndpoint `json:"endpoints"`
}

type ProviderEndpoint

type ProviderEndpoint struct {
	Schemes   []string `json:"schemes"`
	URL       string   `json:"url"`
	Discovery bool     `json:"discovery"`
	Formats   []string `json:"formats"`
}

Jump to

Keyboard shortcuts

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