Fix Tapastic scraper for comics with episode list in ascending order

This commit is contained in:
Techwolf 2021-01-21 01:41:26 -08:00
parent 2d56f94170
commit 67f787c589

View file

@ -10,7 +10,6 @@ class Tapastic(_ParserScraper):
imageSearch = '//article[contains(@class, "js-episode-article")]//img/@data-src' imageSearch = '//article[contains(@class, "js-episode-article")]//img/@data-src'
prevSearch = '//a[contains(@class, "js-prev-ep-btn")]' prevSearch = '//a[contains(@class, "js-prev-ep-btn")]'
latestSearch = '//ul[contains(@class, "js-episode-list")]//a' latestSearch = '//ul[contains(@class, "js-episode-list")]//a'
starter = indirectStarter
multipleImagesPerStrip = True multipleImagesPerStrip = True
def __init__(self, name, url): def __init__(self, name, url):
@ -18,6 +17,16 @@ class Tapastic(_ParserScraper):
self.url = self.baseUrl + 'series/' + url + '/info' self.url = self.baseUrl + 'series/' + url + '/info'
self.stripUrl = self.baseUrl + 'episode/%s' self.stripUrl = self.baseUrl + 'episode/%s'
def starter(self):
# Retrieve comic metadata from info page
info = self.getPage(self.url)
series = info.xpath('//@data-series-id')[0]
# Retrieve comic metadata from API
data = self.session.get(self.baseUrl + 'series/' + series + '/episodes?sort=NEWEST')
data.raise_for_status()
episodes = data.json()['data']['body']
return self.stripUrl % episodes.split('data-id="')[1].split('"')[0]
def getPrevUrl(self, url, data): def getPrevUrl(self, url, data):
# Retrieve comic metadata from API # Retrieve comic metadata from API
data = self.session.get(url + '/info') data = self.session.get(url + '/info')