Cache html pages (in case build fails or is interrupted so we can quickly resume)

This commit is contained in:
Reinhard Pointner 2016-04-10 15:24:15 +00:00
parent 0ac1490f1e
commit af4b46413b
1 changed files with 5 additions and 1 deletions

View File

@ -248,7 +248,11 @@ tvdb_updates.values().each{ update ->
}
// scrape extra alias titles from webpage (not supported yet by API)
def jsoup = org.jsoup.Jsoup.connect("http://thetvdb.com/?tab=series&id=${update.id}").get()
def html = Cache.getCache('thetvdb_series_page', CacheType.Persistent).text(update.id) {
return new URL("http://thetvdb.com/?tab=series&id=${it}")
}.expire(Cache.ONE_MONTH).get()
def jsoup = org.jsoup.Jsoup.parse(html)
def akaseries = jsoup.select('#akaseries table tr table tr')
.findAll{ it.select('td').any{ it.text() ==~ /en/ } }
.findResults{ it.select('td').first().text() }