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,23 +95,20 @@ func getAuthors(doc *goutil.HtmlNode) []string {
} }
func setDetails(b *book, doc *goutil.HtmlNode) { func setDetails(b *book, doc *goutil.HtmlNode) {
details := doc.GetElementById("detail-bullets") details := doc.GetElementById("productDetailsTable")
if details == nil { if details == nil {
details = doc.GetElementById("detail_bullets_id") details = doc.GetElementById("detailBullets_feature_div")
} }
if details != nil { if details != nil {
tmpcont := details.GetElementsByClass("content") cont := details.FindAll(func(n *goutil.HtmlNode) bool { return n.Type == html.ElementNode && n.Data == "li" })
if len(tmpcont) > 0 { for _, c := range cont {
cont := tmpcont[0].FindAll(func(n *goutil.HtmlNode) bool { return n.Type == html.ElementNode && n.Data == "li" }) line := c.Text()
for _, c := range cont { if strings.Contains(line, "Verlag") || strings.Contains(line, "Publisher") || strings.Contains(line, "Herausgeber") {
line := c.Text() b.publisher = readLine(line)
if strings.Contains(line, "Verlag") || strings.Contains(line, "Publisher") { } else if strings.Contains(line, "ISBN-10") {
b.publisher = readLine(line) b.isbn10 = readLine(line)
} else if strings.Contains(line, "ISBN-10") { } else if strings.Contains(line, "ISBN-13") {
b.isbn10 = readLine(line) b.isbn13 = readLine(line)
} else if strings.Contains(line, "ISBN-13") {
b.isbn13 = readLine(line)
}
} }
} }
} }