[tapas] fix TypeError for locked episodes (#6700)

This commit is contained in:
Mike Fährmann
2024-12-21 15:17:51 +01:00
parent 454f766f5e
commit 18491a4ce6
3 changed files with 77 additions and 4 deletions

View File

@@ -85,8 +85,8 @@ class TapasEpisodeExtractor(TapasExtractor):
episode = data["episode"]
if not episode.get("free") and not episode.get("unlocked"):
raise exception.AuthorizationError(
"%s: Episode '%s' not unlocked",
episode_id, episode["title"])
"{}: Episode '{}' not unlocked".format(
episode_id, episode["title"]))
html = data["html"]
episode["series"] = self._extract_series(html)

View File

@@ -6,5 +6,5 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
__version__ = "1.28.2"
__version__ = "1.28.3-dev"
__variant__ = None

View File

@@ -5,6 +5,7 @@
# published by the Free Software Foundation.
from gallery_dl.extractor import tapas
from gallery_dl import exception
__tests__ = (
@@ -25,7 +26,7 @@ __tests__ = (
{
"#url" : "https://tapas.io/episode/2068651",
"#comment" : "html",
"#comment" : "book / html",
"#class" : tapas.TapasEpisodeExtractor,
"#pattern" : "^text:",
"#sha1_url": "0b53644c864a0a097f65accea6bb620be9671078",
@@ -72,6 +73,78 @@ __tests__ = (
},
},
{
"#url" : "https://tapas.io/episode/2717154",
"#comment" : "comic / jpg",
"#class" : tapas.TapasEpisodeExtractor,
"#pattern" : r"https://us-a\.tapas\.io/pc/\w\w/[0-9a-f-]{36}(-\d)?\.jpg\?__token__=.+",
"#count" : 63,
"book" : False,
"closing" : None,
"closing_date" : None,
"comment_cnt" : 335,
"date" : "dt:2023-01-13 19:00:00",
"early_access" : False,
"escape_title" : "Episode 3",
"extension" : "jpg",
"filename" : str,
"free" : True,
"free_access" : False,
"has_bgm" : False,
"id" : 2717154,
"like_cnt" : range(7000, 20000),
"liked" : False,
"mature" : False,
"must_pay" : False,
"next_ep_id" : 2717157,
"nsfw" : False,
"nu" : False,
"num" : range(1, 63),
"open_comments": True,
"pending_scene": 3,
"prev_ep_id" : 2717153,
"publish_date" : "2023-01-13T19:00:00Z",
"read" : False,
"related_ep_id": None,
"relative_publish_date": "Jan 13, 2023",
"scene" : 3,
"scheduled" : False,
"thumb_url" : "https://us-a.tapas.io/sa/f9/a42d3c2f-d642-4481-9583-1d3bacbd302b.png",
"title" : "Episode 3",
"unlock_cnt" : 0,
"unlocked" : False,
"view_cnt" : range(70000, 200000),
"series" : {
"badges" : list,
"book" : False,
"comic" : True,
"discount_rate" : int,
"escape_title" : "The Doctor Is Out",
"genre" : dict,
"has_book_cover": True,
"has_top_banner": True,
"id" : 251031,
"item_type" : None,
"on_sale_now" : False,
"premium" : True,
"sale_type" : "WAIT_OR_MUST_PAY",
"subscribed" : False,
"thumb_url" : "https://us-a.tapas.io/sa/32/7e1daa84-8951-4a53-9574-48ca7d0b0aca_m.jpg",
"thumbsup_cnt" : range(240000, 500000),
"title" : "The Doctor Is Out",
"type" : "COMICS",
"url" : "the-doctor-is-out",
},
},
{
"#url" : "https://tapas.io/episode/2717157",
"#comment" : "locked",
"#class" : tapas.TapasEpisodeExtractor,
"#exception": exception.AuthorizationError,
},
{
"#url" : "https://tapas.io/SANG123/series",
"#comment" : "#5306",