/gogoamazonwish

A Go library to get items from an Amazon wishlist.

Primary LanguageGoMIT LicenseMIT

GoGo Amazon Wish

A Go library to get items from an Amazon wishlist. Unofficial as Amazon shut down their wishlist API. This uses web scraping to get the items off a specified wishlist.

How to use

See the docs.

go get -u github.com/cheshire137/gogoamazonwish/pkg/amazon
import (
  "fmt"
  "log"

  "github.com/cheshire137/gogoamazonwish/pkg/amazon"
)

func main() {
  url := "https://www.amazon.com/hz/wishlist/ls/3I6EQPZ8OB1DT"
  wishlist, err := amazon.NewWishlist(url)
  if err != nil {
    log.Fatalln(err)
  }

  items, err := wishlist.Items()
  if err != nil {
    log.Fatalln(err)
  }

  fmt.Printf("Found %d item(s):\n\n", len(items))
  number := 1
  for _itemID, item := range items {
    fmt.Printf("%d) %s\n\n", number, item)
    number++
  }
}

How to develop

I built this with Go version 1.13.4. There's a command-line tool to test loading an Amazon wishlist that you can run via:

go run cmd/getwishlist/main.go URL to Amazon wishlist [proxy URL]...

You can specify optional proxy URLs to hit Amazon with. Might be useful if you're hitting errors about Amazon thinking the tool is a bot.

Sample use:

go run cmd/getwishlist/main.go "https://www.amazon.com/hz/wishlist/ls/3I6EQPZ8OB1DT"

To run tests: make

Thanks