Skip to content

Commit

Permalink
Merge pull request #121 from jakopako:jakopako/issue116
Browse files Browse the repository at this point in the history
bug in root selector extraction
  • Loading branch information
jakopako authored Sep 12, 2022
2 parents 99072e0 + cb6ee1f commit 33c39e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
14 changes: 9 additions & 5 deletions config-gen.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
scrapers:
- name: ""
url: https://www.goodreads.com/quotes/tag/life
item: body > div.content > div.mainContentContainer > div.mainContent > div.mainContentFloat > div.leftContainer > div.quote.mediumText > div.quoteDetails
- name: "Luxor"
url: https://www.luxor-koeln.de/programm/
item: body.page-template.page-template-page-events.page-template-page-events-php.page.page-id-26.wp-embed-responsive.preload > main.content > article.article.post-26.page.type-page.status-publish.hentry > section.events-overview.alignwide > div.events-overview__listing > article.event-sneak-peek.event.type-event.status-publish.has-post-thumbnail.hentry
fields:
dynamic:
- name: field-0
type: text
location:
selector: div.quoteText > span.authorOrTitle
selector: div.event-sneak-peek__meta > div.event-sneak-peek__time
- name: field-1
type: text
location:
selector: div.quoteText
selector: div.event-sneak-peek__meta > div.event-sneak-peek__date
- name: field-2
type: text
location:
selector: div.event-sneak-peek__content > h3.event-sneak-peek__title > a
3 changes: 2 additions & 1 deletion generate/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ outer:
c = selectorToPath(e.Selector)[i]
} else {
if selectorToPath(e.Selector)[i] != c {
itemSelector = pathToSelector(selectorToPath(e.Selector)[:i-1])
itemSelector = pathToSelector(selectorToPath(e.Selector)[:i])
break outer
}
}
Expand Down Expand Up @@ -263,6 +263,7 @@ parse:
}
ns = append(ns, ni)
}
// ns := []int{0, 3, 4}
var fs []scraper.ElementLocation
for _, n := range ns {
if n >= len(locMan) {
Expand Down

0 comments on commit 33c39e5

Please sign in to comment.