Add JSON scrape support (#717)

* Add support for scene fragment scrape in xpath
This commit is contained in:
WithoutPants
2020-08-10 14:21:50 +10:00
committed by GitHub
parent 470a2b5833
commit 7158e83b75
28 changed files with 5005 additions and 14 deletions

View File

@@ -8,17 +8,19 @@ const (
scraperActionScript scraperAction = "script"
scraperActionStash scraperAction = "stash"
scraperActionXPath scraperAction = "scrapeXPath"
scraperActionJson scraperAction = "scrapeJson"
)
var allScraperAction = []scraperAction{
scraperActionScript,
scraperActionStash,
scraperActionXPath,
scraperActionJson,
}
func (e scraperAction) IsValid() bool {
switch e {
case scraperActionScript, scraperActionStash, scraperActionXPath:
case scraperActionScript, scraperActionStash, scraperActionXPath, scraperActionJson:
return true
}
return false
@@ -47,6 +49,8 @@ func getScraper(scraper scraperTypeConfig, config config, globalConfig GlobalCon
return newStashScraper(scraper, config, globalConfig)
case scraperActionXPath:
return newXpathScraper(scraper, config, globalConfig)
case scraperActionJson:
return newJsonScraper(scraper, config, globalConfig)
}
panic("unknown scraper action: " + scraper.Action)