我正在尝试登录我的亚马逊买家帐户以获取跟踪信息。我做了 wordpress-woocommerce 登录并获取信息,但我不能登录亚马逊。
package main
import (
"fmt"
"log"
"github.com/gocolly/colly"
)
func main() {
// create a new collector
c := colly.NewCollector()
login_link := "https://www.amazon.de/-/en/ap/signin?openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.de%2F%3Flanguage%3Den_GB%26ref_%3Dnav_signin&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.assoc_handle=deflex&openid.mode=checkid_setup&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&"
// authenticate
err := c.Post(login_link, map[string]string{"username": "mail@example.com", "password": "123qwerty"})
if err != nil {
log.Fatal(err)
}
// attach callbacks after login
c.OnResponse(func(r *colly.Response) {
log.Println("response received", r.StatusCode) //response received 200
})
c.OnHTML("div", func(h *colly.HTMLElement) {
fmt.Println("PRINT ALL: ", h.Text)
})
// start scraping
c.Visit("https://www.amazon.de/-/en/gp/your-account/order-history?ref_=ya_d_c_yo")
}
Wordpress 登录一页 - 亚马逊登录两页。我们可能需要为亚马逊滚动 2 页
https://i.stack.imgur.com/4TNj5.png -> Wordpress 登录(一页)
https://i.stack.imgur.com/bhE4m.png -> 亚马逊登录(第 1 页 - 邮件)
https://i.stack.imgur.com/0BFcA.png -> 亚马逊登录(第 1 页 - 密码)