Documentation
¶
Overview ¶
Package wayback provides a client for the Internet Archive Wayback Machine API.
Index ¶
Constants ¶
View Source
const (
// MaxItems sets the max items to fetch.
MaxItems = 10
)
Variables ¶
View Source
var ( ErrAPIRequestFail = errors.New("wayback machine: API request failed") ErrAlreadyArchived = errors.New("wayback machine: URL already has archive") ErrNoSnapshots = errors.New("wayback machine: no snapshots found") ErrNoVersionAvailable = errors.New("wayback machine: no version available") ErrSaveFailed = errors.New("wayback machine: failed to save snapshot") ErrTooManyRecords = errors.New("wayback machine: too many records") )
Functions ¶
This section is empty.
Types ¶
type AvailableSnapshot ¶
type AvailableSnapshot struct {
ArchivedSnapshots struct {
Closest struct {
Available bool `json:"available"`
URL string `json:"url"`
Timestamp string `json:"timestamp"`
Status string `json:"status"`
} `json:"closest"`
} `json:"archived_snapshots"`
}
AvailableSnapshot represents the Wayback "available" API response.
type SnapshotInfo ¶
type SnapshotInfo struct {
ArchiveURL string `json:"archive_url"`
ArchiveTimestamp string `json:"timestamp"`
}
SnapshotInfo represents a single CDX snapshot record.
type WaybackMachine ¶
type WaybackMachine struct {
*Options
// contains filtered or unexported fields
}
WaybackMachine provides methods to query the Internet Archive Wayback Machine.
func New ¶
func New(opts ...OptFn) *WaybackMachine
New creates a new WaybackMachine with sensible defaults.
func (*WaybackMachine) ClosestSnapshot ¶
func (wm *WaybackMachine) ClosestSnapshot(ctx context.Context, urlStr string) (*SnapshotInfo, error)
ClosestSnapshot returns the closest archived version of a URL.
func (*WaybackMachine) SaveSnapshot ¶
SaveSnapshot requests the Wayback Machine to archive a URL (create new snapshot).
func (*WaybackMachine) Snapshots ¶
func (wm *WaybackMachine) Snapshots(ctx context.Context, urlStr string) ([]SnapshotInfo, error)
Snapshots fetches the last N snapshots for a URL.
Click to show internal directories.
Click to hide internal directories.