from flask import request
import re
def seen(element, manga=False):
read = 0
if manga:
available_matches = re.search(r"\[(\d+)\]|\[(\d+)\]", element)
read_matches = re.search(r" (\d+) /(\d+))*\s", element
)
if seen_matches:
read = int(seen_matches.group(1))
if len(available_matches) > 1:
return int(available_matches[1].strip("[]")) - read
elif len(available_matches) == 1:
return int(available_matches[0].strip("[]")) - read
else:
return 0
def page(main_content, footer):
message = 'Slow loads? If your media hasn\'t been cached in a while, the first load will take a couple seconds longer than the rest. Subsequent requests on cached media should be faster. Hide forever
'
if request.cookies.get("hide_message") == "1":
message = ""
return f"""
期限
{main_content}
{footer}
{message}
"""