Skip to content

saveweb/gospn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gospn

Save Page Now client in Go

Set environment variable GOSPN_DEBUG to 1 to enable debug output.

Usage

c, _ := spn.Init("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY")
defer c.Close()
options := spn.CaptureOptions{
    SkipFirstArchive:    true,
    IfNotArchivedWithin: "3d",
    ... More options ...
}
url := "https://example.com"
captureResp, err = c.Capture(url, options)

Some possible capture responses:

{"url":"https://example.com/","job_id":"spn2-0123456789abcdef0123456789abcdef12345678"}
{"message": "Cannot resolve host nxdomain.fake.tld.", "status": "error", "status_ext": "error:invalid-host-resolution"}
{"url":"https://example.com/","job_id":null,"message":"The same snapshot had been made 3 minutes ago. You can make new capture of this URL after 2 hours."}

Note

Capture() will return immediately after sending the request to the Save Page Now API. The actual capture process may take a while to complete. You can use the GetCaptureStatus() method to check the status of the capture job.

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%