Repos / pytaku / 93b3f3f035
commit 93b3f3f035cfcd077151862a6ea18d2e22bb5c25
Author: Bùi Thành Nhân <hi@imnhan.com>
Date: Mon Sep 21 07:33:53 2020 +0700
filter out chapters not yet accessible
diff --git a/pyproject.toml b/pyproject.toml
index be89ed1..4ed6912 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pytaku"
-version = "0.3.21"
+version = "0.3.22"
description = "Self-hostable web-based manga reader"
authors = ["Bùi Thành Nhân <hi@imnhan.com>"]
license = "AGPL-3.0-only"
diff --git a/src/mangoapi/mangadex.py b/src/mangoapi/mangadex.py
index 425218f..ceab26f 100644
--- a/src/mangoapi/mangadex.py
+++ b/src/mangoapi/mangadex.py
@@ -1,5 +1,6 @@
import html
import re
+import time
from mangoapi.base_site import Site, requires_login
@@ -14,6 +15,8 @@ def get_title(self, title_id):
cover = md_json["manga"]["cover_url"].split("/")[-1]
cover_ext = cover[cover.find(".") + 1 : cover.rfind("?")]
+ current_timestamp = time.time()
+
title = {
"id": title_id,
"name": md_json["manga"]["title"],
@@ -32,7 +35,12 @@ def get_title(self, title_id):
**_parse_chapter_number(chap["chapter"]),
}
for chap_id, chap in md_json.get("chapter", {}).items()
- if chap["lang_code"] == "gb" and chap["group_name"] != "MangaPlus"
+ if chap["lang_code"] == "gb"
+ and chap["group_name"] != "MangaPlus"
+ and chap["timestamp"] <= current_timestamp
+ # ^ Chapter may be listed but with access delayed for a certain amount
+ # of time set by uploader, in which case we just filter it out. God I
+ # hate this generation of Patreon "scanlators".
],
}
return title