updated to work with current amazon layout
This commit is contained in:
parent
7c1cd3288d
commit
09e4d0313b
25
ambrowse.go
25
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user