Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrArchivedUrl = errors.New("can't get archived url")
)
Functions ¶
func Archive ¶
Archive creates an archive of the given URL using the Wayback Machine. It takes a URL and an optional http.Client as parameters. If the client is nil, a default client will be used. It returns the URL of the archived snapshot and any error encountered.
Example ¶
package main import ( "fmt" "log" "net/http" "github.com/seekr-osint/wayback-machine-golang/wayback" ) func main() { client := http.Client{} url, err := wayback.Archive("github.com/max", &client) // the clint argument can also be nil if err != nil { log.Panic(err) } fmt.Printf("Archived URL: %s\n", url) }
Output:
Types ¶
type ArchivedSnapshot ¶
type ArchivedSnapshot struct { Status string `json:"status"` Available bool `json:"available"` URL string `json:"url"` Timestamp time.Time `json:"timestamp"` }
func (ArchivedSnapshot) MarshalJSON ¶
func (a ArchivedSnapshot) MarshalJSON() ([]byte, error)
func (ArchivedSnapshot) String ¶
func (a ArchivedSnapshot) String() string
func (*ArchivedSnapshot) UnmarshalJSON ¶
func (a *ArchivedSnapshot) UnmarshalJSON(data []byte) error
type SnapshotData ¶
type SnapshotData struct { URL string `json:"url"` ArchivedSnapshots struct { Closest ArchivedSnapshot `json:"closest"` } `json:"archived_snapshots"` }
func GetSnapshotData ¶
func GetSnapshotData(url string, client *http.Client) (*SnapshotData, error)
GetSnapshotData retrieves snapshot data for the given URL from the Wayback Machine. It takes a URL and an http.Client as parameters. It returns a pointer to SnapshotData and any error encountered.
func (SnapshotData) String ¶
func (s SnapshotData) String() string
Click to show internal directories.
Click to hide internal directories.