updated to work with current amazon layout

This commit is contained in:
gutmet 2020-08-27 22:45:01 +02:00
parent 7c1cd3288d
commit 09e4d0313b

View File

@ -95,17 +95,15 @@ 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" })
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") {
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)
@ -115,7 +113,6 @@ func setDetails(b *book, doc *goutil.HtmlNode) {
}
}
}
}
func getPrice(doc *goutil.HtmlNode) string {
price := doc.GetElementsByClass("a-color-price")