From 2d56f9417030410ecb606ee6aa5dc8ea58633f83 Mon Sep 17 00:00:00 2001 From: Techwolf Date: Fri, 19 Jun 2020 23:12:53 -0700 Subject: [PATCH] Fix Tapastic scraper --- dosagelib/plugins/tapastic.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dosagelib/plugins/tapastic.py b/dosagelib/plugins/tapastic.py index 1be31c225..4cf83777b 100644 --- a/dosagelib/plugins/tapastic.py +++ b/dosagelib/plugins/tapastic.py @@ -1,9 +1,6 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2019-2020 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -import json -import re - from ..scraper import _ParserScraper from ..helpers import indirectStarter @@ -18,9 +15,18 @@ class Tapastic(_ParserScraper): def __init__(self, name, url): super(Tapastic, self).__init__('Tapastic/' + name) - self.url = self.baseUrl + 'series/' + url + self.url = self.baseUrl + 'series/' + url + '/info' self.stripUrl = self.baseUrl + 'episode/%s' + def getPrevUrl(self, url, data): + # Retrieve comic metadata from API + data = self.session.get(url + '/info') + data.raise_for_status() + apiData = data.json()['data'] + if apiData['scene'] == 2: + self.firstStripUrl = self.stripUrl % apiData['prev_ep_id'] + return self.stripUrl % apiData['prev_ep_id'] + def fetchUrls(self, url, data, urlSearch): # Save link order for position-based filenames self.imageUrls = super().fetchUrls(url, data, urlSearch)