Documentation
¶
Index ¶
- func GetURLs(text string) []string
- func NewDefaultHTTPClient() http.Client
- func UnfurlURLs(logger *zap.Logger, httpClient http.Client, urls []string) ([]common.LinkPreview, error)
- type Headers
- type LinkPreview
- type OEmbedResponse
- type OEmbedUnfurler
- type OpenGraphMetadata
- type OpenGraphUnfurler
- type Unfurler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetURLs ¶
GetURLs returns only what we consider unfurleable URLs.
If we wanted to be extra precise and help improve UX, we could ignore URLs that we know can't be unfurled. This is at least possible with the oEmbed protocol because providers must specify an endpoint scheme.
func NewDefaultHTTPClient ¶ added in v0.154.5
func UnfurlURLs ¶
func UnfurlURLs(logger *zap.Logger, httpClient http.Client, 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 OEmbedResponse ¶ added in v0.154.5
type OEmbedUnfurler ¶ added in v0.154.5
type OEmbedUnfurler struct {
// contains filtered or unexported fields
}
type OpenGraphMetadata ¶
type OpenGraphUnfurler ¶
type OpenGraphUnfurler struct {
// contains filtered or unexported fields
}
OpenGraphUnfurler should be preferred over OEmbedUnfurler because oEmbed gives back a JSON response with a "html" field that's supposed to be embedded in an iframe (hardly useful for existing Status' clients).
Click to show internal directories.
Click to hide internal directories.