readpage

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package readpage fetches information from a web page.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoTitleFound = errors.New("no title found in the document")
	ErrTimeout      = errors.New("request timed out")
)

Functions

func FindTitle

func FindTitle(link string) (string, error)

FindTitle finds a <title> in the document.

If there is no title, or the title is empty string, ErrNoTitleFound is returned. If any other error occurred, it is returned.

func IsThisValidRepost

func IsThisValidRepost(report activities.AnnounceReport) (validRepost bool, err error)

Types

type FoundData

type FoundData struct {

	// PostName is the first p-name found.
	PostName string

	// BookmarkOf is the first u-bookmark-of found. Must be a valid URL.
	BookmarkOf string

	// RepostOf is the first u-repost-of found. Must be a valid URL.
	RepostOf string

	// Tags are all p-category found.
	Tags []string

	// Mycomarkup is the Mycomarkup text. It is fetched with a second request.
	Mycomarkup string

	// IsHFeed is true if the document has an h-feed somewhere in the beginning. You don't repost h-feed:s.
	IsHFeed bool
	// contains filtered or unexported fields
}

FoundData is all data found in a document. Specific fields are set iff you wish for them.

func FindDataForMyRepost

func FindDataForMyRepost(link string) (FoundData, error)

FindDataForMyRepost finds data relevant for us to make a repost.

Jump to

Keyboard shortcuts

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