Print a warning if a Tapas page needs a login

This commit is contained in:
Tobias Gruetzmacher 2022-06-06 02:27:22 +02:00
parent 1d9b74bd66
commit f1e29703bc

View file

@ -1,7 +1,9 @@
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# Copyright (C) 2019-2022 Tobias Gruetzmacher # 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 ..scraper import _ParserScraper
from ..xml import NS
class Tapas(_ParserScraper): class Tapas(_ParserScraper):
@ -40,6 +42,12 @@ class Tapas(_ParserScraper):
self.imageUrls = super().fetchUrls(url, data, urlSearch) self.imageUrls = super().fetchUrls(url, data, urlSearch)
return self.imageUrls 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): def namer(self, imageUrl, pageUrl):
# Construct filename from episode number and image position on page # Construct filename from episode number and image position on page
episodeNum = pageUrl.rsplit('/', 1)[-1] episodeNum = pageUrl.rsplit('/', 1)[-1]