blob: 5cd518eb3d41d48987993044074329eaed7e0723 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
from flask import request
import re
def seen(element, manga=False):
read = 0
if manga:
available_matches = re.search(r"\[<a href=\".*\">(\d+)</a>\]|\[(\d+)\]", element)
read_matches = re.search(r"</a> (\d+) <a href=\"/anilist", element)
if read_matches:
read = int(read_matches.group(1))
if available_matches:
return int(available_matches.group(1) or re.sub(r"[\[\]]", '', available_matches.group(0))) - read
else:
return 0
available_matches = re.findall(r"\d+\]|\[\d+", element)
seen_matches = re.search(
r"\s(\d+)*?(<span style=\"opacity: 50%\">/(\d+)</span>)*\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 = '<blockquote>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. <a href="/?hide_message">Hide <i>forever</i></a></blockquote>'
if request.cookies.get("hide_message") == "1":
message = ""
return f"""
<!DOCTYPE html>
<html>
<head>
<title>期限</title>
<link rel="stylesheet" type="text/css" href="https://latex.now.sh/style.css">
<link rel="stylesheet" type="text/css" href="https://skybox.sh/css/palettes/base16-light.css">
<link rel="stylesheet" type="text/css" href="https://skybox.sh/css/risotto.css">
<!-- <link rel="stylesheet" type="text/css" href="https://skybox.sh/css/custom.css"> -->
<link rel="shortcut icon" type="image/x-icon" href="https://ps.fuwn.me/-tePaWtKW2y/angry-miku-nakano.ico">
</head>
<body>
<style>text-align: center;</style>
<h1><a href="/">期限</a></h1>
{main_content}
<p></p>
<hr>
<p>{footer}</p>
{message}
</body>
</html>
"""
|