From f1e29703bccde47189d442bfe58d88eeb70434c7 Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Mon, 6 Jun 2022 02:27:22 +0200 Subject: [PATCH] Print a warning if a Tapas page needs a login --- dosagelib/plugins/tapas.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dosagelib/plugins/tapas.py b/dosagelib/plugins/tapas.py index be860621b..ffcb45432 100644 --- a/dosagelib/plugins/tapas.py +++ b/dosagelib/plugins/tapas.py @@ -1,7 +1,9 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2019-2022 Tobias Gruetzmacher -# Copyright (C) 2019-2020 Daniel Ring +# Copyright (C) 2019-2022 Daniel Ring +from ..output import out from ..scraper import _ParserScraper +from ..xml import NS class Tapas(_ParserScraper): @@ -40,6 +42,12 @@ class Tapas(_ParserScraper): self.imageUrls = super().fetchUrls(url, data, urlSearch) return self.imageUrls + def shouldSkipUrl(self, url, data): + if data.xpath('//button[d:class("js-have-to-sign")]', namespaces=NS): + out.warn(f'Nothing to download on "{url}", because a login is required.') + return True + return False + def namer(self, imageUrl, pageUrl): # Construct filename from episode number and image position on page episodeNum = pageUrl.rsplit('/', 1)[-1]