From 09e4d0313b4f9a8e5c59f4af667d02cb2a6e777a Mon Sep 17 00:00:00 2001 From: gutmet Date: Thu, 27 Aug 2020 22:45:01 +0200 Subject: [PATCH] updated to work with current amazon layout --- ambrowse.go | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/ambrowse.go b/ambrowse.go index 097137f..babc2dc 100644 --- a/ambrowse.go +++ b/ambrowse.go @@ -95,23 +95,20 @@ func getAuthors(doc *goutil.HtmlNode) []string { } func setDetails(b *book, doc *goutil.HtmlNode) { - details := doc.GetElementById("detail-bullets") + details := doc.GetElementById("productDetailsTable") if details == nil { - details = doc.GetElementById("detail_bullets_id") + details = doc.GetElementById("detailBullets_feature_div") } if details != nil { - tmpcont := details.GetElementsByClass("content") - if len(tmpcont) > 0 { - cont := tmpcont[0].FindAll(func(n *goutil.HtmlNode) bool { return n.Type == html.ElementNode && n.Data == "li" }) - for _, c := range cont { - line := c.Text() - if strings.Contains(line, "Verlag") || strings.Contains(line, "Publisher") { - b.publisher = readLine(line) - } else if strings.Contains(line, "ISBN-10") { - b.isbn10 = readLine(line) - } else if strings.Contains(line, "ISBN-13") { - b.isbn13 = readLine(line) - } + cont := details.FindAll(func(n *goutil.HtmlNode) bool { return n.Type == html.ElementNode && n.Data == "li" }) + for _, c := range cont { + line := c.Text() + if strings.Contains(line, "Verlag") || strings.Contains(line, "Publisher") || strings.Contains(line, "Herausgeber") { + b.publisher = readLine(line) + } else if strings.Contains(line, "ISBN-10") { + b.isbn10 = readLine(line) + } else if strings.Contains(line, "ISBN-13") { + b.isbn13 = readLine(line) } } }