aboutsummaryrefslogtreecommitdiff
path: root/archive.go
diff options
context:
space:
mode:
Diffstat (limited to 'archive.go')
-rw-r--r--archive.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/archive.go b/archive.go
index 9397797..5c9a322 100644
--- a/archive.go
+++ b/archive.go
@@ -22,8 +22,9 @@ var (
)
type Save struct {
- URL string `json:"url"`
- Job string `json:"job_id"`
+ URL string `json:"url"`
+ Job string `json:"job_id"`
+ Message string `json:"message"`
}
type Wayback struct {
@@ -68,7 +69,7 @@ func isArchived(url string) (bool, int) {
return av.Snapshots.Recent.Available, status
}
-func archive(accessKey string, secretKey string, URL string) (int, string) {
+func archive(accessKey string, secretKey string, URL string) (int, string, string) {
params := url.Values{}
params.Set("url", URL)
@@ -85,14 +86,14 @@ func archive(accessKey string, secretKey string, URL string) (int, string) {
if e, _ := err.(net.Error); !e.Timeout() {
log.Println("SAVE", err)
}
- return 0, ""
+ return 0, "", ""
}
defer resp.Body.Close()
save := &Save{}
decoder := json.NewDecoder(resp.Body)
if err := decoder.Decode(save); err != nil {
log.Println("SAVE", err)
- return 0, ""
+ return 0, "", ""
}
- return resp.StatusCode, save.Job
+ return resp.StatusCode, save.Job, save.Message
}