HLN, Parool: fix relatief xpath
This commit is contained in:
@@ -185,7 +185,7 @@ func doArticle(filename string, url string, timestamp time.Time, needUpdate bool
|
||||
article := articles[0]
|
||||
|
||||
tags := make([]string, 0)
|
||||
ell, err := article.Search(`//*[@data-content-type="LABEL"]`)
|
||||
ell, err := article.Search(`.//*[@data-content-type="LABEL"]`)
|
||||
p(err)
|
||||
for _, el := range ell {
|
||||
s := strings.TrimSpace(el.Content())
|
||||
@@ -196,7 +196,7 @@ func doArticle(filename string, url string, timestamp time.Time, needUpdate bool
|
||||
|
||||
pars := make([]string, 0)
|
||||
|
||||
ell, err = article.Search(`//*[@data-content-type="TITLE"]`)
|
||||
ell, err = article.Search(`.//*[@data-content-type="TITLE"]`)
|
||||
p(err)
|
||||
if len(ell) != 1 {
|
||||
_ = w(fmt.Errorf("found %d titles: %s", len(ell), url))
|
||||
@@ -209,7 +209,7 @@ func doArticle(filename string, url string, timestamp time.Time, needUpdate bool
|
||||
}
|
||||
|
||||
hasIntro := false
|
||||
ell, err = article.Search(`//*[@data-content-type="INTRO"]`)
|
||||
ell, err = article.Search(`.//*[@data-content-type="INTRO"]`)
|
||||
p(err)
|
||||
for _, el := range ell {
|
||||
s := strings.TrimSpace(el.Content())
|
||||
@@ -222,17 +222,17 @@ func doArticle(filename string, url string, timestamp time.Time, needUpdate bool
|
||||
_ = w(fmt.Errorf("no intro: %s", url))
|
||||
}
|
||||
|
||||
specials, err := article.Search(`//*[@data-content-type="GROUP"]`)
|
||||
specials, err := article.Search(`.//*[@data-content-type="GROUP"]`)
|
||||
p(err)
|
||||
for _, special := range specials {
|
||||
special.Remove()
|
||||
}
|
||||
|
||||
other, err := article.Search(`//*[@data-content-type="PODCAST"]`)
|
||||
other, err := article.Search(`.//*[@data-content-type="PODCAST"]`)
|
||||
p(err)
|
||||
hasOther := len(other) > 0
|
||||
|
||||
ell, err = article.Search(`//*[@data-content-type="PARAGRAPH"]`)
|
||||
ell, err = article.Search(`.//*[@data-content-type="PARAGRAPH"]`)
|
||||
p(err)
|
||||
if len(ell) == 0 && !hasOther && !hasIntro {
|
||||
_ = w(fmt.Errorf("no paragraphs: %s", url))
|
||||
|
||||
Reference in New Issue
Block a user