Compare commits
1878 Commits
feature/fa
...
fe5534b006
| Author | SHA1 | Date | |
|---|---|---|---|
|
fe5534b006
|
|||
|
|
6ca07aeff7 | ||
|
19567f9642
|
|||
|
4a854c7a23
|
|||
|
|
312b617b95 | ||
| 0a0a869e88 | |||
|
|
8573921243 | ||
|
|
b8d3124227 | ||
|
|
14e23694fd | ||
|
|
7e25002dba | ||
|
|
a94d9bf8b8 | ||
|
|
7430c7386e | ||
|
|
5f99e694c8 | ||
|
|
25b23854d8 | ||
|
|
45d39fe94d | ||
|
|
21b63c1d77 | ||
|
|
f64ce0f4a2 | ||
|
|
b3e7d8e8d5 | ||
|
|
8a147dbdd3 | ||
|
|
5a039acf82 | ||
|
|
e9469ae0e0 | ||
|
|
48cfc3347b | ||
|
|
1566b807b7 | ||
|
|
8bed45dd2f | ||
|
|
36c3a88d63 | ||
|
16f5129b69
|
|||
|
|
674290d029 | ||
|
|
6cb6873fcb | ||
|
|
705a684cc2 | ||
|
|
de76ccf753 | ||
|
|
cbd74dd7df | ||
|
|
7f39798a8c | ||
|
|
31999d97a0 | ||
|
|
fd0df2414e | ||
|
|
a93140fc36 | ||
|
|
7c264b6af7 | ||
|
|
134656b835 | ||
|
|
8964bb1584 | ||
|
|
8bee71342b | ||
|
|
a4824a3582 | ||
|
|
6fb4cc608c | ||
|
|
12aa4479cd | ||
|
|
bfdb10d002 | ||
|
|
f61f5329e3 | ||
|
|
0477fe0659 | ||
|
|
6b3329436f | ||
|
|
35fd5042a7 | ||
|
|
d366628a20 | ||
|
|
5483453f35 | ||
|
|
02ac1cb896 | ||
|
|
1563783afe | ||
|
|
f5436977a9 | ||
|
|
b58cf32b7a | ||
|
|
38025a6b35 | ||
|
|
96a2d9e0ac | ||
|
|
c9ebbfa1bf | ||
|
|
91ec95448c | ||
|
|
b5512e7574 | ||
|
|
8bc7480d84 | ||
|
|
db9a7161f4 | ||
|
74d0951d3d
|
|||
|
91d5eff20a
|
|||
|
|
54d6b2a2bb | ||
|
|
66cd27a673 | ||
|
|
137490001a | ||
|
|
c85dac5e0e | ||
|
|
9a9102fa33 | ||
|
|
0d31adb20b | ||
|
|
df7f2d1a89 | ||
|
|
eaca421132 | ||
|
|
5f1f2df7f0 | ||
|
|
ed21a5b397 | ||
|
|
39703e3ebb | ||
|
|
14cff0d651 | ||
|
|
af89f42251 | ||
|
|
036ce155ae | ||
|
|
177d014b13 | ||
|
|
7c74ff6177 | ||
|
|
b139586df5 | ||
|
|
15c7f97432 | ||
|
|
f22c8f9e7c | ||
|
|
b24baf7d93 | ||
|
|
98e0f6cd6c | ||
|
|
e7316b5cd0 | ||
|
|
33a0a68ac7 | ||
|
a83baf4c12
|
|||
|
307f2090f6
|
|||
|
|
e73d636979 | ||
|
|
77fb7270ce | ||
|
9d35f26252
|
|||
|
4eeb879451
|
|||
|
06aa701ab1
|
|||
|
|
3c55b68beb | ||
|
|
63f37d159a | ||
|
|
cb74c43f71 | ||
|
|
798b7570fe | ||
|
|
9197b82e0d | ||
|
|
ad45480439 | ||
|
|
9493ff1630 | ||
|
|
8ee46ad2d1 | ||
|
|
ba1b35522c | ||
|
|
41c37c025a | ||
|
|
9995657da5 | ||
|
|
1569275cd4 | ||
|
|
352d998680 | ||
|
|
d0b2002a1b | ||
|
5962efb7df
|
|||
|
|
8b18d1f0f8 | ||
|
|
97ca214815 | ||
|
|
5d9b56296b | ||
|
|
66f25c30fc | ||
|
|
fd197de86a | ||
|
|
5f7478b33c | ||
|
|
b058477b67 | ||
|
|
149d9e5a81 | ||
|
|
6420def95a | ||
|
|
5dae26ce0b | ||
|
|
b5fddadb18 | ||
|
|
613d1cd1a1 | ||
|
|
a6a72064bb | ||
|
|
73c0a4f606 | ||
|
|
1d2ee20d17 | ||
|
|
67b556c2eb | ||
|
|
3962c87e1d | ||
|
|
e6ca455254 | ||
|
|
d481ff416f | ||
|
|
b0236e492d | ||
|
|
497321bfa8 | ||
|
|
eff26f6303 | ||
|
|
b5bd5b8cdf | ||
|
|
4cc15daba3 | ||
|
248d51321a
|
|||
|
7cb9a264de
|
|||
|
|
b58e9ff328 | ||
|
|
958e0bed5c | ||
|
|
e8d4143d72 | ||
|
|
079b2346f1 | ||
|
|
553615b3ff | ||
|
f8992457dc
|
|||
|
|
06a9209b9e | ||
|
|
4c0b873013 | ||
|
dba7f46f73
|
|||
|
8665186426
|
|||
|
b5c6a94311
|
|||
|
1540021f6f
|
|||
|
0e1247476e
|
|||
|
|
bf83909349 | ||
|
|
e398a01f14 | ||
|
|
0e77938ade | ||
|
|
a4a9a1cf67 | ||
|
|
3f9544fdb8 | ||
|
|
bd30fc35a1 | ||
|
|
b6f82cc282 | ||
|
|
9222079e98 | ||
|
|
49158b99d5 | ||
|
|
3fe61a09b7 | ||
|
|
b82ad1356e | ||
|
|
b825d06b22 | ||
|
|
28f5856f9e | ||
|
|
19751674ee | ||
|
|
a78afba15e | ||
|
|
0e946cf84c | ||
|
|
6cd29603ac | ||
|
|
d94cf53624 | ||
|
|
c81628c027 | ||
|
bcde8ef2a2
|
|||
|
66df6caa67
|
|||
|
|
08e53b2f5f | ||
|
|
7c83730ad0 | ||
|
|
d2a026c054 | ||
|
|
faf8f6ffd7 | ||
|
|
6c372548db | ||
|
|
0029697350 | ||
|
|
bdcf27b955 | ||
|
|
bb7ac26c0c | ||
|
|
7b42317996 | ||
|
|
103b0e7eb6 | ||
|
|
fa80598e7c | ||
|
|
3cb5367028 | ||
|
|
9417d1f973 | ||
|
|
173d30737b | ||
|
|
0db45877b7 | ||
|
|
e7fac812a7 | ||
|
|
ab26e6b3d0 | ||
|
|
baafc29967 | ||
|
|
b0bd3e99a4 | ||
|
|
6bf377a654 | ||
|
|
3d78b9003d | ||
|
|
f57722ec54 | ||
|
9558a34b00
|
|||
|
|
522e3af41d | ||
|
7b1a0b8d0d
|
|||
|
5856681753
|
|||
|
|
f066be47fe | ||
|
|
884142a15e | ||
|
|
d7267b20fd | ||
|
|
0537cdd533 | ||
|
|
c5f939df70 | ||
|
|
6854164e5a | ||
|
|
1e942c650b | ||
|
|
30a06b67d8 | ||
|
|
34a1dabae4 | ||
|
|
23227a0427 | ||
|
|
02d1aef77c | ||
|
|
39ebdacef9 | ||
|
|
276349e23c | ||
|
|
0507ed8d59 | ||
|
|
2f8a0fe775 | ||
|
|
aab7e9360a | ||
|
|
9db443f7f7 | ||
|
|
70ce9eb008 | ||
|
|
a58947376c | ||
|
|
cbb70f94dd | ||
|
9408b9ba1b
|
|||
|
409828d22f
|
|||
|
|
c9d32a804c | ||
|
|
a65cbf4981 | ||
|
|
e325063260 | ||
|
cf0177364c
|
|||
|
|
8eaad2270b | ||
|
|
362f9c6786 | ||
|
|
3047949b22 | ||
|
|
8d7c81c8ef | ||
|
|
7d6e12d1fc | ||
|
|
7a0f1af06a | ||
|
|
21aaa23586 | ||
|
|
95fcbd44fd | ||
|
|
cc98931147 | ||
|
|
8f61beadb2 | ||
|
|
6d404c6997 | ||
|
|
27060cfef0 | ||
|
|
ca3d8f555a | ||
|
|
7ea59a7bf1 | ||
|
|
cea4db9619 | ||
|
|
e7c3168099 | ||
|
|
b165a0d611 | ||
|
|
43e6c7c86f | ||
|
|
346828402b | ||
|
|
01d67eca2e | ||
|
|
4445b666aa | ||
|
|
adf0b4e397 | ||
|
|
e797cabd88 | ||
|
|
0c32b56378 | ||
|
|
5c9c2c3a7a | ||
|
|
7cd7180adb | ||
|
|
4b6b585801 | ||
|
|
1cf2153df0 | ||
|
|
6ed104aeca | ||
|
|
9ba1629065 | ||
|
|
669709dfbb | ||
|
|
b5cb310aab | ||
|
|
50771771a8 | ||
|
|
dce24e2005 | ||
|
|
d3a61f6556 | ||
|
|
8cdd7effe5 | ||
|
|
e389b01d35 | ||
|
|
2c9632e3e5 | ||
|
|
2fff92b023 | ||
|
|
c949b95dab | ||
|
|
da145c7f41 | ||
|
|
16b8bf9328 | ||
|
f076c8095a
|
|||
|
d2b2578a3a
|
|||
|
b24741678c
|
|||
|
|
fecb1db3be | ||
|
|
6418422157 | ||
|
|
7718ff28e7 | ||
|
|
3771b8d26b | ||
|
|
c1357b46fb | ||
|
|
6c9f6eaae5 | ||
|
|
309b6405f9 | ||
|
|
9058ead462 | ||
|
|
162436c913 | ||
|
|
876f3a3d3a | ||
|
|
02acc7e9d4 | ||
|
e874837efb
|
|||
|
|
c294f5bb61 | ||
|
|
826c948260 | ||
|
|
a5c70f0b51 | ||
|
|
c2f9c18e29 | ||
|
|
91cd239c97 | ||
|
|
4d255d0d53 | ||
|
|
d5a1e1a52f | ||
|
9abc80880f
|
|||
|
|
8d91adbd6e | ||
|
|
20a24db949 | ||
|
b837659408
|
|||
|
|
696e0bc8f6 | ||
|
|
2ec2484982 | ||
|
|
738e2649d6 | ||
|
|
8e9da4e39f | ||
|
|
da3a9a7d9b | ||
|
|
8f9c0d93f6 | ||
|
|
8bb0c4f4f1 | ||
|
dbb04d2051
|
|||
|
|
84562d7b36 | ||
|
|
29327dafd0 | ||
|
|
c0d12b0c83 | ||
|
a0041f3c93
|
|||
|
2175e91db7
|
|||
|
|
5fa7590550 | ||
|
|
f3ae64ed1f | ||
|
cc437b8cd4
|
|||
|
|
db0782c61a | ||
|
|
bbf059ff35 | ||
|
|
bebc615376 | ||
|
|
77616a5404 | ||
|
|
45584f2eea | ||
|
|
1c3e59f9f0 | ||
|
|
a88de5b1b6 | ||
|
|
91977ba025 | ||
|
|
5420290564 | ||
|
|
98c21db8da | ||
|
|
23953cae11 | ||
|
|
9cd310ba51 | ||
|
|
51311a17fb | ||
|
|
6799d79754 | ||
|
|
e429cdd811 | ||
|
|
2e5ce98bac | ||
|
|
68c3a7148f | ||
|
|
2a1c5bc6da | ||
|
|
6fd18543ef | ||
|
ae76631aaf
|
|||
|
|
ca59e8e577 | ||
|
|
3648b36d16 | ||
|
|
439b7862a3 | ||
|
|
f4b975c865 | ||
|
|
da02a82d74 | ||
|
|
0d5498e60d | ||
|
0847baf17b
|
|||
|
adf5794ad3
|
|||
|
|
cfeea09a05 | ||
|
|
e9bcb1abed | ||
|
|
35cf827c90 | ||
|
|
a10c34115b | ||
|
|
2f4e93e391 | ||
|
|
6ed42bc28b | ||
|
|
dc7c859344 | ||
|
a82e41aabb
|
|||
|
|
3c62f4280f | ||
|
|
f806cdd118 | ||
|
|
224c8a6c53 | ||
|
|
408be7fa3c | ||
|
|
a02b001768 | ||
|
|
5edbdf801a | ||
|
|
cc3701250a | ||
|
|
e94d434f92 | ||
|
|
4d3adaa143 | ||
|
|
36eecf781f | ||
|
|
76f44c98be | ||
|
|
d660d9a30f | ||
|
|
8326ee8c29 | ||
|
|
690a004de6 | ||
|
|
98c6454eba | ||
|
|
8e42ef1229 | ||
|
|
02359a2630 | ||
|
|
158f6f4232 | ||
|
|
77de194b83 | ||
|
|
85cd13c8b2 | ||
|
|
bfbd01b1c2 | ||
|
e83636edc0
|
|||
|
63dc67b6fd
|
|||
|
b0de4c3b66
|
|||
|
|
d5a4cf68c6 | ||
|
|
288d6e0b8f | ||
|
|
aa98db9ac6 | ||
|
|
c19e1fd5e5 | ||
|
|
ef10e3cafc | ||
|
|
400c423dde | ||
|
|
85ba4fa0de | ||
|
|
8cb913d538 | ||
|
|
2128bbe1b6 | ||
|
|
4df07a50fb | ||
|
|
8fa63bca64 | ||
|
|
e191e0c9c1 | ||
|
|
5970509886 | ||
|
|
b2c7d1028c | ||
|
|
377606d1aa | ||
|
|
688bfdaa82 | ||
|
|
bc60629e66 | ||
|
|
f3372751d1 | ||
|
|
77a5216ebf | ||
|
|
7ced91beea | ||
|
|
41f5cee6c6 | ||
|
|
ba5086c409 | ||
|
531145c7f9
|
|||
|
f26fecb714
|
|||
|
|
dd7568659f | ||
|
843d1f1bea
|
|||
|
29263ff59b
|
|||
|
3b91a3883e
|
|||
|
ddb9b13df7
|
|||
|
ed578e5bff
|
|||
|
cdbb004ca1
|
|||
|
|
f6145bc412 | ||
|
|
86e7c21e4d | ||
|
|
76638c6aab | ||
|
|
3a950f401b | ||
|
|
eeba47ea03 | ||
|
|
762f5cbec2 | ||
|
|
5b6c9be6d6 | ||
|
f681ed270b
|
|||
|
a0168a7d49
|
|||
|
|
47263e641e | ||
|
|
70c78f1cab | ||
|
|
e7cb83f7b1 | ||
|
|
0212e1e18f | ||
|
|
265c411df2 | ||
|
|
69a14b6fc5 | ||
|
|
168446e6d5 | ||
|
|
23af28f4dd | ||
|
|
ac80384ba1 | ||
|
|
c4be0b58ca | ||
|
|
023d13e44b | ||
|
|
f4909ade09 | ||
|
|
26fb2b9dcb | ||
|
|
44c2ebd4a5 | ||
|
|
47874032a3 | ||
|
|
6dfa5ad1c2 | ||
|
|
111ad58b57 | ||
|
|
f1086c93f7 | ||
|
|
5e27a59414 | ||
|
|
cece556669 | ||
|
|
9252da8004 | ||
|
|
a9fdfee7ad | ||
|
|
6904aecea3 | ||
|
|
b516632731 | ||
|
|
87ad5d0c3a | ||
|
|
b95bb46d00 | ||
|
|
60c91f9cc4 | ||
|
|
20ce9cb8d9 | ||
|
|
a2625410f9 | ||
|
|
e2697012ea | ||
|
|
f28cd3aad9 | ||
|
|
fd82a54d63 | ||
|
|
d95d26a280 | ||
|
|
33310bdc42 | ||
|
|
6281d770c1 | ||
|
|
c37f3bdad7 | ||
|
|
5630ca5982 | ||
|
|
ceb75d98d0 | ||
|
|
75ad3b5657 | ||
|
|
5adf27eab1 | ||
|
|
18fbbed723 | ||
|
|
201bbf755d | ||
|
|
b9fe35b8c3 | ||
|
|
fd0787152e | ||
|
29cf04c804
|
|||
|
a4827d1b7d
|
|||
|
f107e11528
|
|||
|
|
52b6f75dd0 | ||
|
|
fd719221ed | ||
|
|
a2c04fa954 | ||
|
|
6db5ac5f26 | ||
|
|
cedce23cf5 | ||
|
|
645816f614 | ||
|
|
00a769bfd5 | ||
|
|
0fe5133992 | ||
|
|
2994f5936e | ||
|
|
e8a96fa0ad | ||
|
|
8c8cf5dcd9 | ||
|
|
19ff5db70d | ||
|
|
c7b689842e | ||
|
|
df03c65d5a | ||
|
|
4a88a93e8d | ||
|
|
950b9e5510 | ||
|
|
70230de8e1 | ||
|
|
c0ea9cadd7 | ||
|
|
8c966c3e23 | ||
|
|
9f87e77ede | ||
|
|
6165c9b7cf | ||
|
88ea5215c0
|
|||
|
522b3d53cc
|
|||
|
|
9a1d37166a | ||
|
|
07ae87f72b | ||
|
|
a16a202800 | ||
|
|
09ff9c0a7d | ||
|
|
8c4a93d1dc | ||
|
|
2da8a4af84 | ||
|
|
7d5f0d3187 | ||
|
|
a65c1810a2 | ||
|
|
09b7d27b40 | ||
|
|
e1175d01cc | ||
|
|
51fe77ff33 | ||
|
|
c540266e48 | ||
|
|
198e859850 | ||
|
|
87944719a5 | ||
|
|
6b44656819 | ||
|
|
35334e82ae | ||
|
|
32e7b7184f | ||
|
|
4098183be7 | ||
|
|
e25b03b68f | ||
|
|
7076b2d443 | ||
|
|
1933200372 | ||
|
|
0359afe574 | ||
|
|
cd8282bbe0 | ||
|
|
8350b3c70e | ||
|
|
8488d80c6f | ||
|
|
affd4646af | ||
|
|
9853638c6b | ||
|
|
faf2f2a312 | ||
|
|
4adf485208 | ||
|
|
eaab76aa9e | ||
|
|
2ca740a85d | ||
|
|
569aa73cd4 | ||
|
|
d3858ff5ff | ||
|
|
2760dc8a76 | ||
|
|
c1990dde75 | ||
|
|
af5b62b8fd | ||
|
|
fcd6e92dba | ||
|
|
dad098ff34 | ||
|
|
aa9a499a09 | ||
|
|
f10e6f021c | ||
|
|
09596331fd | ||
|
|
c8f9962def | ||
|
|
e91e8fcccb | ||
|
|
a702f1f7ef | ||
|
|
9654a68dad | ||
|
|
a2f18e2284 | ||
|
|
fceb927bce | ||
|
|
f192c1716d | ||
|
|
f2960c2229 | ||
|
|
552a68c1d4 | ||
|
|
e5f277c957 | ||
|
|
ff05dd7694 | ||
|
|
7c604647bf | ||
|
|
0fd0c38971 | ||
|
|
a454613ce8 | ||
|
|
73dd8c4688 | ||
|
|
1a07cfc144 | ||
|
|
715fe9e645 | ||
|
|
6316ac055c | ||
|
|
ff64db7a7c | ||
|
|
d5a299d7ff | ||
|
|
0e3c3f89d0 | ||
|
|
234e23b7a5 | ||
|
|
69093b8214 | ||
|
|
708d7908aa | ||
|
|
b08051789d | ||
|
|
794a737b6d | ||
|
|
b1ef29fadf | ||
|
|
0475fc81ed | ||
|
6aefb603ae
|
|||
|
|
92bdefcf9d | ||
|
|
576de54ef8 | ||
|
|
319225d645 | ||
|
|
9addea65d6 | ||
|
|
95c43a06d5 | ||
|
|
72c7317672 | ||
|
|
1cec3e5436 | ||
|
|
6c18056cef | ||
|
|
f4b678083d | ||
|
|
50eb6f7b7e | ||
|
|
0b6af2549f | ||
|
|
f229d95469 | ||
|
|
7ba725de6d | ||
|
|
677fd51e91 | ||
|
45b843fadc
|
|||
|
9ec62f0be0
|
|||
|
|
9baba17692 | ||
|
|
d86d0a5d5b | ||
|
|
543e8e3267 | ||
|
|
267dcf8fa7 | ||
|
|
fec4594480 | ||
|
|
f669df2ff5 | ||
|
|
9dfa652125 | ||
|
|
87f1cd8cdc | ||
|
|
f30f8ee563 | ||
|
|
64eceba9fa | ||
|
|
58e09bdaba | ||
|
|
d4e9040ccf | ||
|
|
653894cb82 | ||
|
|
581cb0c1fe | ||
|
4e545ca7af
|
|||
|
|
b4050e0335 | ||
|
|
1cecd1fe94 | ||
|
51ed1b2db8
|
|||
|
|
3e4d712dca | ||
|
|
d284b647ab | ||
|
|
3bcd05fc5f | ||
|
b0a1cc48a6
|
|||
|
|
2eba38b289 | ||
|
8481fadbd0
|
|||
|
6abcdd8d4b
|
|||
|
5df1445e29
|
|||
|
|
a94adf4d90 | ||
|
|
f21aa282dd | ||
|
|
8ce6694232 | ||
|
|
d8bd51e17e | ||
|
|
b1b04d2953 | ||
|
|
8852020ca8 | ||
|
|
deb4f763d0 | ||
|
|
58593de53d | ||
|
|
040be87a54 | ||
|
|
1703ac39d5 | ||
|
|
839869061e | ||
|
764c65563b
|
|||
|
2550b9cac1
|
|||
|
04225170d3
|
|||
|
326a3f78b2
|
|||
|
f86d31f811
|
|||
|
|
10dac6c0d4 | ||
|
|
fece09b781 | ||
|
|
6b1fb90584 | ||
| 5055cfddbd | |||
|
|
878d20e612 | ||
| 336f64712d | |||
|
|
56989c6b2f | ||
|
|
7b1d3dcd46 | ||
| f1e66daf06 | |||
|
|
ca087290b9 | ||
| 883886bc32 | |||
|
|
9e60253eb1 | ||
|
|
dba85f2bff | ||
| e5b852793e | |||
|
|
d4cbd86b96 | ||
|
|
8d82bacaa3 | ||
|
|
4af760c172 | ||
|
|
7747bc53b1 | ||
|
0456a92f15
|
|||
|
|
677afa9a41 | ||
|
ebcce4f2ec
|
|||
|
91e53e4872
|
|||
|
8bc51b3b79
|
|||
|
733d3ca69f
|
|||
|
4a2e465e5d
|
|||
|
|
7ed3c5a175 | ||
|
|
8567cedf0a | ||
|
e02b563bf4
|
|||
|
|
27d2814ef9 | ||
|
|
de95fa2e3e | ||
|
5a4f9d8914
|
|||
|
23271c4623
|
|||
|
f3d14e101c
|
|||
|
275d7f5419
|
|||
|
ac163085e1
|
|||
|
|
8b4bac3cc2 | ||
|
35f4db7905
|
|||
|
08b1241a68
|
|||
|
3ffcefaa1b
|
|||
|
3b173dc6fc
|
|||
|
|
60f1fb1f70 | ||
|
|
f610ae6412 | ||
|
f80b586081
|
|||
|
7999064dd4
|
|||
|
8c387e7983
|
|||
|
1d29cacf04
|
|||
|
|
ce4b4d06d0 | ||
|
79e1d59482
|
|||
|
|
47e1c0fa89 | ||
|
|
3ec23a56ab | ||
|
|
a01493e071 | ||
|
|
16052210c1 | ||
|
7dd9658864
|
|||
|
f794f411b7
|
|||
|
|
94fbbad6f3 | ||
|
4c5ed57958
|
|||
|
|
3d5cc5ceff | ||
|
|
c506153737 | ||
|
|
95ee8a4a16 | ||
|
|
3f7b0695f4 | ||
|
|
b3bb0939de | ||
|
08fe54c36d
|
|||
|
166c5be5d6
|
|||
|
7ce2a97c1f
|
|||
|
|
b23e241973 | ||
|
|
b8b54b7139 | ||
|
|
5853e54684 | ||
|
|
32e3b07e5d | ||
|
|
3b99676e7a | ||
|
|
3c829302c7 | ||
|
|
b579b01db5 | ||
|
|
7db798c420 | ||
|
|
77ed11b58e | ||
|
|
3ae6ffb8d0 | ||
|
|
0e5e4d57c5 | ||
|
d8cb38a9be
|
|||
|
07b0a2da9e
|
|||
|
1d040e8291
|
|||
|
|
797a91a037 | ||
|
|
9c0b57835f | ||
|
|
72564f5449 | ||
|
|
cc18692538 | ||
|
|
3e102e9d69 | ||
|
|
b9b53bcc91 | ||
|
|
00ef8e5cdf | ||
|
|
a738591dd0 | ||
|
|
85771bcd89 | ||
|
0150ede4cb
|
|||
|
|
1406165789 | ||
|
|
a62eadb581 | ||
|
|
197b148fca | ||
|
|
fd4a1cda2d | ||
|
|
108920c4fd | ||
|
|
49c7702707 | ||
|
|
15361654b7 | ||
|
|
c2b64d40d1 | ||
|
ce9404da84
|
|||
|
5c55d65eb3
|
|||
|
|
6f9180545b | ||
|
|
e966aa07cd | ||
|
|
102993cb10 | ||
|
|
d0627b83d0 | ||
|
|
a6602a0f5a | ||
|
|
55b9a72795 | ||
|
|
d4f0c9d116 | ||
|
|
bbb3184454 | ||
|
|
7d81e68757 | ||
|
|
487388c950 | ||
|
|
9d507eb10c | ||
|
|
cf9b19ffa7 | ||
|
|
9591269a68 | ||
|
|
27fe426213 | ||
|
|
b23d899f5e | ||
|
|
8bf0c03fe2 | ||
|
|
1ebb298cd7 | ||
|
|
9f588ab9fd | ||
|
|
91a1198900 | ||
|
|
321ac087dc | ||
|
|
5d81c030b5 | ||
|
|
e798bc7787 | ||
|
|
057b053d58 | ||
|
|
e9a9ef6b95 | ||
|
|
bd7062a479 | ||
|
a659068ef3
|
|||
|
6f7e1fcfb2
|
|||
|
|
eff26c8889 | ||
|
|
037059d0e6 | ||
|
|
9b78a3ecf2 | ||
|
|
4df8311e18 | ||
|
645006fde8
|
|||
| 95bbfefe90 | |||
|
|
3181a5860b | ||
|
|
39c83444b7 | ||
|
|
7356d2036d | ||
| a8df8665ae | |||
| 6355252699 | |||
|
|
6ec65e4aa4 | ||
|
|
f58bb421e5 | ||
|
|
38ecde185a | ||
|
|
e3924d5b06 | ||
|
|
c1a7fc2624 | ||
| 818d14fdbb | |||
|
|
e93a6865e7 | ||
|
|
c6325eef50 | ||
|
|
06d6653c78 | ||
|
|
aac722909b | ||
|
|
78d64713a2 | ||
|
|
7d71421c30 | ||
|
7a571e596d
|
|||
|
|
1718a034ee | ||
|
|
5443daabb6 | ||
|
|
de4f8ef2f9 | ||
|
|
b9fb4a5e93 | ||
|
3cdd391410
|
|||
|
ad77e8afa4
|
|||
|
c85d17d60d
|
|||
|
955c75a99f
|
|||
|
|
d32d1f5044 | ||
| 091c5247d5 | |||
|
|
c593798d83 | ||
|
|
edac81f51a | ||
|
|
8da3b4b7ac | ||
|
|
844e5fdb50 | ||
|
|
3f502de1f7 | ||
|
|
6532f392b5 | ||
|
|
9f340b2dfb | ||
|
|
30d34de653 | ||
|
|
52329e658f | ||
|
|
1c0df02c56 | ||
|
|
2061a971b8 | ||
|
cc62981f12
|
|||
|
613623fa53
|
|||
|
|
fffdbfdbee | ||
|
|
a55a4720fe | ||
|
42f2813e44
|
|||
|
c58d35288b
|
|||
|
f410df40f1
|
|||
|
7e95949ab7
|
|||
|
7c4c3a3c97
|
|||
|
|
7f25c5f82d | ||
|
|
f1939391e8 | ||
|
|
d1f9b0d829 | ||
|
f2354957e6
|
|||
|
|
600eab20a1 | ||
|
336c4a4d49
|
|||
|
a1e47edfb2
|
|||
| 5269659c73 | |||
|
ab1b549a64
|
|||
|
|
2867dffc5a | ||
|
6d972a13fe
|
|||
|
3918bfafdf
|
|||
|
1c15e569bf
|
|||
|
5030548500
|
|||
|
c5d3a7b0c1
|
|||
|
|
75c46130ed | ||
|
|
62c17155ca | ||
|
|
3a52062ce4 | ||
|
|
74ccbdcaee | ||
|
|
fbd610349a | ||
|
|
8af75d8c6a | ||
|
|
0bafd117ff | ||
|
ae9a7c6090
|
|||
|
481ad02e01
|
|||
|
9042074c50
|
|||
|
821e51ff7d
|
|||
|
0f4808f5b5
|
|||
|
aba8a80d8f
|
|||
|
2b0edfde60
|
|||
|
01a496768a
|
|||
|
|
82a57cb3c8 | ||
|
|
27c07d86bc | ||
|
|
e916f2a66e | ||
|
|
494ecdfec8 | ||
|
|
8a3c0e02f6 | ||
|
|
37428bf9c0 | ||
|
|
62b4a21cef | ||
|
|
b566e4e7e4 | ||
|
|
4ff2061bb7 | ||
|
|
03d7e138e9 | ||
|
|
0540da57e6 | ||
|
|
e0e9d25a4f | ||
|
|
fd7684866e | ||
|
|
7c8b427d2a | ||
|
|
4fcc68d149 | ||
|
ad726a3fd7
|
|||
|
f167a8c8f6
|
|||
|
|
b404b44008 | ||
|
|
c6dc51bb5d | ||
|
|
69ee6be246 | ||
|
|
e08fab2938 | ||
|
5db275bce2
|
|||
|
9c05e3f8e8
|
|||
|
|
ac2c9b8621 | ||
|
|
02852ac4e7 | ||
|
|
1163541ac5 | ||
|
|
2da0c17fe2 | ||
|
|
7528480f54 | ||
|
|
a45a270479 | ||
|
|
380804361b | ||
|
|
e072ee8b44 | ||
|
|
d812644e61 | ||
|
|
71deb11e1f | ||
|
|
2e138da3d5 | ||
|
939b6b1e46
|
|||
|
d937c7e6ab
|
|||
|
f91ff0b9d0
|
|||
|
98cbee11b9
|
|||
|
|
7f0431d493 | ||
|
|
3227c53699 | ||
|
|
2ee8784d7d | ||
|
|
0fac0f450c | ||
|
|
b4fb202db4 | ||
|
|
93ba163ea2 | ||
|
|
bd3ff20146 | ||
|
|
b3a0b97f0e | ||
|
|
ca212ca692 | ||
|
|
3b809202b3 | ||
|
|
9858419586 | ||
|
|
1f7fe2aed3 | ||
|
|
71affd155c | ||
|
|
a54f030c4e | ||
|
|
3b5a018f8c | ||
|
|
8d5fc945d4 | ||
|
|
50194df24d | ||
|
|
5f771973a8 | ||
|
|
4fcfbb374f | ||
|
853c21e49f
|
|||
|
|
3efb5d8520 | ||
|
|
e74985d870 | ||
|
|
32eab42c26 | ||
|
|
0d3d8232f9 | ||
|
|
fd3dc389df | ||
|
|
2d274f37ee | ||
|
|
d1a12df18f | ||
|
|
017a9a58a3 | ||
|
|
e33c57f51b | ||
|
|
da041df054 | ||
|
|
99b57e1297 | ||
|
|
6ce8a22514 | ||
|
|
a9fc534ea7 | ||
|
|
6e04fa1251 | ||
|
|
8f851282b4 | ||
|
|
d774935a6a | ||
|
|
712d42b328 | ||
|
|
f66aab03f2 | ||
|
|
53ca9c9677 | ||
|
|
7bcc624a74 | ||
|
|
fa2d73348e | ||
|
|
26c3edbc17 | ||
|
b9d89edfc2
|
|||
|
7ccc6438d5
|
|||
|
|
cd9f65596b | ||
|
5404743f17
|
|||
|
c0296d0882
|
|||
|
|
dec07bd27d | ||
|
|
1be1e9843d | ||
|
|
5b5afcfe4c | ||
|
|
4f5dc9ffad | ||
|
|
9c5b00ecf0 | ||
|
|
048ba99323 | ||
|
|
35bdc15aa9 | ||
|
b06288e7eb
|
|||
|
|
426c7ad708 | ||
|
|
fadf8861e7 | ||
|
|
dceedf019a | ||
|
|
f49ddf7437 | ||
|
|
33a3c8350d | ||
|
|
052fa146d2 | ||
|
|
1c85782690 | ||
|
|
cf5abdf7d3 | ||
|
|
df562bedbb | ||
|
|
11c1eafa0d | ||
|
|
cc8369e02a | ||
|
|
cd468df9ad | ||
|
|
64666e42e8 | ||
| ad7c953d29 | |||
|
|
b345efe2d1 | ||
|
|
74b8aaa94e | ||
|
|
1ace1ba3ec | ||
|
|
b822574b70 | ||
|
|
466ca0f0e9 | ||
|
|
0bcac0c639 | ||
|
7433fb8fa0
|
|||
|
b1ac1cf238
|
|||
|
|
a88a861d82 | ||
|
|
41ced8edee | ||
|
0f73f74539
|
|||
|
bb9902e3b2
|
|||
|
|
c03b0fc981 | ||
| e8733f15e4 | |||
|
|
26519c71a6 | ||
|
f923acc5a7
|
|||
|
|
55b9b6aac4 | ||
|
|
52db07a33b | ||
|
7ed8c9f787
|
|||
|
cc12b193d3
|
|||
|
4d9c51bcd9
|
|||
|
|
7de48393b6 | ||
|
|
283aa92fd5 | ||
|
|
9d0393ca72 | ||
| c5fc7f76d3 | |||
|
|
6b6325895b | ||
|
39e9f5a2ff
|
|||
| 204223e2a8 | |||
|
|
b39abcc4a0 | ||
|
|
f49e9fa66b | ||
|
|
56fd22b43f | ||
|
0b2bf607f7
|
|||
|
3ff9e69585
|
|||
| 9ceb90204c | |||
|
|
ab3c4b2b2d | ||
|
|
060ca4b7ef | ||
|
|
a7a29ef029 | ||
|
|
e7826c2570 | ||
|
|
77a733a062 | ||
|
|
96bd99650f | ||
|
|
2d1899f1f2 | ||
|
|
42b1740b0f | ||
|
|
fbf613c4e6 | ||
|
|
bf18070bc1 | ||
|
|
c9c41fdd33 | ||
|
|
949d822385 | ||
|
|
83b8f28055 | ||
|
|
c602d817d9 | ||
|
|
a50b217b6f | ||
|
|
23c031780f | ||
|
|
e3b50d5dfa | ||
|
|
9b1bee567f | ||
|
|
3534973357 | ||
|
|
c4c4bdd547 | ||
|
|
528fadceb8 | ||
|
|
e15aecaa52 | ||
|
|
62e635ebe5 | ||
|
|
be846b43ae | ||
|
|
7bfe168eee | ||
|
|
e8d4a91ad7 | ||
|
|
bc1804c030 | ||
|
|
d18c9fe0da | ||
|
|
a7ea87dd8c | ||
|
|
e3a0ab8513 | ||
|
|
3a77144a5e | ||
|
|
69e311829b | ||
|
|
b1effdb7c7 | ||
|
|
124537eb18 | ||
|
|
b81924b144 | ||
|
|
dd18605678 | ||
|
|
6bce31d43f | ||
|
|
0da5b47ce5 | ||
|
|
d0d891b112 | ||
|
|
2292c392e9 | ||
| cc35aa6bc3 | |||
|
|
9e4a124a58 | ||
|
|
d63afb0917 | ||
|
|
80a3f61a1f | ||
|
|
303c817d2d | ||
|
|
d9cf94c6b5 | ||
|
|
d72414d531 | ||
|
26be293f24
|
|||
|
|
36b8633c1e | ||
|
|
6bdbf2c65e | ||
|
80ec615548
|
|||
| ffc45ff79b | |||
|
|
48cb28d9f8 | ||
| 51da0b62c1 | |||
|
|
e391ed52f3 | ||
|
|
a5e6e4255d | ||
|
|
590e7e3ba3 | ||
|
d218ad5a67
|
|||
|
350bc0ad58
|
|||
|
|
a0f9bc032d | ||
|
|
4edcd70871 | ||
|
|
90c0bf46f4 | ||
|
|
9d4fc1980f | ||
|
|
332524f1f3 | ||
|
078b59b1e2
|
|||
|
0551ed5f0b
|
|||
|
915d4093b9
|
|||
|
952e9c39ac
|
|||
|
3e32a6280a
|
|||
|
288b67e250
|
|||
|
7d2f5696f5
|
|||
|
8c3fec0933
|
|||
|
33b00fe65f
|
|||
|
f0f50a37b5
|
|||
|
c2b2148190
|
|||
|
f22362dc53
|
|||
|
68cc1d4c4f
|
|||
|
0f84ef1e58
|
|||
|
|
a245574dee | ||
|
fd90970173
|
|||
|
75a55e4748
|
|||
|
bbd4867830
|
|||
|
3463c8a49e
|
|||
|
7829a2ad3b
|
|||
|
|
fb387dbcd9 | ||
|
cd0b3cd1dc
|
|||
|
fe500a27c0
|
|||
|
da860bc250
|
|||
| e3a8eeb647 | |||
|
|
6dbc709f98 | ||
|
|
49ca54d68a | ||
|
|
e81b8127af | ||
|
|
d1b490ed98 | ||
|
|
893ed6afd2 | ||
|
9df2cf5bd7
|
|||
|
b5ceaf4e65
|
|||
|
|
44ea9fe709 | ||
| 8174229d28 | |||
|
f628ed2e1b
|
|||
|
c90a0a77bc
|
|||
|
|
10b3f2e65b | ||
| 9821e93d25 | |||
|
|
6c16c9c55f | ||
| ab679bccc6 | |||
|
|
6fcf3785ef | ||
|
|
e605b325c7 | ||
|
|
a714d0927e | ||
|
|
fe1ef89d30 | ||
|
639895f511
|
|||
|
4fdc02de35
|
|||
|
103ef11f3d
|
|||
|
69e7efe6d1
|
|||
|
83e971d85b
|
|||
| fec60955ed | |||
|
c5b980a406
|
|||
|
99483268d6
|
|||
|
|
67fef2cc1c | ||
|
|
f450111c1c | ||
|
|
718e7eab82 | ||
|
eb031b00ab
|
|||
|
a10c1101ab
|
|||
|
|
9c0c20f86b | ||
|
c6d1f1b525
|
|||
| 9a84791f5c | |||
|
14fc02cb23
|
|||
|
39ae6a406c
|
|||
| ba8682f79e | |||
|
|
986e4d8fcc | ||
|
|
016ced24e0 | ||
|
|
b60b2d8355 | ||
|
|
f733b85878 | ||
|
|
1926a73dee | ||
|
071f4f0911
|
|||
|
813c5236b3
|
|||
|
|
f39a9f191a | ||
|
|
6d8d757798 | ||
|
|
81975977ad | ||
|
b7613606c0
|
|||
|
0aa4ea01f7
|
|||
|
20685598e3
|
|||
| b1fb1bdc6b | |||
|
|
a80bdcc611 | ||
|
|
4571e3e001 | ||
|
|
38d7d97167 | ||
| 3913e95b53 | |||
| 954c926a9f | |||
|
|
0973444c47 | ||
|
|
368b61c21a | ||
|
|
efc9b3502c | ||
|
|
2e86c480ec | ||
|
|
39eeaacdcb | ||
|
|
ea45e91aa7 | ||
|
|
a65e41e796 | ||
|
|
91648756c9 | ||
|
|
a225234800 | ||
|
|
de58333dc4 | ||
|
|
24a25e3dbf | ||
|
|
8e5ae51067 | ||
|
|
86c981ae8e | ||
|
|
b716c35438 | ||
|
|
9e984510d4 | ||
|
|
3c08119ccc | ||
|
|
ada1b7b54c | ||
|
|
a7ed4fbcc3 | ||
|
|
1330feaea5 | ||
| 103f578c61 | |||
| deee80ae71 | |||
|
|
54350040ad | ||
|
|
3472b8ba00 | ||
|
|
f2dd9af66c | ||
|
|
da46f7967a | ||
|
|
ed3d6c5f98 | ||
|
|
c4ea825df9 | ||
|
|
4120e3946c | ||
|
|
c84b6acff2 | ||
|
|
159110c032 | ||
|
|
93e1b38da2 | ||
| 3ff028c4e9 | |||
|
|
9b46963015 | ||
| 09e1c14f37 | |||
|
|
58af01b90a | ||
|
e338237e2a
|
|||
|
014ea5ef49
|
|||
|
4a8c7fa36a
|
|||
| 1251a6cd75 | |||
|
|
0ce8eae969 | ||
|
|
8b9c76fca5 | ||
|
52e4e6b802
|
|||
|
57c9d26916
|
|||
|
19d7003a9e
|
|||
|
b11e50ab22
|
|||
|
a03ab0e0c0
|
|||
|
05d4db00b3
|
|||
|
f4aaa14fc5
|
|||
|
a8f9423307
|
|||
| 7c871edbca | |||
|
|
f7d9579cee | ||
|
|
b7e6ca8a26 | ||
|
8852d1e22e
|
|||
|
fcaa0ea442
|
|||
|
8e7d7e0bde
|
|||
|
|
50c6c9f842 | ||
|
a2979753a9
|
|||
|
789e39b6cb
|
|||
|
2f5441ef20
|
|||
|
|
6ad08f13d4 | ||
|
|
656f621711 | ||
|
|
6dc0e12fb0 | ||
|
0e8579017b
|
|||
|
|
e03d0efe71 | ||
|
0b497c4e0b
|
|||
|
|
704f589b6d | ||
|
3feb84ac9e
|
|||
|
e375654009
|
|||
|
ce7ac5d8f4
|
|||
|
|
a172fa5a5b | ||
|
7c89f53988
|
|||
|
4e2d739840
|
|||
|
|
5cdbda700b | ||
|
b274b51699
|
|||
| efb5d34279 | |||
|
|
9ecb75b51c | ||
|
69332a85da
|
|||
|
ea095084cc
|
|||
|
1f176ebab2
|
|||
|
|
327c05d03e | ||
|
|
2d7c120d19 | ||
|
|
a2e9f19814 | ||
|
|
c602355e65 | ||
|
|
a390e0de49 | ||
| a228d71d57 | |||
|
|
b2f0eaccc4 | ||
|
|
07aaec7d3c | ||
|
|
392e9af944 | ||
|
904e0719eb
|
|||
| 52ac3d2e6c | |||
|
|
859b07e454 | ||
|
|
d4b252fd71 | ||
|
4a0e7221b0
|
|||
| 43bdbe5a01 | |||
| 3d10456a87 | |||
|
d5a6c95ffb
|
|||
|
|
edc07b5dbd | ||
|
|
a5219ceb6c | ||
|
|
039075086e | ||
|
|
495c9fad33 | ||
|
|
b61c5e8f12 | ||
|
|
a40a8d329a | ||
|
|
3f3ab5a7be | ||
|
|
d8c32047d0 | ||
|
|
f5f2854f36 | ||
|
|
86a2b95141 | ||
|
4db7ccc853
|
|||
|
b1da5c2924
|
|||
|
|
0fe6fed838 | ||
|
|
a3f8c0a236 | ||
|
|
c88d7de138 | ||
|
|
eeafb3c6fd | ||
|
|
0208f5be97 | ||
| 42ecf8a958 | |||
| d780623b98 | |||
|
|
1b1a167580 | ||
|
|
49d0c80070 | ||
|
|
a35c2f3394 | ||
|
|
3034a87929 | ||
|
|
33b96043c9 | ||
|
|
4d02dc0d12 | ||
|
|
79fd2a58c1 | ||
|
|
ab82d0eba0 | ||
| 75cc0716fd | |||
|
87f99addbb
|
|||
|
|
3e1b15a23c | ||
|
|
5758e9f68f | ||
|
|
0964c02a44 | ||
|
|
bf06ab7492 | ||
|
|
e992566899 | ||
|
|
97338f31c5 | ||
|
|
0ff4f976e1 | ||
|
|
496b3388ee | ||
|
|
d6b578acb0 | ||
|
b3be87f541
|
|||
|
|
786cd12dba | ||
|
|
a1a17c02d7 | ||
|
|
b8caf8e572 | ||
|
44c2c074a8
|
|||
|
3ed960254d
|
|||
| f1e8fbec5d | |||
| c5ed9cf54b | |||
|
|
65c567dbcb | ||
|
|
b312823afd | ||
|
|
56eb059bcd | ||
|
|
6ad78f1cba | ||
|
|
26b758ae50 | ||
|
|
019b8cc087 | ||
|
|
c95845083a | ||
| 9c7f314f65 | |||
|
|
743a92a3e8 | ||
|
|
37e9b33c24 | ||
|
|
7c2ac033d7 | ||
|
0efd5437f9
|
|||
|
|
db770351f3 | ||
|
|
14b2457627 | ||
|
|
f62ea43de8 | ||
|
|
ab2aad6bd0 | ||
|
|
1293233ad9 | ||
|
|
5fff2adbfb | ||
|
|
7d67b718a5 | ||
|
|
b8ca21d588 | ||
|
|
44d91e43ad | ||
| 3bb10ee948 | |||
|
|
81caa59a36 | ||
|
46e863ef79
|
|||
|
cecba7623e
|
|||
| 7dee865c8a | |||
|
|
5ac3cdb03c | ||
|
c3613f3ba4
|
|||
|
e7ac1c1feb
|
|||
|
24573d12f5
|
|||
|
9d2f633e14
|
|||
| 570b0c19c5 | |||
|
|
a11e42a4d6 | ||
|
|
410c73a74f | ||
|
|
3ea088371b | ||
|
|
09a0bb364a | ||
|
|
d91947ae15 | ||
|
|
0a8a9e5935 | ||
|
|
59226b298f | ||
|
|
dc41bf3e83 | ||
|
|
a790a18f7f | ||
|
|
1fcc1096f5 | ||
|
|
86aaca271f | ||
|
|
b8cc2d6953 | ||
| 11f110b0bb | |||
|
|
31459ea6e7 | ||
|
|
7ab84688c2 | ||
|
|
d18f287804 | ||
|
|
1c3b41acba | ||
|
|
ecfc7e40c9 | ||
|
41eea1c420
|
|||
|
|
594524afc3 | ||
|
|
70a5337604 | ||
|
|
924fde8790 | ||
|
dea70974bf
|
|||
|
43fd7b8d47
|
|||
|
|
6c2a526aeb | ||
|
43a8caa687
|
|||
|
|
f3fc848b6c | ||
|
|
98f5d115b3 | ||
|
|
885d98cebd | ||
|
|
6f73ff23e8 | ||
| 2cd2d7dbc4 | |||
|
|
d3afdad95b | ||
|
|
48ac46eb5c | ||
|
|
2d6e6b359b | ||
|
|
7462743be8 | ||
|
|
db2acb752a | ||
|
|
335229e61b | ||
|
|
2acdd66f70 | ||
|
|
d3bec9006e | ||
|
|
44f70c1388 | ||
|
02463e5833
|
|||
|
|
778d14a1a2 | ||
|
|
8b3814c485 | ||
|
|
6bcd9dd65c | ||
|
154ae09c6e
|
|||
|
|
58c9d14d42 | ||
|
3e69b88518
|
|||
|
|
9d3671e117 | ||
|
|
0731d2487a | ||
|
|
5e4dd82b8d | ||
|
|
9d33d1a560 | ||
|
|
e788cff04a | ||
| face1d5b26 | |||
|
|
18f8472baa | ||
|
|
f14edd871f | ||
|
c892a38c52
|
|||
|
|
e9d473711d | ||
|
|
97a8bb1ca7 | ||
|
|
66d47bf579 | ||
|
|
508647eb5a | ||
|
4ca3a492b0
|
|||
|
|
fffe104cbe | ||
|
|
6258476a58 | ||
|
|
af1aca8725 | ||
|
|
bdb7fbc039 | ||
|
6bf0ae92e4
|
|||
|
17b8fd51b7
|
|||
|
d089fad6ce
|
|||
|
ec11b79b18
|
|||
|
0f216c6de9
|
|||
|
|
0606ace83a | ||
|
|
746d857550 | ||
|
|
cf1d0b8d7e | ||
|
|
d94145c6e5 | ||
|
|
b71a0ac3cf | ||
|
|
32afa26be5 | ||
|
|
23cc86e429 | ||
|
|
87032a6835 | ||
|
|
a4d9c6e36c | ||
|
|
76af0b0edb | ||
|
0054d06e6e
|
|||
|
|
e2e027df81 | ||
| a61e441e79 | |||
|
|
9b4153aacc | ||
|
|
b1d2d0a475 | ||
|
|
aeec98db2a | ||
|
|
00f21de9eb | ||
|
|
2d595bb6ee | ||
|
|
e43c9f6489 | ||
|
|
81004b53a9 | ||
|
|
85a0918da5 | ||
|
|
b10fa0fd10 | ||
|
a2f4bb35cd
|
|||
|
|
4120514256 | ||
|
|
29ef717ece | ||
|
|
d34cfbf405 | ||
|
|
94c2326153 | ||
|
|
06c2287b71 | ||
|
|
8cb0d3d6fe | ||
|
|
76860f82b9 | ||
|
|
f134137a05 | ||
|
|
fc231ec330 | ||
|
|
d3c32faf01 | ||
|
|
d16f4cd892 | ||
|
|
9a8de28a1d | ||
|
|
939f08b8a1 | ||
|
|
09500c0734 | ||
|
400a90464e
|
|||
| 9103f9d473 | |||
|
|
27c29f99d9 | ||
|
|
753c27a90c | ||
|
3d7e62d2fe
|
|||
| e8289277a7 | |||
|
|
887fc691d1 | ||
|
|
543e3da194 | ||
|
|
908cc22619 | ||
|
|
c09d484a14 | ||
| 07c3f22f75 | |||
|
|
d494bf19ee | ||
|
|
eda4f75219 | ||
| 931f126119 | |||
|
bc171ce06e
|
|||
|
|
191d1fcec8 | ||
|
|
eaea9e54d1 | ||
|
|
c9b3912fd4 | ||
|
1611dc3429
|
|||
|
88dc2145e0
|
|||
| 8979987344 | |||
|
|
1cec2cc187 | ||
|
|
a1279b64a2 | ||
|
|
2ce5f2563a | ||
|
|
75a60ff738 | ||
|
|
74eb7f83d6 | ||
|
|
5b2ac5f6fb | ||
|
|
fde4ba1d85 | ||
|
|
8278a8f5c3 | ||
|
a39d644094
|
|||
|
0004be15ba
|
|||
|
8fef459346
|
|||
|
109603f124
|
|||
| 91879a8405 | |||
|
|
f471a3513e | ||
|
|
7362111318 | ||
|
|
609c7188c0 | ||
|
|
a106b34379 | ||
|
|
853b95363e | ||
|
|
45113e419e | ||
|
|
519bb3053b | ||
|
|
366cc862ba | ||
|
|
611aaf0d38 | ||
|
|
712d829b54 | ||
|
|
e25656c090 | ||
|
|
7debe6d7e2 | ||
|
|
55e14e4cb3 | ||
|
7fbeb2e266
|
|||
|
7be6d779da
|
|||
|
96585fbdf7
|
|||
| 1a0d623c02 | |||
|
67cf2c2a6e
|
|||
|
b6dd7fb5f6
|
|||
| e0c5562600 | |||
|
|
2447f66834 | ||
|
|
11ed27e397 | ||
|
|
6158547571 | ||
|
|
a24dfde1ba | ||
|
|
d805b49a4d | ||
|
|
f871bf77fa | ||
|
|
be610b825d | ||
|
f791cc6f9c
|
|||
|
|
30b2e81b15 | ||
|
|
067c7f2d0d | ||
|
aae3fa3b05
|
|||
| 41cd8ac7d7 | |||
|
|
61f2a499da | ||
|
2f7e704e21
|
|||
| 4d22e7d1e8 | |||
|
|
18125ea982 | ||
|
|
1498541b45 | ||
|
|
4faaa9fc13 | ||
|
|
c6c4b7190a | ||
|
|
c0bf3ad56c | ||
|
|
ad51271c40 | ||
|
|
fce952d240 | ||
|
|
0dc5032a7a | ||
|
|
0395f29503 | ||
|
|
03581add21 | ||
|
|
e0249accf8 | ||
|
|
a3afbafdcc | ||
|
|
4d4c126327 | ||
|
|
c4bf7b2ae0 | ||
|
|
5d5f804c76 | ||
|
3a76504380
|
|||
| 5035c90c73 | |||
|
|
7f1cd30ce8 | ||
|
|
155a91a13d | ||
|
|
8c291e274d | ||
|
|
10e1eb8aac | ||
|
06a2aa6f97
|
|||
| f08a2e4551 | |||
|
e6839b1270
|
|||
|
270890f841
|
|||
|
|
02581c9e2d | ||
|
|
ea4e69df19 | ||
|
|
cb0ebb31f7 | ||
|
|
497cd0bd15 | ||
|
|
b74c7841dd | ||
| 407ef5b655 | |||
|
|
f034b1874b | ||
|
|
eac086b935 | ||
|
|
ea310b184e | ||
|
|
ea3386eda5 | ||
|
|
2efdb1940a | ||
|
|
896139a8ed | ||
|
|
da344233f4 | ||
|
9cf3551356
|
|||
| 10aaae1ca8 | |||
|
dcb5206272
|
|||
|
|
ccdd2b6c19 | ||
|
|
16f3e1c180 | ||
|
|
7283cde5ff | ||
|
|
4c20384d39 | ||
|
|
5e9bc4fcc7 | ||
|
|
e5448649c3 | ||
|
|
951e89d429 | ||
|
|
f34dd7926a | ||
|
|
b900c05d9b | ||
|
|
06948934ac | ||
|
|
e82915ef17 | ||
|
|
bb37da403f | ||
| 065263a9bd | |||
|
|
f3359cc830 | ||
| 1b3b5d95c0 | |||
| c290ba5436 | |||
|
|
bb4ea05375 | ||
|
|
47dde65f65 | ||
|
08eb9552d6
|
|||
| 6058221fec | |||
|
|
5bf4ecb394 | ||
|
|
41fa80e8b8 | ||
|
|
0dd3a26080 | ||
|
|
fb400d83e3 | ||
|
|
37e5c43e5c | ||
|
341aa0e13d
|
|||
|
3c4359096d
|
|||
|
|
d56240086c | ||
|
|
bfea5b314e | ||
|
03b4fc9f00
|
|||
|
|
826563694e | ||
|
|
880ff923bc | ||
|
|
cd0d4b103a | ||
|
|
fefec4985d | ||
|
|
ba655f3d64 | ||
|
|
be3812fa2f | ||
|
|
87d4326411 | ||
|
|
ef6ede6b12 | ||
|
|
eeccda24b0 | ||
|
|
2bf29da2ea | ||
|
|
0b54029e26 | ||
|
d24ab347cb
|
|||
|
74ffe9418b
|
|||
| c945434d71 | |||
|
|
b28545c852 | ||
|
|
c8d33d06a1 | ||
|
|
2089c3cc7b | ||
|
|
5df1da2bfd | ||
|
|
70fda48983 | ||
|
|
36fe5cb625 | ||
|
|
7e2a00520b | ||
|
caeeb699d1
|
|||
|
|
f6dc4f9a00 | ||
|
|
28135aed66 | ||
|
8e452f4271
|
|||
|
f4656efebd
|
|||
| 42cc0430f8 | |||
| 81dd8b58c8 | |||
|
415da81b1a
|
|||
|
74a20455f2
|
|||
|
|
0bdce39def | ||
|
|
24f7d8b5bd | ||
|
|
18adc66f53 | ||
|
|
8c1c855531 | ||
|
|
02ae76baf2 | ||
|
|
b5c44383e8 | ||
|
|
c48ebb937b | ||
|
|
49c30d1d26 | ||
|
|
cb1a7ece8c | ||
|
|
4d60ae3cb6 | ||
|
|
fe64620e9f | ||
|
|
a42ca9e2da | ||
| 506f6f7d30 | |||
|
|
380861f29e | ||
|
|
9afc046d7b | ||
|
|
aec87a9a67 | ||
|
69e0a531df
|
|||
| c85101991f | |||
|
|
99e87fd97a | ||
|
|
665ec6b7ed | ||
|
|
01fbd209c8 | ||
|
|
f0fa8d59a1 | ||
|
a1598fd712
|
|||
|
db96a1ff2e
|
|||
| 833a42e798 | |||
| 922c665ef5 | |||
| 01842e9870 | |||
|
|
a235f6281c | ||
|
|
c9e7d4f483 | ||
|
|
94496ecc02 | ||
|
|
5104a8b542 | ||
|
|
e67beae235 | ||
|
|
7c4bffede2 | ||
|
|
8df620b1cd | ||
|
|
cbbdd13c8e | ||
| 3874fe31d5 | |||
| a8c086b340 | |||
| 06a043d290 | |||
| 5a15014369 | |||
| 7fe1f4b3ff | |||
|
|
0055146264 | ||
|
|
cc26897fb9 | ||
|
|
46535f82af | ||
|
|
23a7b945af | ||
|
|
4fb6ff63b9 | ||
|
|
c2e90a210c | ||
|
|
22d59e46c8 | ||
|
|
e462b7df97 | ||
|
|
af8fb952df | ||
|
|
a3fa04bcb7 | ||
|
|
adf6fea4ac | ||
| 69af4fe586 | |||
|
|
31476a55f9 | ||
|
|
c833563907 | ||
|
|
74a4a3a8b4 | ||
|
|
141bca517d | ||
|
|
b9eb6363b7 | ||
|
|
c3bed26739 | ||
|
|
a15d54fe11 | ||
|
|
1998ceac5a | ||
|
|
4192ffdbfe | ||
|
|
5ec7227886 | ||
|
|
a9ebc372f6 | ||
|
|
1e98104eca | ||
|
|
d05d5fa911 | ||
| 07df5a81cf | |||
| 9861a9aa6b | |||
| b65e1c498e | |||
| 240562037d | |||
| b3f79e77c3 | |||
| db3c73156e | |||
|
|
44b3b9b0c1 | ||
|
|
ea8c1de44d | ||
|
|
8195d0190a | ||
|
|
8fd10eabd1 | ||
|
|
7b28072ee5 | ||
|
|
b37db4d680 | ||
| 92bfc7e9fa | |||
| b3e97760db | |||
| 3895312bfc | |||
| 06d2976bb5 | |||
| da4566f82f | |||
| b8f0ea4690 | |||
| bb5e49758a | |||
|
|
e617904b62 | ||
|
|
b0e455e163 | ||
|
|
6c31cea155 | ||
|
|
9c71d1b57c | ||
|
|
e4f12149ed | ||
|
|
f6d264f37d | ||
|
|
aa734e5ad3 | ||
|
|
591291e9d6 | ||
|
|
2311a56658 | ||
| 514e4473a1 | |||
| 7ccacf4c27 | |||
| 15f226fc73 | |||
| 1388196288 | |||
| fe024cb306 | |||
| 04e7edaa3e | |||
|
|
87abdf6346 | ||
|
|
c4fad321db | ||
|
|
c17c9d9ccc | ||
|
|
d27c208ab7 | ||
|
|
90966aa7e4 | ||
| 553a6c709a | |||
| 16698201f4 | |||
| 33f27a8af7 | |||
| 48ec877ad5 | |||
| 54002ce27f | |||
| de03d80e10 | |||
| 60954c38b6 | |||
| ba41d5f4ce | |||
| 9b76f42138 | |||
| 5a0306b4b5 | |||
| b70ddf0a7c | |||
|
|
f53174258c | ||
|
|
36706d998e | ||
|
|
65ec3ca5c6 | ||
|
|
0b0068e113 | ||
|
|
553777ef08 | ||
|
|
3cda7ffc18 | ||
|
|
48d98548cd | ||
|
|
b878824d15 | ||
|
|
16a99d7b8c | ||
|
|
c34f250ac9 | ||
|
|
e74b276c98 | ||
|
|
f0e61daa63 | ||
|
|
34b6f4aa32 | ||
| c2b79b55f8 | |||
| 875b08b1fc | |||
| 0e3788d943 | |||
| 396508da6f | |||
|
|
6fc6beb067 | ||
|
|
939cdf71ad | ||
|
|
8d7eabdd71 | ||
|
|
d28d6b17d8 | ||
| f096ca2ad3 | |||
| 32914eb36d | |||
|
|
b58190ed17 | ||
| 86a82970fc | |||
| 9976ea5dfc | |||
| f732582d55 | |||
| 44e28b40d3 | |||
| f969e2a8d1 | |||
| fa7ea5b16a | |||
| 3d7a39cf67 | |||
| 46f8b8e700 | |||
| ebcc6391d6 | |||
| 12522ce8d8 | |||
| cae7073f87 | |||
| 0366ad0e57 | |||
| 6b95a8c55e | |||
| 6183f6edf3 | |||
| 83cca4ef12 | |||
| 20ad9d0472 | |||
| 96b9ac36f3 | |||
| 65170c0fe9 | |||
| 3e349d3db3 | |||
| b2675c3cac | |||
| 7414cf4a4e | |||
| f43c482539 | |||
| f0fbbf4333 | |||
| 0d03c68c8b | |||
|
|
b4a4c86049 | ||
| 306d46ea93 | |||
| 5b94badfc2 | |||
| 9adc0c5358 | |||
| 66adc65a96 | |||
| 8def9b5446 | |||
| e6511061a7 | |||
|
|
647a694d91 | ||
|
|
e5ececa42d | ||
| c321faeaa9 | |||
|
|
3112b7937c | ||
|
|
a3565abdc3 | ||
|
|
34d2e15302 | ||
| 1b6d1456f3 | |||
|
|
b49aee3188 | ||
| 749f682ef9 | |||
| 1b269efaa4 | |||
| 2db1a8d958 | |||
| ece7d71e09 | |||
| 129602ea70 | |||
| 5e3fddb652 | |||
| 2340100999 | |||
| dc0151720e | |||
| 36e88b2c0c | |||
| 35695904d1 | |||
| a3ffecc00f | |||
| cc418570d5 | |||
| 481af22ae7 | |||
| 96b9dc8b5c | |||
| 93f5f70d79 | |||
| fc53b19915 | |||
| 413f4a2f10 | |||
| e8d299782b | |||
| 489a4ab586 | |||
| 32fa3a89e2 | |||
|
|
f2614dd3d7 | ||
| 1093584202 | |||
| f62d024342 | |||
| eea87d8607 | |||
| f4c47b5b84 | |||
|
|
fa78d5dd6f | ||
| 779c6664be | |||
|
|
38efd7935a | ||
|
|
03f021377d | ||
| cf345d2d0c | |||
| fb3a3f49dd | |||
| f3b731114e | |||
| 454b24ec88 | |||
|
|
2c6c64fbe9 | ||
|
|
a51d6d6485 | ||
|
|
0da57c041c | ||
|
|
503573f388 | ||
|
|
29cd1f1fdf | ||
|
|
e51b33c74a | ||
| 624a3dd991 | |||
| 05d705ac03 | |||
| 1e1756aa17 | |||
| 91109bf6dc | |||
|
|
7f852e793a | ||
|
|
aae3747925 | ||
|
|
5e23d52e8a | ||
|
|
3bc8013d2f | ||
| 00abaea324 | |||
| d14168e325 | |||
| c3b1556816 | |||
| 80a2a10e71 | |||
|
|
029f554d6e | ||
|
|
841d8f05d9 | ||
|
|
7253699529 | ||
|
|
5fe546c94d | ||
|
|
31c26f16ac | ||
|
|
5eda6f96b4 | ||
|
|
56a54d5eb4 | ||
|
|
7a78a67740 | ||
|
|
742533977f | ||
|
|
2dedaea0ab | ||
|
|
cf7f55181f | ||
|
|
f68f0009a2 | ||
|
|
4799f54fd1 | ||
|
|
06ff8df2e4 | ||
|
|
9b78944f9b | ||
|
|
fc2781c83a | ||
|
|
176437531d | ||
| c28e2a72d5 | |||
| 7f630184c0 | |||
| e5a6b82853 | |||
| e1d22b1110 | |||
| 918318252e | |||
| e153463c35 | |||
| cf00732023 | |||
| ef838068ff | |||
| c4acb9725f | |||
| 04e219ff69 | |||
| 106a85aa80 | |||
| ad6e074cce | |||
| e89f06a35b | |||
| 238cc7529a | |||
| fb22eb5fac | |||
| 9ee1c21a67 | |||
| c7c142f4a0 | |||
| efd0394398 | |||
| 0091a8280a | |||
|
|
f9b0e82473 | ||
|
|
63676c21a8 | ||
| add70b4790 | |||
| d18f665556 | |||
|
|
42253e43b3 | ||
|
|
ad500a9db6 | ||
|
|
2ab03cb668 | ||
|
|
b78ddc6166 | ||
| 1e49d4095b | |||
| bf8a1f3db2 | |||
| 321cc7529e | |||
|
|
7907b3126c | ||
|
|
ccf9af0e51 | ||
| b38b43edc0 | |||
|
|
5d13c55dd5 | ||
| a1441e7ed7 | |||
| a62662d116 | |||
| 5cb953eb86 | |||
| 505ffcf405 | |||
| a45f9bfc58 | |||
| b1990c7918 | |||
| e8b801684f | |||
| de0c12c078 | |||
| b3a9c5fcda | |||
| c73d34b04f | |||
| 583b24854f | |||
| 1c79b29845 | |||
| 11f19b1f76 | |||
| c348d68983 | |||
| 6d7506cc1b | |||
| 551a1d70ae | |||
| 7ea80b51e1 | |||
| ca6d5c429c | |||
|
|
eb1bcac175 | ||
|
|
704a063cb3 | ||
|
|
1577afc4a9 | ||
|
|
aec404c0a1 | ||
|
|
1bad7eeb75 | ||
|
|
e3612ef466 | ||
|
|
01cc33e309 | ||
|
|
599f606aef | ||
|
|
c976e0e4e0 | ||
| f112a06ab6 | |||
| 8709c3dd0c | |||
| e2308214a7 | |||
| baf6234a2a | |||
| 85bfe42ddf | |||
| dac06ddd0b | |||
| b632571ebc | |||
| 7588617316 | |||
| dd6de64c44 | |||
| fadb06aabb | |||
| c4abb758f3 | |||
| 6495ddf277 | |||
| 30071709af | |||
| 37fda4bd9e | |||
| a1dc901439 | |||
| 6af8cec134 | |||
| 67f6af63f8 | |||
| be595af075 | |||
| c5c84c8630 | |||
| abc7eca40b | |||
| 2d1907569b | |||
| cb7a23950a | |||
| 941cc61577 |
@@ -3,12 +3,18 @@ root = true
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_style = tab
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
max_line_length = 120
|
||||
tab_width = 4
|
||||
insert_final_newline = false
|
||||
disabled_rules=no-wildcard-imports,no-unused-imports
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
# noinspection EditorConfigKeyCorrectness
|
||||
disabled_rules = no-wildcard-imports, no-unused-imports
|
||||
|
||||
[{*.kt,*.kts}]
|
||||
[*.{kt,kts}]
|
||||
ij_kotlin_allow_trailing_comma = true
|
||||
ij_kotlin_allow_trailing_comma_on_call_site = true
|
||||
|
||||
[*.md]
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
144
.github/ISSUE_TEMPLATE/report_issue.yml
vendored
144
.github/ISSUE_TEMPLATE/report_issue.yml
vendored
@@ -1,94 +1,66 @@
|
||||
name: 🐞 Issue report
|
||||
description: Report a source issue in Kotatsu
|
||||
labels: [bug]
|
||||
description: Report a source issue with a source
|
||||
labels: [ bug ]
|
||||
body:
|
||||
|
||||
- type: input
|
||||
id: source
|
||||
attributes:
|
||||
label: Source information
|
||||
description: |
|
||||
You can find the source name in navigation drawer.
|
||||
placeholder: |
|
||||
Example: "MangaDex"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: source
|
||||
attributes:
|
||||
label: Source information
|
||||
description: |
|
||||
You can find the source name in navigation drawer.
|
||||
placeholder: |
|
||||
Example: "MangaDex"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: reproduce-steps
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: Provide an example of the issue.
|
||||
placeholder: |
|
||||
Example:
|
||||
1. First step
|
||||
2. Second step
|
||||
3. Issue here
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce-steps
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: Provide an example of the issue.
|
||||
placeholder: |
|
||||
Example:
|
||||
1. First step
|
||||
2. Second step
|
||||
3. Issue here
|
||||
Please use English language
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: expected-behavior
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
placeholder: |
|
||||
Example:
|
||||
"This should happen..."
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: kotatsu-version
|
||||
attributes:
|
||||
label: Kotatsu version
|
||||
description: |
|
||||
You can find your Kotatsu version in **Settings → About**.
|
||||
placeholder: |
|
||||
Example: "3.3"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: actual-behavior
|
||||
attributes:
|
||||
label: Actual behavior
|
||||
placeholder: |
|
||||
Example:
|
||||
"This happened instead..."
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: android-version
|
||||
attributes:
|
||||
label: Android version
|
||||
description: |
|
||||
You can find this somewhere in your Android settings.
|
||||
placeholder: |
|
||||
Example: "Android 12"
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: input
|
||||
id: kotatsu-version
|
||||
attributes:
|
||||
label: Kotatsu version
|
||||
description: |
|
||||
You can find your Kotatsu version in **Settings → About**.
|
||||
placeholder: |
|
||||
Example: "3.3.1"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: other-details
|
||||
attributes:
|
||||
label: Other details
|
||||
placeholder: |
|
||||
Additional details and attachments.
|
||||
|
||||
- type: input
|
||||
id: android-version
|
||||
attributes:
|
||||
label: Android version
|
||||
description: |
|
||||
You can find this somewhere in your Android settings.
|
||||
placeholder: |
|
||||
Example: "Android 12"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: other-details
|
||||
attributes:
|
||||
label: Other details
|
||||
placeholder: |
|
||||
Additional details and attachments.
|
||||
|
||||
- type: checkboxes
|
||||
id: acknowledgements
|
||||
attributes:
|
||||
label: Acknowledgements
|
||||
description: Your issue will be closed if you haven't done these steps.
|
||||
options:
|
||||
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open issue.
|
||||
required: true
|
||||
- label: I have written a short but informative title.
|
||||
required: true
|
||||
- label: I have updated the app to version **[3.3.1](https://github.com/KotatsuApp/Kotatsu/releases/latest)**.
|
||||
required: true
|
||||
- label: If this is an issue with the app itself, I should be opening an issue in the [app repository](https://github.com/KotatsuApp/Kotatsu/issues/new/choose).
|
||||
required: true
|
||||
- label: I will fill out all of the requested information in this form.
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: acknowledgements
|
||||
attributes:
|
||||
label: Acknowledgements
|
||||
options:
|
||||
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open issue.
|
||||
required: true
|
||||
|
||||
58
.github/ISSUE_TEMPLATE/request_feature.yml
vendored
58
.github/ISSUE_TEMPLATE/request_feature.yml
vendored
@@ -1,39 +1,31 @@
|
||||
name: ⭐ Feature request
|
||||
description: Suggest a feature to improve a source
|
||||
labels: [feature request]
|
||||
labels: [ feature request ]
|
||||
body:
|
||||
|
||||
- type: textarea
|
||||
id: feature-description
|
||||
attributes:
|
||||
label: Describe your suggested feature
|
||||
description: How can an existing source be improved?
|
||||
placeholder: |
|
||||
Example:
|
||||
"It should work like this..."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: feature-description
|
||||
attributes:
|
||||
label: Describe your suggested feature
|
||||
description: How can an existing source be improved?
|
||||
placeholder: |
|
||||
Example:
|
||||
"It should work like this..."
|
||||
Please use English language
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: other-details
|
||||
attributes:
|
||||
label: Other details
|
||||
placeholder: |
|
||||
Additional details and attachments.
|
||||
- type: textarea
|
||||
id: other-details
|
||||
attributes:
|
||||
label: Other details
|
||||
placeholder: |
|
||||
Additional details and attachments.
|
||||
|
||||
- type: checkboxes
|
||||
id: acknowledgements
|
||||
attributes:
|
||||
label: Acknowledgements
|
||||
description: Your issue will be closed if you haven't done these steps.
|
||||
options:
|
||||
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open issue.
|
||||
required: true
|
||||
- label: I have written a short but informative title.
|
||||
required: true
|
||||
- label: If this is an issue with the app itself, I should be opening an issue in the [app repository](https://github.com/KotatsuApp/Kotatsu/issues/new/choose).
|
||||
required: true
|
||||
- label: I have updated the app to version **[3.3.1](https://github.com/KotatsuApp/Kotatsu/releases/latest)**.
|
||||
required: true
|
||||
- label: I will fill out all of the requested information in this form.
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: acknowledgements
|
||||
attributes:
|
||||
label: Acknowledgements
|
||||
options:
|
||||
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open issue.
|
||||
required: true
|
||||
|
||||
52
.github/ISSUE_TEMPLATE/request_removal.yml
vendored
52
.github/ISSUE_TEMPLATE/request_removal.yml
vendored
@@ -1,33 +1,31 @@
|
||||
name: 🗑 Source removal request
|
||||
description: Scanlators can request their site to be removed
|
||||
labels: [source removal]
|
||||
labels: [ source removal ]
|
||||
body:
|
||||
|
||||
- type: input
|
||||
id: link
|
||||
attributes:
|
||||
label: Source link
|
||||
placeholder: |
|
||||
Example: "https://example.org"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: link
|
||||
attributes:
|
||||
label: Source link
|
||||
placeholder: |
|
||||
Example: "https://example.org"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: other-details
|
||||
attributes:
|
||||
label: Other details
|
||||
placeholder: |
|
||||
Additional details and attachments.
|
||||
- type: textarea
|
||||
id: other-details
|
||||
attributes:
|
||||
label: Other details (reason for removal, etc)
|
||||
placeholder: |
|
||||
Additional details and attachments.
|
||||
|
||||
- type: checkboxes
|
||||
id: requirements
|
||||
attributes:
|
||||
label: Requirements
|
||||
description: Your request will be denied if you don't meet these requirements.
|
||||
options:
|
||||
- label: Proof of ownership/intent to remove sent to a Kotatsu Discord server mod via DM
|
||||
required: true
|
||||
- label: Site only hosts content scanlated by the group and not stolen from other scanlators or official releases (i.e., not an aggregator site)
|
||||
required: true
|
||||
- label: Site is not infested with user-hostile features (e.g., invasive or malicious ads)
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: requirements
|
||||
attributes:
|
||||
label: Requirements
|
||||
description: Your request will be denied if you don't meet these requirements.
|
||||
options:
|
||||
- label: Proof of ownership of the website is sent to a Kotatsu [Discord server](https://discord.gg/NNJ5RgVBC5) or [Telegram community](https://t.me/kotatsuapp)
|
||||
required: true
|
||||
- label: Site only hosts content scanlated by the group and not stolen from other scanlators or official releases (i.e., not an aggregator site)
|
||||
required: true
|
||||
|
||||
94
.github/ISSUE_TEMPLATE/request_source.yml
vendored
94
.github/ISSUE_TEMPLATE/request_source.yml
vendored
@@ -1,57 +1,53 @@
|
||||
name: 🌐 Source request
|
||||
description: Suggest a new source for Kotatsu
|
||||
labels: [source request]
|
||||
labels: [ source request ]
|
||||
body:
|
||||
|
||||
- type: input
|
||||
id: name
|
||||
attributes:
|
||||
label: Source name
|
||||
placeholder: |
|
||||
Example: "Example Scans"
|
||||
validations:
|
||||
required: true
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: Please specify source **name** and **language** in the issue title
|
||||
- type: input
|
||||
id: name
|
||||
attributes:
|
||||
label: Source name
|
||||
placeholder: |
|
||||
Example: "Example Scans"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: link
|
||||
attributes:
|
||||
label: Source link
|
||||
placeholder: |
|
||||
Example: "https://example.org"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: link
|
||||
attributes:
|
||||
label: Source link
|
||||
placeholder: |
|
||||
Example: "https://example.org"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: language
|
||||
attributes:
|
||||
label: Language
|
||||
placeholder: |
|
||||
Example: "English"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: language
|
||||
attributes:
|
||||
label: Language
|
||||
placeholder: |
|
||||
Example: "English"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: other-details
|
||||
attributes:
|
||||
label: Other details
|
||||
placeholder: |
|
||||
Additional details and attachments.
|
||||
- type: textarea
|
||||
id: other-details
|
||||
attributes:
|
||||
label: Other details
|
||||
placeholder: |
|
||||
Additional details and attachments.
|
||||
|
||||
- type: checkboxes
|
||||
id: acknowledgements
|
||||
attributes:
|
||||
label: Acknowledgements
|
||||
description: Your issue will be closed if you haven't done these steps.
|
||||
options:
|
||||
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open issue.
|
||||
required: true
|
||||
- label: I have written a title with source name.
|
||||
required: true
|
||||
- label: I have updated the app to version **[3.3.1](https://github.com/KotatsuApp/Kotatsu/releases/latest)**.
|
||||
required: true
|
||||
- label: I have checked that the source does not already exist on the app.
|
||||
required: true
|
||||
- label: I have checked that the source does not already exist by searching the [GitHub repository](https://github.com/KotatsuApp/kotatsu-parsers) and verified it does not appear in the code base.
|
||||
required: true
|
||||
- label: I will fill out all of the requested information in this form.
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: acknowledgements
|
||||
attributes:
|
||||
label: Acknowledgements
|
||||
options:
|
||||
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open issue.
|
||||
required: true
|
||||
- label: I have checked that the source does not already exist on the app.
|
||||
required: true
|
||||
- label: I have checked that the source does not already exist by searching the [GitHub repository](https://github.com/KotatsuApp/kotatsu-parsers) and verified it does not appear in the code base.
|
||||
required: true
|
||||
|
||||
1
.github/summary.yaml
vendored
Normal file
1
.github/summary.yaml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
total: 1251
|
||||
27
.github/workflows/test-branch.yml
vendored
Normal file
27
.github/workflows/test-branch.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Check & Test latest parsers
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
check-and-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository 🌏
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Set up enviroment 🔧
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Set up Gradle 📦
|
||||
uses: gradle/actions/setup-gradle@017a9effdb900e5b5b2fddfb590a105619dca3c3 # v4.4.2
|
||||
with:
|
||||
cache-read-only: true
|
||||
|
||||
- name: Compile parsers 🚀
|
||||
run: ./gradlew compileKotlin
|
||||
46
.github/workflows/test-parsers.yml
vendored
46
.github/workflows/test-parsers.yml
vendored
@@ -1,27 +1,31 @@
|
||||
name: Parsers test
|
||||
name: Parsers test for PRs
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/main/kotlin/org/koitharu/kotatsu/parsers/site/*'
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/main/kotlin/org/koitharu/kotatsu/parsers/**'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'temurin'
|
||||
cache: 'gradle'
|
||||
- run: ./gradlew :test --tests "org.koitharu.kotatsu.parsers.MangaParserTest" || true
|
||||
- run: ./gradlew generateTestsReport
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Report
|
||||
path: build/test-results-html/TEST-org.koitharu.kotatsu.parsers.MangaParserTest.htm
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository 🌏
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Set up enviroment 🔧
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Set up Gradle 📦
|
||||
uses: gradle/actions/setup-gradle@017a9effdb900e5b5b2fddfb590a105619dca3c3 # v4.4.2
|
||||
with:
|
||||
cache-read-only: true
|
||||
|
||||
- name: Compile parsers 🚀
|
||||
run: ./gradlew compileKotlin
|
||||
|
||||
18
.gitignore
vendored
18
.gitignore
vendored
@@ -4,6 +4,7 @@
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
.idea/**/copilot
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
@@ -16,6 +17,7 @@
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
.idea/**/Project_Default.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
@@ -25,10 +27,13 @@
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
.idea/deviceManager.xml
|
||||
.idea/.name
|
||||
.idea/artifacts
|
||||
.idea/compiler.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/modules.xml
|
||||
.idea/ktlint-plugin.xml
|
||||
.idea/*.iml
|
||||
.idea/modules
|
||||
*.iml
|
||||
@@ -69,10 +74,21 @@ fabric.properties
|
||||
|
||||
.gradle/
|
||||
build/
|
||||
bin/
|
||||
|
||||
.idea/**/misc.xml
|
||||
.idea/**/vcs.xml
|
||||
.idea/**/ktlint.xml
|
||||
.idea/codeStyles/
|
||||
.idea/kotlinc.xml
|
||||
|
||||
src/test/resources/cookies.txt
|
||||
src/test/resources/cookies.txt
|
||||
local.properties
|
||||
.kotlin/
|
||||
!/.idea/kotlin-statistics.xml
|
||||
|
||||
.idea/**/discord.xml
|
||||
.idea/**/migrations.xml
|
||||
.idea/**/runConfigurations.xml
|
||||
.idea/**/AndroidProjectSystem.xml
|
||||
.idea/caches/deviceStreaming.xml
|
||||
|
||||
5
.idea/.gitignore
generated
vendored
5
.idea/.gitignore
generated
vendored
@@ -1,3 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# GitHub Copilot persisted chat sessions
|
||||
/copilot/chatSessions
|
||||
|
||||
.name
|
||||
deviceManager.xml
|
||||
|
||||
6
.idea/kotlinc.xml
generated
6
.idea/kotlinc.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.6.21" />
|
||||
</component>
|
||||
</project>
|
||||
7
.idea/runConfigurations/TestsAndReport.xml
generated
7
.idea/runConfigurations/TestsAndReport.xml
generated
@@ -1,7 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="TestsAndReport" type="CompoundRunConfigurationType">
|
||||
<toRun name="MangaParserTest" type="GradleRunConfiguration" />
|
||||
<toRun name="kotatsu-parsers [generateTestsReport]" type="GradleRunConfiguration" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
96
CONTRIBUTING.md
Normal file
96
CONTRIBUTING.md
Normal file
@@ -0,0 +1,96 @@
|
||||
# Contributing
|
||||
|
||||
The following is a guide for creating Kotatsu parsers. Thanks for taking the time to contribute!
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before you start, please note that the ability to use the following technologies is **required**.
|
||||
|
||||
- Basic [Android development](https://developer.android.com/)
|
||||
- [Kotlin](https://kotlinlang.org/)
|
||||
- Web scraping ([JSoup](https://jsoup.org/)) or JSON API
|
||||
|
||||
### Tools
|
||||
|
||||
- [Android Studio](https://developer.android.com/studio)
|
||||
- [IntelliJ IDEA](https://www.jetbrains.com/idea/) (Community edition is enough)
|
||||
- Android device (or emulator)
|
||||
|
||||
Kotatsu parsers are not a part of the Android application, but you can easily develop and test it directly inside an
|
||||
Android application project and relocate it to the library project when done.
|
||||
|
||||
### Before you start
|
||||
|
||||
First, take a look at the `kotatsu-parsers` project structure. Each parser is a single class that
|
||||
extends the `MangaParser` class and has a `MangaSourceParser` annotation.
|
||||
Also, pay attention to extensions in the `util` package. For example, extensions from the `Jsoup` file
|
||||
should be used instead of existing JSoup functions because they have better nullability support
|
||||
and improved error messages.
|
||||
|
||||
## Writing your parser
|
||||
|
||||
So, you want to create a parser, that will provide access to manga from a website.
|
||||
First, you should explore a website to learn about API availability.
|
||||
If it does not contain any documentation about
|
||||
API, [explore network requests](https://firefox-source-docs.mozilla.org/devtools-user/):
|
||||
some websites use AJAX.
|
||||
|
||||
- [Example](https://github.com/KotatsuApp/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/DesuMeParser.kt)
|
||||
of Json API usage.
|
||||
- [Example](https://github.com/KotatsuApp/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/site/be/AnibelParser.kt)
|
||||
of GraphQL API usage
|
||||
- [Example](https://github.com/KotatsuApp/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/MangaTownParser.kt)
|
||||
of pure HTML parsing.
|
||||
|
||||
If the website is based on some engine it is rationally to use a common base class for this one (for example, Madara
|
||||
Wordpress theme and the `MadaraParser` class)
|
||||
|
||||
### Parser class skeleton
|
||||
|
||||
The parser class must have exactly one primary constructor parameter of type `MangaLoaderContext` and have an
|
||||
`MangaSourceParser` annotation that provides the internal name, title, and language of a manga source.
|
||||
|
||||
All members of the `MangaParser` class are documented. Pay attention to some peculiarities:
|
||||
|
||||
- Never hardcode domain. Specify the default domain in the `configKeyDomain` field and obtain an actual one using
|
||||
`domain`.
|
||||
- All IDs must be unique and domain-independent. Use `generateUid` functions with a relative URL or some internal id
|
||||
that is unique across the manga source.
|
||||
- The `availableSortOrders` set should not be empty. If your source does not support sorting, specify one most relevant
|
||||
value.
|
||||
- If you cannot obtain direct links to page images inside the `getPages` method, it is ok to use an intermediate URL
|
||||
as `Page.url` and fetch a direct link in the `getPageUrl` function.
|
||||
- You can use _asserts_ to check some optional fields. For example, the `Manga.author` field is not required, but if
|
||||
your source provides this information, add `assert(it != null)`. This will not have any effect on production but help
|
||||
to find issues during unit testing.
|
||||
- Your parser may also implement the `Interceptor` interface for additional manipulation of all network requests and
|
||||
responses, including image loading.
|
||||
- If your source website (or its API) uses pages for pagination instead of offset you should extend `PagedMangaParser`
|
||||
instead of `MangaParser`.
|
||||
- If your source website (or its API) does not provide pagination (has only one page of content) you should extend
|
||||
`SinglePageMangaParser` instead of `MangaParser` or `PagedMangaParser`.
|
||||
|
||||

|
||||
|
||||
## Development process
|
||||
|
||||
During the development, it is recommended (but not necessary) to write it directly
|
||||
in the Kotatsu Android application project. You can use the `core.parser.DummyParser` class as a sandbox. The `Dummy`
|
||||
manga source is available in the debug Kotatsu build.
|
||||
|
||||
Once the parser is ready you can relocate your code into the `kotatsu-parsers` library project in a `site` package and
|
||||
create a Pull Request.
|
||||
|
||||
### Testing
|
||||
|
||||
It is recommended that unit tests be run before submitting a PR.
|
||||
|
||||
- Temporary modify the `MangaSources` annotation class: specify your parser(s) name(s) and change mode
|
||||
to `EnumSource.Mode.INCLUDE`
|
||||
- Run the `MangaParserTest` (`gradlew :test --tests "org.koitharu.kotatsu.parsers.MangaParserTest"`)
|
||||
- Optionally, you can run the `generateTestsReport` gradle task to get a pretty readable html report from test results.
|
||||
|
||||
## Help
|
||||
|
||||
If you need help or have some questions, ask a community in our [Telegram chat](https://t.me/kotatsuapp)
|
||||
or [Discord server](https://discord.gg/NNJ5RgVBC5).
|
||||
81
README.md
81
README.md
@@ -1,49 +1,74 @@
|
||||
# Kotatsu parsers
|
||||
|
||||
Library that provides manga sources.
|
||||
This library provides a collection of manga parsers for convenient access manga available on the web. It can be used in
|
||||
JVM and Android applications.
|
||||
|
||||
[](https://jitpack.io/#nv95/kotatsu-parsers)   [](https://discord.gg/NNJ5RgVBC5)
|
||||
 [](https://jitpack.io/#KotatsuApp/kotatsu-parsers)  [](https://t.me/kotatsuapp) [](https://discord.gg/NNJ5RgVBC5)
|
||||
|
||||
### Usage
|
||||
## Usage
|
||||
|
||||
1. Add it in your root build.gradle at the end of repositories:
|
||||
1. Add it to your root build.gradle at the end of repositories:
|
||||
|
||||
```groovy
|
||||
allprojects {
|
||||
repositories {
|
||||
...
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
```
|
||||
```groovy
|
||||
allprojects {
|
||||
repositories {
|
||||
...
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. Add the dependency
|
||||
2. Add the dependency
|
||||
|
||||
For Java/Kotlin project:
|
||||
For Java/Kotlin project:
|
||||
```groovy
|
||||
dependencies {
|
||||
implementation("com.github.nv95:kotatsu-parsers:$parsers_version")
|
||||
implementation("com.github.KotatsuApp:kotatsu-parsers:$parsers_version")
|
||||
}
|
||||
```
|
||||
|
||||
For Android project:
|
||||
|
||||
For Android project:
|
||||
```groovy
|
||||
dependencies {
|
||||
implementation("com.github.nv95:kotatsu-parsers:$parsers_version") {
|
||||
implementation("com.github.KotatsuApp:kotatsu-parsers:$parsers_version") {
|
||||
exclude group: 'org.json', module: 'json'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See for versions at [JitPack](https://jitpack.io/#nv95/kotatsu-parsers)
|
||||
|
||||
|
||||
Versions are available on [JitPack](https://jitpack.io/#KotatsuApp/kotatsu-parsers)
|
||||
|
||||
When used in Android
|
||||
projects, [core library desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) with
|
||||
the [NIO specification](https://developer.android.com/studio/write/java11-nio-support-table) should be enabled to
|
||||
support Java 8+ features.
|
||||
|
||||
|
||||
3. Usage in code
|
||||
|
||||
```kotlin
|
||||
val parser = MangaSource.MANGADEX.newParser(mangaLoaderContext)
|
||||
```
|
||||
|
||||
`mangaLoaderContext` is an implementation of the `MangaLoaderContext` class.
|
||||
See [Android](https://github.com/nv95/Kotatsu/blob/devel/app/src/main/java/org/koitharu/kotatsu/core/parser/MangaLoaderContextImpl.kt) and [Non-Android](https://github.com/nv95/kotatsu-dl/blob/master/src/main/kotlin/org/koitharu/kotatsu_dl/env/MangaLoaderContextImpl.kt) implementation examples.
|
||||
```kotlin
|
||||
val parser = mangaLoaderContext.newParserInstance(MangaParserSource.MANGADEX)
|
||||
```
|
||||
|
||||
Note that the `MangaSource.LOCAL` and `MangaSource.DUMMY` parsers cannot be instantiated.
|
||||
`mangaLoaderContext` is an implementation of the `MangaLoaderContext` class.
|
||||
See examples
|
||||
of [Android](https://github.com/KotatsuApp/Kotatsu/blob/devel/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/MangaLoaderContextImpl.kt)
|
||||
and [Non-Android](https://github.com/KotatsuApp/kotatsu-dl/blob/master/src/main/kotlin/org/koitharu/kotatsu/dl/parsers/MangaLoaderContextImpl.kt)
|
||||
implementation.
|
||||
|
||||
## Projects that use the library
|
||||
|
||||
- [Kotatsu](https://github.com/KotatsuApp/Kotatsu)
|
||||
- [Doki](https://github.com/DokiTeam/Doki)
|
||||
- [kotatsu-dl](https://github.com/KotatsuApp/kotatsu-dl)
|
||||
- [Shirizu (WIP)](https://github.com/ztimms73/shirizu)
|
||||
- [OtakuWorld](https://github.com/jakepurple13/OtakuWorld)
|
||||
|
||||
## Contribution
|
||||
|
||||
See [CONTRIBUTING.md](./CONTRIBUTING.md) for the guidelines.
|
||||
|
||||
## DMCA disclaimer
|
||||
|
||||
The developers of this application have no affiliation with the content available in the app. It is collected from
|
||||
sources freely available through any web browser.
|
||||
|
||||
72
build.gradle
72
build.gradle
@@ -1,72 +0,0 @@
|
||||
import tasks.ReportGenerateTask
|
||||
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'org.jetbrains.kotlin.jvm'
|
||||
id 'com.google.devtools.ksp'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
group = 'org.koitharu'
|
||||
version = '1.0'
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
freeCompilerArgs += [
|
||||
'-opt-in=kotlin.RequiresOptIn',
|
||||
'-opt-in=kotlin.contracts.ExperimentalContracts',
|
||||
'-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi',
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
compileTestKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
freeCompilerArgs += [
|
||||
'-opt-in=kotlin.RequiresOptIn',
|
||||
'-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi',
|
||||
'-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi',
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
main.kotlin.srcDirs += 'build/generated/ksp/main/kotlin'
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
|
||||
implementation 'com.squareup.okio:okio:3.2.0'
|
||||
implementation 'org.jsoup:jsoup:1.15.1'
|
||||
implementation 'org.json:json:20220320'
|
||||
implementation 'androidx.collection:collection-ktx:1.2.0'
|
||||
|
||||
ksp project(':kotatsu-parsers-ksp')
|
||||
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
|
||||
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.3'
|
||||
testImplementation 'io.webfolder:quickjs:1.1.0'
|
||||
}
|
||||
|
||||
task generateTestsReport(type: ReportGenerateTask)
|
||||
63
build.gradle.kts
Normal file
63
build.gradle.kts
Normal file
@@ -0,0 +1,63 @@
|
||||
import tasks.ReportGenerateTask
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
alias(libs.plugins.kotlin.jvm)
|
||||
alias(libs.plugins.ksp)
|
||||
}
|
||||
|
||||
group = "org.koitharu"
|
||||
version = "1.0"
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
ksp {
|
||||
arg("summaryOutputDir", "${projectDir}/.github")
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
compilerOptions {
|
||||
freeCompilerArgs.addAll(
|
||||
"-opt-in=kotlin.RequiresOptIn",
|
||||
"-opt-in=kotlin.contracts.ExperimentalContracts",
|
||||
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||
"-opt-in=org.koitharu.kotatsu.parsers.InternalParsersApi",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(8)
|
||||
explicitApiWarning()
|
||||
sourceSets["main"].kotlin.srcDirs("build/generated/ksp/main/kotlin")
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
implementation(libs.okhttp)
|
||||
implementation(libs.okio)
|
||||
implementation(libs.json)
|
||||
implementation(libs.androidx.collection)
|
||||
api(libs.jsoup)
|
||||
|
||||
ksp(project(":kotatsu-parsers-ksp"))
|
||||
|
||||
testImplementation(libs.junit.api)
|
||||
testImplementation(libs.junit.engine)
|
||||
testImplementation(libs.junit.params)
|
||||
testImplementation(libs.kotlinx.coroutines.test)
|
||||
testImplementation(libs.quickjs)
|
||||
}
|
||||
|
||||
tasks.register<ReportGenerateTask>("generateTestsReport")
|
||||
@@ -1,13 +0,0 @@
|
||||
plugins {
|
||||
id('org.jetbrains.kotlin.jvm') version '1.6.21'
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation gradleApi()
|
||||
implementation 'org.simpleframework:simple-xml:2.7.1'
|
||||
implementation 'com.soywiz.korlibs.korte:korte-jvm:3.0.0-Beta5'
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3'
|
||||
}
|
||||
18
buildSrc/build.gradle.kts
Normal file
18
buildSrc/build.gradle.kts
Normal file
@@ -0,0 +1,18 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "2.2.10"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(8)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(gradleApi())
|
||||
implementation("org.simpleframework:simple-xml:2.7.1")
|
||||
implementation("com.soywiz.korlibs.korte:korte-jvm:4.0.10")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package tasks
|
||||
|
||||
import com.soywiz.korte.Template
|
||||
import korlibs.template.Template
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
@@ -42,10 +42,13 @@ open class ReportGenerateTask : DefaultTask() {
|
||||
val results = LinkedHashMap<String, LinkedHashMap<String, TestCase>>()
|
||||
val tests = LinkedHashSet<String>()
|
||||
for (case in testSuite.testCases) {
|
||||
if (!case.isValid()) {
|
||||
continue
|
||||
}
|
||||
tests.add(case.testName)
|
||||
val map = results.getOrPut(case.source) { LinkedHashMap() }
|
||||
val oldValue = map.put(case.testName, case)
|
||||
check(oldValue == null)
|
||||
check(oldValue == null) { "Check failed: $oldValue" }
|
||||
}
|
||||
|
||||
val failPercent = (testSuite.failures.toDouble() / testSuite.tests * 100.0).roundToInt()
|
||||
|
||||
@@ -19,14 +19,16 @@ class TestCase {
|
||||
var failure: Failure? = null
|
||||
|
||||
val index by lazy {
|
||||
name.split('|')[0].toInt()
|
||||
name.split('|').getOrNull(0)?.toIntOrNull() ?: 0
|
||||
}
|
||||
|
||||
val testName by lazy {
|
||||
name.split('|')[1]
|
||||
name.split('|').getOrNull(1).orEmpty()
|
||||
}
|
||||
|
||||
val source by lazy {
|
||||
name.split('|')[2]
|
||||
name.split('|').getOrNull(2).orEmpty()
|
||||
}
|
||||
}
|
||||
|
||||
fun isValid() = name.count { it == '|' } == 2
|
||||
}
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta content="width=device-width, initial-scale=1" name="viewport">
|
||||
<title>{{ testSuite.name }}</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2"
|
||||
crossorigin="anonymous"></script>
|
||||
<!-- CSS only -->
|
||||
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" rel="stylesheet">
|
||||
<!-- JavaScript Bundle with Popper -->
|
||||
<script crossorigin="anonymous"
|
||||
integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3"
|
||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
||||
</head>
|
||||
<body class="py-4">
|
||||
@@ -25,67 +27,80 @@
|
||||
{{ testSuite.errors }} ({{ error_percent }}%)
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive mt-4">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Source</th>
|
||||
{% for test in tests %}
|
||||
<th scope="col" style="min-width: 5em;">{{ test }}</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
{% for name, cases in results %}
|
||||
<tr>
|
||||
<th scope="row">{{ name }}</th>
|
||||
{% for test in tests %}
|
||||
{% set case = cases[test] %}
|
||||
{% if case.failure == null %}
|
||||
<td class="table-success text-center">
|
||||
<i data-feather="check"></i>
|
||||
</td>
|
||||
{% else %}
|
||||
{% if case.failure.type == 'java.lang.AssertionError' %}
|
||||
<td class="table-warning text-center" style="cursor: pointer;"
|
||||
data-bs-toggle="modal" data-bs-target="#failure_{{ case.hashCode }}">
|
||||
<i data-feather="alert-triangle"></i>
|
||||
</td>
|
||||
{% else %}
|
||||
<td class="table-danger text-center" style="cursor: pointer;"
|
||||
data-bs-toggle="modal" data-bs-target="#failure_{{ case.hashCode }}">
|
||||
<i data-feather="x"></i>
|
||||
</td>
|
||||
{% endif %}
|
||||
<!--suppress HtmlUnknownTag -->
|
||||
<div class="modal fade" id="failure_{{ case.hashCode }}" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg modal-dialog-scrollable">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">{{ case.testName }} failed</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"
|
||||
aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body font-monospace lh-sm bg-light" style="font-size: 0.7em;">
|
||||
{{ case.failure.textHtml()|raw }}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
</div>
|
||||
<table class="table table-hover">
|
||||
<thead class="sticky-top bg-body">
|
||||
<tr>
|
||||
<th scope="col">Source</th>
|
||||
{% for test in tests %}
|
||||
<th class="text-center" scope="col" style="min-width: 5em;">{{ test }}</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
{% for name, cases in results %}
|
||||
<tr>
|
||||
<th scope="row">{{ name }}</th>
|
||||
{% for test in tests %}
|
||||
{% set case = cases[test] %}
|
||||
{% if case.failure == null %}
|
||||
<td class="table-success text-center">
|
||||
<i data-feather="check"></i>
|
||||
</td>
|
||||
{% else %}
|
||||
{% if case.failure.type == 'java.lang.AssertionError' %}
|
||||
<td class="table-warning text-center" data-bs-target="#failure_{{ case.hashCode }}"
|
||||
data-bs-toggle="modal" style="cursor: pointer;">
|
||||
<i data-feather="alert-triangle"></i>
|
||||
</td>
|
||||
{% elseif case.failure.type == 'java.net.SocketTimeoutException' or case.failure.type ==
|
||||
'java.net.UnknownHostException' %}
|
||||
<td class="table-secondary text-center" data-bs-target="#failure_{{ case.hashCode }}"
|
||||
data-bs-toggle="modal" style="cursor: pointer;">
|
||||
<i data-feather="power"></i>
|
||||
</td>
|
||||
{% elseif case.failure.type == 'org.koitharu.kotatsu.parsers.CloudFlareProtectedException' %}
|
||||
<td class="table-secondary text-center" data-bs-target="#failure_{{ case.hashCode }}"
|
||||
data-bs-toggle="modal" style="cursor: pointer;">
|
||||
<i data-feather="shield"></i>
|
||||
</td>
|
||||
{% elseif case.failure.type == 'org.koitharu.kotatsu.parsers.exception.AuthRequiredException' %}
|
||||
<td class="table-secondary text-center" data-bs-target="#failure_{{ case.hashCode }}"
|
||||
data-bs-toggle="modal" style="cursor: pointer;">
|
||||
<i data-feather="user-x"></i>
|
||||
</td>
|
||||
{% else %}
|
||||
<td class="table-danger text-center" data-bs-target="#failure_{{ case.hashCode }}"
|
||||
data-bs-toggle="modal" style="cursor: pointer;">
|
||||
<i data-feather="x"></i>
|
||||
</td>
|
||||
{% endif %}
|
||||
<!--suppress HtmlUnknownTag -->
|
||||
<div class="modal fade" id="failure_{{ case.hashCode }}" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg modal-dialog-scrollable">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">{{ case.testName }} failed</h5>
|
||||
<button aria-label="Close" class="btn-close" data-bs-dismiss="modal"
|
||||
type="button"></button>
|
||||
</div>
|
||||
<div class="modal-body font-monospace lh-sm bg-light" style="font-size: 0.7em;">
|
||||
{{ case.failure.textHtml()|raw }}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-secondary" data-bs-dismiss="modal" type="button">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
<script>
|
||||
feather.replace()
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
804
docs/parser_classes.gaphor
Normal file
804
docs/parser_classes.gaphor
Normal file
@@ -0,0 +1,804 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<gaphor xmlns="https://gaphor.org/model" xmlns:Core="https://gaphor.org/modelinglanguage/Core" xmlns:UML="https://gaphor.org/modelinglanguage/UML" xmlns:general="https://gaphor.org/modelinglanguage/general" version="4" gaphor-version="3.1.0">
|
||||
<model>
|
||||
<Core:StyleSheet id="58d6989a-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
<UML:Package id="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed">
|
||||
<name>
|
||||
<val>Новая модель</val>
|
||||
</name>
|
||||
<ownedDiagram>
|
||||
<reflist>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</reflist>
|
||||
</ownedDiagram>
|
||||
<ownedType>
|
||||
<reflist>
|
||||
<ref refid="0b54a350-f59d-11ef-bfb1-4cbb5880a0b8"/>
|
||||
<ref refid="a300f58a-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="ad4c68d0-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="198a3108-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="32081654-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</ownedType>
|
||||
<packagedElement>
|
||||
<reflist>
|
||||
<ref refid="0b54a350-f59d-11ef-bfb1-4cbb5880a0b8"/>
|
||||
<ref refid="a300f58a-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="ad4c68d0-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="198a3108-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="32081654-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="25a17c58-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="41318a02-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</packagedElement>
|
||||
</UML:Package>
|
||||
<UML:Diagram id="58d6c536-66f8-11ec-b4c8-0456e5e540ed">
|
||||
<element>
|
||||
<ref refid="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</element>
|
||||
<name>
|
||||
<val>Новая диаграмма</val>
|
||||
</name>
|
||||
<ownedPresentation>
|
||||
<reflist>
|
||||
<ref refid="0b54edc4-f59d-11ef-bfb1-4cbb5880a0b8"/>
|
||||
<ref refid="a3018fc2-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="ad4d2aae-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="198aace6-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="320868c0-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="b760bcd4-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="bff32eae-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="d5113ca4-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="e8042ad8-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="531831f2-f5c0-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="5ccae8d4-f5c0-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="b6e0240e-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="254e40f6-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="2bb6e87a-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="40e36d2c-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="bcc07c64-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="f6b48e4c-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="f89ba010-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="fabe0540-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="6f993af6-f5c0-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</ownedPresentation>
|
||||
</UML:Diagram>
|
||||
<UML:Class id="0b54a350-f59d-11ef-bfb1-4cbb5880a0b8">
|
||||
<clientDependency>
|
||||
<reflist>
|
||||
<ref refid="25a17c58-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</clientDependency>
|
||||
<comment>
|
||||
<reflist>
|
||||
<ref refid="bff31afe-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</comment>
|
||||
<isAbstract>
|
||||
<val>1</val>
|
||||
</isAbstract>
|
||||
<name>
|
||||
<val>AbstractMangaParser</val>
|
||||
</name>
|
||||
<owningPackage>
|
||||
<ref refid="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</owningPackage>
|
||||
<package>
|
||||
<ref refid="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</package>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="0b54edc4-f59d-11ef-bfb1-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
<specialization>
|
||||
<reflist>
|
||||
<ref refid="b969dac6-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="2c236356-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</specialization>
|
||||
</UML:Class>
|
||||
<UML:ClassItem id="0b54edc4-f59d-11ef-bfb1-4cbb5880a0b8">
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 405.16796875, 388.8671875)</val>
|
||||
</matrix>
|
||||
<top-left>
|
||||
<val>(0.0, 0.0)</val>
|
||||
</top-left>
|
||||
<width>
|
||||
<val>158.0</val>
|
||||
</width>
|
||||
<height>
|
||||
<val>60.0</val>
|
||||
</height>
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<show_attributes>
|
||||
<val>0</val>
|
||||
</show_attributes>
|
||||
<show_operations>
|
||||
<val>0</val>
|
||||
</show_operations>
|
||||
<subject>
|
||||
<ref refid="0b54a350-f59d-11ef-bfb1-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
</UML:ClassItem>
|
||||
<UML:Class id="a300f58a-f5bd-11ef-9ec2-4cbb5880a0b8">
|
||||
<comment>
|
||||
<reflist>
|
||||
<ref refid="d5112a70-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</comment>
|
||||
<generalization>
|
||||
<reflist>
|
||||
<ref refid="b969dac6-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</generalization>
|
||||
<isAbstract>
|
||||
<val>1</val>
|
||||
</isAbstract>
|
||||
<name>
|
||||
<val>PagedMangaParser</val>
|
||||
</name>
|
||||
<owningPackage>
|
||||
<ref refid="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</owningPackage>
|
||||
<package>
|
||||
<ref refid="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</package>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="a3018fc2-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
</UML:Class>
|
||||
<UML:ClassItem id="a3018fc2-f5bd-11ef-9ec2-4cbb5880a0b8">
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 476.3368367667698, 525.76953125)</val>
|
||||
</matrix>
|
||||
<top-left>
|
||||
<val>(0.0, 0.0)</val>
|
||||
</top-left>
|
||||
<width>
|
||||
<val>142.0</val>
|
||||
</width>
|
||||
<height>
|
||||
<val>60.0</val>
|
||||
</height>
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<show_attributes>
|
||||
<val>0</val>
|
||||
</show_attributes>
|
||||
<show_operations>
|
||||
<val>0</val>
|
||||
</show_operations>
|
||||
<subject>
|
||||
<ref refid="a300f58a-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
</UML:ClassItem>
|
||||
<UML:Class id="ad4c68d0-f5bd-11ef-9ec2-4cbb5880a0b8">
|
||||
<comment>
|
||||
<reflist>
|
||||
<ref refid="e80418f4-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</comment>
|
||||
<generalization>
|
||||
<reflist>
|
||||
<ref refid="2c236356-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</generalization>
|
||||
<isAbstract>
|
||||
<val>1</val>
|
||||
</isAbstract>
|
||||
<name>
|
||||
<val>SinglePageMangaParser</val>
|
||||
</name>
|
||||
<owningPackage>
|
||||
<ref refid="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</owningPackage>
|
||||
<package>
|
||||
<ref refid="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</package>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="ad4d2aae-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
</UML:Class>
|
||||
<UML:ClassItem id="ad4d2aae-f5bd-11ef-9ec2-4cbb5880a0b8">
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 405.16796875, 627.46875)</val>
|
||||
</matrix>
|
||||
<top-left>
|
||||
<val>(0.0, 0.0)</val>
|
||||
</top-left>
|
||||
<width>
|
||||
<val>175.0</val>
|
||||
</width>
|
||||
<height>
|
||||
<val>60.0</val>
|
||||
</height>
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<show_attributes>
|
||||
<val>0</val>
|
||||
</show_attributes>
|
||||
<show_operations>
|
||||
<val>0</val>
|
||||
</show_operations>
|
||||
<subject>
|
||||
<ref refid="ad4c68d0-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
</UML:ClassItem>
|
||||
<UML:GeneralizationItem id="b6e0240e-f5bd-11ef-9ec2-4cbb5880a0b8">
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<horizontal>
|
||||
<val>False</val>
|
||||
</horizontal>
|
||||
<orthogonal>
|
||||
<val>False</val>
|
||||
</orthogonal>
|
||||
<subject>
|
||||
<ref refid="b969dac6-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 499.2109069824219, 463.45703125)</val>
|
||||
</matrix>
|
||||
<points>
|
||||
<val>[(28.486861756586336, 62.3125), (25.111328125, -14.58984375)]</val>
|
||||
</points>
|
||||
<head-connection>
|
||||
<ref refid="a3018fc2-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</head-connection>
|
||||
<tail-connection>
|
||||
<ref refid="0b54edc4-f59d-11ef-bfb1-4cbb5880a0b8"/>
|
||||
</tail-connection>
|
||||
</UML:GeneralizationItem>
|
||||
<UML:Generalization id="b969dac6-f5bd-11ef-9ec2-4cbb5880a0b8">
|
||||
<general>
|
||||
<ref refid="0b54a350-f59d-11ef-bfb1-4cbb5880a0b8"/>
|
||||
</general>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="b6e0240e-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
<specific>
|
||||
<ref refid="a300f58a-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</specific>
|
||||
</UML:Generalization>
|
||||
<UML:Interface id="198a3108-f5be-11ef-9ec2-4cbb5880a0b8">
|
||||
<name>
|
||||
<val>MangaParser</val>
|
||||
</name>
|
||||
<owningPackage>
|
||||
<ref refid="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</owningPackage>
|
||||
<package>
|
||||
<ref refid="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</package>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="198aace6-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
<supplierDependency>
|
||||
<reflist>
|
||||
<ref refid="25a17c58-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
<ref refid="41318a02-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</supplierDependency>
|
||||
</UML:Interface>
|
||||
<UML:InterfaceItem id="198aace6-f5be-11ef-9ec2-4cbb5880a0b8">
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 278.00391387939453, 232.92578125)</val>
|
||||
</matrix>
|
||||
<top-left>
|
||||
<val>(0.0, 0.0)</val>
|
||||
</top-left>
|
||||
<width>
|
||||
<val>105.0</val>
|
||||
</width>
|
||||
<height>
|
||||
<val>80.0</val>
|
||||
</height>
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<show_attributes>
|
||||
<val>0</val>
|
||||
</show_attributes>
|
||||
<show_operations>
|
||||
<val>0</val>
|
||||
</show_operations>
|
||||
<subject>
|
||||
<ref refid="198a3108-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
<folded>
|
||||
<val>0</val>
|
||||
</folded>
|
||||
</UML:InterfaceItem>
|
||||
<UML:InterfaceRealizationItem id="254e40f6-f5be-11ef-9ec2-4cbb5880a0b8">
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<horizontal>
|
||||
<val>False</val>
|
||||
</horizontal>
|
||||
<orthogonal>
|
||||
<val>False</val>
|
||||
</orthogonal>
|
||||
<subject>
|
||||
<ref refid="25a17c58-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 306.1445007324219, 270.0625)</val>
|
||||
</matrix>
|
||||
<points>
|
||||
<val>[(55.866059373910275, 42.86328125), (164.5765002560883, 118.8046875)]</val>
|
||||
</points>
|
||||
<head-connection>
|
||||
<ref refid="198aace6-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</head-connection>
|
||||
<tail-connection>
|
||||
<ref refid="0b54edc4-f59d-11ef-bfb1-4cbb5880a0b8"/>
|
||||
</tail-connection>
|
||||
</UML:InterfaceRealizationItem>
|
||||
<UML:InterfaceRealization id="25a17c58-f5be-11ef-9ec2-4cbb5880a0b8">
|
||||
<client>
|
||||
<reflist>
|
||||
<ref refid="0b54a350-f59d-11ef-bfb1-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</client>
|
||||
<owningPackage>
|
||||
<ref refid="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</owningPackage>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="254e40f6-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
<supplier>
|
||||
<reflist>
|
||||
<ref refid="198a3108-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</supplier>
|
||||
</UML:InterfaceRealization>
|
||||
<UML:GeneralizationItem id="2bb6e87a-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<horizontal>
|
||||
<val>False</val>
|
||||
</horizontal>
|
||||
<orthogonal>
|
||||
<val>False</val>
|
||||
</orthogonal>
|
||||
<subject>
|
||||
<ref refid="2c236356-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 436.2929382324219, 439.1913757324219)</val>
|
||||
</matrix>
|
||||
<points>
|
||||
<val>[(20.37646032737257, 188.27737426757812), (18.488327026367188, 9.675811767578125)]</val>
|
||||
</points>
|
||||
<head-connection>
|
||||
<ref refid="ad4d2aae-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</head-connection>
|
||||
<tail-connection>
|
||||
<ref refid="0b54edc4-f59d-11ef-bfb1-4cbb5880a0b8"/>
|
||||
</tail-connection>
|
||||
</UML:GeneralizationItem>
|
||||
<UML:Generalization id="2c236356-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<general>
|
||||
<ref refid="0b54a350-f59d-11ef-bfb1-4cbb5880a0b8"/>
|
||||
</general>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="2bb6e87a-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
<specific>
|
||||
<ref refid="ad4c68d0-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</specific>
|
||||
</UML:Generalization>
|
||||
<UML:Class id="32081654-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<clientDependency>
|
||||
<reflist>
|
||||
<ref refid="41318a02-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</clientDependency>
|
||||
<name>
|
||||
<val>MangaParserWrapper</val>
|
||||
</name>
|
||||
<note>
|
||||
<val></val>
|
||||
</note>
|
||||
<owningPackage>
|
||||
<ref refid="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</owningPackage>
|
||||
<package>
|
||||
<ref refid="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</package>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="320868c0-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
</UML:Class>
|
||||
<UML:ClassItem id="320868c0-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 128.5008992667698, 410.48990205860804)</val>
|
||||
</matrix>
|
||||
<top-left>
|
||||
<val>(0.0, 0.0)</val>
|
||||
</top-left>
|
||||
<width>
|
||||
<val>158.0</val>
|
||||
</width>
|
||||
<height>
|
||||
<val>60.0</val>
|
||||
</height>
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<show_attributes>
|
||||
<val>0</val>
|
||||
</show_attributes>
|
||||
<show_operations>
|
||||
<val>0</val>
|
||||
</show_operations>
|
||||
<subject>
|
||||
<ref refid="32081654-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
</UML:ClassItem>
|
||||
<UML:InterfaceRealizationItem id="40e36d2c-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<horizontal>
|
||||
<val>False</val>
|
||||
</horizontal>
|
||||
<orthogonal>
|
||||
<val>False</val>
|
||||
</orthogonal>
|
||||
<subject>
|
||||
<ref refid="41318a02-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 306.0585632324219, 249.69920349121094)</val>
|
||||
</matrix>
|
||||
<points>
|
||||
<val>[(11.759223915218172, 63.22657775878906), (-98.55766396565207, 160.7906985673971)]</val>
|
||||
</points>
|
||||
<head-connection>
|
||||
<ref refid="198aace6-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</head-connection>
|
||||
<tail-connection>
|
||||
<ref refid="320868c0-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</tail-connection>
|
||||
</UML:InterfaceRealizationItem>
|
||||
<UML:InterfaceRealization id="41318a02-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<client>
|
||||
<reflist>
|
||||
<ref refid="32081654-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</client>
|
||||
<owningPackage>
|
||||
<ref refid="58d6c2e8-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</owningPackage>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="40e36d2c-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
<supplier>
|
||||
<reflist>
|
||||
<ref refid="198a3108-f5be-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</supplier>
|
||||
</UML:InterfaceRealization>
|
||||
<UML:Comment id="b760ac44-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<body>
|
||||
<val>Used for providing external api. Do not use this class directly</val>
|
||||
</body>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="b760bcd4-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
</UML:Comment>
|
||||
<UML:CommentItem id="b760bcd4-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 108.0561294327963, 550.1347579956054)</val>
|
||||
</matrix>
|
||||
<top-left>
|
||||
<val>(0.0, 0.0)</val>
|
||||
</top-left>
|
||||
<width>
|
||||
<val>183.21868896484375</val>
|
||||
</width>
|
||||
<height>
|
||||
<val>91.23829650878906</val>
|
||||
</height>
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<subject>
|
||||
<ref refid="b760ac44-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
</UML:CommentItem>
|
||||
<UML:CommentLineItem id="bcc07c64-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<horizontal>
|
||||
<val>False</val>
|
||||
</horizontal>
|
||||
<orthogonal>
|
||||
<val>False</val>
|
||||
</orthogonal>
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 549.205520203852, 278.05499559311954)</val>
|
||||
</matrix>
|
||||
<points>
|
||||
<val>[(-349.5400462886338, 192.4349064654885), (-349.5400462886338, 272.0797624024858)]</val>
|
||||
</points>
|
||||
<tail-connection>
|
||||
<ref refid="b760bcd4-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</tail-connection>
|
||||
</UML:CommentLineItem>
|
||||
<UML:Comment id="bff31afe-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<annotatedElement>
|
||||
<reflist>
|
||||
<ref refid="0b54a350-f59d-11ef-bfb1-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</annotatedElement>
|
||||
<body>
|
||||
<val>Extend this class if your manga source provides standard limit-offset based lists (get manga list by offset)</val>
|
||||
</body>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="bff32eae-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
</UML:Comment>
|
||||
<UML:CommentItem id="bff32eae-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 673.0610499890082, 367.0515553989646)</val>
|
||||
</matrix>
|
||||
<top-left>
|
||||
<val>(0.0, 0.0)</val>
|
||||
</top-left>
|
||||
<width>
|
||||
<val>228.8028016098773</val>
|
||||
</width>
|
||||
<height>
|
||||
<val>88.0</val>
|
||||
</height>
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<subject>
|
||||
<ref refid="bff31afe-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
</UML:CommentItem>
|
||||
<UML:Comment id="d5112a70-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<annotatedElement>
|
||||
<reflist>
|
||||
<ref refid="a300f58a-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</annotatedElement>
|
||||
<body>
|
||||
<val>Extend this class if your manga source provides paged-based lists (get manga list by page number)</val>
|
||||
</body>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="d5113ca4-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
</UML:Comment>
|
||||
<UML:CommentItem id="d5113ca4-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 666.7924311664914, 507.7539062499999)</val>
|
||||
</matrix>
|
||||
<top-left>
|
||||
<val>(0.0, 0.0)</val>
|
||||
</top-left>
|
||||
<width>
|
||||
<val>214.34368896484375</val>
|
||||
</width>
|
||||
<height>
|
||||
<val>88.0</val>
|
||||
</height>
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<subject>
|
||||
<ref refid="d5112a70-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
</UML:CommentItem>
|
||||
<UML:Comment id="e80418f4-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<annotatedElement>
|
||||
<reflist>
|
||||
<ref refid="ad4c68d0-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</annotatedElement>
|
||||
<body>
|
||||
<val>Extend this class if your manga source does not provide pagination (all manga provided in one list)</val>
|
||||
</body>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="e8042ad8-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
</UML:Comment>
|
||||
<UML:CommentItem id="e8042ad8-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 666.7924311664914, 560.9671898788581)</val>
|
||||
</matrix>
|
||||
<top-left>
|
||||
<val>(0.0, 58.00435704705592)</val>
|
||||
</top-left>
|
||||
<width>
|
||||
<val>263.9307954323941</val>
|
||||
</width>
|
||||
<height>
|
||||
<val>78.01706672440287</val>
|
||||
</height>
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<subject>
|
||||
<ref refid="e80418f4-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
</UML:CommentItem>
|
||||
<UML:CommentLineItem id="f6b48e4c-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<horizontal>
|
||||
<val>False</val>
|
||||
</horizontal>
|
||||
<orthogonal>
|
||||
<val>False</val>
|
||||
</orthogonal>
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 561.8951626340418, 549.6101338901756)</val>
|
||||
</matrix>
|
||||
<points>
|
||||
<val>[(56.44167413272805, 7.038279316310902), (104.89726853244963, 8.304008355003589)]</val>
|
||||
</points>
|
||||
<head-connection>
|
||||
<ref refid="a3018fc2-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</head-connection>
|
||||
<tail-connection>
|
||||
<ref refid="d5113ca4-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</tail-connection>
|
||||
</UML:CommentLineItem>
|
||||
<UML:CommentLineItem id="f89ba010-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<horizontal>
|
||||
<val>False</val>
|
||||
</horizontal>
|
||||
<orthogonal>
|
||||
<val>False</val>
|
||||
</orthogonal>
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 559.3873501340418, 413.0007588901755)</val>
|
||||
</matrix>
|
||||
<points>
|
||||
<val>[(3.7806186159582467, 0.0), (113.67369985496646, 1.6012844908540842)]</val>
|
||||
</points>
|
||||
<head-connection>
|
||||
<ref refid="0b54edc4-f59d-11ef-bfb1-4cbb5880a0b8"/>
|
||||
</head-connection>
|
||||
<tail-connection>
|
||||
<ref refid="bff32eae-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</tail-connection>
|
||||
</UML:CommentLineItem>
|
||||
<UML:CommentLineItem id="fabe0540-f5bf-11ef-9ec2-4cbb5880a0b8">
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<horizontal>
|
||||
<val>False</val>
|
||||
</horizontal>
|
||||
<orthogonal>
|
||||
<val>False</val>
|
||||
</orthogonal>
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 522.3600063840418, 652.6882588901756)</val>
|
||||
</matrix>
|
||||
<points>
|
||||
<val>[(57.80796236595825, 5.29182139794003), (144.43242478244963, 5.657840086725969)]</val>
|
||||
</points>
|
||||
<head-connection>
|
||||
<ref refid="ad4d2aae-f5bd-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</head-connection>
|
||||
<tail-connection>
|
||||
<ref refid="e8042ad8-f5bf-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</tail-connection>
|
||||
</UML:CommentLineItem>
|
||||
<general:Box id="531831f2-f5c0-11ef-9ec2-4cbb5880a0b8">
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 375.05802564891326, 349.05453145170736)</val>
|
||||
</matrix>
|
||||
<top-left>
|
||||
<val>(0.0, 3.15625)</val>
|
||||
</top-left>
|
||||
<width>
|
||||
<val>590.6594026101285</val>
|
||||
</width>
|
||||
<height>
|
||||
<val>368.44140625</val>
|
||||
</height>
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
</general:Box>
|
||||
<UML:Comment id="5ccad4ca-f5c0-11ef-9ec2-4cbb5880a0b8">
|
||||
<body>
|
||||
<val>To create your own parser you have to extends one of these classes</val>
|
||||
</body>
|
||||
<presentation>
|
||||
<reflist>
|
||||
<ref refid="5ccae8d4-f5c0-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</reflist>
|
||||
</presentation>
|
||||
</UML:Comment>
|
||||
<UML:CommentItem id="5ccae8d4-f5c0-11ef-9ec2-4cbb5880a0b8">
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 756.725301794198, 225.57697659840966)</val>
|
||||
</matrix>
|
||||
<top-left>
|
||||
<val>(0.0, 0.0)</val>
|
||||
</top-left>
|
||||
<width>
|
||||
<val>208.99212646484375</val>
|
||||
</width>
|
||||
<height>
|
||||
<val>73.47482464883183</val>
|
||||
</height>
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<subject>
|
||||
<ref refid="5ccad4ca-f5c0-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</subject>
|
||||
</UML:CommentItem>
|
||||
<UML:CommentLineItem id="6f993af6-f5c0-11ef-9ec2-4cbb5880a0b8">
|
||||
<diagram>
|
||||
<ref refid="58d6c536-66f8-11ec-b4c8-0456e5e540ed"/>
|
||||
</diagram>
|
||||
<horizontal>
|
||||
<val>False</val>
|
||||
</horizontal>
|
||||
<orthogonal>
|
||||
<val>False</val>
|
||||
</orthogonal>
|
||||
<matrix>
|
||||
<val>(1.0, 0.0, 0.0, 1.0, 943.6141683885666, 419.2772168262177)</val>
|
||||
</matrix>
|
||||
<points>
|
||||
<val>[(-27.404961772030788, -67.06643537451032), (-27.404961772030788, -120.2254155789762)]</val>
|
||||
</points>
|
||||
<head-connection>
|
||||
<ref refid="531831f2-f5c0-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</head-connection>
|
||||
<tail-connection>
|
||||
<ref refid="5ccae8d4-f5c0-11ef-9ec2-4cbb5880a0b8"/>
|
||||
</tail-connection>
|
||||
</UML:CommentLineItem>
|
||||
</model>
|
||||
</gaphor>
|
||||
BIN
docs/parser_classes.png
Normal file
BIN
docs/parser_classes.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
@@ -1 +1,9 @@
|
||||
# Following this blog:
|
||||
# https://proandroiddev.com/how-we-reduced-our-gradle-build-times-by-over-80-51f2b6d6b05b
|
||||
kotlin.code.style=official
|
||||
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=4096m -XX:+UseParallelGC
|
||||
org.gradle.vfs.watch=true
|
||||
org.gradle.configureondemand=true
|
||||
org.gradle.parallel=true
|
||||
org.gradle.caching=true
|
||||
org.gradle.unsafe.configuration-cache=true
|
||||
29
gradle/libs.versions.toml
Normal file
29
gradle/libs.versions.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
[versions]
|
||||
kotlin = "2.2.10"
|
||||
ksp = "2.2.10-2.0.2"
|
||||
coroutines = "1.10.2"
|
||||
junit = "5.10.1"
|
||||
okhttp = "5.1.0"
|
||||
okio = "3.16.0"
|
||||
json = "20240303"
|
||||
androidx-collection = "1.5.0"
|
||||
jsoup = "1.21.2"
|
||||
quickjs = "1.1.0"
|
||||
|
||||
[plugins]
|
||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
||||
|
||||
[libraries]
|
||||
ksp-symbol-processing-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
|
||||
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }
|
||||
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" }
|
||||
junit-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit" }
|
||||
junit-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit" }
|
||||
junit-params = { group = "org.junit.jupiter", name = "junit-jupiter-params", version.ref = "junit" }
|
||||
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
|
||||
okio = { module = "com.squareup.okio:okio", version.ref = "okio" }
|
||||
json = { module = "org.json:json", version.ref = "json" }
|
||||
androidx-collection = { module = "androidx.collection:collection", version.ref = "androidx-collection" }
|
||||
jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
|
||||
quickjs = { module = "io.webfolder:quickjs", version.ref = "quickjs" }
|
||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,7 @@
|
||||
#Wed Aug 27 01:56:37 ICT 2025
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.google.devtools.ksp:symbol-processing-api:1.6.21-1.0.5'
|
||||
}
|
||||
11
kotatsu-parsers-ksp/build.gradle.kts
Normal file
11
kotatsu-parsers-ksp/build.gradle.kts
Normal file
@@ -0,0 +1,11 @@
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin.jvm)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(8)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.ksp.symbol.processing.api)
|
||||
}
|
||||
@@ -7,146 +7,180 @@ import com.google.devtools.ksp.symbol.KSAnnotated
|
||||
import com.google.devtools.ksp.symbol.KSClassDeclaration
|
||||
import com.google.devtools.ksp.symbol.KSVisitorVoid
|
||||
import com.google.devtools.ksp.validate
|
||||
import java.io.File
|
||||
import java.io.Writer
|
||||
import java.util.*
|
||||
|
||||
class ParserProcessor(
|
||||
private val codeGenerator: CodeGenerator,
|
||||
private val logger: KSPLogger,
|
||||
private val options: Map<String, String>,
|
||||
private val codeGenerator: CodeGenerator,
|
||||
private val logger: KSPLogger,
|
||||
private val options: Map<String, String>,
|
||||
) : SymbolProcessor {
|
||||
private val availableLocales = Locale.getAvailableLocales().toSet()
|
||||
private val sourceNamePattern = Regex("[A-Z_][A-Z0-9_]{3,}")
|
||||
|
||||
private val availableLocales = Locale.getAvailableLocales().toSet()
|
||||
private val sourceNamePattern = Regex("[A-Z_][A-Z0-9_]{3,}")
|
||||
override fun process(resolver: Resolver): List<KSAnnotated> {
|
||||
val symbols = resolver.getSymbolsWithAnnotation("org.koitharu.kotatsu.parsers.MangaSourceParser")
|
||||
val ret = symbols.filterNot { it.validate() }.toList()
|
||||
if (!symbols.iterator().hasNext()) {
|
||||
return ret
|
||||
}
|
||||
val dependencies = Dependencies.ALL_FILES
|
||||
val factoryFile =
|
||||
try {
|
||||
codeGenerator.createNewFile(
|
||||
dependencies = dependencies,
|
||||
packageName = "org.koitharu.kotatsu.parsers",
|
||||
fileName = "MangaParserFactory",
|
||||
)
|
||||
} catch (e: FileAlreadyExistsException) {
|
||||
logger.warn(e.toString(), null)
|
||||
null
|
||||
}
|
||||
val sourcesFile =
|
||||
try {
|
||||
codeGenerator.createNewFile(
|
||||
dependencies = dependencies,
|
||||
packageName = "org.koitharu.kotatsu.parsers.model",
|
||||
fileName = "MangaSource",
|
||||
)
|
||||
} catch (e: FileAlreadyExistsException) {
|
||||
logger.warn(e.toString(), null)
|
||||
null
|
||||
}
|
||||
val totalCount = sourcesFile?.writer().use { sourcesWriter ->
|
||||
factoryFile?.writer().use { factoryWriter ->
|
||||
writeContent(sourcesWriter, factoryWriter, symbols)
|
||||
}
|
||||
}
|
||||
writeSummary(totalCount)
|
||||
return ret
|
||||
}
|
||||
|
||||
override fun process(resolver: Resolver): List<KSAnnotated> {
|
||||
val symbols = resolver
|
||||
.getSymbolsWithAnnotation("org.koitharu.kotatsu.parsers.MangaSourceParser")
|
||||
val ret = symbols.filterNot { it.validate() }.toList()
|
||||
if (!symbols.iterator().hasNext()) {
|
||||
return ret
|
||||
}
|
||||
val dependencies = Dependencies.ALL_FILES
|
||||
val factoryFile = try {
|
||||
codeGenerator.createNewFile(
|
||||
dependencies = dependencies,
|
||||
packageName = "org.koitharu.kotatsu.parsers",
|
||||
fileName = "MangaParserFactory",
|
||||
)
|
||||
} catch (e: FileAlreadyExistsException) {
|
||||
logger.warn(e.toString(), null)
|
||||
null
|
||||
}
|
||||
val sourcesFile = try {
|
||||
codeGenerator.createNewFile(
|
||||
dependencies = dependencies,
|
||||
packageName = "org.koitharu.kotatsu.parsers.model",
|
||||
fileName = "MangaSource",
|
||||
)
|
||||
} catch (e: FileAlreadyExistsException) {
|
||||
logger.warn(e.toString(), null)
|
||||
null
|
||||
}
|
||||
sourcesFile?.writer().use { sourcesWriter ->
|
||||
factoryFile?.writer().use { factoryWriter ->
|
||||
writeContent(sourcesWriter, factoryWriter, symbols)
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
private fun writeContent(
|
||||
sourcesWriter: Writer?,
|
||||
factoryWriter: Writer?,
|
||||
symbols: Sequence<KSAnnotated>,
|
||||
): Int {
|
||||
if (sourcesWriter == null && factoryWriter == null) {
|
||||
return 0
|
||||
}
|
||||
factoryWriter?.write(
|
||||
"""
|
||||
package org.koitharu.kotatsu.parsers
|
||||
|
||||
private fun writeContent(
|
||||
sourcesWriter: Writer?,
|
||||
factoryWriter: Writer?,
|
||||
symbols: Sequence<KSAnnotated>,
|
||||
) {
|
||||
if (sourcesWriter == null && factoryWriter == null) {
|
||||
return
|
||||
}
|
||||
factoryWriter?.write(
|
||||
"""
|
||||
package org.koitharu.kotatsu.parsers
|
||||
import org.koitharu.kotatsu.parsers.model.MangaParserSource
|
||||
import org.koitharu.kotatsu.parsers.core.MangaParserWrapper
|
||||
|
||||
internal fun MangaParserSource.newParser(context: MangaLoaderContext): MangaParser = when (this) {
|
||||
|
||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||
|
||||
fun MangaSource.newParser(context: MangaLoaderContext): MangaParser = when (this) {
|
||||
|
||||
""".trimIndent(),
|
||||
)
|
||||
sourcesWriter?.write(
|
||||
"""
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
enum class MangaSource(
|
||||
val title: String,
|
||||
val locale: String?,
|
||||
) {
|
||||
LOCAL("Local", null),
|
||||
|
||||
)
|
||||
sourcesWriter?.write(
|
||||
"""
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
public enum class MangaParserSource(
|
||||
public val title: String,
|
||||
public val locale: String,
|
||||
public val contentType: ContentType,
|
||||
public val isBroken: Boolean,
|
||||
): MangaSource {
|
||||
|
||||
""".trimIndent(),
|
||||
)
|
||||
)
|
||||
|
||||
val visitor = ParserVisitor(sourcesWriter, factoryWriter)
|
||||
symbols
|
||||
.filter { it is KSClassDeclaration && it.validate() }
|
||||
.forEach { it.accept(visitor, Unit) }
|
||||
val visitor = ParserVisitor(sourcesWriter, factoryWriter)
|
||||
val totalCount = symbols
|
||||
.filter { it is KSClassDeclaration && it.validate() }
|
||||
.onEach { it.accept(visitor, Unit) }
|
||||
.count()
|
||||
|
||||
factoryWriter?.write(
|
||||
"""
|
||||
MangaSource.LOCAL -> throw NotImplementedError("Local manga parser is not supported")
|
||||
MangaSource.DUMMY -> throw NotImplementedError("Dummy manga parser cannot be instantiated")
|
||||
}.also {
|
||||
factoryWriter?.write(
|
||||
"""
|
||||
}.let {
|
||||
require(it.source == this) {
|
||||
"Cannot instantiate manga parser: ${'$'}name mapped to ${'$'}{it.source}"
|
||||
}
|
||||
MangaParserWrapper(it)
|
||||
}
|
||||
""".trimIndent(),
|
||||
)
|
||||
sourcesWriter?.write(
|
||||
"""
|
||||
DUMMY("Dummy", null),
|
||||
)
|
||||
sourcesWriter?.write(
|
||||
"""
|
||||
;
|
||||
}
|
||||
""".trimIndent(),
|
||||
)
|
||||
}
|
||||
)
|
||||
return totalCount
|
||||
}
|
||||
|
||||
private inner class ParserVisitor(
|
||||
private val sourcesWriter: Writer?,
|
||||
private val factoryWriter: Writer?,
|
||||
) : KSVisitorVoid() {
|
||||
private fun writeSummary(totalCount: Int) {
|
||||
val file = File(options["summaryOutputDir"] ?: return, "summary.yaml")
|
||||
file.writeText("total: $totalCount")
|
||||
}
|
||||
|
||||
override fun visitClassDeclaration(classDeclaration: KSClassDeclaration, data: Unit) {
|
||||
if (classDeclaration.classKind != ClassKind.CLASS || classDeclaration.isAbstract()) {
|
||||
logger.error("Only non-abstract can be annotated with @MangaSourceParser", classDeclaration)
|
||||
}
|
||||
val annotation = classDeclaration.annotations.single { it.shortName.asString() == "MangaSourceParser" }
|
||||
val name = annotation.arguments.single { it.name?.asString() == "name" }.value as String
|
||||
val title = annotation.arguments.single { it.name?.asString() == "title" }.value as String
|
||||
val locale = annotation.arguments.single { it.name?.asString() == "locale" }.value as String
|
||||
val localeString = if (locale.isEmpty()) "null" else "\"$locale\""
|
||||
val localeObj = if (locale.isEmpty()) null else Locale(locale)
|
||||
val localeTitle = localeObj?.getDisplayLanguage(localeObj)
|
||||
if (localeObj != null && localeObj !in availableLocales) {
|
||||
logger.error("Manga source $name has wrong locale: $localeTitle")
|
||||
}
|
||||
private inner class ParserVisitor(
|
||||
private val sourcesWriter: Writer?,
|
||||
private val factoryWriter: Writer?,
|
||||
) : KSVisitorVoid() {
|
||||
private val titles = HashMap<String, String>()
|
||||
|
||||
if (!sourceNamePattern.matches(name)) {
|
||||
logger.error("Manga source name must be uppercase: $name")
|
||||
}
|
||||
override fun visitClassDeclaration(
|
||||
classDeclaration: KSClassDeclaration,
|
||||
data: Unit,
|
||||
) {
|
||||
if (classDeclaration.classKind != ClassKind.CLASS || classDeclaration.isAbstract()) {
|
||||
logger.error("Only non-abstract can be annotated with @MangaSourceParser", classDeclaration)
|
||||
}
|
||||
val annotation = classDeclaration.annotations.single { it.shortName.asString() == "MangaSourceParser" }
|
||||
val deprecation = classDeclaration.annotations.singleOrNull { it.shortName.asString() == "Deprecated" }
|
||||
val isBroken = classDeclaration.annotations.any { it.shortName.asString() == "Broken" }
|
||||
val name = annotation.arguments.single { it.name?.asString() == "name" }.value as String
|
||||
val title = annotation.arguments.single { it.name?.asString() == "title" }.value as String
|
||||
val locale = annotation.arguments.single { it.name?.asString() == "locale" }.value as String
|
||||
val type = annotation.arguments.single { it.name?.asString() == "type" }.value
|
||||
val localeString = "\"$locale\""
|
||||
val localeObj = if (locale.isEmpty()) null else Locale(locale)
|
||||
val localeTitle = localeObj?.getDisplayLanguage(localeObj)
|
||||
if (localeObj != null && localeObj !in availableLocales) {
|
||||
logger.error("Manga source $name has wrong locale: $localeTitle")
|
||||
}
|
||||
|
||||
val constructor = classDeclaration.primaryConstructor
|
||||
if (constructor == null || constructor.parameters.count { !it.hasDefault } != 1) {
|
||||
logger.error(
|
||||
"Class with @MangaSourceParser must have a primary constructor with one parameter",
|
||||
classDeclaration,
|
||||
)
|
||||
}
|
||||
if (!sourceNamePattern.matches(name)) {
|
||||
logger.error("Manga source name must be uppercase: $name")
|
||||
}
|
||||
|
||||
val className = classDeclaration.qualifiedName?.asString()
|
||||
factoryWriter?.write("\tMangaSource.$name -> $className(context)\n")
|
||||
val localeComment = localeTitle?.toTitleCase(localeObj)?.let { " /* $it */" }.orEmpty()
|
||||
sourcesWriter?.write("\t$name(\"$title\", $localeString$localeComment),\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
val constructor = classDeclaration.primaryConstructor
|
||||
if (constructor == null || constructor.parameters.count { !it.hasDefault } != 1) {
|
||||
logger.error(
|
||||
"Class with @MangaSourceParser must have a primary constructor with one parameter",
|
||||
classDeclaration,
|
||||
)
|
||||
}
|
||||
val className = checkNotNull(classDeclaration.qualifiedName?.asString()) { "Class name is null" }
|
||||
|
||||
val prevTitleClass = titles.put(title, className)
|
||||
if (prevTitleClass != null) {
|
||||
logger.warn("Source title duplication: \"$title\" is assigned to both $prevTitleClass and $className")
|
||||
}
|
||||
|
||||
factoryWriter?.write("\tMangaParserSource.$name -> $className(context)\n")
|
||||
val deprecationString =
|
||||
if (deprecation != null) {
|
||||
val reason =
|
||||
deprecation.arguments
|
||||
.find { it.name?.asString() == "message" }
|
||||
?.value
|
||||
?.toString() ?: "Unknown reason"
|
||||
"@Deprecated(\"$reason\") "
|
||||
} else {
|
||||
""
|
||||
}
|
||||
val localeComment = localeTitle?.toTitleCase(localeObj)?.let { " /* $it */" }.orEmpty()
|
||||
sourcesWriter?.write(
|
||||
"\t$deprecationString$name(\"$title\", $localeString$localeComment, $type, $isBroken),\n",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
pluginManagement {
|
||||
plugins {
|
||||
id 'com.google.devtools.ksp' version '1.6.21-1.0.5'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.6.21'
|
||||
}
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
google()
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = 'kotatsu-parsers'
|
||||
include 'kotatsu-parsers-ksp'
|
||||
|
||||
18
settings.gradle.kts
Normal file
18
settings.gradle.kts
Normal file
@@ -0,0 +1,18 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "kotatsu-parsers"
|
||||
include("kotatsu-parsers-ksp")
|
||||
14
src/main/kotlin/org/koitharu/kotatsu/parsers/Broken.kt
Normal file
14
src/main/kotlin/org/koitharu/kotatsu/parsers/Broken.kt
Normal file
@@ -0,0 +1,14 @@
|
||||
package org.koitharu.kotatsu.parsers
|
||||
|
||||
/**
|
||||
* Annotate [MangaParser] implementation to mark this parser as broken instead of removing it
|
||||
*/
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
internal annotation class Broken(
|
||||
|
||||
/**
|
||||
* Reason why this parser is broken
|
||||
*/
|
||||
val message: String = "",
|
||||
)
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.koitharu.kotatsu.parsers
|
||||
|
||||
public object ErrorMessages {
|
||||
|
||||
public const val FILTER_MULTIPLE_STATES_NOT_SUPPORTED: String = "Multiple states are not supported by this source"
|
||||
public const val FILTER_MULTIPLE_GENRES_NOT_SUPPORTED: String = "Multiple genres are not supported by this source"
|
||||
public const val FILTER_MULTIPLE_CONTENT_RATING_NOT_SUPPORTED: String =
|
||||
"Multiple Content ratings are not supported by this source"
|
||||
public const val FILTER_MULTIPLE_CONTENT_TYPES_NOT_SUPPORTED: String =
|
||||
"Multiple Content types are not supported by this source"
|
||||
public const val FILTER_MULTIPLE_DEMOGRAPHICS_NOT_SUPPORTED: String =
|
||||
"Multiple Demographics are not supported by this source"
|
||||
public const val FILTER_BOTH_LOCALE_GENRES_NOT_SUPPORTED: String =
|
||||
"Filtering by both genres and locale is not supported by this source"
|
||||
public const val FILTER_BOTH_STATES_GENRES_NOT_SUPPORTED: String =
|
||||
"Filtering by both genres and states is not supported by this source"
|
||||
public const val SEARCH_NOT_SUPPORTED: String = "Search is not supported by this source"
|
||||
}
|
||||
@@ -11,4 +11,4 @@ package org.koitharu.kotatsu.parsers
|
||||
@SinceKotlin("1.3")
|
||||
@RequiresOptIn
|
||||
@MustBeDocumented
|
||||
annotation class InternalParsersApi()
|
||||
public annotation class InternalParsersApi
|
||||
|
||||
@@ -1,160 +1,78 @@
|
||||
package org.koitharu.kotatsu.parsers
|
||||
|
||||
import okhttp3.*
|
||||
import okhttp3.MediaType.Companion.toMediaType
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import org.json.JSONObject
|
||||
import org.jsoup.HttpStatusException
|
||||
import okhttp3.CookieJar
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Response
|
||||
import org.koitharu.kotatsu.parsers.bitmap.Bitmap
|
||||
import org.koitharu.kotatsu.parsers.config.MangaSourceConfig
|
||||
import org.koitharu.kotatsu.parsers.exception.GraphQLException
|
||||
import org.koitharu.kotatsu.parsers.model.MangaParserSource
|
||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||
import org.koitharu.kotatsu.parsers.util.await
|
||||
import org.koitharu.kotatsu.parsers.util.parseJson
|
||||
import org.koitharu.kotatsu.parsers.util.LinkResolver
|
||||
import java.util.*
|
||||
|
||||
abstract class MangaLoaderContext {
|
||||
public abstract class MangaLoaderContext {
|
||||
|
||||
protected abstract val httpClient: OkHttpClient
|
||||
public abstract val httpClient: OkHttpClient
|
||||
|
||||
abstract val cookieJar: CookieJar
|
||||
public abstract val cookieJar: CookieJar
|
||||
|
||||
/**
|
||||
* Do a GET http request to specific url
|
||||
* @param url
|
||||
* @param headers an additional headers for request, may be null
|
||||
*/
|
||||
suspend fun httpGet(url: String, headers: Headers? = null): Response {
|
||||
val request = Request.Builder()
|
||||
.get()
|
||||
.url(url)
|
||||
if (headers != null) {
|
||||
request.headers(headers)
|
||||
}
|
||||
return httpClient.newCall(request.build()).await().ensureSuccess()
|
||||
}
|
||||
public fun newParserInstance(source: MangaParserSource): MangaParser = source.newParser(this)
|
||||
|
||||
/**
|
||||
* Do a HEAD http request to specific url
|
||||
* @param url
|
||||
* @param headers an additional headers for request, may be null
|
||||
*/
|
||||
suspend fun httpHead(url: String, headers: Headers? = null): Response {
|
||||
val request = Request.Builder()
|
||||
.head()
|
||||
.url(url)
|
||||
if (headers != null) {
|
||||
request.headers(headers)
|
||||
}
|
||||
return httpClient.newCall(request.build()).await().ensureSuccess()
|
||||
}
|
||||
public fun newLinkResolver(link: HttpUrl): LinkResolver = LinkResolver(this, link)
|
||||
|
||||
/**
|
||||
* Do a POST http request to specific url with `multipart/form-data` payload
|
||||
* @param url
|
||||
* @param form payload as key=>value map
|
||||
* @param headers an additional headers for request, may be null
|
||||
*/
|
||||
suspend fun httpPost(
|
||||
url: String,
|
||||
form: Map<String, String>,
|
||||
headers: Headers? = null,
|
||||
): Response {
|
||||
val body = FormBody.Builder()
|
||||
form.forEach { (k, v) ->
|
||||
body.addEncoded(k, v)
|
||||
}
|
||||
val request = Request.Builder()
|
||||
.post(body.build())
|
||||
.url(url)
|
||||
if (headers != null) {
|
||||
request.headers(headers)
|
||||
}
|
||||
return httpClient.newCall(request.build()).await().ensureSuccess()
|
||||
}
|
||||
public fun newLinkResolver(link: String): LinkResolver = newLinkResolver(link.toHttpUrl())
|
||||
|
||||
/**
|
||||
* Do a POST http request to specific url with `multipart/form-data` payload
|
||||
* @param url
|
||||
* @param payload payload as `key=value` string with `&` separator
|
||||
* @param headers an additional headers for request, may be null
|
||||
*/
|
||||
suspend fun httpPost(
|
||||
url: String,
|
||||
payload: String,
|
||||
headers: Headers?,
|
||||
): Response {
|
||||
val body = FormBody.Builder()
|
||||
payload.split('&').forEach {
|
||||
val pos = it.indexOf('=')
|
||||
if (pos != -1) {
|
||||
val k = it.substring(0, pos)
|
||||
val v = it.substring(pos + 1)
|
||||
body.addEncoded(k, v)
|
||||
}
|
||||
}
|
||||
val request = Request.Builder()
|
||||
.post(body.build())
|
||||
.url(url)
|
||||
if (headers != null) {
|
||||
request.headers(headers)
|
||||
}
|
||||
return httpClient.newCall(request.build()).await().ensureSuccess()
|
||||
}
|
||||
public open fun encodeBase64(data: ByteArray): String = Base64.getEncoder().encodeToString(data)
|
||||
|
||||
/**
|
||||
* Do a GraphQL request to specific url
|
||||
* @param endpoint an url
|
||||
* @param query GraphQL request payload
|
||||
*/
|
||||
suspend fun graphQLQuery(endpoint: String, query: String): JSONObject {
|
||||
val body = JSONObject()
|
||||
body.put("operationName", null as Any?)
|
||||
body.put("variables", JSONObject())
|
||||
body.put("query", "{$query}")
|
||||
val mediaType = "application/json; charset=utf-8".toMediaType()
|
||||
val requestBody = body.toString().toRequestBody(mediaType)
|
||||
val request = Request.Builder()
|
||||
.post(requestBody)
|
||||
.url(endpoint)
|
||||
val json = httpClient.newCall(request.build()).await().ensureSuccess().parseJson()
|
||||
json.optJSONArray("errors")?.let {
|
||||
if (it.length() != 0) {
|
||||
throw GraphQLException(it)
|
||||
}
|
||||
}
|
||||
return json
|
||||
}
|
||||
public open fun decodeBase64(data: String): ByteArray = Base64.getDecoder().decode(data)
|
||||
|
||||
open fun encodeBase64(data: ByteArray): String = Base64.getEncoder().encodeToString(data)
|
||||
|
||||
open fun decodeBase64(data: String): ByteArray = Base64.getDecoder().decode(data)
|
||||
|
||||
open fun getPreferredLocales(): List<Locale> = listOf(Locale.getDefault())
|
||||
public open fun getPreferredLocales(): List<Locale> = listOf(Locale.getDefault())
|
||||
|
||||
/**
|
||||
* Execute JavaScript code and return result
|
||||
* @param script JavaScript source code
|
||||
* @return execution result as string, may be null
|
||||
*/
|
||||
abstract suspend fun evaluateJs(script: String): String?
|
||||
@Deprecated("Provide a base url")
|
||||
public abstract suspend fun evaluateJs(script: String): String?
|
||||
|
||||
abstract fun getConfig(source: MangaSource): MangaSourceConfig
|
||||
/**
|
||||
* Execute JavaScript code and return result
|
||||
* @param script JavaScript source code
|
||||
* @param baseUrl url of page script will be executed in context of
|
||||
* @return execution result as string, may be null
|
||||
*/
|
||||
public abstract suspend fun evaluateJs(baseUrl: String, script: String): String?
|
||||
|
||||
private fun Response.ensureSuccess() = apply {
|
||||
val exception: Exception? = when (code) { // Catch some error codes, not all
|
||||
404,
|
||||
in 500..599,
|
||||
-> HttpStatusException(message, code, request.url.toString())
|
||||
|
||||
else -> null
|
||||
}
|
||||
if (exception != null) {
|
||||
runCatching {
|
||||
close()
|
||||
}.onFailure {
|
||||
exception.addSuppressed(it)
|
||||
}
|
||||
throw exception
|
||||
}
|
||||
/**
|
||||
* Open [url] in browser for some external action (e.g. captcha solving or non cookie-based authorization)
|
||||
*/
|
||||
public open fun requestBrowserAction(parser: MangaParser, url: String): Nothing {
|
||||
throw UnsupportedOperationException("Browser is not available")
|
||||
}
|
||||
}
|
||||
|
||||
public abstract fun getConfig(source: MangaSource): MangaSourceConfig
|
||||
|
||||
public abstract fun getDefaultUserAgent(): String
|
||||
|
||||
/**
|
||||
* Helper function to be used in an interceptor
|
||||
* to descramble images
|
||||
* @param response Image response
|
||||
* @param redraw lambda function to implement descrambling logic
|
||||
*/
|
||||
public abstract fun redrawImageResponse(
|
||||
response: Response,
|
||||
redraw: (image: Bitmap) -> Bitmap,
|
||||
): Response
|
||||
|
||||
/**
|
||||
* create a new empty Bitmap with given dimensions
|
||||
*/
|
||||
public abstract fun createBitmap(
|
||||
width: Int,
|
||||
height: Int,
|
||||
): Bitmap
|
||||
}
|
||||
|
||||
@@ -1,189 +1,88 @@
|
||||
package org.koitharu.kotatsu.parsers
|
||||
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.Interceptor
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.exception.ParseException
|
||||
import org.koitharu.kotatsu.parsers.config.MangaSourceConfig
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.FaviconParser
|
||||
import org.koitharu.kotatsu.parsers.util.toAbsoluteUrl
|
||||
import org.koitharu.kotatsu.parsers.model.search.MangaSearchQuery
|
||||
import org.koitharu.kotatsu.parsers.model.search.MangaSearchQueryCapabilities
|
||||
import org.koitharu.kotatsu.parsers.util.LinkResolver
|
||||
import org.koitharu.kotatsu.parsers.util.convertToMangaSearchQuery
|
||||
import org.koitharu.kotatsu.parsers.util.toMangaListFilterCapabilities
|
||||
import java.util.*
|
||||
|
||||
abstract class MangaParser @InternalParsersApi constructor(val source: MangaSource) {
|
||||
public interface MangaParser : Interceptor {
|
||||
|
||||
protected abstract val context: MangaLoaderContext
|
||||
public val source: MangaParserSource
|
||||
|
||||
/**
|
||||
* Supported [SortOrder] variants. Must not be empty.
|
||||
*
|
||||
* For better performance use [EnumSet] for more than one item.
|
||||
*/
|
||||
abstract val sortOrders: Set<SortOrder>
|
||||
public val availableSortOrders: Set<SortOrder>
|
||||
|
||||
val config by lazy { context.getConfig(source) }
|
||||
@Deprecated("Too complex. Use filterCapabilities instead")
|
||||
public val searchQueryCapabilities: MangaSearchQueryCapabilities
|
||||
|
||||
val sourceLocale: Locale?
|
||||
get() = source.locale?.let { Locale(it) }
|
||||
public val filterCapabilities: MangaListFilterCapabilities
|
||||
|
||||
public val config: MangaSourceConfig
|
||||
|
||||
public val authorizationProvider: MangaParserAuthProvider?
|
||||
get() = this as? MangaParserAuthProvider
|
||||
|
||||
/**
|
||||
* Provide default domain and available alternatives, if any.
|
||||
*
|
||||
* Never hardcode domain in requests, use [getDomain] instead.
|
||||
* Never hardcode domain in requests, use [domain] instead.
|
||||
*/
|
||||
protected abstract val configKeyDomain: ConfigKey.Domain
|
||||
public val configKeyDomain: ConfigKey.Domain
|
||||
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
|
||||
internal open val headers: Headers? = null
|
||||
public val domain: String
|
||||
|
||||
/**
|
||||
* Used as fallback if value of `sortOrder` passed to [getList] is null
|
||||
*/
|
||||
protected open val defaultSortOrder: SortOrder
|
||||
get() {
|
||||
val supported = sortOrders
|
||||
return SortOrder.values().first { it in supported }
|
||||
}
|
||||
@Deprecated("Too complex. Use getList with filter instead")
|
||||
public suspend fun getList(query: MangaSearchQuery): List<Manga>
|
||||
|
||||
/**
|
||||
* Parse list of manga by specified criteria
|
||||
*
|
||||
* @param offset starting from 0 and used for pagination.
|
||||
* Note than passed value may not be divisible by internal page size, so you should adjust it manually.
|
||||
* @param query search query, may be null or empty if no search needed
|
||||
* @param tags genres for filtering, values from [getTags] and [Manga.tags]. May be null or empty
|
||||
* @param sortOrder one of [sortOrders] or null for default value
|
||||
*/
|
||||
@JvmSynthetic
|
||||
@InternalParsersApi
|
||||
abstract suspend fun getList(
|
||||
offset: Int,
|
||||
query: String?,
|
||||
tags: Set<MangaTag>?,
|
||||
sortOrder: SortOrder,
|
||||
): List<Manga>
|
||||
|
||||
/**
|
||||
* Parse list of manga with search by text query
|
||||
*
|
||||
* @param offset starting from 0 and used for pagination.
|
||||
* @param query search query
|
||||
*/
|
||||
suspend fun getList(offset: Int, query: String): List<Manga> {
|
||||
return getList(offset, query, null, defaultSortOrder)
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse list of manga by specified criteria
|
||||
*
|
||||
* @param offset starting from 0 and used for pagination.
|
||||
* Note than passed value may not be divisible by internal page size, so you should adjust it manually.
|
||||
* @param tags genres for filtering, values from [getTags] and [Manga.tags]. May be null or empty
|
||||
* @param sortOrder one of [sortOrders] or null for default value
|
||||
*/
|
||||
suspend fun getList(offset: Int, tags: Set<MangaTag>?, sortOrder: SortOrder?): List<Manga> {
|
||||
return getList(offset, null, tags, sortOrder ?: defaultSortOrder)
|
||||
}
|
||||
public suspend fun getList(offset: Int, order: SortOrder, filter: MangaListFilter): List<Manga>
|
||||
|
||||
/**
|
||||
* Parse details for [Manga]: chapters list, description, large cover, etc.
|
||||
* Must return the same manga, may change any fields excepts id, url and source
|
||||
* @see Manga.copy
|
||||
*/
|
||||
abstract suspend fun getDetails(manga: Manga): Manga
|
||||
public suspend fun getDetails(manga: Manga): Manga
|
||||
|
||||
/**
|
||||
* Parse pages list for specified chapter.
|
||||
* @see MangaPage for details
|
||||
*/
|
||||
abstract suspend fun getPages(chapter: MangaChapter): List<MangaPage>
|
||||
public suspend fun getPages(chapter: MangaChapter): List<MangaPage>
|
||||
|
||||
/**
|
||||
* Fetch direct link to the page image.
|
||||
*/
|
||||
open suspend fun getPageUrl(page: MangaPage): String = page.url.toAbsoluteUrl(getDomain())
|
||||
public suspend fun getPageUrl(page: MangaPage): String
|
||||
|
||||
public suspend fun getFilterOptions(): MangaListFilterOptions
|
||||
|
||||
/**
|
||||
* Fetch available tags (genres) for source
|
||||
* Parse favicons from the main page of the source`s website
|
||||
*/
|
||||
abstract suspend fun getTags(): Set<MangaTag>
|
||||
public suspend fun getFavicons(): Favicons
|
||||
|
||||
public fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>)
|
||||
|
||||
public suspend fun getRelatedManga(seed: Manga): List<Manga>
|
||||
|
||||
public fun getRequestHeaders(): Headers
|
||||
|
||||
/**
|
||||
* Returns direct link to the website favicon
|
||||
*/
|
||||
@Deprecated(
|
||||
message = "Use parseFavicons() to get multiple favicons with different size",
|
||||
replaceWith = ReplaceWith("parseFavicons()"),
|
||||
)
|
||||
open fun getFaviconUrl() = "https://${getDomain()}/favicon.ico"
|
||||
|
||||
open suspend fun parseFavicons(): Favicons {
|
||||
return FaviconParser(context, getDomain(), headers).parseFavicons()
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
open fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||
keys.add(configKeyDomain)
|
||||
}
|
||||
|
||||
/* Utils */
|
||||
|
||||
fun getDomain(): String {
|
||||
return config[configKeyDomain]
|
||||
}
|
||||
|
||||
fun getDomain(subdomain: String): String {
|
||||
val domain = getDomain()
|
||||
return subdomain + "." + domain.removePrefix("www.")
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a unique id for [Manga]/[MangaChapter]/[MangaPage].
|
||||
* @param url must be relative url, without a domain
|
||||
* @see [Manga.id]
|
||||
* @see [MangaChapter.id]
|
||||
* @see [MangaPage.id]
|
||||
* Return [Manga] object by web link to it
|
||||
* @see [Manga.publicUrl]
|
||||
*/
|
||||
@InternalParsersApi
|
||||
protected fun generateUid(url: String): Long {
|
||||
var h = 1125899906842597L
|
||||
source.name.forEach { c ->
|
||||
h = 31 * h + c.code
|
||||
}
|
||||
url.forEach { c ->
|
||||
h = 31 * h + c.code
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a unique id for [Manga]/[MangaChapter]/[MangaPage].
|
||||
* @param id an internal identifier
|
||||
* @see [Manga.id]
|
||||
* @see [MangaChapter.id]
|
||||
* @see [MangaPage.id]
|
||||
*/
|
||||
@InternalParsersApi
|
||||
protected fun generateUid(id: Long): Long {
|
||||
var h = 1125899906842597L
|
||||
source.name.forEach { c ->
|
||||
h = 31 * h + c.code
|
||||
}
|
||||
h = 31 * h + id
|
||||
return h
|
||||
}
|
||||
|
||||
@InternalParsersApi
|
||||
protected fun parseFailed(message: String? = null): Nothing {
|
||||
throw ParseException(message, null)
|
||||
}
|
||||
|
||||
@InternalParsersApi
|
||||
protected fun Set<MangaTag>?.oneOrThrowIfMany(): MangaTag? {
|
||||
return when {
|
||||
isNullOrEmpty() -> null
|
||||
size == 1 -> first()
|
||||
else -> throw IllegalArgumentException("Multiple genres are not supported by this source")
|
||||
}
|
||||
}
|
||||
}
|
||||
public suspend fun resolveLink(resolver: LinkResolver, link: HttpUrl): Manga?
|
||||
}
|
||||
|
||||
@@ -6,19 +6,19 @@ import org.koitharu.kotatsu.parsers.exception.ParseException
|
||||
/**
|
||||
* Implement this in your parser for authorization support
|
||||
*/
|
||||
interface MangaParserAuthProvider {
|
||||
public interface MangaParserAuthProvider {
|
||||
|
||||
/**
|
||||
* Return link to the login page, which will be opened in browser.
|
||||
* Must be an absolute url
|
||||
*/
|
||||
val authUrl: String
|
||||
public val authUrl: String
|
||||
|
||||
/**
|
||||
* Quick check if user is logged in.
|
||||
* In most case you should check for cookies in [MangaLoaderContext.cookieJar].
|
||||
*/
|
||||
val isAuthorized: Boolean
|
||||
public suspend fun isAuthorized(): Boolean
|
||||
|
||||
/**
|
||||
* Fetch and return current user`s name or login.
|
||||
@@ -26,5 +26,5 @@ interface MangaParserAuthProvider {
|
||||
* @throws [AuthRequiredException] if user is not logged in or authorization is expired
|
||||
* @throws [ParseException] on parsing error
|
||||
*/
|
||||
suspend fun getUsername(): String
|
||||
}
|
||||
public suspend fun getUsername(): String
|
||||
}
|
||||
|
||||
@@ -1,20 +1,28 @@
|
||||
package org.koitharu.kotatsu.parsers
|
||||
|
||||
import org.koitharu.kotatsu.parsers.model.ContentType
|
||||
|
||||
/**
|
||||
* Annotate each [MangaParser] implementation with this annotation, used by codegen
|
||||
*/
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class MangaSourceParser(
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
internal annotation class MangaSourceParser(
|
||||
/**
|
||||
* Name of manga source. Used as an Enum value, must be UPPER_CASE and unique.
|
||||
*/
|
||||
val name: String,
|
||||
/**
|
||||
* User-friendly title of manga source. In most case equals the website name.
|
||||
* Avoid extra whitespaces between the words if it is not required.
|
||||
*/
|
||||
val title: String,
|
||||
/**
|
||||
* Language code (for example "en" or "ru") or blank if parser provide manga on different languages.
|
||||
*/
|
||||
val locale: String = "",
|
||||
)
|
||||
/**
|
||||
* Type of content provided by parser. See [ContentType] for more info
|
||||
*/
|
||||
val type: ContentType = ContentType.MANGA,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.koitharu.kotatsu.parsers.bitmap
|
||||
|
||||
public interface Bitmap {
|
||||
|
||||
public val width: Int
|
||||
public val height: Int
|
||||
|
||||
public fun drawBitmap(sourceBitmap: Bitmap, src: Rect, dst: Rect)
|
||||
}
|
||||
15
src/main/kotlin/org/koitharu/kotatsu/parsers/bitmap/Rect.kt
Normal file
15
src/main/kotlin/org/koitharu/kotatsu/parsers/bitmap/Rect.kt
Normal file
@@ -0,0 +1,15 @@
|
||||
package org.koitharu.kotatsu.parsers.bitmap
|
||||
|
||||
public data class Rect(
|
||||
val left: Int = 0,
|
||||
val top: Int = 0,
|
||||
val right: Int = 0,
|
||||
val bottom: Int = 0,
|
||||
) {
|
||||
|
||||
val width: Int
|
||||
get() = right - left
|
||||
|
||||
val height: Int
|
||||
get() = bottom - top
|
||||
}
|
||||
@@ -1,13 +1,37 @@
|
||||
package org.koitharu.kotatsu.parsers.config
|
||||
|
||||
sealed class ConfigKey<T>(
|
||||
val key: String,
|
||||
public sealed class ConfigKey<T>(
|
||||
@JvmField public val key: String,
|
||||
) {
|
||||
|
||||
abstract val defaultValue: T
|
||||
public abstract val defaultValue: T
|
||||
|
||||
class Domain(
|
||||
public class Domain(
|
||||
@JvmField @JvmSuppressWildcards public vararg val presetValues: String,
|
||||
) : ConfigKey<String>("domain") {
|
||||
|
||||
init {
|
||||
require(presetValues.isNotEmpty()) { "You must provide at least one domain" }
|
||||
}
|
||||
|
||||
override val defaultValue: String
|
||||
get() = presetValues.first()
|
||||
}
|
||||
|
||||
public class ShowSuspiciousContent(
|
||||
override val defaultValue: Boolean,
|
||||
) : ConfigKey<Boolean>("show_suspicious")
|
||||
|
||||
public class UserAgent(
|
||||
override val defaultValue: String,
|
||||
val presetValues: Array<String>?,
|
||||
) : ConfigKey<String>("domain")
|
||||
}
|
||||
) : ConfigKey<String>("user_agent")
|
||||
|
||||
public class SplitByTranslations(
|
||||
override val defaultValue: Boolean,
|
||||
) : ConfigKey<Boolean>("split_translations")
|
||||
|
||||
public class PreferredImageServer(
|
||||
public val presetValues: Map<String?, String?>,
|
||||
override val defaultValue: String?,
|
||||
) : ConfigKey<String?>("img_server")
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.koitharu.kotatsu.parsers.config
|
||||
|
||||
interface MangaSourceConfig {
|
||||
public interface MangaSourceConfig {
|
||||
|
||||
operator fun <T> get(key: ConfigKey<T>): T
|
||||
}
|
||||
public operator fun <T> get(key: ConfigKey<T>): T
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package org.koitharu.kotatsu.parsers.core
|
||||
|
||||
import androidx.annotation.CallSuper
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
import org.koitharu.kotatsu.parsers.InternalParsersApi
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.config.MangaSourceConfig
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.model.search.MangaSearchQuery
|
||||
import org.koitharu.kotatsu.parsers.model.search.MangaSearchQueryCapabilities
|
||||
import org.koitharu.kotatsu.parsers.network.OkHttpWebClient
|
||||
import org.koitharu.kotatsu.parsers.network.WebClient
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.util.*
|
||||
|
||||
@Suppress("OVERRIDE_DEPRECATION")
|
||||
@InternalParsersApi
|
||||
public abstract class AbstractMangaParser @InternalParsersApi constructor(
|
||||
@property:InternalParsersApi public val context: MangaLoaderContext,
|
||||
public final override val source: MangaParserSource,
|
||||
) : MangaParser {
|
||||
|
||||
public final override val searchQueryCapabilities: MangaSearchQueryCapabilities
|
||||
get() = filterCapabilities.toMangaSearchQueryCapabilities()
|
||||
|
||||
public override val config: MangaSourceConfig by lazy { context.getConfig(source) }
|
||||
|
||||
public open val sourceLocale: Locale
|
||||
get() = if (source.locale.isEmpty()) Locale.ROOT else Locale(source.locale)
|
||||
|
||||
protected val sourceContentRating: ContentRating?
|
||||
get() = if (source.contentType == ContentType.HENTAI) {
|
||||
ContentRating.ADULT
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
protected val isNsfwSource: Boolean = source.contentType == ContentType.HENTAI
|
||||
|
||||
protected open val userAgentKey: ConfigKey.UserAgent = ConfigKey.UserAgent(context.getDefaultUserAgent())
|
||||
|
||||
override fun getRequestHeaders(): Headers = Headers.Builder()
|
||||
.add("User-Agent", config[userAgentKey])
|
||||
.build()
|
||||
|
||||
/**
|
||||
* Used as fallback if value of `order` passed to [getList] is null
|
||||
*/
|
||||
public open val defaultSortOrder: SortOrder
|
||||
get() {
|
||||
val supported = availableSortOrders
|
||||
return SortOrder.entries.first { it in supported }
|
||||
}
|
||||
|
||||
final override val domain: String
|
||||
get() = config[configKeyDomain]
|
||||
|
||||
@JvmField
|
||||
protected val webClient: WebClient = OkHttpWebClient(context.httpClient, source)
|
||||
|
||||
/**
|
||||
* Search list of manga by specified searchQuery
|
||||
*
|
||||
* @param query searchQuery
|
||||
*/
|
||||
public final override suspend fun getList(query: MangaSearchQuery): List<Manga> = getList(
|
||||
offset = query.offset,
|
||||
order = query.order ?: defaultSortOrder,
|
||||
filter = convertToMangaListFilter(query),
|
||||
)
|
||||
|
||||
/**
|
||||
* Fetch direct link to the page image.
|
||||
*/
|
||||
public override suspend fun getPageUrl(page: MangaPage): String = page.url.toAbsoluteUrl(domain)
|
||||
|
||||
/**
|
||||
* Parse favicons from the main page of the source`s website
|
||||
*/
|
||||
public override suspend fun getFavicons(): Favicons {
|
||||
return FaviconParser(webClient, domain).parseFavicons()
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
public override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||
keys.add(configKeyDomain)
|
||||
}
|
||||
|
||||
public override suspend fun getRelatedManga(seed: Manga): List<Manga> {
|
||||
return RelatedMangaFinder(listOf(this)).invoke(seed)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return [Manga] object by web link to it
|
||||
* @see [Manga.publicUrl]
|
||||
*/
|
||||
override suspend fun resolveLink(resolver: LinkResolver, link: HttpUrl): Manga? = null
|
||||
|
||||
override fun intercept(chain: Interceptor.Chain): Response = chain.proceed(chain.request())
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package org.koitharu.kotatsu.parsers.core
|
||||
|
||||
import androidx.annotation.CallSuper
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
import org.koitharu.kotatsu.parsers.InternalParsersApi
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.config.MangaSourceConfig
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.network.OkHttpWebClient
|
||||
import org.koitharu.kotatsu.parsers.network.WebClient
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.util.*
|
||||
|
||||
@Deprecated("Too complex. Use AbstractMangaParser instead")
|
||||
internal abstract class FlexibleMangaParser @InternalParsersApi constructor(
|
||||
@property:InternalParsersApi val context: MangaLoaderContext,
|
||||
final override val source: MangaParserSource,
|
||||
) : MangaParser {
|
||||
|
||||
override val config: MangaSourceConfig by lazy { context.getConfig(source) }
|
||||
|
||||
open val sourceLocale: Locale
|
||||
get() = if (source.locale.isEmpty()) Locale.ROOT else Locale(source.locale)
|
||||
|
||||
protected open val userAgentKey: ConfigKey.UserAgent = ConfigKey.UserAgent(context.getDefaultUserAgent())
|
||||
|
||||
final override val filterCapabilities: MangaListFilterCapabilities
|
||||
get() = searchQueryCapabilities.toMangaListFilterCapabilities()
|
||||
|
||||
protected val sourceContentRating: ContentRating?
|
||||
get() = if (source.contentType == ContentType.HENTAI) {
|
||||
ContentRating.ADULT
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
final override val domain: String
|
||||
get() = config[configKeyDomain]
|
||||
|
||||
@Deprecated("Override intercept() instead")
|
||||
override fun getRequestHeaders(): Headers = Headers.Builder()
|
||||
.add("User-Agent", config[userAgentKey])
|
||||
.build()
|
||||
|
||||
/**
|
||||
* Used as fallback if value of `order` passed to [getList] is null
|
||||
*/
|
||||
open val defaultSortOrder: SortOrder
|
||||
get() {
|
||||
val supported = availableSortOrders
|
||||
return SortOrder.entries.first { it in supported }
|
||||
}
|
||||
|
||||
@JvmField
|
||||
protected val webClient: WebClient = OkHttpWebClient(context.httpClient, source)
|
||||
|
||||
/**
|
||||
* Fetch direct link to the page image.
|
||||
*/
|
||||
override suspend fun getPageUrl(page: MangaPage): String = page.url.toAbsoluteUrl(domain)
|
||||
|
||||
final override suspend fun getList(offset: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||
return getList(convertToMangaSearchQuery(offset, order, filter))
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse favicons from the main page of the source`s website
|
||||
*/
|
||||
override suspend fun getFavicons(): Favicons {
|
||||
return FaviconParser(webClient, domain).parseFavicons()
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||
keys.add(configKeyDomain)
|
||||
}
|
||||
|
||||
override suspend fun getRelatedManga(seed: Manga): List<Manga> {
|
||||
return RelatedMangaFinder(listOf(this)).invoke(seed)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return [Manga] object by web link to it
|
||||
* @see [Manga.publicUrl]
|
||||
*/
|
||||
override suspend fun resolveLink(resolver: LinkResolver, link: HttpUrl): Manga? = null
|
||||
|
||||
override fun intercept(chain: Interceptor.Chain): Response = chain.proceed(chain.request())
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.koitharu.kotatsu.parsers.core
|
||||
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.model.Manga
|
||||
import org.koitharu.kotatsu.parsers.model.MangaParserSource
|
||||
import org.koitharu.kotatsu.parsers.model.search.MangaSearchQuery
|
||||
import org.koitharu.kotatsu.parsers.model.search.SearchableField
|
||||
import org.koitharu.kotatsu.parsers.util.Paginator
|
||||
|
||||
@Deprecated("Too complex. Use PagedMangaParser instead")
|
||||
internal abstract class FlexiblePagedMangaParser(
|
||||
context: MangaLoaderContext,
|
||||
source: MangaParserSource,
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) @JvmField public val pageSize: Int,
|
||||
searchPageSize: Int = pageSize,
|
||||
) : FlexibleMangaParser(context, source) {
|
||||
|
||||
@JvmField
|
||||
protected val paginator: Paginator = Paginator(pageSize)
|
||||
|
||||
@JvmField
|
||||
protected val searchPaginator: Paginator = Paginator(searchPageSize)
|
||||
|
||||
final override suspend fun getList(query: MangaSearchQuery): List<Manga> {
|
||||
var containTitleNameCriteria = false
|
||||
query.criteria.forEach {
|
||||
if (it.field == SearchableField.TITLE_NAME) {
|
||||
containTitleNameCriteria = true
|
||||
}
|
||||
}
|
||||
|
||||
return searchManga(
|
||||
paginator = if (containTitleNameCriteria) {
|
||||
paginator
|
||||
} else {
|
||||
searchPaginator
|
||||
},
|
||||
query = query,
|
||||
)
|
||||
}
|
||||
|
||||
public abstract suspend fun getListPage(query: MangaSearchQuery, page: Int): List<Manga>
|
||||
|
||||
protected fun setFirstPage(firstPage: Int, firstPageForSearch: Int = firstPage) {
|
||||
paginator.firstPage = firstPage
|
||||
searchPaginator.firstPage = firstPageForSearch
|
||||
}
|
||||
|
||||
private suspend fun searchManga(
|
||||
paginator: Paginator,
|
||||
query: MangaSearchQuery,
|
||||
): List<Manga> {
|
||||
val offset: Int = query.offset
|
||||
val page = paginator.getPage(offset)
|
||||
val list = getListPage(query, page)
|
||||
paginator.onListReceived(offset, page, list.size)
|
||||
return list
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package org.koitharu.kotatsu.parsers.core
|
||||
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.MangaParserAuthProvider
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.model.search.MangaSearchQuery
|
||||
import org.koitharu.kotatsu.parsers.util.mergeWith
|
||||
|
||||
internal class MangaParserWrapper(
|
||||
private val delegate: MangaParser,
|
||||
) : MangaParser by delegate {
|
||||
|
||||
override val authorizationProvider: MangaParserAuthProvider?
|
||||
get() = delegate as? MangaParserAuthProvider
|
||||
|
||||
@Deprecated("Too complex. Use getList with filter instead")
|
||||
override suspend fun getList(query: MangaSearchQuery): List<Manga> = withContext(Dispatchers.Default) {
|
||||
if (!query.skipValidation) {
|
||||
searchQueryCapabilities.validate(query)
|
||||
}
|
||||
delegate.getList(query)
|
||||
}
|
||||
|
||||
override suspend fun getList(
|
||||
offset: Int,
|
||||
order: SortOrder,
|
||||
filter: MangaListFilter,
|
||||
): List<Manga> = withContext(Dispatchers.Default) {
|
||||
delegate.getList(offset, order, filter)
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga = withContext(Dispatchers.Default) {
|
||||
delegate.getDetails(manga)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> = withContext(Dispatchers.Default) {
|
||||
delegate.getPages(chapter)
|
||||
}
|
||||
|
||||
override suspend fun getPageUrl(page: MangaPage): String = withContext(Dispatchers.Default) {
|
||||
delegate.getPageUrl(page)
|
||||
}
|
||||
|
||||
override suspend fun getFilterOptions(): MangaListFilterOptions = withContext(Dispatchers.Default) {
|
||||
delegate.getFilterOptions()
|
||||
}
|
||||
|
||||
override suspend fun getFavicons(): Favicons = withContext(Dispatchers.Default) {
|
||||
delegate.getFavicons()
|
||||
}
|
||||
|
||||
override suspend fun getRelatedManga(seed: Manga): List<Manga> = withContext(Dispatchers.Default) {
|
||||
delegate.getRelatedManga(seed)
|
||||
}
|
||||
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
val request = chain.request()
|
||||
val headers = request.headers.newBuilder()
|
||||
.mergeWith(delegate.getRequestHeaders(), replaceExisting = false)
|
||||
.build()
|
||||
val newRequest = request.newBuilder().headers(headers).build()
|
||||
return delegate.intercept(ProxyChain(chain, newRequest))
|
||||
}
|
||||
|
||||
private class ProxyChain(
|
||||
private val delegate: Interceptor.Chain,
|
||||
private val request: Request,
|
||||
) : Interceptor.Chain by delegate {
|
||||
|
||||
override fun request(): Request = request
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package org.koitharu.kotatsu.parsers.core
|
||||
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import org.koitharu.kotatsu.parsers.InternalParsersApi
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.model.Manga
|
||||
import org.koitharu.kotatsu.parsers.model.MangaListFilter
|
||||
import org.koitharu.kotatsu.parsers.model.MangaParserSource
|
||||
import org.koitharu.kotatsu.parsers.model.SortOrder
|
||||
import org.koitharu.kotatsu.parsers.util.Paginator
|
||||
|
||||
@InternalParsersApi
|
||||
public abstract class PagedMangaParser(
|
||||
context: MangaLoaderContext,
|
||||
source: MangaParserSource,
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) @JvmField public val pageSize: Int,
|
||||
searchPageSize: Int = pageSize,
|
||||
) : AbstractMangaParser(context, source) {
|
||||
|
||||
@JvmField
|
||||
protected val paginator: Paginator = Paginator(pageSize)
|
||||
|
||||
@JvmField
|
||||
protected val searchPaginator: Paginator = Paginator(searchPageSize)
|
||||
|
||||
final override suspend fun getList(offset: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||
return getList(
|
||||
paginator = if (filter.query.isNullOrEmpty()) {
|
||||
paginator
|
||||
} else {
|
||||
searchPaginator
|
||||
},
|
||||
offset = offset,
|
||||
order = order,
|
||||
filter = filter,
|
||||
)
|
||||
}
|
||||
|
||||
public abstract suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga>
|
||||
|
||||
protected fun setFirstPage(firstPage: Int, firstPageForSearch: Int = firstPage) {
|
||||
paginator.firstPage = firstPage
|
||||
searchPaginator.firstPage = firstPageForSearch
|
||||
}
|
||||
|
||||
private suspend fun getList(
|
||||
paginator: Paginator,
|
||||
offset: Int,
|
||||
order: SortOrder,
|
||||
filter: MangaListFilter,
|
||||
): List<Manga> {
|
||||
val page = paginator.getPage(offset)
|
||||
val list = getListPage(page, order, filter)
|
||||
paginator.onListReceived(offset, page, list.size)
|
||||
return list
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.koitharu.kotatsu.parsers.core
|
||||
|
||||
import org.koitharu.kotatsu.parsers.InternalParsersApi
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.model.Manga
|
||||
import org.koitharu.kotatsu.parsers.model.MangaListFilter
|
||||
import org.koitharu.kotatsu.parsers.model.MangaParserSource
|
||||
import org.koitharu.kotatsu.parsers.model.SortOrder
|
||||
|
||||
@InternalParsersApi
|
||||
public abstract class SinglePageMangaParser(
|
||||
context: MangaLoaderContext,
|
||||
source: MangaParserSource,
|
||||
) : AbstractMangaParser(context, source) {
|
||||
|
||||
final override suspend fun getList(offset: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||
if (offset > 0) {
|
||||
return emptyList()
|
||||
}
|
||||
return getList(order, filter)
|
||||
}
|
||||
|
||||
public abstract suspend fun getList(order: SortOrder, filter: MangaListFilter): List<Manga>
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package org.koitharu.kotatsu.parsers.exception
|
||||
|
||||
import okio.IOException
|
||||
import org.koitharu.kotatsu.parsers.InternalParsersApi
|
||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||
|
||||
/**
|
||||
* Authorization is required for access to the requested content
|
||||
*/
|
||||
class AuthRequiredException @InternalParsersApi constructor(
|
||||
val source: MangaSource,
|
||||
) : RuntimeException("Authorization required")
|
||||
public class AuthRequiredException @InternalParsersApi @JvmOverloads constructor(
|
||||
public val source: MangaSource,
|
||||
cause: Throwable? = null,
|
||||
) : IOException("Authorization required", cause)
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package org.koitharu.kotatsu.parsers.exception
|
||||
|
||||
import okio.IOException
|
||||
|
||||
class CloudFlareProtectedException(
|
||||
val url: String,
|
||||
) : IOException("Protected by CloudFlare: $url")
|
||||
@@ -0,0 +1,3 @@
|
||||
package org.koitharu.kotatsu.parsers.exception
|
||||
|
||||
public class ContentUnavailableException(message: String) : RuntimeException(message)
|
||||
@@ -2,14 +2,15 @@ package org.koitharu.kotatsu.parsers.exception
|
||||
|
||||
import okio.IOException
|
||||
import org.json.JSONArray
|
||||
import org.koitharu.kotatsu.parsers.util.json.mapJSON
|
||||
import org.koitharu.kotatsu.parsers.InternalParsersApi
|
||||
import org.koitharu.kotatsu.parsers.util.json.mapJSONNotNull
|
||||
|
||||
class GraphQLException(private val errors: JSONArray) : IOException() {
|
||||
public class GraphQLException @InternalParsersApi constructor(errors: JSONArray) : IOException() {
|
||||
|
||||
val messages = errors.mapJSON {
|
||||
public val messages: List<String> = errors.mapJSONNotNull {
|
||||
it.getString("message")
|
||||
}
|
||||
|
||||
override val message: String
|
||||
get() = messages.joinToString("\n")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.koitharu.kotatsu.parsers.exception
|
||||
|
||||
import org.jsoup.HttpStatusException
|
||||
import java.net.HttpURLConnection
|
||||
|
||||
public class NotFoundException(
|
||||
message: String,
|
||||
url: String,
|
||||
) : HttpStatusException(message, HttpURLConnection.HTTP_NOT_FOUND, url)
|
||||
@@ -2,7 +2,8 @@ package org.koitharu.kotatsu.parsers.exception
|
||||
|
||||
import org.koitharu.kotatsu.parsers.InternalParsersApi
|
||||
|
||||
class ParseException @InternalParsersApi @JvmOverloads constructor(
|
||||
message: String?,
|
||||
public class ParseException @InternalParsersApi @JvmOverloads constructor(
|
||||
public val shortMessage: String?,
|
||||
public val url: String,
|
||||
cause: Throwable? = null,
|
||||
) : RuntimeException(message, cause)
|
||||
) : RuntimeException("$shortMessage at $url", cause)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.koitharu.kotatsu.parsers.exception
|
||||
|
||||
import okio.IOException
|
||||
import java.time.Instant
|
||||
import java.time.temporal.ChronoUnit
|
||||
|
||||
public class TooManyRequestExceptions(
|
||||
public val url: String,
|
||||
retryAfter: Long,
|
||||
) : IOException("Too man requests") {
|
||||
|
||||
public val retryAt: Instant? = if (retryAfter > 0 && retryAfter < Long.MAX_VALUE) {
|
||||
Instant.now().plusMillis(retryAfter)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
public fun getRetryDelay(): Long {
|
||||
if (retryAt == null) {
|
||||
return -1L
|
||||
}
|
||||
return Instant.now().until(retryAt, ChronoUnit.MILLIS).coerceAtLeast(0L)
|
||||
}
|
||||
|
||||
override val message: String?
|
||||
get() = if (retryAt != null) {
|
||||
"${super.message}, retry at $retryAt"
|
||||
} else {
|
||||
super.message
|
||||
}
|
||||
}
|
||||
@@ -2,4 +2,10 @@
|
||||
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
const val RATING_UNKNOWN = -1f
|
||||
public const val RATING_UNKNOWN: Float = -1f
|
||||
|
||||
public const val YEAR_UNKNOWN: Int = 0
|
||||
|
||||
public const val YEAR_MIN: Int = 1900
|
||||
|
||||
public const val YEAR_MAX: Int = 2099
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
public enum class ContentRating {
|
||||
SAFE,
|
||||
SUGGESTIVE,
|
||||
ADULT
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
public enum class ContentType {
|
||||
|
||||
/**
|
||||
* Standard manga, manhua, webtoons, etc
|
||||
*/
|
||||
MANGA,
|
||||
|
||||
MANHWA,
|
||||
|
||||
MANHUA,
|
||||
|
||||
/**
|
||||
* Use this if the source provides mostly nsfw content.
|
||||
*/
|
||||
HENTAI,
|
||||
|
||||
/**
|
||||
* Western comics
|
||||
*/
|
||||
COMICS,
|
||||
|
||||
NOVEL,
|
||||
|
||||
/**
|
||||
* Use this type if no other suits your needs. For example, for an indie manga
|
||||
*/
|
||||
|
||||
ONE_SHOT,
|
||||
DOUJINSHI,
|
||||
IMAGE_SET,
|
||||
ARTIST_CG,
|
||||
GAME_CG,
|
||||
OTHER,
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
public enum class Demographic {
|
||||
SHOUNEN,
|
||||
SHOUJO,
|
||||
SEINEN,
|
||||
JOSEI,
|
||||
KODOMO,
|
||||
NONE,
|
||||
}
|
||||
@@ -2,13 +2,14 @@ package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
|
||||
class Favicon internal constructor(
|
||||
val url: String,
|
||||
val size: Int,
|
||||
internal val rel: String?,
|
||||
public data class Favicon(
|
||||
@JvmField public val url: String,
|
||||
@JvmField public val size: Int,
|
||||
@JvmField internal val rel: String?,
|
||||
) : Comparable<Favicon> {
|
||||
|
||||
val type: String = url.toHttpUrl().pathSegments.last()
|
||||
@JvmField
|
||||
public val type: String = url.toHttpUrl().pathSegments.last()
|
||||
.substringAfterLast('.', "").lowercase()
|
||||
|
||||
override fun compareTo(other: Favicon): Int {
|
||||
@@ -19,33 +20,9 @@ class Favicon internal constructor(
|
||||
return relWeightOf(rel).compareTo(relWeightOf(other.rel))
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Favicon
|
||||
|
||||
if (url != other.url) return false
|
||||
if (size != other.size) return false
|
||||
if (rel != other.rel) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = url.hashCode()
|
||||
result = 31 * result + size
|
||||
result = 31 * result + rel.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Favicon(size=$size, type='$type', rel='$rel', url='$url')"
|
||||
}
|
||||
|
||||
private fun relWeightOf(rel: String?) = when (rel) {
|
||||
"apple-touch-icon" -> 1 // Prefer apple-touch-icon because it has a better quality
|
||||
"mask-icon" -> -1
|
||||
else -> 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
class Favicons internal constructor(
|
||||
public class Favicons(
|
||||
favicons: Collection<Favicon>,
|
||||
val referer: String,
|
||||
@JvmField public val referer: String?,
|
||||
) : Collection<Favicon> {
|
||||
|
||||
private val icons = favicons.sortedDescending()
|
||||
@@ -18,6 +18,11 @@ class Favicons internal constructor(
|
||||
|
||||
override fun iterator(): Iterator<Favicon> = icons.iterator()
|
||||
|
||||
public operator fun minus(victim: Favicon): Favicons = Favicons(
|
||||
favicons = icons.filterNot { it == victim },
|
||||
referer = referer,
|
||||
)
|
||||
|
||||
/**
|
||||
* Finds a favicon whose size in pixels is greater than or equal to the specified size.
|
||||
* If such icon is not available returns the largest icon
|
||||
@@ -25,7 +30,7 @@ class Favicons internal constructor(
|
||||
* @param types supported file types, e.g. png, svg, ico. May be null but not empty
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun find(size: Int, types: Set<String>? = null): Favicon? {
|
||||
public fun find(size: Int, types: Set<String>? = null): Favicon? {
|
||||
if (icons.isEmpty()) {
|
||||
return null
|
||||
}
|
||||
@@ -42,4 +47,13 @@ class Favicons internal constructor(
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
public companion object {
|
||||
|
||||
@JvmStatic
|
||||
public val EMPTY: Favicons = Favicons(emptySet(), null)
|
||||
|
||||
@JvmStatic
|
||||
public fun single(url: String): Favicons = Favicons(setOf(Favicon(url, 0, null)), null)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,158 +1,203 @@
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
import org.koitharu.kotatsu.parsers.InternalParsersApi
|
||||
import androidx.collection.ArrayMap
|
||||
import org.koitharu.kotatsu.parsers.util.findById
|
||||
import org.koitharu.kotatsu.parsers.util.nullIfEmpty
|
||||
|
||||
class Manga(
|
||||
public data class Manga(
|
||||
/**
|
||||
* Unique identifier for manga
|
||||
*/
|
||||
val id: Long,
|
||||
@JvmField public val id: Long,
|
||||
/**
|
||||
* Manga title, human-readable
|
||||
*/
|
||||
val title: String,
|
||||
@JvmField public val title: String,
|
||||
/**
|
||||
* Alternative title (for example on other language), may be null
|
||||
* Alternative titles (for example on other language), may be empty
|
||||
*/
|
||||
val altTitle: String?,
|
||||
@JvmField public val altTitles: Set<String>,
|
||||
/**
|
||||
* Relative url to manga (**without** a domain) or any other uri.
|
||||
* Used principally in parsers
|
||||
*/
|
||||
val url: String,
|
||||
@JvmField public val url: String,
|
||||
/**
|
||||
* Absolute url to manga, must be ready to open in browser
|
||||
*/
|
||||
val publicUrl: String,
|
||||
@JvmField public val publicUrl: String,
|
||||
/**
|
||||
* Normalized manga rating, must be in range of 0..1 or [RATING_UNKNOWN] if rating s unknown
|
||||
* @see hasRating
|
||||
*/
|
||||
val rating: Float,
|
||||
@JvmField public val rating: Float,
|
||||
/**
|
||||
* Indicates that manga may contain sensitive information (18+, NSFW)
|
||||
*/
|
||||
val isNsfw: Boolean,
|
||||
@JvmField public val contentRating: ContentRating?,
|
||||
/**
|
||||
* Absolute link to the cover
|
||||
* @see largeCoverUrl
|
||||
*/
|
||||
val coverUrl: String,
|
||||
@JvmField public val coverUrl: String?,
|
||||
/**
|
||||
* Tags (genres) of the manga
|
||||
*/
|
||||
val tags: Set<MangaTag>,
|
||||
@JvmField public val tags: Set<MangaTag>,
|
||||
/**
|
||||
* Manga status (ongoing, finished) or null if unknown
|
||||
*/
|
||||
val state: MangaState?,
|
||||
@JvmField public val state: MangaState?,
|
||||
/**
|
||||
* Author of the manga, may be null
|
||||
* Authors of the manga
|
||||
*/
|
||||
val author: String?,
|
||||
@JvmField public val authors: Set<String>,
|
||||
/**
|
||||
* Large cover url (absolute), null if is no large cover
|
||||
* @see coverUrl
|
||||
*/
|
||||
val largeCoverUrl: String? = null,
|
||||
@JvmField public val largeCoverUrl: String? = null,
|
||||
/**
|
||||
* Manga description, may be html or null
|
||||
*/
|
||||
val description: String? = null,
|
||||
@JvmField public val description: String? = null,
|
||||
/**
|
||||
* List of chapters
|
||||
*/
|
||||
val chapters: List<MangaChapter>? = null,
|
||||
@JvmField public val chapters: List<MangaChapter>? = null,
|
||||
/**
|
||||
* Manga source
|
||||
*/
|
||||
val source: MangaSource,
|
||||
@JvmField public val source: MangaSource,
|
||||
) {
|
||||
|
||||
@Deprecated("Use other constructor")
|
||||
public constructor(
|
||||
/**
|
||||
* Unique identifier for manga
|
||||
*/
|
||||
id: Long,
|
||||
/**
|
||||
* Manga title, human-readable
|
||||
*/
|
||||
title: String,
|
||||
/**
|
||||
* Alternative title (for example on other language), may be null
|
||||
*/
|
||||
altTitle: String?,
|
||||
/**
|
||||
* Relative url to manga (**without** a domain) or any other uri.
|
||||
* Used principally in parsers
|
||||
*/
|
||||
url: String,
|
||||
/**
|
||||
* Absolute url to manga, must be ready to open in browser
|
||||
*/
|
||||
publicUrl: String,
|
||||
/**
|
||||
* Normalized manga rating, must be in range of 0..1 or [RATING_UNKNOWN] if rating s unknown
|
||||
* @see hasRating
|
||||
*/
|
||||
rating: Float,
|
||||
/**
|
||||
* Indicates that manga may contain sensitive information (18+, NSFW)
|
||||
*/
|
||||
isNsfw: Boolean,
|
||||
/**
|
||||
* Absolute link to the cover
|
||||
* @see largeCoverUrl
|
||||
*/
|
||||
coverUrl: String?,
|
||||
/**
|
||||
* Tags (genres) of the manga
|
||||
*/
|
||||
tags: Set<MangaTag>,
|
||||
/**
|
||||
* Manga status (ongoing, finished) or null if unknown
|
||||
*/
|
||||
state: MangaState?,
|
||||
/**
|
||||
* Authors of the manga
|
||||
*/
|
||||
author: String?,
|
||||
/**
|
||||
* Large cover url (absolute), null if is no large cover
|
||||
* @see coverUrl
|
||||
*/
|
||||
largeCoverUrl: String? = null,
|
||||
/**
|
||||
* Manga description, may be html or null
|
||||
*/
|
||||
description: String? = null,
|
||||
/**
|
||||
* List of chapters
|
||||
*/
|
||||
chapters: List<MangaChapter>? = null,
|
||||
/**
|
||||
* Manga source
|
||||
*/
|
||||
source: MangaSource,
|
||||
) : this(
|
||||
id = id,
|
||||
title = title,
|
||||
altTitles = setOfNotNull(altTitle?.nullIfEmpty()),
|
||||
url = url,
|
||||
publicUrl = publicUrl,
|
||||
rating = rating,
|
||||
contentRating = if (isNsfw) ContentRating.ADULT else null,
|
||||
coverUrl = coverUrl?.nullIfEmpty(),
|
||||
tags = tags,
|
||||
state = state,
|
||||
authors = setOfNotNull(author),
|
||||
largeCoverUrl = largeCoverUrl?.nullIfEmpty(),
|
||||
description = description?.nullIfEmpty(),
|
||||
chapters = chapters,
|
||||
source = source,
|
||||
)
|
||||
|
||||
/**
|
||||
* Author of the manga, may be null
|
||||
*/
|
||||
@Deprecated("Please use authors")
|
||||
public val author: String?
|
||||
get() = authors.firstOrNull()
|
||||
|
||||
/**
|
||||
* Alternative title (for example on other language), may be null
|
||||
*/
|
||||
@Deprecated("Please use altTitles")
|
||||
public val altTitle: String?
|
||||
get() = altTitles.firstOrNull()
|
||||
|
||||
/**
|
||||
* Return if manga has a specified rating
|
||||
* @see rating
|
||||
*/
|
||||
val hasRating: Boolean
|
||||
public val hasRating: Boolean
|
||||
get() = rating > 0f && rating <= 1f
|
||||
|
||||
fun getChapters(branch: String?): List<MangaChapter>? {
|
||||
return chapters?.filter { x -> x.branch == branch }
|
||||
@Deprecated("Use contentRating instead", ReplaceWith("contentRating == ContentRating.ADULT"))
|
||||
public val isNsfw: Boolean
|
||||
get() = contentRating == ContentRating.ADULT
|
||||
|
||||
public fun getChapters(branch: String?): List<MangaChapter> {
|
||||
return chapters?.filter { x -> x.branch == branch }.orEmpty()
|
||||
}
|
||||
|
||||
@InternalParsersApi
|
||||
fun copy(
|
||||
title: String = this.title,
|
||||
altTitle: String? = this.altTitle,
|
||||
publicUrl: String = this.publicUrl,
|
||||
rating: Float = this.rating,
|
||||
isNsfw: Boolean = this.isNsfw,
|
||||
coverUrl: String = this.coverUrl,
|
||||
tags: Set<MangaTag> = this.tags,
|
||||
state: MangaState? = this.state,
|
||||
author: String? = this.author,
|
||||
largeCoverUrl: String? = this.largeCoverUrl,
|
||||
description: String? = this.description,
|
||||
chapters: List<MangaChapter>? = this.chapters,
|
||||
) = Manga(
|
||||
id = id,
|
||||
title = title,
|
||||
altTitle = altTitle,
|
||||
url = url,
|
||||
publicUrl = publicUrl,
|
||||
rating = rating,
|
||||
isNsfw = isNsfw,
|
||||
coverUrl = coverUrl,
|
||||
tags = tags,
|
||||
state = state,
|
||||
author = author,
|
||||
largeCoverUrl = largeCoverUrl,
|
||||
description = description,
|
||||
chapters = chapters,
|
||||
source = source,
|
||||
)
|
||||
public fun findChapterById(id: Long): MangaChapter? = chapters?.findById(id)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
public fun requireChapterById(id: Long): MangaChapter = findChapterById(id)
|
||||
?: throw NoSuchElementException("Chapter with id $id not found")
|
||||
|
||||
other as Manga
|
||||
|
||||
if (id != other.id) return false
|
||||
if (title != other.title) return false
|
||||
if (altTitle != other.altTitle) return false
|
||||
if (url != other.url) return false
|
||||
if (publicUrl != other.publicUrl) return false
|
||||
if (rating != other.rating) return false
|
||||
if (isNsfw != other.isNsfw) return false
|
||||
if (coverUrl != other.coverUrl) return false
|
||||
if (tags != other.tags) return false
|
||||
if (state != other.state) return false
|
||||
if (author != other.author) return false
|
||||
if (largeCoverUrl != other.largeCoverUrl) return false
|
||||
if (description != other.description) return false
|
||||
if (chapters != other.chapters) return false
|
||||
if (source != other.source) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = id.hashCode()
|
||||
result = 31 * result + title.hashCode()
|
||||
result = 31 * result + (altTitle?.hashCode() ?: 0)
|
||||
result = 31 * result + url.hashCode()
|
||||
result = 31 * result + publicUrl.hashCode()
|
||||
result = 31 * result + rating.hashCode()
|
||||
result = 31 * result + isNsfw.hashCode()
|
||||
result = 31 * result + coverUrl.hashCode()
|
||||
result = 31 * result + tags.hashCode()
|
||||
result = 31 * result + (state?.hashCode() ?: 0)
|
||||
result = 31 * result + (author?.hashCode() ?: 0)
|
||||
result = 31 * result + (largeCoverUrl?.hashCode() ?: 0)
|
||||
result = 31 * result + (description?.hashCode() ?: 0)
|
||||
result = 31 * result + (chapters?.hashCode() ?: 0)
|
||||
result = 31 * result + source.hashCode()
|
||||
public fun getBranches(): Map<String?, Int> {
|
||||
if (chapters.isNullOrEmpty()) {
|
||||
return emptyMap()
|
||||
}
|
||||
val result = ArrayMap<String?, Int>()
|
||||
chapters.forEach {
|
||||
val key = it.branch
|
||||
result[key] = result.getOrDefault(key, 0) + 1
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,70 +1,65 @@
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
class MangaChapter(
|
||||
import org.koitharu.kotatsu.parsers.util.formatSimple
|
||||
import org.koitharu.kotatsu.parsers.util.ifNullOrEmpty
|
||||
|
||||
public data class MangaChapter(
|
||||
/**
|
||||
* An unique id of chapter
|
||||
*/
|
||||
val id: Long,
|
||||
@JvmField public val id: Long,
|
||||
/**
|
||||
* User-readable name of chapter
|
||||
* User-readable name of chapter if provided by parser or null instead
|
||||
* Do not pass manga title or chapter number here
|
||||
*/
|
||||
val name: String,
|
||||
@JvmField public val title: String?,
|
||||
/**
|
||||
* Chapter number starting from 1
|
||||
* Chapter number starting from 1, 0 if unknown
|
||||
*/
|
||||
val number: Int,
|
||||
@JvmField public val number: Float,
|
||||
/**
|
||||
* Volume number starting from 1, 0 if unknown
|
||||
*/
|
||||
@JvmField public val volume: Int,
|
||||
/**
|
||||
* Relative url to chapter (**without** a domain) or any other uri.
|
||||
* Used principally in parsers
|
||||
*/
|
||||
val url: String,
|
||||
@JvmField public val url: String,
|
||||
/**
|
||||
* User-readable name of scanlator (releaser) or null if unknown
|
||||
*/
|
||||
val scanlator: String?,
|
||||
@JvmField public val scanlator: String?,
|
||||
/**
|
||||
* Chapter upload date in milliseconds
|
||||
*/
|
||||
val uploadDate: Long,
|
||||
@JvmField public val uploadDate: Long,
|
||||
/**
|
||||
* User-readable name of branch.
|
||||
* A branch is a group of chapters that overlap (e.g. different languages)
|
||||
*/
|
||||
val branch: String?,
|
||||
val source: MangaSource,
|
||||
) : Comparable<MangaChapter> {
|
||||
@JvmField public val branch: String?,
|
||||
@JvmField public val source: MangaSource,
|
||||
) {
|
||||
|
||||
override fun compareTo(other: MangaChapter): Int {
|
||||
return number.compareTo(other.number)
|
||||
@Deprecated("Use title instead", ReplaceWith("title"))
|
||||
val name: String
|
||||
get() = title.ifNullOrEmpty {
|
||||
buildString {
|
||||
if (volume > 0) append("Vol ").append(volume).append(' ')
|
||||
if (number > 0) append("Chapter ").append(number.formatSimple()) else append("Unnamed")
|
||||
}
|
||||
}
|
||||
|
||||
public fun numberString(): String? = if (number > 0f) {
|
||||
number.formatSimple()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as MangaChapter
|
||||
|
||||
if (id != other.id) return false
|
||||
if (name != other.name) return false
|
||||
if (number != other.number) return false
|
||||
if (url != other.url) return false
|
||||
if (scanlator != other.scanlator) return false
|
||||
if (uploadDate != other.uploadDate) return false
|
||||
if (branch != other.branch) return false
|
||||
if (source != other.source) return false
|
||||
|
||||
return true
|
||||
public fun volumeString(): String? = if (volume > 0) {
|
||||
volume.toString()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = id.hashCode()
|
||||
result = 31 * result + name.hashCode()
|
||||
result = 31 * result + number
|
||||
result = 31 * result + url.hashCode()
|
||||
result = 31 * result + (scanlator?.hashCode() ?: 0)
|
||||
result = 31 * result + uploadDate.hashCode()
|
||||
result = 31 * result + (branch?.hashCode() ?: 0)
|
||||
result = 31 * result + source.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
import java.util.*
|
||||
|
||||
public data class MangaListFilter(
|
||||
@JvmField val query: String? = null,
|
||||
@JvmField val tags: Set<MangaTag> = emptySet(),
|
||||
@JvmField val tagsExclude: Set<MangaTag> = emptySet(),
|
||||
@JvmField val locale: Locale? = null,
|
||||
@JvmField val originalLocale: Locale? = null,
|
||||
@JvmField val states: Set<MangaState> = emptySet(),
|
||||
@JvmField val contentRating: Set<ContentRating> = emptySet(),
|
||||
@JvmField val types: Set<ContentType> = emptySet(),
|
||||
@JvmField val demographics: Set<Demographic> = emptySet(),
|
||||
@JvmField val year: Int = YEAR_UNKNOWN,
|
||||
@JvmField val yearFrom: Int = YEAR_UNKNOWN,
|
||||
@JvmField val yearTo: Int = YEAR_UNKNOWN,
|
||||
@JvmField val author: String? = null,
|
||||
) {
|
||||
|
||||
private fun isNonSearchOptionsEmpty(): Boolean = tags.isEmpty() &&
|
||||
tagsExclude.isEmpty() &&
|
||||
locale == null &&
|
||||
originalLocale == null &&
|
||||
states.isEmpty() &&
|
||||
contentRating.isEmpty() &&
|
||||
year == YEAR_UNKNOWN &&
|
||||
yearFrom == YEAR_UNKNOWN &&
|
||||
yearTo == YEAR_UNKNOWN &&
|
||||
types.isEmpty() &&
|
||||
demographics.isEmpty() &&
|
||||
author.isNullOrEmpty()
|
||||
|
||||
public fun isEmpty(): Boolean = isNonSearchOptionsEmpty() && query.isNullOrEmpty()
|
||||
|
||||
public fun isNotEmpty(): Boolean = !isEmpty()
|
||||
|
||||
public fun hasNonSearchOptions(): Boolean = !isNonSearchOptionsEmpty()
|
||||
|
||||
public companion object {
|
||||
|
||||
@JvmStatic
|
||||
public val EMPTY: MangaListFilter = MangaListFilter()
|
||||
}
|
||||
|
||||
internal class Builder {
|
||||
private var query: String? = null
|
||||
private val tags: MutableSet<MangaTag> = mutableSetOf()
|
||||
private val tagsExclude: MutableSet<MangaTag> = mutableSetOf()
|
||||
private var locale: Locale? = null
|
||||
private var originalLocale: Locale? = null
|
||||
private val states: MutableSet<MangaState> = mutableSetOf()
|
||||
private val contentRating: MutableSet<ContentRating> = mutableSetOf()
|
||||
private val types: MutableSet<ContentType> = mutableSetOf()
|
||||
private val demographics: MutableSet<Demographic> = mutableSetOf()
|
||||
private var year: Int = YEAR_UNKNOWN
|
||||
private var yearFrom: Int = YEAR_UNKNOWN
|
||||
private var yearTo: Int = YEAR_UNKNOWN
|
||||
|
||||
fun query(query: String?): Builder = apply { this.query = query }
|
||||
fun addTag(tag: MangaTag): Builder = apply { tags.add(tag) }
|
||||
fun addTags(tags: Collection<MangaTag>): Builder = apply { this.tags.addAll(tags) }
|
||||
fun excludeTag(tag: MangaTag): Builder = apply { tagsExclude.add(tag) }
|
||||
fun excludeTags(tags: Collection<MangaTag>): Builder = apply { this.tagsExclude.addAll(tags) }
|
||||
fun locale(locale: Locale?): Builder = apply { this.locale = locale }
|
||||
fun originalLocale(locale: Locale?): Builder = apply { this.originalLocale = locale }
|
||||
fun addState(state: MangaState): Builder = apply { states.add(state) }
|
||||
fun addStates(states: Collection<MangaState>): Builder = apply { this.states.addAll(states) }
|
||||
fun addContentRating(rating: ContentRating): Builder = apply { contentRating.add(rating) }
|
||||
fun addContentRatings(ratings: Collection<ContentRating>): Builder =
|
||||
apply { this.contentRating.addAll(ratings) }
|
||||
|
||||
fun addType(type: ContentType): Builder = apply { types.add(type) }
|
||||
fun addTypes(types: Collection<ContentType>): Builder = apply { this.types.addAll(types) }
|
||||
fun addDemographic(demographic: Demographic): Builder = apply { demographics.add(demographic) }
|
||||
fun addDemographics(demographics: Collection<Demographic>): Builder =
|
||||
apply { this.demographics.addAll(demographics) }
|
||||
|
||||
fun year(year: Int): Builder = apply { this.year = year }
|
||||
fun yearFrom(year: Int): Builder = apply { this.yearFrom = year }
|
||||
fun yearTo(year: Int): Builder = apply { this.yearTo = year }
|
||||
|
||||
fun build(): MangaListFilter = MangaListFilter(
|
||||
query, tags, tagsExclude, locale, originalLocale, states,
|
||||
contentRating, types, demographics, year, yearFrom, yearTo,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
import org.koitharu.kotatsu.parsers.InternalParsersApi
|
||||
|
||||
public data class MangaListFilterCapabilities @InternalParsersApi constructor(
|
||||
|
||||
/**
|
||||
* Whether parser supports filtering by more than one tag
|
||||
* @see [MangaListFilter.tags]
|
||||
* @see [MangaListFilterOptions.availableTags]
|
||||
*/
|
||||
val isMultipleTagsSupported: Boolean = false,
|
||||
|
||||
/**
|
||||
* Whether parser supports tagsExclude field in filter
|
||||
* @see [MangaListFilter.tagsExclude]
|
||||
* @see [MangaListFilterOptions.availableTags]
|
||||
*/
|
||||
val isTagsExclusionSupported: Boolean = false,
|
||||
|
||||
/**
|
||||
* Whether parser supports searching by string query
|
||||
* @see [MangaListFilter.query]
|
||||
*/
|
||||
val isSearchSupported: Boolean = false,
|
||||
|
||||
/**
|
||||
* Whether parser supports searching by string query combined within other filters
|
||||
*/
|
||||
val isSearchWithFiltersSupported: Boolean = false,
|
||||
|
||||
/**
|
||||
* Whether parser supports searching/filtering by year
|
||||
* @see [MangaListFilter.year]
|
||||
*/
|
||||
val isYearSupported: Boolean = false,
|
||||
|
||||
/**
|
||||
* Whether parser supports searching by year range
|
||||
* @see [MangaListFilter.yearFrom] and [MangaListFilter.yearTo]
|
||||
*/
|
||||
val isYearRangeSupported: Boolean = false,
|
||||
|
||||
/**
|
||||
* Whether parser supports searching Original Languages
|
||||
* @see [MangaListFilter.originalLocale]
|
||||
* @see [MangaListFilterOptions.availableLocales]
|
||||
*/
|
||||
val isOriginalLocaleSupported: Boolean = false,
|
||||
|
||||
/**
|
||||
* Whether parser supports searching by author name
|
||||
* @see [MangaListFilter.author]
|
||||
*/
|
||||
val isAuthorSearchSupported: Boolean = false,
|
||||
)
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
import org.koitharu.kotatsu.parsers.InternalParsersApi
|
||||
import java.util.*
|
||||
|
||||
public data class MangaListFilterOptions @InternalParsersApi constructor(
|
||||
|
||||
/**
|
||||
* Available tags (genres)
|
||||
*/
|
||||
public val availableTags: Set<MangaTag> = emptySet(),
|
||||
|
||||
/**
|
||||
* Supported [MangaState] variants for filtering. May be empty.
|
||||
*
|
||||
* For better performance use [EnumSet] for more than one item.
|
||||
*/
|
||||
public val availableStates: Set<MangaState> = emptySet(),
|
||||
|
||||
/**
|
||||
* Supported [ContentRating] variants for filtering. May be empty.
|
||||
*
|
||||
* For better performance use [EnumSet] for more than one item.
|
||||
*/
|
||||
public val availableContentRating: Set<ContentRating> = emptySet(),
|
||||
|
||||
/**
|
||||
* Supported [ContentType] variants for filtering. May be empty.
|
||||
*
|
||||
* For better performance use [EnumSet] for more than one item.
|
||||
*/
|
||||
public val availableContentTypes: Set<ContentType> = emptySet(),
|
||||
|
||||
/**
|
||||
* Supported [Demographic] variants for filtering. May be empty.
|
||||
*
|
||||
* For better performance use [EnumSet] for more than one item.
|
||||
*/
|
||||
public val availableDemographics: Set<Demographic> = emptySet(),
|
||||
|
||||
/**
|
||||
* Supported content locales for multilingual sources
|
||||
*/
|
||||
public val availableLocales: Set<Locale> = emptySet(),
|
||||
)
|
||||
@@ -2,51 +2,21 @@ package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
|
||||
class MangaPage(
|
||||
public data class MangaPage(
|
||||
/**
|
||||
* Unique identifier for manga
|
||||
* Unique identifier for page
|
||||
*/
|
||||
val id: Long,
|
||||
@JvmField public val id: Long,
|
||||
/**
|
||||
* Relative url to page (**without** a domain) or any other uri.
|
||||
* Used principally in parsers.
|
||||
* May contain link to image or html page.
|
||||
* @see MangaParser.getPageUrl
|
||||
*/
|
||||
val url: String,
|
||||
/**
|
||||
* Absolute link to the chapter or website home page.
|
||||
* Used in Referer header
|
||||
*/
|
||||
val referer: String,
|
||||
@JvmField public val url: String,
|
||||
/**
|
||||
* Absolute url of the small page image if exists, null otherwise
|
||||
*/
|
||||
val preview: String?,
|
||||
val source: MangaSource,
|
||||
) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as MangaPage
|
||||
|
||||
if (id != other.id) return false
|
||||
if (url != other.url) return false
|
||||
if (referer != other.referer) return false
|
||||
if (preview != other.preview) return false
|
||||
if (source != other.source) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = id.hashCode()
|
||||
result = 31 * result + url.hashCode()
|
||||
result = 31 * result + referer.hashCode()
|
||||
result = 31 * result + (preview?.hashCode() ?: 0)
|
||||
result = 31 * result + source.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
@JvmField public val preview: String?,
|
||||
@JvmField public val source: MangaSource,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
public interface MangaSource {
|
||||
|
||||
public val name: String
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
enum class MangaState {
|
||||
ONGOING, FINISHED
|
||||
}
|
||||
public enum class MangaState {
|
||||
ONGOING, FINISHED, ABANDONED, PAUSED, UPCOMING, RESTRICTED
|
||||
}
|
||||
|
||||
@@ -2,36 +2,15 @@ package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
|
||||
class MangaTag(
|
||||
public data class MangaTag(
|
||||
/**
|
||||
* User-readable tag title, should be in Title case
|
||||
*/
|
||||
val title: String,
|
||||
@JvmField public val title: String,
|
||||
/**
|
||||
* Identifier of a tag, must be unique among the source.
|
||||
* @see MangaParser.getList
|
||||
*/
|
||||
val key: String,
|
||||
val source: MangaSource,
|
||||
) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as MangaTag
|
||||
|
||||
if (title != other.title) return false
|
||||
if (key != other.key) return false
|
||||
if (source != other.source) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = title.hashCode()
|
||||
result = 31 * result + key.hashCode()
|
||||
result = 31 * result + source.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
@JvmField public val key: String,
|
||||
@JvmField public val source: MangaSource,
|
||||
)
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
enum class SortOrder {
|
||||
public enum class SortOrder {
|
||||
UPDATED,
|
||||
UPDATED_ASC,
|
||||
POPULARITY,
|
||||
POPULARITY_ASC,
|
||||
RATING,
|
||||
RATING_ASC,
|
||||
NEWEST,
|
||||
ALPHABETICAL
|
||||
}
|
||||
NEWEST_ASC,
|
||||
ALPHABETICAL,
|
||||
ALPHABETICAL_DESC,
|
||||
ADDED,
|
||||
ADDED_ASC,
|
||||
RELEVANCE,
|
||||
POPULARITY_HOUR,
|
||||
POPULARITY_TODAY,
|
||||
POPULARITY_WEEK,
|
||||
POPULARITY_MONTH,
|
||||
POPULARITY_YEAR,
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ package org.koitharu.kotatsu.parsers.model
|
||||
import org.koitharu.kotatsu.parsers.InternalParsersApi
|
||||
|
||||
@InternalParsersApi
|
||||
class WordSet(private vararg val words: String) {
|
||||
public class WordSet(private vararg val words: String) {
|
||||
|
||||
fun anyWordIn(dateString: String): Boolean = words.any {
|
||||
dateString.contains(it, ignoreCase = true)
|
||||
}
|
||||
}
|
||||
public fun anyWordIn(dateString: String): Boolean = words.any { dateString.contains(it, ignoreCase = true) }
|
||||
public fun startsWith(dateString: String): Boolean = words.any { dateString.startsWith(it, ignoreCase = true) }
|
||||
public fun endsWith(dateString: String): Boolean = words.any { dateString.endsWith(it, ignoreCase = true) }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package org.koitharu.kotatsu.parsers.model.search
|
||||
|
||||
import androidx.collection.ArrayMap
|
||||
import androidx.collection.ArraySet
|
||||
import org.koitharu.kotatsu.parsers.model.SortOrder
|
||||
|
||||
/**
|
||||
* Represents a search query for filtering and sorting manga search results.
|
||||
* This class is immutable and must be constructed using the [Builder].
|
||||
*
|
||||
* @property criteria The set of search criteria applied to the query.
|
||||
* @property order The sorting order for the results (optional).
|
||||
* @property offset The offset number for paginated search results (optional).
|
||||
*/
|
||||
|
||||
@Deprecated("Too complex. Use MangaListFilter instead")
|
||||
@ConsistentCopyVisibility
|
||||
public data class MangaSearchQuery private constructor(
|
||||
@JvmField public val criteria: Set<QueryCriteria<*>>,
|
||||
@JvmField public val order: SortOrder?,
|
||||
@JvmField public val offset: Int,
|
||||
@JvmField public val skipValidation: Boolean,
|
||||
) {
|
||||
|
||||
public fun newBuilder(): Builder = Builder(this)
|
||||
|
||||
public class Builder {
|
||||
|
||||
private val criteria = ArraySet<QueryCriteria<*>>()
|
||||
private var order: SortOrder? = null
|
||||
private var offset: Int = 0
|
||||
private var skipValidation: Boolean = false
|
||||
|
||||
public constructor()
|
||||
|
||||
public constructor(query: MangaSearchQuery) : this() {
|
||||
criteria.addAll(query.criteria)
|
||||
order = query.order
|
||||
offset = query.offset
|
||||
}
|
||||
|
||||
public fun criterion(criterion: QueryCriteria<*>): Builder = apply { criteria.add(criterion) }
|
||||
|
||||
public fun order(order: SortOrder?): Builder = apply { this.order = order }
|
||||
|
||||
public fun offset(offset: Int): Builder = apply { this.offset = offset }
|
||||
|
||||
public fun skipValidation(skip: Boolean): Builder = apply { this.skipValidation = skip }
|
||||
|
||||
@Throws(IllegalArgumentException::class)
|
||||
public fun build(): MangaSearchQuery {
|
||||
return MangaSearchQuery(deduplicateCriteria(criteria), order, offset, skipValidation)
|
||||
}
|
||||
|
||||
private fun deduplicateCriteria(criteria: Set<QueryCriteria<*>>): Set<QueryCriteria<*>> {
|
||||
val uniqueCriteria =
|
||||
ArrayMap<Pair<SearchableField, Class<out QueryCriteria<*>>>, QueryCriteria<*>>(criteria.size)
|
||||
|
||||
for (criterion in criteria) {
|
||||
val key = criterion.field to criterion::class.java
|
||||
val existing = uniqueCriteria[key]
|
||||
|
||||
when {
|
||||
existing == null -> uniqueCriteria[key] = criterion
|
||||
|
||||
existing is QueryCriteria.Include<*> && criterion is QueryCriteria.Include<*> -> {
|
||||
uniqueCriteria[key] =
|
||||
QueryCriteria.Include(criterion.field, existing.values union criterion.values)
|
||||
}
|
||||
|
||||
existing is QueryCriteria.Exclude<*> && criterion is QueryCriteria.Exclude<*> -> {
|
||||
uniqueCriteria[key] =
|
||||
QueryCriteria.Exclude(criterion.field, existing.values union criterion.values)
|
||||
}
|
||||
|
||||
else -> throw IllegalArgumentException(
|
||||
"Match and Range have only one criterion per type, but found duplicates for: ${criterion.field} in ${criterion::class.simpleName}",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return uniqueCriteria.values.toSet()
|
||||
}
|
||||
}
|
||||
|
||||
public companion object {
|
||||
|
||||
public val EMPTY: MangaSearchQuery = MangaSearchQuery(emptySet(), null, 0, false)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.koitharu.kotatsu.parsers.model.search
|
||||
|
||||
import androidx.collection.ArraySet
|
||||
import org.koitharu.kotatsu.parsers.model.search.QueryCriteria.*
|
||||
import org.koitharu.kotatsu.parsers.util.mapToSet
|
||||
|
||||
@Deprecated("Too complex. Use MangaListFilterCapabilities instead")
|
||||
@ExposedCopyVisibility
|
||||
public data class MangaSearchQueryCapabilities internal constructor(
|
||||
public val capabilities: Set<SearchCapability>,
|
||||
) {
|
||||
|
||||
public constructor(vararg capabilities: SearchCapability) : this(ArraySet(capabilities))
|
||||
|
||||
internal fun validate(query: MangaSearchQuery) {
|
||||
val strictFields = capabilities.filter { it.isExclusive }.mapToSet { it.field }
|
||||
val usedStrictFields = query.criteria.mapToSet { it.field }.intersect(strictFields)
|
||||
|
||||
require(usedStrictFields.isEmpty() || query.criteria.size <= 1) {
|
||||
"Query contains multiple criteria, but at least one field (${usedStrictFields.joinToString()}) does not support multiple criteria."
|
||||
}
|
||||
for (criterion in query.criteria) {
|
||||
val capability = requireNotNull(capabilities.find { it.field == criterion.field }) {
|
||||
"Unsupported search field: ${criterion.field}"
|
||||
}
|
||||
|
||||
require(criterion::class in capability.criteriaTypes) {
|
||||
"Unsupported search criterion: ${criterion::class.simpleName} for field ${criterion.field}"
|
||||
}
|
||||
|
||||
// Ensure single value per criterion if supportMultiValue is false
|
||||
if (!capability.isMultiple) {
|
||||
when (criterion) {
|
||||
is Include<*> -> require(criterion.values.size <= 1) {
|
||||
"Multiple values are not allowed for field ${criterion.field}"
|
||||
}
|
||||
|
||||
is Exclude<*> -> require(criterion.values.size <= 1) {
|
||||
"Multiple values are not allowed for field ${criterion.field}"
|
||||
}
|
||||
|
||||
is Range<*> -> Unit // Range is always valid (from, to)
|
||||
is Match<*> -> Unit // Match always has a single value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package org.koitharu.kotatsu.parsers.model.search
|
||||
|
||||
/**
|
||||
* Represents a generic search criterion used for filtering manga search results.
|
||||
* Each criterion applies a specific condition to a [SearchableField] and operates on values of type [T].
|
||||
*
|
||||
* @param T The type of value associated with the search criterion.
|
||||
* @property field The field to which this search criterion applies.
|
||||
*/
|
||||
@Deprecated("Too complex")
|
||||
public sealed interface QueryCriteria<T> {
|
||||
|
||||
public val field: SearchableField
|
||||
|
||||
override fun equals(other: Any?): Boolean
|
||||
|
||||
override fun hashCode(): Int
|
||||
|
||||
/**
|
||||
* Represents an inclusion criterion that allows search results based on a set of allowed values.
|
||||
*
|
||||
* @param T The type of value being included in the search.
|
||||
* @property values The set of values that should be included in the search results.
|
||||
*
|
||||
* ### Example Usage:
|
||||
* ```kotlin
|
||||
* val genreFilter = QueryCriteria.Include(SearchableField.STATE, setOf(MangaState.ONGOING, MangaState.FINISHED))
|
||||
* ```
|
||||
*/
|
||||
public data class Include<T : Any>(
|
||||
public override val field: SearchableField,
|
||||
@JvmField public val values: Set<T>,
|
||||
) : QueryCriteria<T> {
|
||||
|
||||
init {
|
||||
check(values.all { x -> field.type.isInstance(x) })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an exclusion criterion that exclude results containing certain values.
|
||||
*
|
||||
* @param T The type of value being excluded from the search.
|
||||
* @property values The set of values that should be excluded from the search results.
|
||||
*
|
||||
* ### Example Usage:
|
||||
* ```kotlin
|
||||
* val excludeTag = QueryCriteria.Exclude(SearchableField.TAG, setOf(MangaTag(key, title, source)))
|
||||
* ```
|
||||
*/
|
||||
public data class Exclude<T : Any>(
|
||||
public override val field: SearchableField,
|
||||
@JvmField public val values: Set<T>,
|
||||
) : QueryCriteria<T> {
|
||||
|
||||
init {
|
||||
check(values.all { x -> field.type.isInstance(x) })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a range criterion that allows search based on a range of values.
|
||||
*
|
||||
* @param T The type of value used in the range (must be comparable).
|
||||
* @property from The starting value of the range (inclusive).
|
||||
* @property to The ending value of the range (inclusive).
|
||||
*
|
||||
* ### Example Usage:
|
||||
* ```kotlin
|
||||
* val yearRange = QueryCriteria.Range(SearchableField.PUBLICATION_YEAR, 2000, 2020)
|
||||
* ```
|
||||
*/
|
||||
public data class Range<T : Comparable<T>>(
|
||||
public override val field: SearchableField,
|
||||
@JvmField public val from: T,
|
||||
@JvmField public val to: T,
|
||||
) : QueryCriteria<T> {
|
||||
|
||||
init {
|
||||
check(field.type.isInstance(from))
|
||||
check(field.type.isInstance(to))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Represents a match criterion that search results based on an exact match of a value.
|
||||
*
|
||||
* @param T The type of value being matched.
|
||||
* @property value The exact value that must be matched.
|
||||
*
|
||||
* ### Example Usage:
|
||||
* ```kotlin
|
||||
* val titleMatch = QueryCriteria.Match(SearchableField.TITLE, "manga title")
|
||||
* ```
|
||||
*/
|
||||
public data class Match<T : Any>(
|
||||
public override val field: SearchableField,
|
||||
@JvmField public val value: T,
|
||||
) : QueryCriteria<T> {
|
||||
|
||||
init {
|
||||
check(field.type.isInstance(value))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.koitharu.kotatsu.parsers.model.search
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
/**
|
||||
* Defines the search capabilities of a given field in the manga search query.
|
||||
*
|
||||
* @property field The searchable field that this capability applies to.
|
||||
* Example values:
|
||||
* - `SearchableField.TITLE_NAME` for searching by title.
|
||||
* - `SearchableField.AUTHOR` for searching by author names.
|
||||
* - `SearchableField.TAG` for filtering by tags.
|
||||
* @property criteriaTypes The set of supported criteria types for the field.
|
||||
* Example values:
|
||||
* - `setOf(Include::class, Exclude::class)` selected field supports inclusion/exclusion criteria.
|
||||
* - `setOf(Range::class)` selected field support numerical range criteria.
|
||||
* @property isMultiValue Indicates whether the field supports multiple values.
|
||||
* - `true` if multiple values can be provided (e.g., multiple tags or authors).
|
||||
* - `false` if only a single value is allowed (e.g., only one tag or author).
|
||||
* @property isExclusive Specifies whether the field can be used alongside other criteria.
|
||||
* - `true` if this field can be used with other search criteria.
|
||||
* - `false` if using this field requires it to be the only criterion in query.
|
||||
*/
|
||||
@Deprecated("Too complex")
|
||||
public data class SearchCapability(
|
||||
/** The searchable field that this capability applies to. */
|
||||
@JvmField public val field: SearchableField,
|
||||
/** The set of supported criteria types for this field. */
|
||||
@JvmField public val criteriaTypes: Set<KClass<out QueryCriteria<*>>>,
|
||||
/** Indicates whether the field supports multiple values. */
|
||||
@JvmField public val isMultiple: Boolean,
|
||||
/** Specifies whether the field can be used alongside other criteria. */
|
||||
@JvmField public val isExclusive: Boolean = false,
|
||||
)
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.koitharu.kotatsu.parsers.model.search
|
||||
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Represents the various fields that can be used for searching manga.
|
||||
* Each field is associated with a specific data type that defines its expected values.
|
||||
*
|
||||
* @property type The Java class representing the expected type of values for this field.
|
||||
*/
|
||||
@Deprecated("Too complex")
|
||||
public enum class SearchableField(public val type: Class<*>) {
|
||||
TITLE_NAME(String::class.java),
|
||||
TAG(MangaTag::class.java),
|
||||
AUTHOR(MangaTag::class.java),
|
||||
LANGUAGE(Locale::class.java),
|
||||
ORIGINAL_LANGUAGE(Locale::class.java),
|
||||
STATE(MangaState::class.java),
|
||||
CONTENT_TYPE(ContentType::class.java),
|
||||
CONTENT_RATING(ContentRating::class.java),
|
||||
DEMOGRAPHIC(Demographic::class.java),
|
||||
PUBLICATION_YEAR(Int::class.javaObjectType);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.koitharu.kotatsu.parsers.network
|
||||
|
||||
import okhttp3.CookieJar
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.Response
|
||||
import org.jsoup.Jsoup
|
||||
import java.net.HttpURLConnection.HTTP_FORBIDDEN
|
||||
import java.net.HttpURLConnection.HTTP_UNAVAILABLE
|
||||
|
||||
public object CloudFlareHelper {
|
||||
|
||||
public const val PROTECTION_NOT_DETECTED: Int = 0
|
||||
public const val PROTECTION_CAPTCHA: Int = 1
|
||||
public const val PROTECTION_BLOCKED: Int = 2
|
||||
|
||||
private const val CF_CLEARANCE = "cf_clearance"
|
||||
|
||||
public fun checkResponseForProtection(response: Response): Int {
|
||||
if (response.code != HTTP_FORBIDDEN && response.code != HTTP_UNAVAILABLE) {
|
||||
return PROTECTION_NOT_DETECTED
|
||||
}
|
||||
val content = try {
|
||||
response.peekBody(Long.MAX_VALUE).use {
|
||||
Jsoup.parse(it.byteStream(), Charsets.UTF_8.name(), response.request.url.toString())
|
||||
}
|
||||
} catch (_: IllegalStateException) {
|
||||
return PROTECTION_NOT_DETECTED
|
||||
}
|
||||
return when {
|
||||
content.selectFirst("h2[data-translate=\"blocked_why_headline\"]") != null -> PROTECTION_BLOCKED
|
||||
content.getElementById("challenge-error-title") != null || content.getElementById("challenge-error-text") != null -> PROTECTION_CAPTCHA
|
||||
|
||||
else -> PROTECTION_NOT_DETECTED
|
||||
}
|
||||
}
|
||||
|
||||
public fun getClearanceCookie(cookieJar: CookieJar, url: String): String? {
|
||||
return cookieJar.loadForRequest(url.toHttpUrl()).find { it.name == CF_CLEARANCE }?.value
|
||||
}
|
||||
|
||||
public fun isCloudFlareCookie(name: String): Boolean {
|
||||
return name.startsWith("cf_")
|
||||
|| name.startsWith("_cf")
|
||||
|| name.startsWith("__cf")
|
||||
|| name == "csrftoken"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package org.koitharu.kotatsu.parsers.network
|
||||
|
||||
import okhttp3.*
|
||||
import okhttp3.MediaType.Companion.toMediaType
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import org.json.JSONObject
|
||||
import org.jsoup.HttpStatusException
|
||||
import org.koitharu.kotatsu.parsers.exception.AuthRequiredException
|
||||
import org.koitharu.kotatsu.parsers.exception.GraphQLException
|
||||
import org.koitharu.kotatsu.parsers.exception.NotFoundException
|
||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||
import org.koitharu.kotatsu.parsers.util.await
|
||||
import org.koitharu.kotatsu.parsers.util.parseJson
|
||||
import java.net.HttpURLConnection
|
||||
|
||||
public class OkHttpWebClient(
|
||||
private val httpClient: OkHttpClient,
|
||||
private val mangaSource: MangaSource,
|
||||
) : WebClient {
|
||||
|
||||
override suspend fun httpGet(url: HttpUrl, extraHeaders: Headers?): Response {
|
||||
val request = Request.Builder()
|
||||
.get()
|
||||
.url(url)
|
||||
.addTags()
|
||||
.addExtraHeaders(extraHeaders)
|
||||
return httpClient.newCall(request.build()).await().ensureSuccess()
|
||||
}
|
||||
|
||||
override suspend fun httpHead(url: HttpUrl): Response {
|
||||
val request = Request.Builder()
|
||||
.head()
|
||||
.url(url)
|
||||
.addTags()
|
||||
return httpClient.newCall(request.build()).await().ensureSuccess()
|
||||
}
|
||||
|
||||
override suspend fun httpPost(url: HttpUrl, form: Map<String, String>, extraHeaders: Headers?): Response {
|
||||
val body = FormBody.Builder()
|
||||
form.forEach { (k, v) ->
|
||||
body.addEncoded(k, v)
|
||||
}
|
||||
val request = Request.Builder()
|
||||
.post(body.build())
|
||||
.url(url)
|
||||
.addTags()
|
||||
.addExtraHeaders(extraHeaders)
|
||||
return httpClient.newCall(request.build()).await().ensureSuccess()
|
||||
}
|
||||
|
||||
override suspend fun httpPost(url: HttpUrl, payload: String, extraHeaders: Headers?): Response {
|
||||
val body = FormBody.Builder()
|
||||
payload.split('&').forEach {
|
||||
val pos = it.indexOf('=')
|
||||
if (pos != -1) {
|
||||
val k = it.substring(0, pos)
|
||||
val v = it.substring(pos + 1)
|
||||
body.addEncoded(k, v)
|
||||
}
|
||||
}
|
||||
val request = Request.Builder()
|
||||
.post(body.build())
|
||||
.url(url)
|
||||
.addTags()
|
||||
.addExtraHeaders(extraHeaders)
|
||||
return httpClient.newCall(request.build()).await().ensureSuccess()
|
||||
}
|
||||
|
||||
override suspend fun httpPost(url: HttpUrl, body: JSONObject, extraHeaders: Headers?): Response {
|
||||
val mediaType = "application/json; charset=utf-8".toMediaType()
|
||||
val requestBody = body.toString().toRequestBody(mediaType)
|
||||
val request = Request.Builder()
|
||||
.post(requestBody)
|
||||
.url(url)
|
||||
.addTags()
|
||||
.addExtraHeaders(extraHeaders)
|
||||
return httpClient.newCall(request.build()).await().ensureSuccess()
|
||||
}
|
||||
|
||||
override suspend fun graphQLQuery(endpoint: String, query: String): JSONObject {
|
||||
val body = JSONObject()
|
||||
body.put("operationName", null as Any?)
|
||||
body.put("variables", JSONObject())
|
||||
body.put("query", "{$query}")
|
||||
|
||||
val mediaType = "application/json; charset=utf-8".toMediaType()
|
||||
val requestBody = body.toString().toRequestBody(mediaType)
|
||||
val request = Request.Builder()
|
||||
.post(requestBody)
|
||||
.url(endpoint)
|
||||
.addTags()
|
||||
val json = httpClient.newCall(request.build()).await().parseJson()
|
||||
json.optJSONArray("errors")?.let {
|
||||
if (it.length() != 0) {
|
||||
throw GraphQLException(it)
|
||||
}
|
||||
}
|
||||
return json
|
||||
}
|
||||
|
||||
private fun Request.Builder.addTags(): Request.Builder {
|
||||
tag(MangaSource::class.java, mangaSource)
|
||||
return this
|
||||
}
|
||||
|
||||
private fun Request.Builder.addExtraHeaders(headers: Headers?): Request.Builder {
|
||||
if (headers != null) {
|
||||
headers(headers)
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
private fun Response.ensureSuccess(): Response {
|
||||
val exception: Exception? = when (code) { // Catch some error codes, not all
|
||||
HttpURLConnection.HTTP_NOT_FOUND -> NotFoundException(message, request.url.toString())
|
||||
HttpURLConnection.HTTP_UNAUTHORIZED -> request.tag(MangaSource::class.java)?.let {
|
||||
AuthRequiredException(it)
|
||||
} ?: HttpStatusException(message, code, request.url.toString())
|
||||
|
||||
in 400..599 -> HttpStatusException(message, code, request.url.toString())
|
||||
else -> null
|
||||
}
|
||||
if (exception != null) {
|
||||
runCatching {
|
||||
close()
|
||||
}.onFailure {
|
||||
exception.addSuppressed(it)
|
||||
}
|
||||
throw exception
|
||||
}
|
||||
return this
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.koitharu.kotatsu.parsers.network
|
||||
|
||||
public object UserAgents {
|
||||
|
||||
public const val CHROME_MOBILE: String =
|
||||
"Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.196 Mobile Safari/537.36"
|
||||
|
||||
public const val FIREFOX_MOBILE: String =
|
||||
"Mozilla/5.0 (Android 14; Mobile; LG-M255; rv:123.0) Gecko/123.0 Firefox/123.0"
|
||||
|
||||
public const val CHROME_DESKTOP: String =
|
||||
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
|
||||
|
||||
public const val FIREFOX_DESKTOP: String = "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0"
|
||||
|
||||
public const val KOTATSU: String = "Kotatsu/6.8 (Android 13;;; en)"
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package org.koitharu.kotatsu.parsers.network
|
||||
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.Response
|
||||
import org.json.JSONObject
|
||||
|
||||
public interface WebClient {
|
||||
|
||||
/**
|
||||
* Do a GET http request to specific url
|
||||
* @param url
|
||||
*/
|
||||
public suspend fun httpGet(url: String): Response = httpGet(url.toHttpUrl())
|
||||
|
||||
public suspend fun httpGet(url: String, extraHeaders: Headers?): Response = httpGet(url.toHttpUrl(), extraHeaders)
|
||||
|
||||
/**
|
||||
* Do a GET http request to specific url
|
||||
* @param url
|
||||
*/
|
||||
public suspend fun httpGet(url: HttpUrl): Response = httpGet(url, null)
|
||||
|
||||
/**
|
||||
* Do a GET http request to specific url
|
||||
* @param url
|
||||
* @param extraHeaders additional HTTP headers for request
|
||||
*/
|
||||
public suspend fun httpGet(url: HttpUrl, extraHeaders: Headers?): Response
|
||||
|
||||
/**
|
||||
* Do a HEAD http request to specific url
|
||||
* @param url
|
||||
*/
|
||||
public suspend fun httpHead(url: String): Response = httpHead(url.toHttpUrl())
|
||||
|
||||
/**
|
||||
* Do a HEAD http request to specific url
|
||||
* @param url
|
||||
*/
|
||||
public suspend fun httpHead(url: HttpUrl): Response
|
||||
|
||||
/**
|
||||
* Do a POST http request to specific url with `multipart/form-data` payload
|
||||
* @param url
|
||||
* @param form payload as key=>value map
|
||||
*/
|
||||
public suspend fun httpPost(url: String, form: Map<String, String>): Response =
|
||||
httpPost(url.toHttpUrl(), form, null)
|
||||
|
||||
/**
|
||||
* Do a POST http request to specific url with `multipart/form-data` payload
|
||||
* @param url
|
||||
* @param form payload as key=>value map
|
||||
*/
|
||||
public suspend fun httpPost(url: HttpUrl, form: Map<String, String>): Response = httpPost(url, form, null)
|
||||
|
||||
/**
|
||||
* Do a POST http request to specific url with `multipart/form-data` payload
|
||||
* @param url
|
||||
* @param form payload as key=>value map
|
||||
* @param extraHeaders additional HTTP headers for request
|
||||
*/
|
||||
public suspend fun httpPost(url: HttpUrl, form: Map<String, String>, extraHeaders: Headers?): Response
|
||||
|
||||
/**
|
||||
* Do a POST http request to specific url with `multipart/form-data` payload
|
||||
* @param url
|
||||
* @param payload payload as `key=value` string with `&` separator
|
||||
*/
|
||||
public suspend fun httpPost(url: String, payload: String): Response = httpPost(url.toHttpUrl(), payload, null)
|
||||
|
||||
/**
|
||||
* Do a POST http request to specific url with `multipart/form-data` payload
|
||||
* @param url
|
||||
* @param payload payload as `key=value` string with `&` separator
|
||||
*/
|
||||
public suspend fun httpPost(url: HttpUrl, payload: String): Response = httpPost(url, payload, null)
|
||||
|
||||
/**
|
||||
* Do a POST http request to specific url with `multipart/form-data` payload
|
||||
* @param url
|
||||
* @param payload payload as `key=value` string with `&` separator
|
||||
* @param extraHeaders additional HTTP headers for request
|
||||
*/
|
||||
public suspend fun httpPost(url: HttpUrl, payload: String, extraHeaders: Headers?): Response
|
||||
|
||||
/**
|
||||
* Do a POST http request to specific url with json payload
|
||||
* @param url
|
||||
* @param body
|
||||
*/
|
||||
public suspend fun httpPost(url: String, body: JSONObject): Response = httpPost(url.toHttpUrl(), body, null)
|
||||
|
||||
/**
|
||||
* Do a POST http request to specific url with json payload
|
||||
* @param url
|
||||
* @param body
|
||||
*/
|
||||
public suspend fun httpPost(url: HttpUrl, body: JSONObject): Response = httpPost(url, body, null)
|
||||
|
||||
/**
|
||||
* Do a POST http request to specific url with json payload
|
||||
* @param url
|
||||
* @param body
|
||||
* @param extraHeaders additional HTTP headers for request
|
||||
*/
|
||||
public suspend fun httpPost(url: HttpUrl, body: JSONObject, extraHeaders: Headers?): Response
|
||||
|
||||
/**
|
||||
* Do a GraphQL request to specific url
|
||||
* @param endpoint an url
|
||||
* @param query GraphQL request payload
|
||||
*/
|
||||
public suspend fun graphQLQuery(endpoint: String, query: String): JSONObject
|
||||
}
|
||||
@@ -1,311 +0,0 @@
|
||||
package org.koitharu.kotatsu.parsers.site
|
||||
|
||||
import androidx.collection.ArraySet
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import org.jsoup.nodes.Element
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.security.MessageDigest
|
||||
import java.util.*
|
||||
import javax.crypto.Cipher
|
||||
import javax.crypto.spec.IvParameterSpec
|
||||
import javax.crypto.spec.SecretKeySpec
|
||||
|
||||
private const val PAGE_SIZE = 60
|
||||
private const val PAGE_SIZE_SEARCH = 20
|
||||
|
||||
@MangaSourceParser("BATOTO", "Bato.To")
|
||||
internal class BatoToParser(override val context: MangaLoaderContext) : MangaParser(MangaSource.BATOTO) {
|
||||
|
||||
override val sortOrders: Set<SortOrder> = EnumSet.of(
|
||||
SortOrder.NEWEST,
|
||||
SortOrder.UPDATED,
|
||||
SortOrder.POPULARITY,
|
||||
SortOrder.ALPHABETICAL,
|
||||
)
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain(
|
||||
"bato.to",
|
||||
arrayOf("bato.to", "mto.to", "mangatoto.com", "battwo.com", "batotwo.com", "comiko.net", "batotoo.com"),
|
||||
)
|
||||
|
||||
override suspend fun getList(
|
||||
offset: Int,
|
||||
query: String?,
|
||||
tags: Set<MangaTag>?,
|
||||
sortOrder: SortOrder,
|
||||
): List<Manga> {
|
||||
if (!query.isNullOrEmpty()) {
|
||||
return search(offset, query)
|
||||
}
|
||||
val page = (offset / PAGE_SIZE) + 1
|
||||
|
||||
@Suppress("NON_EXHAUSTIVE_WHEN_STATEMENT")
|
||||
val url = buildString {
|
||||
append("https://")
|
||||
append(getDomain())
|
||||
append("/browse?sort=")
|
||||
when (sortOrder) {
|
||||
SortOrder.UPDATED,
|
||||
-> append("update.za")
|
||||
|
||||
SortOrder.POPULARITY -> append("views_a.za")
|
||||
SortOrder.NEWEST -> append("create.za")
|
||||
SortOrder.ALPHABETICAL -> append("title.az")
|
||||
}
|
||||
if (!tags.isNullOrEmpty()) {
|
||||
append("&genres=")
|
||||
appendAll(tags, ",") { it.key }
|
||||
}
|
||||
append("&page=")
|
||||
append(page)
|
||||
}
|
||||
return parseList(url, page)
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val root = context.httpGet(manga.url.toAbsoluteUrl(getDomain())).parseHtml()
|
||||
.getElementById("mainer") ?: parseFailed("Cannot find root")
|
||||
val details = root.selectFirst(".detail-set") ?: parseFailed("Cannot find detail-set")
|
||||
val attrs = details.selectFirst(".attr-main")?.select(".attr-item")?.associate {
|
||||
it.child(0).text().trim() to it.child(1)
|
||||
}.orEmpty()
|
||||
return manga.copy(
|
||||
title = root.selectFirst("h3.item-title")?.text() ?: manga.title,
|
||||
isNsfw = !root.selectFirst("alert")?.getElementsContainingOwnText("NSFW").isNullOrEmpty(),
|
||||
largeCoverUrl = details.selectFirst("img[src]")?.absUrl("src"),
|
||||
description = details.getElementById("limit-height-body-summary")
|
||||
?.selectFirst(".limit-html")
|
||||
?.html(),
|
||||
tags = manga.tags + attrs["Genres:"]?.parseTags().orEmpty(),
|
||||
state = when (attrs["Release status:"]?.text()) {
|
||||
"Ongoing" -> MangaState.ONGOING
|
||||
"Completed" -> MangaState.FINISHED
|
||||
else -> manga.state
|
||||
},
|
||||
author = attrs["Authors:"]?.text()?.trim() ?: manga.author,
|
||||
chapters = root.selectFirst(".episode-list")
|
||||
?.selectFirst(".main")
|
||||
?.children()
|
||||
?.reversed()
|
||||
?.mapChapters { i, div ->
|
||||
div.parseChapter(i)
|
||||
}.orEmpty(),
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val fullUrl = chapter.url.toAbsoluteUrl(getDomain())
|
||||
val scripts = context.httpGet(fullUrl).parseHtml().select("script")
|
||||
for (script in scripts) {
|
||||
val scriptSrc = script.html()
|
||||
val p = scriptSrc.indexOf("const images =")
|
||||
if (p == -1) continue
|
||||
val start = scriptSrc.indexOf('[', p)
|
||||
val end = scriptSrc.indexOf(';', start)
|
||||
if (start == -1 || end == -1) {
|
||||
continue
|
||||
}
|
||||
val images = JSONArray(scriptSrc.substring(start, end))
|
||||
val batoJs = scriptSrc.substringBetweenFirst("batojs =", ";")?.trim(' ', '"', '\n')
|
||||
?: parseFailed("Cannot find batojs")
|
||||
val server = scriptSrc.substringBetweenFirst("server =", ";")?.trim(' ', '"', '\n')
|
||||
?: parseFailed("Cannot find server")
|
||||
val password = context.evaluateJs(batoJs)?.removeSurrounding('"')
|
||||
?: parseFailed("Cannot evaluate batojs")
|
||||
val serverDecrypted = decryptAES(server, password).removeSurrounding('"')
|
||||
val result = ArrayList<MangaPage>(images.length())
|
||||
repeat(images.length()) { i ->
|
||||
val url = images.getString(i)
|
||||
result += MangaPage(
|
||||
id = generateUid(url),
|
||||
url = if (url.startsWith("http")) url else "$serverDecrypted$url",
|
||||
referer = fullUrl,
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
return result
|
||||
}
|
||||
parseFailed("Cannot find images list")
|
||||
}
|
||||
|
||||
override suspend fun getTags(): Set<MangaTag> {
|
||||
val scripts = context.httpGet(
|
||||
"https://${getDomain()}/browse",
|
||||
).parseHtml().select("script")
|
||||
for (script in scripts) {
|
||||
val genres = script.html().substringBetweenFirst("const _genres =", ";") ?: continue
|
||||
val jo = JSONObject(genres)
|
||||
val result = ArraySet<MangaTag>(jo.length())
|
||||
jo.keys().forEach { key ->
|
||||
val item = jo.getJSONObject(key)
|
||||
result += MangaTag(
|
||||
title = item.getString("text").toTitleCase(),
|
||||
key = item.getString("file"),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
return result
|
||||
}
|
||||
parseFailed("Cannot find gernes list")
|
||||
}
|
||||
|
||||
override fun getFaviconUrl(): String = "https://styles.amarkcdn.com/img/batoto/favicon.ico?v0"
|
||||
|
||||
private suspend fun search(offset: Int, query: String): List<Manga> {
|
||||
val page = (offset / PAGE_SIZE_SEARCH) + 1
|
||||
val url = buildString {
|
||||
append("https://")
|
||||
append(getDomain())
|
||||
append("/search?word=")
|
||||
append(query.replace(' ', '+'))
|
||||
append("&page=")
|
||||
append(page)
|
||||
}
|
||||
return parseList(url, page)
|
||||
}
|
||||
|
||||
private fun getActivePage(body: Element): Int = body.select("nav ul.pagination > li.page-item.active")
|
||||
.lastOrNull()
|
||||
?.text()
|
||||
?.toIntOrNull() ?: parseFailed("Cannot determine current page")
|
||||
|
||||
private suspend fun parseList(url: String, page: Int): List<Manga> {
|
||||
val body = context.httpGet(url).parseHtml().body()
|
||||
if (body.selectFirst(".browse-no-matches") != null) {
|
||||
return emptyList()
|
||||
}
|
||||
val activePage = getActivePage(body)
|
||||
if (activePage != page) {
|
||||
return emptyList()
|
||||
}
|
||||
val root = body.getElementById("series-list") ?: parseFailed("Cannot find root")
|
||||
return root.children().map { div ->
|
||||
val a = div.selectFirst("a") ?: parseFailed()
|
||||
val href = a.attrAsRelativeUrl("href")
|
||||
val title = div.selectFirst(".item-title")?.text() ?: parseFailed("Title not found")
|
||||
Manga(
|
||||
id = generateUid(href),
|
||||
title = title,
|
||||
altTitle = div.selectFirst(".item-alias")?.text()?.takeUnless { it == title },
|
||||
url = href,
|
||||
publicUrl = a.absUrl("href"),
|
||||
rating = RATING_UNKNOWN,
|
||||
isNsfw = false,
|
||||
coverUrl = div.selectFirst("img[src]")?.absUrl("src").orEmpty(),
|
||||
largeCoverUrl = null,
|
||||
description = null,
|
||||
tags = div.selectFirst(".item-genre")?.parseTags().orEmpty(),
|
||||
state = null,
|
||||
author = null,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun Element.parseTags() = children().mapToSet { span ->
|
||||
val text = span.ownText()
|
||||
MangaTag(
|
||||
title = text.toTitleCase(),
|
||||
key = text.lowercase(Locale.ENGLISH).replace(' ', '_'),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
|
||||
private fun Element.parseChapter(index: Int): MangaChapter? {
|
||||
val a = selectFirst("a.chapt") ?: return null
|
||||
val extra = selectFirst(".extra")
|
||||
val href = a.attrAsRelativeUrl("href")
|
||||
return MangaChapter(
|
||||
id = generateUid(href),
|
||||
name = a.text(),
|
||||
number = index + 1,
|
||||
url = href,
|
||||
scanlator = extra?.getElementsByAttributeValueContaining("href", "/group/")?.text(),
|
||||
uploadDate = runCatching {
|
||||
parseChapterDate(extra?.select("i")?.lastOrNull()?.ownText())
|
||||
}.getOrDefault(0),
|
||||
branch = null,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
|
||||
private fun parseChapterDate(date: String?): Long {
|
||||
if (date.isNullOrEmpty()) {
|
||||
return 0
|
||||
}
|
||||
val value = date.substringBefore(' ').toInt()
|
||||
val field = when {
|
||||
"sec" in date -> Calendar.SECOND
|
||||
"min" in date -> Calendar.MINUTE
|
||||
"hour" in date -> Calendar.HOUR
|
||||
"day" in date -> Calendar.DAY_OF_MONTH
|
||||
"week" in date -> Calendar.WEEK_OF_YEAR
|
||||
"month" in date -> Calendar.MONTH
|
||||
"year" in date -> Calendar.YEAR
|
||||
else -> return 0
|
||||
}
|
||||
val calendar = Calendar.getInstance()
|
||||
calendar.add(field, -value)
|
||||
return calendar.timeInMillis
|
||||
}
|
||||
|
||||
private fun decryptAES(encrypted: String, password: String): String {
|
||||
val cipherData = context.decodeBase64(encrypted)
|
||||
val saltData = cipherData.copyOfRange(8, 16)
|
||||
val (key, iv) = generateKeyAndIV(
|
||||
keyLength = 32,
|
||||
ivLength = 16,
|
||||
iterations = 1,
|
||||
salt = saltData,
|
||||
password = password.toByteArray(StandardCharsets.UTF_8),
|
||||
md = MessageDigest.getInstance("MD5"),
|
||||
)
|
||||
val encryptedData = cipherData.copyOfRange(16, cipherData.size)
|
||||
val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding")
|
||||
cipher.init(Cipher.DECRYPT_MODE, key, iv)
|
||||
return cipher.doFinal(encryptedData).toString(Charsets.UTF_8)
|
||||
}
|
||||
|
||||
@Suppress("SameParameterValue")
|
||||
private fun generateKeyAndIV(
|
||||
keyLength: Int,
|
||||
ivLength: Int,
|
||||
iterations: Int,
|
||||
salt: ByteArray,
|
||||
password: ByteArray,
|
||||
md: MessageDigest,
|
||||
): Pair<SecretKeySpec, IvParameterSpec> {
|
||||
val digestLength = md.digestLength
|
||||
val requiredLength = (keyLength + ivLength + digestLength - 1) / digestLength * digestLength
|
||||
val generatedData = ByteArray(requiredLength)
|
||||
var generatedLength = 0
|
||||
md.reset()
|
||||
while (generatedLength < keyLength + ivLength) {
|
||||
if (generatedLength > 0) {
|
||||
md.update(generatedData, generatedLength - digestLength, digestLength)
|
||||
}
|
||||
md.update(password)
|
||||
md.update(salt, 0, 8)
|
||||
md.digest(generatedData, generatedLength, digestLength)
|
||||
repeat(iterations - 1) {
|
||||
md.update(generatedData, generatedLength, digestLength)
|
||||
md.digest(generatedData, generatedLength, digestLength)
|
||||
}
|
||||
generatedLength += digestLength
|
||||
}
|
||||
|
||||
return SecretKeySpec(generatedData.copyOfRange(0, keyLength), "AES") to IvParameterSpec(
|
||||
if (ivLength > 0) {
|
||||
generatedData.copyOfRange(keyLength, keyLength + ivLength)
|
||||
} else byteArrayOf(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
package org.koitharu.kotatsu.parsers.site
|
||||
|
||||
import androidx.collection.ArraySet
|
||||
import androidx.collection.SparseArrayCompat
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import org.koitharu.kotatsu.parsers.util.json.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* https://api.comick.fun/docs/static/index.html
|
||||
*/
|
||||
|
||||
private const val PAGE_SIZE = 20
|
||||
private const val CHAPTERS_LIMIT = 99999
|
||||
|
||||
@MangaSourceParser("COMICK_FUN", "ComicK")
|
||||
internal class ComickFunParser(override val context: MangaLoaderContext) : MangaParser(MangaSource.COMICK_FUN) {
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain("comick.fun", null)
|
||||
|
||||
override val sortOrders: Set<SortOrder> = EnumSet.of(
|
||||
SortOrder.POPULARITY,
|
||||
SortOrder.UPDATED,
|
||||
SortOrder.RATING,
|
||||
)
|
||||
|
||||
@Volatile
|
||||
private var cachedTags: SparseArrayCompat<MangaTag>? = null
|
||||
|
||||
override suspend fun getList(
|
||||
offset: Int,
|
||||
query: String?,
|
||||
tags: Set<MangaTag>?,
|
||||
sortOrder: SortOrder,
|
||||
): List<Manga> {
|
||||
val domain = getDomain()
|
||||
val url = buildString {
|
||||
append("https://api.")
|
||||
append(domain)
|
||||
append("/search?tachiyomi=true")
|
||||
if (!query.isNullOrEmpty()) {
|
||||
if (offset > 0) {
|
||||
return emptyList()
|
||||
}
|
||||
append("&q=")
|
||||
append(query.urlEncoded())
|
||||
} else {
|
||||
append("&limit=")
|
||||
append(PAGE_SIZE)
|
||||
append("&page=")
|
||||
append((offset / PAGE_SIZE) + 1)
|
||||
if (!tags.isNullOrEmpty()) {
|
||||
append("&genres=")
|
||||
appendAll(tags, "&genres=", MangaTag::key)
|
||||
}
|
||||
append("&sort=") // view, uploaded, rating, follow, user_follow_count
|
||||
append(
|
||||
when (sortOrder) {
|
||||
SortOrder.POPULARITY -> "view"
|
||||
SortOrder.RATING -> "rating"
|
||||
else -> "uploaded"
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
val ja = context.httpGet(url).parseJsonArray()
|
||||
val tagsMap = cachedTags ?: loadTags()
|
||||
return ja.mapJSON { jo ->
|
||||
val slug = jo.getString("slug")
|
||||
Manga(
|
||||
id = generateUid(slug),
|
||||
title = jo.getString("title"),
|
||||
altTitle = null,
|
||||
url = slug,
|
||||
publicUrl = "https://$domain/comic/$slug",
|
||||
rating = jo.getDoubleOrDefault("rating", -10.0).toFloat() / 10f,
|
||||
isNsfw = false,
|
||||
coverUrl = jo.getString("cover_url"),
|
||||
largeCoverUrl = null,
|
||||
description = jo.getStringOrNull("desc"),
|
||||
tags = jo.selectGenres("genres", tagsMap),
|
||||
state = runCatching {
|
||||
if (jo.getBoolean("translation_completed")) {
|
||||
MangaState.FINISHED
|
||||
} else {
|
||||
MangaState.ONGOING
|
||||
}
|
||||
}.getOrNull(),
|
||||
author = null,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val domain = getDomain()
|
||||
val url = "https://api.$domain/comic/${manga.url}?tachiyomi=true"
|
||||
val jo = context.httpGet(url).parseJson()
|
||||
val comic = jo.getJSONObject("comic")
|
||||
return manga.copy(
|
||||
title = comic.getString("title"),
|
||||
altTitle = null, // TODO
|
||||
isNsfw = jo.getBoolean("matureContent") || comic.getBoolean("hentai"),
|
||||
description = comic.getStringOrNull("parsed") ?: comic.getString("desc"),
|
||||
tags = manga.tags + jo.getJSONArray("genres").mapJSONToSet {
|
||||
MangaTag(
|
||||
title = it.getString("name"),
|
||||
key = it.getString("slug"),
|
||||
source = source,
|
||||
)
|
||||
},
|
||||
author = jo.getJSONArray("artists").optJSONObject(0)?.getString("name"),
|
||||
chapters = getChapters(comic.getLong("id")),
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val jo = context.httpGet(
|
||||
"https://api.${getDomain()}/chapter/${chapter.url}?tachiyomi=true",
|
||||
).parseJson().getJSONObject("chapter")
|
||||
val referer = "https://${getDomain()}/"
|
||||
return jo.getJSONArray("images").mapJSON {
|
||||
val url = it.getString("url")
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
referer = referer,
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getTags(): Set<MangaTag> {
|
||||
val sparseArray = cachedTags ?: loadTags()
|
||||
val set = ArraySet<MangaTag>(sparseArray.size())
|
||||
for (i in 0 until sparseArray.size()) {
|
||||
set.add(sparseArray.valueAt(i))
|
||||
}
|
||||
return set
|
||||
}
|
||||
|
||||
private suspend fun loadTags(): SparseArrayCompat<MangaTag> {
|
||||
val ja = context.httpGet("https://api.${getDomain()}/genre").parseJsonArray()
|
||||
val tags = SparseArrayCompat<MangaTag>(ja.length())
|
||||
for (jo in ja.JSONIterator()) {
|
||||
tags.append(
|
||||
jo.getInt("id"),
|
||||
MangaTag(
|
||||
title = jo.getString("name"),
|
||||
key = jo.getString("slug"),
|
||||
source = source,
|
||||
),
|
||||
)
|
||||
}
|
||||
cachedTags = tags
|
||||
return tags
|
||||
}
|
||||
|
||||
private suspend fun getChapters(id: Long): List<MangaChapter> {
|
||||
val ja = context.httpGet(
|
||||
url = "https://api.${getDomain()}/comic/$id/chapter?tachiyomi=true&limit=$CHAPTERS_LIMIT",
|
||||
).parseJson().getJSONArray("chapters")
|
||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd")
|
||||
val counters = HashMap<Locale, Int>()
|
||||
return ja.mapReversed { jo ->
|
||||
val locale = Locale.forLanguageTag(jo.getString("lang"))
|
||||
var number = counters[locale] ?: 0
|
||||
number++
|
||||
counters[locale] = number
|
||||
MangaChapter(
|
||||
id = generateUid(jo.getLong("id")),
|
||||
name = buildString {
|
||||
jo.getStringOrNull("vol")?.let { append("Vol ").append(it).append(' ') }
|
||||
jo.getStringOrNull("chap")?.let { append("Chap ").append(it) }
|
||||
jo.getStringOrNull("title")?.let { append(": ").append(it) }
|
||||
},
|
||||
number = number,
|
||||
url = jo.getString("hid"),
|
||||
scanlator = jo.optJSONArray("group_name")?.optString(0),
|
||||
uploadDate = dateFormat.tryParse(jo.getString("created_at").substringBefore('T')),
|
||||
branch = locale.getDisplayName(locale).toTitleCase(locale),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun <R> JSONArray.mapReversed(block: (JSONObject) -> R): List<R> {
|
||||
val len = length()
|
||||
val destination = ArrayList<R>(len)
|
||||
for (i in (0 until len).reversed()) {
|
||||
val jo = getJSONObject(i)
|
||||
destination.add(block(jo))
|
||||
}
|
||||
return destination
|
||||
}
|
||||
|
||||
private fun JSONObject.selectGenres(name: String, tags: SparseArrayCompat<MangaTag>): Set<MangaTag> {
|
||||
val array = optJSONArray(name) ?: return emptySet()
|
||||
val res = ArraySet<MangaTag>(array.length())
|
||||
for (i in 0 until array.length()) {
|
||||
val id = array.getInt(i)
|
||||
val tag = tags.get(id) ?: continue
|
||||
res.add(tag)
|
||||
}
|
||||
return res
|
||||
}
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
package org.koitharu.kotatsu.parsers.site
|
||||
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.exception.ParseException
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import org.koitharu.kotatsu.parsers.util.json.mapJSON
|
||||
import org.koitharu.kotatsu.parsers.util.json.mapJSONIndexed
|
||||
import org.koitharu.kotatsu.parsers.util.json.mapJSONToSet
|
||||
import java.util.*
|
||||
|
||||
@MangaSourceParser("DESUME", "Desu.me", "ru")
|
||||
internal class DesuMeParser(override val context: MangaLoaderContext) : MangaParser(MangaSource.DESUME) {
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain("desu.me", null)
|
||||
|
||||
override val sortOrders: Set<SortOrder> = EnumSet.of(
|
||||
SortOrder.UPDATED,
|
||||
SortOrder.POPULARITY,
|
||||
SortOrder.NEWEST,
|
||||
SortOrder.ALPHABETICAL,
|
||||
)
|
||||
|
||||
override suspend fun getList(
|
||||
offset: Int,
|
||||
query: String?,
|
||||
tags: Set<MangaTag>?,
|
||||
sortOrder: SortOrder,
|
||||
): List<Manga> {
|
||||
if (query != null && offset != 0) {
|
||||
return emptyList()
|
||||
}
|
||||
val domain = getDomain()
|
||||
val url = buildString {
|
||||
append("https://")
|
||||
append(domain)
|
||||
append("/manga/api/?limit=20&order=")
|
||||
append(getSortKey(sortOrder))
|
||||
append("&page=")
|
||||
append((offset / 20) + 1)
|
||||
if (!tags.isNullOrEmpty()) {
|
||||
append("&genres=")
|
||||
appendAll(tags, ",") { it.key }
|
||||
}
|
||||
if (query != null) {
|
||||
append("&search=")
|
||||
append(query)
|
||||
}
|
||||
}
|
||||
val json = context.httpGet(url).parseJson().getJSONArray("response") ?: parseFailed("Invalid response")
|
||||
val total = json.length()
|
||||
val list = ArrayList<Manga>(total)
|
||||
for (i in 0 until total) {
|
||||
val jo = json.getJSONObject(i)
|
||||
val cover = jo.getJSONObject("image")
|
||||
val id = jo.getLong("id")
|
||||
list += Manga(
|
||||
url = "/manga/api/$id",
|
||||
publicUrl = jo.getString("url"),
|
||||
source = MangaSource.DESUME,
|
||||
title = jo.getString("russian"),
|
||||
altTitle = jo.getString("name"),
|
||||
coverUrl = cover.getString("preview"),
|
||||
largeCoverUrl = cover.getString("original"),
|
||||
state = when {
|
||||
jo.getInt("ongoing") == 1 -> MangaState.ONGOING
|
||||
else -> null
|
||||
},
|
||||
rating = jo.getDouble("score").toFloat().coerceIn(0f, 1f),
|
||||
id = generateUid(id),
|
||||
isNsfw = false,
|
||||
tags = emptySet(),
|
||||
author = null,
|
||||
description = jo.getString("description"),
|
||||
)
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val url = manga.url.toAbsoluteUrl(getDomain())
|
||||
val json = context.httpGet(url).parseJson().getJSONObject("response")
|
||||
?: throw ParseException("Invalid response")
|
||||
val baseChapterUrl = manga.url + "/chapter/"
|
||||
val chaptersList = json.getJSONObject("chapters").getJSONArray("list")
|
||||
val totalChapters = chaptersList.length()
|
||||
return manga.copy(
|
||||
tags = json.getJSONArray("genres").mapJSONToSet {
|
||||
MangaTag(
|
||||
key = it.getString("text"),
|
||||
title = it.getString("russian").toTitleCase(),
|
||||
source = manga.source,
|
||||
)
|
||||
},
|
||||
publicUrl = json.getString("url"),
|
||||
description = json.getString("description"),
|
||||
chapters = chaptersList.mapJSONIndexed { i, it ->
|
||||
val chid = it.getLong("id")
|
||||
val volChap = "Том " + it.optString("vol", "0") + ". " + "Глава " + it.optString("ch", "0")
|
||||
val title = it.optString("title", "null").takeUnless { it == "null" }
|
||||
MangaChapter(
|
||||
id = generateUid(chid),
|
||||
source = manga.source,
|
||||
url = "$baseChapterUrl$chid",
|
||||
uploadDate = it.getLong("date") * 1000,
|
||||
name = if (title.isNullOrEmpty()) volChap else "$volChap: $title",
|
||||
number = totalChapters - i,
|
||||
scanlator = null,
|
||||
branch = null,
|
||||
)
|
||||
}.reversed(),
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val fullUrl = chapter.url.toAbsoluteUrl(getDomain())
|
||||
val json = context.httpGet(fullUrl)
|
||||
.parseJson()
|
||||
.getJSONObject("response") ?: throw ParseException("Invalid response")
|
||||
return json.getJSONObject("pages").getJSONArray("list").mapJSON { jo ->
|
||||
MangaPage(
|
||||
id = generateUid(jo.getLong("id")),
|
||||
referer = fullUrl,
|
||||
preview = null,
|
||||
source = chapter.source,
|
||||
url = jo.getString("img"),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getTags(): Set<MangaTag> {
|
||||
val doc = context.httpGet("https://${getDomain()}/manga/").parseHtml()
|
||||
val root = doc.body().getElementById("animeFilter")
|
||||
?.selectFirst(".catalog-genres") ?: throw ParseException("Root not found")
|
||||
return root.select("li").mapToSet {
|
||||
val input = it.selectFirst("input") ?: parseFailed()
|
||||
MangaTag(
|
||||
source = source,
|
||||
key = input.attr("data-genre-slug").ifEmpty {
|
||||
parseFailed("data-genre-slug is empty")
|
||||
},
|
||||
title = input.attr("data-genre-name").toTitleCase().ifEmpty {
|
||||
parseFailed("data-genre-name is empty")
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSortKey(sortOrder: SortOrder) =
|
||||
when (sortOrder) {
|
||||
SortOrder.ALPHABETICAL -> "name"
|
||||
SortOrder.POPULARITY -> "popular"
|
||||
SortOrder.UPDATED -> "updated"
|
||||
SortOrder.NEWEST -> "id"
|
||||
else -> "updated"
|
||||
}
|
||||
}
|
||||
@@ -1,283 +0,0 @@
|
||||
package org.koitharu.kotatsu.parsers.site
|
||||
|
||||
import org.jsoup.nodes.Element
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.MangaParserAuthProvider
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.exception.AuthRequiredException
|
||||
import org.koitharu.kotatsu.parsers.exception.ParseException
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.util.*
|
||||
import kotlin.math.pow
|
||||
|
||||
private const val DOMAIN_UNAUTHORIZED = "e-hentai.org"
|
||||
private const val DOMAIN_AUTHORIZED = "exhentai.org"
|
||||
|
||||
@MangaSourceParser("EXHENTAI", "ExHentai")
|
||||
internal class ExHentaiParser(
|
||||
override val context: MangaLoaderContext,
|
||||
) : MangaParser(MangaSource.EXHENTAI), MangaParserAuthProvider {
|
||||
|
||||
override val sortOrders: Set<SortOrder> = Collections.singleton(
|
||||
SortOrder.NEWEST,
|
||||
)
|
||||
|
||||
override val configKeyDomain: ConfigKey.Domain
|
||||
get() = ConfigKey.Domain(if (isAuthorized) DOMAIN_AUTHORIZED else DOMAIN_UNAUTHORIZED, null)
|
||||
|
||||
override val authUrl: String
|
||||
get() = "https://${getDomain()}/bounce_login.php"
|
||||
|
||||
private val ratingPattern = Regex("-?[0-9]+px")
|
||||
private val authCookies = arrayOf("ipb_member_id", "ipb_pass_hash")
|
||||
private var updateDm = false
|
||||
|
||||
override val isAuthorized: Boolean
|
||||
get() {
|
||||
val authorized = isAuthorized(DOMAIN_UNAUTHORIZED)
|
||||
if (authorized) {
|
||||
if (!isAuthorized(DOMAIN_AUTHORIZED)) {
|
||||
context.cookieJar.copyCookies(
|
||||
DOMAIN_UNAUTHORIZED,
|
||||
DOMAIN_AUTHORIZED,
|
||||
authCookies,
|
||||
)
|
||||
context.cookieJar.insertCookies(DOMAIN_AUTHORIZED, "yay=louder")
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
init {
|
||||
context.cookieJar.insertCookies(DOMAIN_AUTHORIZED, "nw=1", "sl=dm_2")
|
||||
context.cookieJar.insertCookies(DOMAIN_UNAUTHORIZED, "nw=1", "sl=dm_2")
|
||||
}
|
||||
|
||||
override suspend fun getList(
|
||||
offset: Int,
|
||||
query: String?,
|
||||
tags: Set<MangaTag>?,
|
||||
sortOrder: SortOrder,
|
||||
): List<Manga> {
|
||||
val page = (offset / 25f).toIntUp()
|
||||
var search = query?.urlEncoded().orEmpty()
|
||||
val url = buildString {
|
||||
append("https://")
|
||||
append(getDomain())
|
||||
append("/?page=")
|
||||
append(page)
|
||||
if (!tags.isNullOrEmpty()) {
|
||||
var fCats = 0
|
||||
for (tag in tags) {
|
||||
tag.key.toIntOrNull()?.let { fCats = fCats or it } ?: run {
|
||||
search += tag.key + " "
|
||||
}
|
||||
}
|
||||
if (fCats != 0) {
|
||||
append("&f_cats=")
|
||||
append(1023 - fCats)
|
||||
}
|
||||
}
|
||||
if (search.isNotEmpty()) {
|
||||
append("&f_search=")
|
||||
append(search.trim().replace(' ', '+'))
|
||||
}
|
||||
// by unknown reason cookie "sl=dm_2" is ignored, so, we should request it again
|
||||
if (updateDm) {
|
||||
append("&inline_set=dm_e")
|
||||
}
|
||||
}
|
||||
val body = context.httpGet(url).parseHtml().body()
|
||||
val root = body.selectFirst("table.itg")
|
||||
?.selectFirst("tbody")
|
||||
?: if (updateDm) {
|
||||
parseFailed("Cannot find root")
|
||||
} else {
|
||||
updateDm = true
|
||||
return getList(offset, query, tags, sortOrder)
|
||||
}
|
||||
updateDm = false
|
||||
return root.children().mapNotNull { tr ->
|
||||
if (tr.childrenSize() != 2) return@mapNotNull null
|
||||
val (td1, td2) = tr.children()
|
||||
val glink = td2.selectFirst("div.glink") ?: parseFailed("glink not found")
|
||||
val a = glink.parents().select("a").first() ?: parseFailed("link not found")
|
||||
val href = a.attrAsRelativeUrl("href")
|
||||
val tagsDiv = glink.nextElementSibling() ?: parseFailed("tags div not found")
|
||||
val mainTag = td2.selectFirst("div.cn")?.let { div ->
|
||||
MangaTag(
|
||||
title = div.text().toTitleCase(),
|
||||
key = tagIdByClass(div.classNames()) ?: return@let null,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
Manga(
|
||||
id = generateUid(href),
|
||||
title = glink.text().cleanupTitle(),
|
||||
altTitle = null,
|
||||
url = href,
|
||||
publicUrl = a.absUrl("href"),
|
||||
rating = td2.selectFirst("div.ir")?.parseRating() ?: RATING_UNKNOWN,
|
||||
isNsfw = true,
|
||||
coverUrl = td1.selectFirst("img")?.absUrl("src").orEmpty(),
|
||||
tags = setOfNotNull(mainTag),
|
||||
state = null,
|
||||
author = tagsDiv.getElementsContainingOwnText("artist:").first()
|
||||
?.nextElementSibling()?.text(),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val doc = context.httpGet(manga.url.toAbsoluteUrl(getDomain())).parseHtml()
|
||||
val root = doc.body().selectFirst("div.gm") ?: parseFailed("Cannot find root")
|
||||
val cover = root.getElementById("gd1")?.children()?.first()
|
||||
val title = root.getElementById("gd2")
|
||||
val taglist = root.getElementById("taglist")
|
||||
val tabs = doc.body().selectFirst("table.ptt")?.selectFirst("tr")
|
||||
return manga.copy(
|
||||
title = title?.getElementById("gn")?.text()?.cleanupTitle() ?: manga.title,
|
||||
altTitle = title?.getElementById("gj")?.text()?.cleanupTitle() ?: manga.altTitle,
|
||||
publicUrl = doc.baseUri().ifEmpty { manga.publicUrl },
|
||||
rating = root.getElementById("rating_label")?.text()
|
||||
?.substringAfterLast(' ')
|
||||
?.toFloatOrNull()
|
||||
?.div(5f) ?: manga.rating,
|
||||
largeCoverUrl = cover?.styleValueOrNull("background")?.cssUrl(),
|
||||
description = taglist?.select("tr")?.joinToString("<br>") { tr ->
|
||||
val (tc, td) = tr.children()
|
||||
val subtags = td.select("a").joinToString { it.html() }
|
||||
"<b>${tc.html()}</b> $subtags"
|
||||
},
|
||||
chapters = tabs?.select("a")?.findLast { a ->
|
||||
a.text().toIntOrNull() != null
|
||||
}?.let { a ->
|
||||
val count = a.text().toInt()
|
||||
val chapters = ChaptersListBuilder(count)
|
||||
for (i in 1..count) {
|
||||
val url = "${manga.url}?p=${i - 1}"
|
||||
chapters += MangaChapter(
|
||||
id = generateUid(url),
|
||||
name = "${manga.title} #$i",
|
||||
number = i,
|
||||
url = url,
|
||||
uploadDate = 0L,
|
||||
source = source,
|
||||
scanlator = null,
|
||||
branch = null,
|
||||
)
|
||||
}
|
||||
chapters.toList()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val doc = context.httpGet(chapter.url.toAbsoluteUrl(getDomain())).parseHtml()
|
||||
val root = doc.body().getElementById("gdt") ?: parseFailed("Root not found")
|
||||
return root.select("a").map { a ->
|
||||
val url = a.attrAsRelativeUrl("href")
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
referer = a.absUrl("href"),
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getPageUrl(page: MangaPage): String {
|
||||
val doc = context.httpGet(page.url.toAbsoluteUrl(getDomain())).parseHtml()
|
||||
return doc.body().getElementById("img")?.absUrl("src")
|
||||
?: parseFailed("Image not found")
|
||||
}
|
||||
|
||||
override suspend fun getTags(): Set<MangaTag> {
|
||||
val doc = context.httpGet("https://${getDomain()}").parseHtml()
|
||||
val root = doc.body().getElementById("searchbox")?.selectFirst("table")
|
||||
?: parseFailed("Root not found")
|
||||
return root.select("div.cs").mapNotNullToSet { div ->
|
||||
val id = div.id().substringAfterLast('_').toIntOrNull()
|
||||
?: return@mapNotNullToSet null
|
||||
MangaTag(
|
||||
title = div.text().toTitleCase(),
|
||||
key = id.toString(),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getUsername(): String {
|
||||
val doc = context.httpGet("https://forums.$DOMAIN_UNAUTHORIZED/").parseHtml().body()
|
||||
val username = doc.getElementById("userlinks")
|
||||
?.getElementsByAttributeValueContaining("href", "showuser=")
|
||||
?.firstOrNull()
|
||||
?.ownText()
|
||||
?: if (doc.getElementById("userlinksguest") != null) {
|
||||
throw AuthRequiredException(source)
|
||||
} else {
|
||||
throw ParseException(null)
|
||||
}
|
||||
return username
|
||||
}
|
||||
|
||||
private fun isAuthorized(domain: String): Boolean {
|
||||
val cookies = context.cookieJar.getCookies(domain).mapToSet { x -> x.name }
|
||||
return authCookies.all { it in cookies }
|
||||
}
|
||||
|
||||
private fun Element.parseRating(): Float {
|
||||
return runCatching {
|
||||
val style = requireNotNull(attr("style"))
|
||||
val (v1, v2) = ratingPattern.find(style)!!.destructured
|
||||
var p1 = v1.dropLast(2).toInt()
|
||||
val p2 = v2.dropLast(2).toInt()
|
||||
if (p2 != -1) {
|
||||
p1 += 8
|
||||
}
|
||||
(80 - p1) / 80f
|
||||
}.getOrDefault(RATING_UNKNOWN)
|
||||
}
|
||||
|
||||
private fun String.cleanupTitle(): String {
|
||||
val result = StringBuilder(length)
|
||||
var skip = false
|
||||
for (c in this) {
|
||||
when {
|
||||
c == '[' -> skip = true
|
||||
c == ']' -> skip = false
|
||||
c.isWhitespace() && result.isEmpty() -> continue
|
||||
!skip -> result.append(c)
|
||||
}
|
||||
}
|
||||
while (result.lastOrNull()?.isWhitespace() == true) {
|
||||
result.deleteCharAt(result.lastIndex)
|
||||
}
|
||||
return result.toString()
|
||||
}
|
||||
|
||||
private fun String.cssUrl(): String? {
|
||||
val fromIndex = indexOf("url(")
|
||||
if (fromIndex == -1) {
|
||||
return null
|
||||
}
|
||||
val toIndex = indexOf(')', startIndex = fromIndex)
|
||||
return if (toIndex == -1) {
|
||||
null
|
||||
} else {
|
||||
substring(fromIndex + 4, toIndex).trim()
|
||||
}
|
||||
}
|
||||
|
||||
private fun tagIdByClass(classNames: Collection<String>): String? {
|
||||
val className = classNames.find { x -> x.startsWith("ct") } ?: return null
|
||||
val num = className.drop(2).toIntOrNull(16) ?: return null
|
||||
return 2.0.pow(num).toInt().toString()
|
||||
}
|
||||
}
|
||||
@@ -1,230 +0,0 @@
|
||||
package org.koitharu.kotatsu.parsers.site
|
||||
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import org.json.JSONObject
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import org.koitharu.kotatsu.parsers.util.json.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
private const val PAGE_SIZE = 20
|
||||
private const val CHAPTERS_PAGE_SIZE = 60
|
||||
private const val CONTENT_RATING =
|
||||
"contentRating[]=safe&contentRating[]=suggestive&contentRating[]=erotica&contentRating[]=pornographic"
|
||||
private const val LOCALE_FALLBACK = "en"
|
||||
|
||||
@MangaSourceParser("MANGADEX", "MangaDex")
|
||||
internal class MangaDexParser(override val context: MangaLoaderContext) : MangaParser(MangaSource.MANGADEX) {
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain("mangadex.org", null)
|
||||
|
||||
override val sortOrders: EnumSet<SortOrder> = EnumSet.of(
|
||||
SortOrder.UPDATED,
|
||||
SortOrder.ALPHABETICAL,
|
||||
SortOrder.NEWEST,
|
||||
SortOrder.POPULARITY,
|
||||
)
|
||||
|
||||
override suspend fun getList(
|
||||
offset: Int,
|
||||
query: String?,
|
||||
tags: Set<MangaTag>?,
|
||||
sortOrder: SortOrder,
|
||||
): List<Manga> {
|
||||
val domain = getDomain()
|
||||
val url = buildString {
|
||||
append("https://api.")
|
||||
append(domain)
|
||||
append("/manga?limit=")
|
||||
append(PAGE_SIZE)
|
||||
append("&offset=")
|
||||
append(offset)
|
||||
append("&includes[]=cover_art&includes[]=author&includes[]=artist&")
|
||||
tags?.forEach { tag ->
|
||||
append("includedTags[]=")
|
||||
append(tag.key)
|
||||
append('&')
|
||||
}
|
||||
if (!query.isNullOrEmpty()) {
|
||||
append("title=")
|
||||
append(query.urlEncoded())
|
||||
append('&')
|
||||
}
|
||||
append(CONTENT_RATING)
|
||||
append("&order")
|
||||
append(
|
||||
when (sortOrder) {
|
||||
SortOrder.UPDATED,
|
||||
-> "[latestUploadedChapter]=desc"
|
||||
SortOrder.ALPHABETICAL -> "[title]=asc"
|
||||
SortOrder.NEWEST -> "[createdAt]=desc"
|
||||
SortOrder.POPULARITY -> "[followedCount]=desc"
|
||||
else -> "[followedCount]=desc"
|
||||
},
|
||||
)
|
||||
}
|
||||
val json = context.httpGet(url).parseJson().getJSONArray("data")
|
||||
return json.mapJSON { jo ->
|
||||
val id = jo.getString("id")
|
||||
val attrs = jo.getJSONObject("attributes")
|
||||
val relations = jo.getJSONArray("relationships").associateByKey("type")
|
||||
val cover = relations["cover_art"]
|
||||
?.getJSONObject("attributes")
|
||||
?.getString("fileName")
|
||||
?.let {
|
||||
"https://uploads.$domain/covers/$id/$it"
|
||||
}
|
||||
Manga(
|
||||
id = generateUid(id),
|
||||
title = requireNotNull(attrs.getJSONObject("title").selectByLocale()) {
|
||||
"Title should not be null"
|
||||
},
|
||||
altTitle = attrs.optJSONObject("altTitles")?.selectByLocale(),
|
||||
url = id,
|
||||
publicUrl = "https://$domain/title/$id",
|
||||
rating = RATING_UNKNOWN,
|
||||
isNsfw = attrs.getStringOrNull("contentRating") == "erotica",
|
||||
coverUrl = cover?.plus(".256.jpg").orEmpty(),
|
||||
largeCoverUrl = cover,
|
||||
description = attrs.optJSONObject("description")?.selectByLocale(),
|
||||
tags = attrs.getJSONArray("tags").mapJSONToSet { tag ->
|
||||
MangaTag(
|
||||
title = tag.getJSONObject("attributes")
|
||||
.getJSONObject("name")
|
||||
.firstStringValue()
|
||||
.toTitleCase(),
|
||||
key = tag.getString("id"),
|
||||
source = source,
|
||||
)
|
||||
},
|
||||
state = when (jo.getStringOrNull("status")) {
|
||||
"ongoing" -> MangaState.ONGOING
|
||||
"completed" -> MangaState.FINISHED
|
||||
else -> null
|
||||
},
|
||||
author = (relations["author"] ?: relations["artist"])
|
||||
?.getJSONObject("attributes")
|
||||
?.getStringOrNull("name"),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga = coroutineScope {
|
||||
val domain = getDomain()
|
||||
val attrsDeferred = async {
|
||||
context.httpGet(
|
||||
"https://api.$domain/manga/${manga.url}?includes[]=artist&includes[]=author&includes[]=cover_art",
|
||||
).parseJson().getJSONObject("data").getJSONObject("attributes")
|
||||
}
|
||||
val feedDeferred = async { loadChapters(manga) }
|
||||
val mangaAttrs = attrsDeferred.await()
|
||||
val feed = feedDeferred.await()
|
||||
// 2022-01-02T00:27:11+00:00
|
||||
val dateFormat = SimpleDateFormat(
|
||||
"yyyy-MM-dd'T'HH:mm:ss'+00:00'",
|
||||
Locale.ROOT,
|
||||
)
|
||||
manga.copy(
|
||||
description = mangaAttrs.getJSONObject("description").selectByLocale()
|
||||
?: manga.description,
|
||||
chapters = feed.mapNotNull { jo ->
|
||||
val id = jo.getString("id")
|
||||
val attrs = jo.getJSONObject("attributes")
|
||||
if (!attrs.isNull("externalUrl")) {
|
||||
return@mapNotNull null
|
||||
}
|
||||
val locale = attrs.getStringOrNull("translatedLanguage")?.let { Locale.forLanguageTag(it) }
|
||||
val relations = jo.getJSONArray("relationships").associateByKey("type")
|
||||
val number = attrs.getIntOrDefault("chapter", 0)
|
||||
MangaChapter(
|
||||
id = generateUid(id),
|
||||
name = attrs.getStringOrNull("title")?.takeUnless(String::isEmpty)
|
||||
?: "Chapter #$number",
|
||||
number = number,
|
||||
url = id,
|
||||
scanlator = relations["scanlation_group"]?.getStringOrNull("name"),
|
||||
uploadDate = dateFormat.tryParse(attrs.getString("publishAt")),
|
||||
branch = locale?.getDisplayName(locale)?.toTitleCase(locale),
|
||||
source = source,
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val domain = getDomain()
|
||||
val chapterJson = context.httpGet("https://api.$domain/at-home/server/${chapter.url}?forcePort443=false")
|
||||
.parseJson()
|
||||
.getJSONObject("chapter")
|
||||
val pages = chapterJson.getJSONArray("data")
|
||||
val prefix = "https://uploads.$domain/data/${chapterJson.getString("hash")}/"
|
||||
val referer = "https://$domain/"
|
||||
return List(pages.length()) { i ->
|
||||
val url = prefix + pages.getString(i)
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
referer = referer,
|
||||
preview = null, // TODO prefix + dataSaver.getString(i),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getTags(): Set<MangaTag> {
|
||||
val tags = context.httpGet("https://api.${getDomain()}/manga/tag").parseJson()
|
||||
.getJSONArray("data")
|
||||
return tags.mapJSONToSet { jo ->
|
||||
MangaTag(
|
||||
title = jo.getJSONObject("attributes").getJSONObject("name").firstStringValue().toTitleCase(),
|
||||
key = jo.getString("id"),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun JSONObject.firstStringValue() = values().next() as String
|
||||
|
||||
private fun JSONObject.selectByLocale(): String? {
|
||||
val preferredLocales = context.getPreferredLocales()
|
||||
for (locale in preferredLocales) {
|
||||
getStringOrNull(locale.language)?.let { return it }
|
||||
getStringOrNull(locale.toLanguageTag())?.let { return it }
|
||||
}
|
||||
return getStringOrNull(LOCALE_FALLBACK) ?: values().nextOrNull() as? String
|
||||
}
|
||||
|
||||
private suspend fun loadChapters(manga: Manga): List<JSONObject> {
|
||||
val domain = getDomain()
|
||||
val result = ArrayList<JSONObject>()
|
||||
while (true) {
|
||||
val url = buildString {
|
||||
append("https://api.")
|
||||
append(domain)
|
||||
append("/manga/")
|
||||
append(manga.url)
|
||||
append("/feed")
|
||||
append("?limit=")
|
||||
append(CHAPTERS_PAGE_SIZE)
|
||||
append("&includes[]=scanlation_group&order[volume]=asc&order[chapter]=asc&offset=")
|
||||
append(result.size)
|
||||
append('&')
|
||||
append(CONTENT_RATING)
|
||||
}
|
||||
val json = context.httpGet(url).parseJson()
|
||||
val data = json.optJSONArray("data")
|
||||
if (data.isNullOrEmpty()) {
|
||||
break
|
||||
}
|
||||
data.mapJSONTo(result) { it }
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
package org.koitharu.kotatsu.parsers.site
|
||||
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
private const val DEF_BRANCH_NAME = "Основний переклад"
|
||||
|
||||
@MangaSourceParser("MANGAINUA", "MANGA/in/UA", "uk")
|
||||
class MangaInUaParser(override val context: MangaLoaderContext) : MangaParser(MangaSource.MANGAINUA) {
|
||||
|
||||
override val sortOrders: Set<SortOrder>
|
||||
get() = Collections.singleton(SortOrder.UPDATED)
|
||||
|
||||
override val configKeyDomain: ConfigKey.Domain = ConfigKey.Domain("manga.in.ua", null)
|
||||
|
||||
override suspend fun getList(
|
||||
offset: Int,
|
||||
query: String?,
|
||||
tags: Set<MangaTag>?,
|
||||
sortOrder: SortOrder,
|
||||
): List<Manga> {
|
||||
val page = (offset / 24f).toIntUp().inc()
|
||||
val searchPage = (offset / 10f).toIntUp().inc()
|
||||
val url = when {
|
||||
!query.isNullOrEmpty() -> (
|
||||
"/index.php?do=search" +
|
||||
"&subaction=search" +
|
||||
"&search_start=$searchPage" +
|
||||
"&full_search=1" +
|
||||
"&story=$query" +
|
||||
"&titleonly=3"
|
||||
).toAbsoluteUrl(getDomain())
|
||||
|
||||
tags.isNullOrEmpty() -> "/mangas/page/$page".toAbsoluteUrl(getDomain())
|
||||
tags.size == 1 -> "${tags.first().key}/page/$page"
|
||||
tags.size > 1 -> throw IllegalArgumentException("This source supports only 1 genre")
|
||||
else -> "/mangas/page/$page".toAbsoluteUrl(getDomain())
|
||||
}
|
||||
val doc = context.httpGet(url).parseHtml()
|
||||
val container = doc.body().getElementById("dle-content") ?: parseFailed("Container not found")
|
||||
val items = container.select("div.col-6")
|
||||
return items.mapNotNull { item ->
|
||||
val href = item.selectFirst("a")?.attrAsRelativeUrl("href") ?: return@mapNotNull null
|
||||
Manga(
|
||||
id = generateUid(href),
|
||||
title = item.selectFirst("h3.card__title")?.text() ?: return@mapNotNull null,
|
||||
coverUrl = item.selectFirst("header.card__cover")?.selectFirst("img")?.run {
|
||||
attrAsAbsoluteUrlOrNull("data-src") ?: attrAsAbsoluteUrlOrNull("src")
|
||||
}.orEmpty(),
|
||||
altTitle = null,
|
||||
author = null,
|
||||
rating = item.selectFirst("div.card__short-rate--num")
|
||||
?.text()
|
||||
?.toFloatOrNull()
|
||||
?.div(10F) ?: RATING_UNKNOWN,
|
||||
url = href,
|
||||
isNsfw = item.selectFirst("ul.card__list")?.select("li")?.lastOrNull()?.text() == "18+",
|
||||
tags = runCatching {
|
||||
item.selectFirst("div.card__category")?.select("a")?.mapToSet {
|
||||
MangaTag(
|
||||
title = it.ownText(),
|
||||
key = it.attr("href").removeSuffix("/"),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}.getOrNull().orEmpty(),
|
||||
state = null,
|
||||
publicUrl = href.toAbsoluteUrl(container.host ?: getDomain()),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val doc = context.httpGet(manga.url.toAbsoluteUrl(getDomain())).parseHtml()
|
||||
val root =
|
||||
doc.body().getElementById("dle-content") ?: parseFailed("Cannot find root")
|
||||
val dateFormat = SimpleDateFormat("dd.MM.yyyy", Locale.US)
|
||||
val chapterNodes = root.selectFirstOrThrow(".linkstocomics")
|
||||
.select(".ltcitems")
|
||||
.filterNot { x -> x.selectFirst(".foruserreadedbar") != null }
|
||||
var prevChapterName: String? = null
|
||||
var i = 0
|
||||
return manga.copy(
|
||||
description = root.selectFirst("div.item__full-description")?.text(),
|
||||
largeCoverUrl = root.selectFirst("div.item__full-sidebar--poster")?.selectFirst("img")
|
||||
?.attrAsAbsoluteUrlOrNull("src"),
|
||||
chapters = chapterNodes.mapChapters { _, item ->
|
||||
val href = item?.selectFirst("a")?.attrAsRelativeUrlOrNull("href")
|
||||
?: return@mapChapters null
|
||||
val isAlternative = item.styleValueOrNull("background") != null
|
||||
val name = item.selectFirst("a")?.text().orEmpty()
|
||||
if (!isAlternative) i++
|
||||
MangaChapter(
|
||||
id = generateUid(href),
|
||||
name = if (isAlternative) {
|
||||
prevChapterName ?: return@mapChapters null
|
||||
} else {
|
||||
prevChapterName = name
|
||||
name
|
||||
},
|
||||
number = i,
|
||||
url = href,
|
||||
scanlator = null,
|
||||
branch = if (isAlternative) {
|
||||
name.substringAfterLast(':').trim()
|
||||
} else {
|
||||
DEF_BRANCH_NAME
|
||||
},
|
||||
uploadDate = dateFormat.tryParse(item.selectFirst("div.ltcright")?.text()),
|
||||
source = source,
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val fullUrl = chapter.url.toAbsoluteUrl(getDomain())
|
||||
val doc = context.httpGet(fullUrl).parseHtml()
|
||||
val root =
|
||||
doc.body().getElementById("comics")?.selectFirst("ul.xfieldimagegallery") ?: parseFailed("Root not found")
|
||||
return root.select("li").map { ul ->
|
||||
val img = ul.selectFirst("img") ?: parseFailed("Page image not found")
|
||||
val url = img.attrAsAbsoluteUrl("data-src")
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
preview = null,
|
||||
referer = fullUrl,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getTags(): Set<MangaTag> {
|
||||
val domain = getDomain()
|
||||
val doc = context.httpGet("https://$domain/mangas").parseHtml()
|
||||
val root =
|
||||
doc.body().getElementById("menu_1")?.selectFirst("div.menu__wrapper") ?: parseFailed("Cannot find root")
|
||||
return root.select("li").mapNotNullToSet { li ->
|
||||
val a = li.selectFirst("a") ?: return@mapNotNullToSet null
|
||||
MangaTag(
|
||||
title = a.ownText(),
|
||||
key = a.attr("href").removeSuffix("/"),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
package org.koitharu.kotatsu.parsers.site
|
||||
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.exception.ParseException
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
@MangaSourceParser("MANGAOWL", "MangaOwl", "en")
|
||||
internal class MangaOwlParser(override val context: MangaLoaderContext) : MangaParser(MangaSource.MANGAOWL) {
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain("mangaowls.com", null)
|
||||
|
||||
override val sortOrders: Set<SortOrder> = EnumSet.of(
|
||||
SortOrder.POPULARITY,
|
||||
SortOrder.NEWEST,
|
||||
SortOrder.UPDATED,
|
||||
)
|
||||
|
||||
private val regexNsfw = Regex("(yaoi)|(yuri)|(smut)|(mature)|(adult)", RegexOption.IGNORE_CASE)
|
||||
|
||||
override suspend fun getList(
|
||||
offset: Int,
|
||||
query: String?,
|
||||
tags: Set<MangaTag>?,
|
||||
sortOrder: SortOrder,
|
||||
): List<Manga> {
|
||||
val page = (offset / 36f).toIntUp().inc()
|
||||
val link = buildString {
|
||||
append("https://")
|
||||
append(getDomain())
|
||||
when {
|
||||
!query.isNullOrEmpty() -> {
|
||||
append("/search/$page?search=")
|
||||
append(query.urlEncoded())
|
||||
}
|
||||
|
||||
!tags.isNullOrEmpty() -> {
|
||||
for (tag in tags) {
|
||||
append(tag.key)
|
||||
}
|
||||
append("/$page?type=${getAlternativeSortKey(sortOrder)}")
|
||||
}
|
||||
|
||||
else -> {
|
||||
append("/${getSortKey(sortOrder)}/$page")
|
||||
}
|
||||
}
|
||||
}
|
||||
val doc = context.httpGet(link).parseHtml()
|
||||
val slides = doc.body().select("ul.slides") ?: parseFailed("An error occurred while parsing")
|
||||
val items = slides.select("div.col-md-2")
|
||||
return items.mapNotNull { item ->
|
||||
val href = item.selectFirst("h6 a")?.attrAsRelativeUrlOrNull("href") ?: return@mapNotNull null
|
||||
Manga(
|
||||
id = generateUid(href),
|
||||
title = item.selectFirst("h6 a")?.text() ?: return@mapNotNull null,
|
||||
coverUrl = item.select("div.img-responsive").attr("abs:data-background-image"),
|
||||
altTitle = null,
|
||||
author = null,
|
||||
rating = runCatching {
|
||||
item.selectFirst("div.block-stars")
|
||||
?.text()
|
||||
?.toFloatOrNull()
|
||||
?.div(10f)
|
||||
}.getOrNull() ?: RATING_UNKNOWN,
|
||||
url = href,
|
||||
isNsfw = false,
|
||||
tags = emptySet(),
|
||||
state = null,
|
||||
publicUrl = href.toAbsoluteUrl(getDomain()),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val doc = context.httpGet(manga.publicUrl).parseHtml()
|
||||
val info = doc.body().selectFirst("div.single_detail") ?: parseFailed("An error occurred while parsing")
|
||||
val table = doc.body().selectFirst("div.single-grid-right") ?: parseFailed("An error occurred while parsing")
|
||||
val dateFormat = SimpleDateFormat("MM/dd/yyyy", Locale.US)
|
||||
val trRegex = "window\\['tr'] = '([^']*)';".toRegex(RegexOption.IGNORE_CASE)
|
||||
val trElement =
|
||||
doc.getElementsByTag("script").find { trRegex.find(it.data()) != null } ?: parseFailed("Oops, tr not found")
|
||||
val tr = trRegex.find(trElement.data())!!.groups[1]!!.value
|
||||
val s = context.encodeBase64(getDomain().toByteArray())
|
||||
var isNsfw = manga.isNsfw
|
||||
val parsedTags = info.select("div.col-xs-12.col-md-8.single-right-grid-right > p > a[href*=genres]")
|
||||
.mapNotNullToSet {
|
||||
val a = it.selectFirst("a") ?: return@mapNotNullToSet null
|
||||
val name = a.text()
|
||||
if (!isNsfw && isNsfwGenre(name)) {
|
||||
isNsfw = true
|
||||
}
|
||||
MangaTag(
|
||||
title = name.toTitleCase(),
|
||||
key = a.attr("href"),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
return manga.copy(
|
||||
description = info.selectFirst(".description")?.html(),
|
||||
largeCoverUrl = info.select("img").first()?.let { img ->
|
||||
if (img.hasAttr("data-src")) img.attr("abs:data-src") else img.attr("abs:src")
|
||||
},
|
||||
isNsfw = isNsfw,
|
||||
author = info.selectFirst("p.fexi_header_para a.author_link")?.text(),
|
||||
state = parseStatus(info.select("p.fexi_header_para:contains(status)").first()?.ownText()),
|
||||
tags = manga.tags + parsedTags,
|
||||
chapters = table.select("div.table.table-chapter-list").select("li.list-group-item.chapter_list")
|
||||
.asReversed().mapChapters { i, li ->
|
||||
val a = li.select("a")
|
||||
val href = a.attr("data-href").ifEmpty {
|
||||
parseFailed("Link is missing")
|
||||
}
|
||||
MangaChapter(
|
||||
id = generateUid(href),
|
||||
name = a.select("label").text(),
|
||||
number = i + 1,
|
||||
url = "$href?tr=$tr&s=$s",
|
||||
scanlator = null,
|
||||
branch = null,
|
||||
uploadDate = dateFormat.tryParse(li.selectFirst("small:last-of-type")?.text()),
|
||||
source = MangaSource.MANGAOWL,
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val fullUrl = chapter.url.toAbsoluteUrl(getDomain())
|
||||
val doc = context.httpGet(fullUrl).parseHtml()
|
||||
val root = doc.body().select("div.item img.owl-lazy") ?: throw ParseException("Root not found")
|
||||
return root.map { div ->
|
||||
val url = div?.attrAsRelativeUrlOrNull("data-src") ?: parseFailed("Page image not found")
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
preview = null,
|
||||
referer = url,
|
||||
source = MangaSource.MANGAOWL,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun parseStatus(status: String?) = when {
|
||||
status == null -> null
|
||||
status.contains("Ongoing") -> MangaState.ONGOING
|
||||
status.contains("Completed") -> MangaState.FINISHED
|
||||
else -> null
|
||||
}
|
||||
|
||||
override suspend fun getTags(): Set<MangaTag> {
|
||||
val doc = context.httpGet("https://${getDomain()}/").parseHtml()
|
||||
val root = doc.body().select("ul.dropdown-menu.multi-column.columns-3").select("li")
|
||||
return root.mapToSet { p ->
|
||||
val a = p.selectFirst("a") ?: parseFailed("a is null")
|
||||
MangaTag(
|
||||
title = a.text().toTitleCase(),
|
||||
key = a.attr("href"),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSortKey(sortOrder: SortOrder) =
|
||||
when (sortOrder) {
|
||||
SortOrder.POPULARITY -> "popular"
|
||||
SortOrder.NEWEST -> "new_release"
|
||||
SortOrder.UPDATED -> "lastest"
|
||||
else -> "lastest"
|
||||
}
|
||||
|
||||
private fun getAlternativeSortKey(sortOrder: SortOrder) =
|
||||
when (sortOrder) {
|
||||
SortOrder.POPULARITY -> "0"
|
||||
SortOrder.NEWEST -> "2"
|
||||
SortOrder.UPDATED -> "3"
|
||||
else -> "3"
|
||||
}
|
||||
|
||||
private fun isNsfwGenre(name: String): Boolean = regexNsfw.containsMatchIn(name)
|
||||
}
|
||||
@@ -1,220 +0,0 @@
|
||||
package org.koitharu.kotatsu.parsers.site
|
||||
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.exception.ParseException
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
@MangaSourceParser("MANGATOWN", "MangaTown", "en")
|
||||
internal class MangaTownParser(override val context: MangaLoaderContext) : MangaParser(MangaSource.MANGATOWN) {
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain("www.mangatown.com", null)
|
||||
|
||||
override val sortOrders: Set<SortOrder> = EnumSet.of(
|
||||
SortOrder.ALPHABETICAL,
|
||||
SortOrder.RATING,
|
||||
SortOrder.POPULARITY,
|
||||
SortOrder.UPDATED,
|
||||
)
|
||||
|
||||
private val regexTag = Regex("[^\\-]+-[^\\-]+-[^\\-]+-[^\\-]+-[^\\-]+-[^\\-]+")
|
||||
|
||||
override suspend fun getList(
|
||||
offset: Int,
|
||||
query: String?,
|
||||
tags: Set<MangaTag>?,
|
||||
sortOrder: SortOrder,
|
||||
): List<Manga> {
|
||||
val sortKey = when (sortOrder) {
|
||||
SortOrder.ALPHABETICAL -> "?name.az"
|
||||
SortOrder.RATING -> "?rating.za"
|
||||
SortOrder.UPDATED -> "?last_chapter_time.za"
|
||||
else -> ""
|
||||
}
|
||||
val page = (offset / 30) + 1
|
||||
val url = when {
|
||||
!query.isNullOrEmpty() -> {
|
||||
if (offset != 0) {
|
||||
return emptyList()
|
||||
}
|
||||
"/search?name=${query.urlEncoded()}".toAbsoluteUrl(getDomain())
|
||||
}
|
||||
|
||||
tags.isNullOrEmpty() -> "/directory/$page.htm$sortKey".toAbsoluteUrl(getDomain())
|
||||
tags.size == 1 -> "/directory/${tags.first().key}/$page.htm$sortKey".toAbsoluteUrl(getDomain())
|
||||
else -> tags.joinToString(
|
||||
prefix = "/search?page=$page".toAbsoluteUrl(getDomain()),
|
||||
) { tag ->
|
||||
"&genres[${tag.key}]=1"
|
||||
}
|
||||
}
|
||||
val doc = context.httpGet(url).parseHtml()
|
||||
val root = doc.body().selectFirst("ul.manga_pic_list")
|
||||
?: throw ParseException("Root not found")
|
||||
return root.select("li").mapNotNull { li ->
|
||||
val a = li.selectFirst("a.manga_cover")
|
||||
val href = a?.attrAsRelativeUrlOrNull("href")
|
||||
?: return@mapNotNull null
|
||||
val views = li.select("p.view")
|
||||
val status = views.firstNotNullOfOrNull { it.ownText().takeIf { x -> x.startsWith("Status:") } }
|
||||
?.substringAfter(':')?.trim()?.lowercase(Locale.ROOT)
|
||||
Manga(
|
||||
id = generateUid(href),
|
||||
title = a.attr("title"),
|
||||
coverUrl = a.selectFirst("img")?.absUrl("src").orEmpty(),
|
||||
source = MangaSource.MANGATOWN,
|
||||
altTitle = null,
|
||||
rating = li.selectFirst("p.score")?.selectFirst("b")
|
||||
?.ownText()?.toFloatOrNull()?.div(5f) ?: RATING_UNKNOWN,
|
||||
author = views.firstNotNullOfOrNull { it.text().takeIf { x -> x.startsWith("Author:") } }
|
||||
?.substringAfter(':')
|
||||
?.trim(),
|
||||
state = when (status) {
|
||||
"ongoing" -> MangaState.ONGOING
|
||||
"completed" -> MangaState.FINISHED
|
||||
else -> null
|
||||
},
|
||||
tags = li.selectFirst("p.keyWord")?.select("a")?.mapNotNullToSet tags@{ x ->
|
||||
MangaTag(
|
||||
title = x.attr("title").toTitleCase(),
|
||||
key = x.attr("href").parseTagKey() ?: return@tags null,
|
||||
source = MangaSource.MANGATOWN,
|
||||
)
|
||||
}.orEmpty(),
|
||||
url = href,
|
||||
isNsfw = false,
|
||||
publicUrl = href.toAbsoluteUrl(a.host ?: getDomain()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val doc = context.httpGet(manga.url.toAbsoluteUrl(getDomain())).parseHtml()
|
||||
val root = doc.body().selectFirst("section.main")
|
||||
?.selectFirst("div.article_content") ?: throw ParseException("Cannot find root")
|
||||
val info = root.selectFirst("div.detail_info")?.selectFirst("ul")
|
||||
val chaptersList = root.selectFirst("div.chapter_content")
|
||||
?.selectFirst("ul.chapter_list")?.select("li")?.asReversed()
|
||||
val dateFormat = SimpleDateFormat("MMM dd,yyyy", Locale.US)
|
||||
return manga.copy(
|
||||
tags = manga.tags + info?.select("li")?.find { x ->
|
||||
x.selectFirst("b")?.ownText() == "Genre(s):"
|
||||
}?.select("a")?.mapNotNull { a ->
|
||||
MangaTag(
|
||||
title = a.attr("title").toTitleCase(),
|
||||
key = a.attr("href").parseTagKey() ?: return@mapNotNull null,
|
||||
source = MangaSource.MANGATOWN,
|
||||
)
|
||||
}.orEmpty(),
|
||||
description = info?.getElementById("show")?.ownText(),
|
||||
chapters = chaptersList?.mapChapters { i, li ->
|
||||
val href = li.selectFirst("a")?.attrAsRelativeUrlOrNull("href")
|
||||
?: return@mapChapters null
|
||||
val name = li.select("span")
|
||||
.filter { x -> x.className().isEmpty() }
|
||||
.joinToString(" - ") { it.text() }.trim()
|
||||
MangaChapter(
|
||||
id = generateUid(href),
|
||||
url = href,
|
||||
source = MangaSource.MANGATOWN,
|
||||
number = i + 1,
|
||||
uploadDate = parseChapterDate(
|
||||
dateFormat,
|
||||
li.selectFirst("span.time")?.text(),
|
||||
),
|
||||
name = name.ifEmpty { "${manga.title} - ${i + 1}" },
|
||||
scanlator = null,
|
||||
branch = null,
|
||||
)
|
||||
} ?: bypassLicensedChapters(manga),
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val fullUrl = chapter.url.toAbsoluteUrl(getDomain())
|
||||
val doc = context.httpGet(fullUrl).parseHtml()
|
||||
val root = doc.body().selectFirst("div.page_select")
|
||||
?: throw ParseException("Cannot find root")
|
||||
return root.selectFirst("select")?.select("option")?.mapNotNull {
|
||||
val href = it.attrAsRelativeUrlOrNull("value")
|
||||
if (href == null || href.endsWith("featured.html")) {
|
||||
return@mapNotNull null
|
||||
}
|
||||
MangaPage(
|
||||
id = generateUid(href),
|
||||
url = href,
|
||||
preview = null,
|
||||
referer = fullUrl,
|
||||
source = MangaSource.MANGATOWN,
|
||||
)
|
||||
} ?: parseFailed("Pages list not found")
|
||||
}
|
||||
|
||||
override suspend fun getPageUrl(page: MangaPage): String {
|
||||
val doc = context.httpGet(page.url.toAbsoluteUrl(getDomain())).parseHtml()
|
||||
return doc.getElementById("image")?.absUrl("src") ?: parseFailed("Image not found")
|
||||
}
|
||||
|
||||
override suspend fun getTags(): Set<MangaTag> {
|
||||
val doc = context.httpGet("/directory/".toAbsoluteUrl(getDomain())).parseHtml()
|
||||
val root = doc.body().selectFirst("aside.right")
|
||||
?.getElementsContainingOwnText("Genres")
|
||||
?.first()
|
||||
?.nextElementSibling() ?: parseFailed("Root not found")
|
||||
return root.select("li").mapNotNullToSet { li ->
|
||||
val a = li.selectFirst("a") ?: return@mapNotNullToSet null
|
||||
val key = a.attr("href").parseTagKey()
|
||||
if (key.isNullOrEmpty()) {
|
||||
return@mapNotNullToSet null
|
||||
}
|
||||
MangaTag(
|
||||
source = MangaSource.MANGATOWN,
|
||||
key = key,
|
||||
title = a.text().toTitleCase(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun parseChapterDate(dateFormat: DateFormat, date: String?): Long {
|
||||
return when {
|
||||
date.isNullOrEmpty() -> 0L
|
||||
date.contains("Today") -> Calendar.getInstance().timeInMillis
|
||||
date.contains("Yesterday") -> Calendar.getInstance().apply { add(Calendar.DAY_OF_MONTH, -1) }.timeInMillis
|
||||
else -> dateFormat.tryParse(date)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun bypassLicensedChapters(manga: Manga): List<MangaChapter> {
|
||||
val doc = context.httpGet(manga.url.toAbsoluteUrl(getDomain("m"))).parseHtml()
|
||||
val list = doc.body().selectFirst("ul.detail-ch-list") ?: return emptyList()
|
||||
val dateFormat = SimpleDateFormat("MMM dd,yyyy", Locale.US)
|
||||
return list.select("li").asReversed().mapIndexedNotNull { i, li ->
|
||||
val a = li.selectFirst("a") ?: return@mapIndexedNotNull null
|
||||
val href = a.attrAsRelativeUrl("href")
|
||||
val name = a.selectFirst("span.vol")?.text().orEmpty().ifEmpty {
|
||||
a.ownText()
|
||||
}
|
||||
MangaChapter(
|
||||
id = generateUid(href),
|
||||
url = href,
|
||||
source = MangaSource.MANGATOWN,
|
||||
number = i + 1,
|
||||
uploadDate = parseChapterDate(
|
||||
dateFormat,
|
||||
li.selectFirst("span.time")?.text(),
|
||||
),
|
||||
name = name.ifEmpty { "${manga.title} - ${i + 1}" },
|
||||
scanlator = null,
|
||||
branch = null,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun String.parseTagKey() = split('/').findLast { regexTag matches it }
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
package org.koitharu.kotatsu.parsers.site
|
||||
|
||||
import androidx.collection.ArraySet
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import org.jsoup.nodes.Element
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
@MangaSourceParser("NHENTAI", "N-Hentai")
|
||||
class NHentaiParser(override val context: MangaLoaderContext) : MangaParser(MangaSource.NHENTAI) {
|
||||
|
||||
override val configKeyDomain: ConfigKey.Domain
|
||||
get() = ConfigKey.Domain("nhentai.net", null)
|
||||
|
||||
override val sortOrders: Set<SortOrder>
|
||||
get() = EnumSet.of(SortOrder.NEWEST, SortOrder.POPULARITY)
|
||||
|
||||
override suspend fun getList(
|
||||
offset: Int,
|
||||
query: String?,
|
||||
tags: Set<MangaTag>?,
|
||||
sortOrder: SortOrder,
|
||||
): List<Manga> {
|
||||
if (query.isNullOrEmpty() && tags != null && tags.size > 1) {
|
||||
return getList(offset, buildQuery(tags), emptySet(), sortOrder)
|
||||
}
|
||||
val domain = getDomain()
|
||||
val page = (offset / 25) + 1
|
||||
val url = buildString {
|
||||
append("https://")
|
||||
append(domain)
|
||||
if (!query.isNullOrEmpty()) {
|
||||
append("/search/?q=")
|
||||
append(query.urlEncoded())
|
||||
append("&page=")
|
||||
append(page)
|
||||
if (sortOrder == SortOrder.POPULARITY) {
|
||||
append("&sort=popular")
|
||||
}
|
||||
} else {
|
||||
append('/')
|
||||
if (!tags.isNullOrEmpty()) {
|
||||
val tag = tags.single()
|
||||
append("tag/")
|
||||
append(tag.key)
|
||||
append('/')
|
||||
if (sortOrder == SortOrder.POPULARITY) {
|
||||
append("popular")
|
||||
}
|
||||
append("?page=")
|
||||
append(page)
|
||||
} else {
|
||||
if (sortOrder == SortOrder.POPULARITY) {
|
||||
append("?sort=popular&page=")
|
||||
} else {
|
||||
append("?page=")
|
||||
}
|
||||
append(page)
|
||||
}
|
||||
}
|
||||
}
|
||||
val root = context.httpGet(url).parseHtml().body().getElementById("content")
|
||||
?.selectLast("div.index-container") ?: parseFailed("Root not found")
|
||||
val regexBrackets = Regex("\\[[^]]+]|\\([^)]+\\)")
|
||||
val regexSpaces = Regex("\\s+")
|
||||
return root.select(".gallery").map { div ->
|
||||
val a = div.selectFirstOrThrow("a.cover")
|
||||
val href = a.attrAsRelativeUrl("href")
|
||||
val img = div.selectFirstOrThrow("img")
|
||||
val title = div.selectFirstOrThrow(".caption").text()
|
||||
Manga(
|
||||
id = generateUid(href),
|
||||
title = title.replace(regexBrackets, "")
|
||||
.replace(regexSpaces, " ")
|
||||
.trim(),
|
||||
altTitle = null,
|
||||
url = href,
|
||||
publicUrl = href.toAbsoluteUrl(domain),
|
||||
rating = RATING_UNKNOWN,
|
||||
isNsfw = true,
|
||||
coverUrl = img.attrAsAbsoluteUrlOrNull("data-src")
|
||||
?: img.attrAsAbsoluteUrl("src"),
|
||||
tags = setOf(),
|
||||
state = null,
|
||||
author = null,
|
||||
largeCoverUrl = null,
|
||||
description = null,
|
||||
chapters = listOf(),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val root = context.httpGet(
|
||||
url = manga.url.toAbsoluteUrl(getDomain())
|
||||
).parseHtml().body().requireElementById("bigcontainer")
|
||||
val img = root.requireElementById("cover").selectFirstOrThrow("img")
|
||||
val tagContainers = root.requireElementById("tags").select(".tag-container")
|
||||
val dateFormat = SimpleDateFormat(
|
||||
"yyyy-MM-dd'T'HH:mm:ss.SSSSSS'+00:00'",
|
||||
Locale.ROOT,
|
||||
)
|
||||
return manga.copy(
|
||||
tags = tagContainers.find { x -> x.ownText() == "Tags:" }?.parseTags() ?: manga.tags,
|
||||
author = tagContainers.find { x -> x.ownText() == "Artists:" }
|
||||
?.selectFirst("span.name")?.text()?.toCamelCase(),
|
||||
largeCoverUrl = img.attrAsAbsoluteUrlOrNull("data-src")
|
||||
?: img.attrAsAbsoluteUrl("src"),
|
||||
description = null,
|
||||
chapters = listOf(
|
||||
MangaChapter(
|
||||
id = manga.id,
|
||||
name = manga.title,
|
||||
number = 1,
|
||||
url = manga.url,
|
||||
scanlator = null,
|
||||
uploadDate = dateFormat.tryParse(
|
||||
tagContainers.find { x -> x.ownText() == "Uploaded:" }
|
||||
?.selectFirst("time")
|
||||
?.attr("datetime")
|
||||
),
|
||||
branch = null,
|
||||
source = source,
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val url = chapter.url.toAbsoluteUrl(getDomain())
|
||||
val root = context.httpGet(url).parseHtml().requireElementById("thumbnail-container")
|
||||
return root.select(".thumb-container").map { div ->
|
||||
val a = div.selectFirstOrThrow("a")
|
||||
val img = div.selectFirstOrThrow("img")
|
||||
val href = a.attrAsRelativeUrl("href")
|
||||
MangaPage(
|
||||
id = generateUid(href),
|
||||
url = href,
|
||||
referer = url,
|
||||
preview = img.attrAsAbsoluteUrlOrNull("data-src")
|
||||
?: img.attrAsAbsoluteUrl("src"),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getPageUrl(page: MangaPage): String {
|
||||
val root = context.httpGet(page.url.toAbsoluteUrl(getDomain())).parseHtml().body()
|
||||
.requireElementById("image-container")
|
||||
return root.selectFirstOrThrow("img").attrAsAbsoluteUrl("src")
|
||||
}
|
||||
|
||||
override suspend fun getTags(): Set<MangaTag> {
|
||||
return coroutineScope {
|
||||
// parse first 3 pages of tags
|
||||
(1..3).map { page ->
|
||||
async { getTags(page) }
|
||||
}
|
||||
}.awaitAll().flattenTo(ArraySet(360))
|
||||
}
|
||||
|
||||
private suspend fun getTags(page: Int): Set<MangaTag> {
|
||||
val root = context.httpGet("https://${getDomain()}/tags/popular?page=$page").parseHtml().body()
|
||||
.getElementById("tag-container")
|
||||
return root?.parseTags().orEmpty()
|
||||
}
|
||||
|
||||
private fun Element.parseTags() = select("a.tag").mapToSet { a ->
|
||||
val href = a.attr("href").removeSuffix('/')
|
||||
MangaTag(
|
||||
title = a.selectFirstOrThrow(".name").text().toTitleCase(),
|
||||
key = href.substringAfterLast('/'),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
|
||||
private fun buildQuery(tags: Collection<MangaTag>) = tags.joinToString(separator = " ") { tag ->
|
||||
"tag:\"${tag.key}\""
|
||||
}
|
||||
}
|
||||
@@ -1,266 +0,0 @@
|
||||
package org.koitharu.kotatsu.parsers.site
|
||||
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.exception.ParseException
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
private const val PAGE_SIZE = 26
|
||||
|
||||
internal abstract class NineMangaParser(
|
||||
final override val context: MangaLoaderContext,
|
||||
source: MangaSource,
|
||||
defaultDomain: String,
|
||||
) : MangaParser(source) {
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain(defaultDomain, null)
|
||||
|
||||
init {
|
||||
context.cookieJar.insertCookies(getDomain(), "ninemanga_template_desk=yes")
|
||||
}
|
||||
|
||||
override val headers = Headers.Builder()
|
||||
.add("Accept-Language", "en-US;q=0.7,en;q=0.3")
|
||||
.build()
|
||||
|
||||
override val sortOrders: Set<SortOrder> = Collections.singleton(
|
||||
SortOrder.POPULARITY,
|
||||
)
|
||||
|
||||
override suspend fun getList(
|
||||
offset: Int,
|
||||
query: String?,
|
||||
tags: Set<MangaTag>?,
|
||||
sortOrder: SortOrder,
|
||||
): List<Manga> {
|
||||
val page = (offset / PAGE_SIZE.toFloat()).toIntUp() + 1
|
||||
val url = buildString {
|
||||
append("https://")
|
||||
append(getDomain())
|
||||
when {
|
||||
!query.isNullOrEmpty() -> {
|
||||
append("/search/?name_sel=&wd=")
|
||||
append(query.urlEncoded())
|
||||
append("&page=")
|
||||
}
|
||||
|
||||
!tags.isNullOrEmpty() -> {
|
||||
append("/search/?category_id=")
|
||||
for (tag in tags) {
|
||||
append(tag.key)
|
||||
append(',')
|
||||
}
|
||||
append("&page=")
|
||||
}
|
||||
|
||||
else -> {
|
||||
append("/category/index_")
|
||||
}
|
||||
}
|
||||
append(page)
|
||||
append(".html")
|
||||
}
|
||||
val doc = context.httpGet(url, headers).parseHtml()
|
||||
val root = doc.body().selectFirst("ul.direlist")
|
||||
?: throw ParseException("Cannot find root")
|
||||
val baseHost = root.baseUri().toHttpUrl().host
|
||||
return root.select("li").map { node ->
|
||||
val href = node.selectFirst("a")?.absUrl("href")
|
||||
?: parseFailed("Link not found")
|
||||
val relUrl = href.toRelativeUrl(baseHost)
|
||||
val dd = node.selectFirst("dd")
|
||||
Manga(
|
||||
id = generateUid(relUrl),
|
||||
url = relUrl,
|
||||
publicUrl = href,
|
||||
title = dd?.selectFirst("a.bookname")?.text()?.toCamelCase().orEmpty(),
|
||||
altTitle = null,
|
||||
coverUrl = node.selectFirst("img")?.absUrl("src").orEmpty(),
|
||||
rating = RATING_UNKNOWN,
|
||||
author = null,
|
||||
isNsfw = false,
|
||||
tags = emptySet(),
|
||||
state = null,
|
||||
source = source,
|
||||
description = dd?.selectFirst("p")?.html(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val doc = context.httpGet(
|
||||
manga.url.toAbsoluteUrl(getDomain()) + "?waring=1",
|
||||
headers,
|
||||
).parseHtml()
|
||||
val root = doc.body().selectFirst("div.manga")
|
||||
?: throw ParseException("Cannot find root")
|
||||
val infoRoot = root.selectFirst("div.bookintro")
|
||||
?: throw ParseException("Cannot find info")
|
||||
return manga.copy(
|
||||
tags = infoRoot.getElementsByAttributeValue("itemprop", "genre").first()
|
||||
?.select("a")?.mapToSet { a ->
|
||||
MangaTag(
|
||||
title = a.text().toTitleCase(),
|
||||
key = a.attr("href").substringBetween("/", "."),
|
||||
source = source,
|
||||
)
|
||||
}.orEmpty(),
|
||||
author = infoRoot.getElementsByAttributeValue("itemprop", "author").first()?.text(),
|
||||
state = parseStatus(infoRoot.select("li a.red").text()),
|
||||
description = infoRoot.getElementsByAttributeValue("itemprop", "description").first()
|
||||
?.html()?.substringAfter("</b>"),
|
||||
chapters = root.selectFirst("div.chapterbox")?.select("ul.sub_vol_ul > li")
|
||||
?.asReversed()?.mapChapters { i, li ->
|
||||
val a = li.selectFirst("a.chapter_list_a")
|
||||
val href = a?.attrAsRelativeUrlOrNull("href")
|
||||
?.replace("%20", " ") ?: parseFailed("Link not found")
|
||||
MangaChapter(
|
||||
id = generateUid(href),
|
||||
name = a.text(),
|
||||
number = i + 1,
|
||||
url = href,
|
||||
uploadDate = parseChapterDateByLang(li.selectFirst("span")?.text().orEmpty()),
|
||||
source = source,
|
||||
scanlator = null,
|
||||
branch = null,
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val doc = context.httpGet(chapter.url.toAbsoluteUrl(getDomain()), headers).parseHtml()
|
||||
return doc.body().getElementById("page")?.select("option")?.map { option ->
|
||||
val url = option.attr("value")
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
referer = chapter.url.toAbsoluteUrl(getDomain()),
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
} ?: throw ParseException("Pages list not found at ${chapter.url}")
|
||||
}
|
||||
|
||||
override suspend fun getPageUrl(page: MangaPage): String {
|
||||
val doc = context.httpGet(page.url.toAbsoluteUrl(getDomain()), headers).parseHtml()
|
||||
val root = doc.body()
|
||||
return root.selectFirst("a.pic_download")?.absUrl("href")
|
||||
?: throw ParseException("Page image not found")
|
||||
}
|
||||
|
||||
override suspend fun getTags(): Set<MangaTag> {
|
||||
val doc = context.httpGet("https://${getDomain()}/search/?type=high", headers)
|
||||
.parseHtml()
|
||||
val root = doc.body().getElementById("search_form")
|
||||
return root?.select("li.cate_list")?.mapNotNullToSet { li ->
|
||||
val cateId = li.attr("cate_id") ?: return@mapNotNullToSet null
|
||||
val a = li.selectFirst("a") ?: return@mapNotNullToSet null
|
||||
MangaTag(
|
||||
title = a.text().toTitleCase(),
|
||||
key = cateId,
|
||||
source = source,
|
||||
)
|
||||
} ?: parseFailed("Root not found")
|
||||
}
|
||||
|
||||
private fun parseStatus(status: String) = when {
|
||||
status.contains("Ongoing") -> MangaState.ONGOING
|
||||
status.contains("Completed") -> MangaState.FINISHED
|
||||
else -> null
|
||||
}
|
||||
|
||||
private fun parseChapterDateByLang(date: String): Long {
|
||||
val dateWords = date.split(" ")
|
||||
|
||||
if (dateWords.size == 3) {
|
||||
if (dateWords[1].contains(",")) {
|
||||
SimpleDateFormat("MMM d, yyyy", Locale.ENGLISH).tryParse(date)
|
||||
} else {
|
||||
val timeAgo = Integer.parseInt(dateWords[0])
|
||||
return Calendar.getInstance().apply {
|
||||
when (dateWords[1]) {
|
||||
"minutes" -> Calendar.MINUTE // EN-FR
|
||||
"hours" -> Calendar.HOUR // EN
|
||||
|
||||
"minutos" -> Calendar.MINUTE // ES
|
||||
"horas" -> Calendar.HOUR
|
||||
|
||||
// "minutos" -> Calendar.MINUTE // BR
|
||||
"hora" -> Calendar.HOUR
|
||||
|
||||
"минут" -> Calendar.MINUTE // RU
|
||||
"часа" -> Calendar.HOUR
|
||||
|
||||
"Stunden" -> Calendar.HOUR // DE
|
||||
|
||||
"minuti" -> Calendar.MINUTE // IT
|
||||
"ore" -> Calendar.HOUR
|
||||
|
||||
"heures" -> Calendar.HOUR // FR ("minutes" also French word)
|
||||
else -> null
|
||||
}?.let {
|
||||
add(it, -timeAgo)
|
||||
}
|
||||
}.timeInMillis
|
||||
}
|
||||
}
|
||||
return 0L
|
||||
}
|
||||
|
||||
@MangaSourceParser("NINEMANGA_EN", "NineManga English", "en")
|
||||
class English(context: MangaLoaderContext) : NineMangaParser(
|
||||
context,
|
||||
MangaSource.NINEMANGA_EN,
|
||||
"www.ninemanga.com",
|
||||
)
|
||||
|
||||
@MangaSourceParser("NINEMANGA_ES", "NineManga Español", "es")
|
||||
class Spanish(context: MangaLoaderContext) : NineMangaParser(
|
||||
context,
|
||||
MangaSource.NINEMANGA_ES,
|
||||
"es.ninemanga.com",
|
||||
)
|
||||
|
||||
@MangaSourceParser("NINEMANGA_RU", "NineManga Русский", "ru")
|
||||
class Russian(context: MangaLoaderContext) : NineMangaParser(
|
||||
context,
|
||||
MangaSource.NINEMANGA_RU,
|
||||
"ru.ninemanga.com",
|
||||
)
|
||||
|
||||
@MangaSourceParser("NINEMANGA_DE", "NineManga Deutsch", "de")
|
||||
class Deutsch(context: MangaLoaderContext) : NineMangaParser(
|
||||
context,
|
||||
MangaSource.NINEMANGA_DE,
|
||||
"de.ninemanga.com",
|
||||
)
|
||||
|
||||
@MangaSourceParser("NINEMANGA_BR", "NineManga Brasil", "pt")
|
||||
class Brazil(context: MangaLoaderContext) : NineMangaParser(
|
||||
context,
|
||||
MangaSource.NINEMANGA_BR,
|
||||
"br.ninemanga.com",
|
||||
)
|
||||
|
||||
@MangaSourceParser("NINEMANGA_IT", "NineManga Italiano", "it")
|
||||
class Italiano(context: MangaLoaderContext) : NineMangaParser(
|
||||
context,
|
||||
MangaSource.NINEMANGA_IT,
|
||||
"it.ninemanga.com",
|
||||
)
|
||||
|
||||
@MangaSourceParser("NINEMANGA_FR", "NineManga Français", "fr")
|
||||
class Francais(context: MangaLoaderContext) : NineMangaParser(
|
||||
context,
|
||||
MangaSource.NINEMANGA_FR,
|
||||
"fr.ninemanga.com",
|
||||
)
|
||||
}
|
||||
@@ -1,228 +0,0 @@
|
||||
package org.koitharu.kotatsu.parsers.site
|
||||
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.MangaParserAuthProvider
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.exception.AuthRequiredException
|
||||
import org.koitharu.kotatsu.parsers.exception.ParseException
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
private const val MAX_THUMB_INDEX = 19
|
||||
|
||||
@MangaSourceParser("NUDEMOON", "Nude-Moon", "ru")
|
||||
internal class NudeMoonParser(
|
||||
override val context: MangaLoaderContext,
|
||||
) : MangaParser(MangaSource.NUDEMOON), MangaParserAuthProvider {
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain("nude-moon.net", null)
|
||||
override val authUrl: String
|
||||
get() = "https://${getDomain()}/index.php"
|
||||
|
||||
override val isAuthorized: Boolean
|
||||
get() {
|
||||
return context.cookieJar.getCookies(getDomain()).any {
|
||||
it.name == "fusion_user"
|
||||
}
|
||||
}
|
||||
|
||||
override val sortOrders: Set<SortOrder> = EnumSet.of(
|
||||
SortOrder.NEWEST,
|
||||
SortOrder.POPULARITY,
|
||||
SortOrder.RATING,
|
||||
)
|
||||
|
||||
init {
|
||||
context.cookieJar.insertCookies(
|
||||
getDomain(),
|
||||
"NMfYa=1;",
|
||||
"nm_mobile=0;",
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getList(
|
||||
offset: Int,
|
||||
query: String?,
|
||||
tags: Set<MangaTag>?,
|
||||
sortOrder: SortOrder,
|
||||
): List<Manga> {
|
||||
val domain = getDomain()
|
||||
val url = when {
|
||||
!query.isNullOrEmpty() -> "https://$domain/search?stext=${query.urlEncoded()}&rowstart=$offset"
|
||||
!tags.isNullOrEmpty() -> tags.joinToString(
|
||||
separator = "_",
|
||||
prefix = "https://$domain/tags/",
|
||||
postfix = "&rowstart=$offset",
|
||||
transform = { it.key.urlEncoded() },
|
||||
)
|
||||
else -> "https://$domain/all_manga?${getSortKey(sortOrder)}&rowstart=$offset"
|
||||
}
|
||||
val doc = context.httpGet(url).parseHtml()
|
||||
val root = doc.body().run {
|
||||
selectFirst("td.main-bg") ?: selectFirst("td.main-body")
|
||||
} ?: parseFailed("Cannot find root")
|
||||
return root.select("table.news_pic2").mapNotNull { row ->
|
||||
val a = row.selectFirst("td.bg_style1")?.selectFirst("a")
|
||||
?: return@mapNotNull null
|
||||
val href = a.attrAsRelativeUrl("href")
|
||||
val title = a.selectFirst("h2")?.text().orEmpty()
|
||||
val info = row.selectFirst("td[width=100%]") ?: return@mapNotNull null
|
||||
Manga(
|
||||
id = generateUid(href),
|
||||
url = href,
|
||||
title = title.substringAfter(" / "),
|
||||
altTitle = title.substringBefore(" / ", "")
|
||||
.takeUnless { it.isBlank() },
|
||||
author = info.getElementsContainingOwnText("Автор:").firstOrNull()
|
||||
?.nextElementSibling()?.ownText(),
|
||||
coverUrl = row.selectFirst("img.news_pic2")?.absUrl("data-src")
|
||||
.orEmpty(),
|
||||
tags = row.selectFirst("span.tag-links")?.select("a")
|
||||
?.mapToSet {
|
||||
MangaTag(
|
||||
title = it.text().toTitleCase(),
|
||||
key = it.attr("href").substringAfterLast('/'),
|
||||
source = source,
|
||||
)
|
||||
}.orEmpty(),
|
||||
source = source,
|
||||
publicUrl = a.absUrl("href"),
|
||||
rating = RATING_UNKNOWN,
|
||||
isNsfw = true,
|
||||
description = row.selectFirst("div.description")?.html(),
|
||||
state = null,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val body = context.httpGet(manga.url.toAbsoluteUrl(getDomain())).parseHtml().body()
|
||||
val root = body.selectFirst("table.shoutbox")
|
||||
?: parseFailed("Cannot find root")
|
||||
val info = root.select("div.tbl2")
|
||||
val lastInfo = info.last()
|
||||
return manga.copy(
|
||||
largeCoverUrl = body.selectFirst("img.news_pic2")?.absUrl("src"),
|
||||
description = info.select("div.blockquote").lastOrNull()?.html() ?: manga.description,
|
||||
tags = info.select("span.tag-links").firstOrNull()?.select("a")?.mapToSet {
|
||||
MangaTag(
|
||||
title = it.text().toTitleCase(),
|
||||
key = it.attr("href").substringAfterLast('/'),
|
||||
source = source,
|
||||
)
|
||||
}?.plus(manga.tags) ?: manga.tags,
|
||||
author = lastInfo?.getElementsByAttributeValueContaining("href", "mangaka/")?.text()
|
||||
?: manga.author,
|
||||
chapters = listOf(
|
||||
MangaChapter(
|
||||
id = manga.id,
|
||||
url = getReadLink(manga.url),
|
||||
source = source,
|
||||
number = 1,
|
||||
name = manga.title,
|
||||
scanlator = lastInfo?.getElementsByAttributeValueContaining("href", "perevod/")?.text(),
|
||||
uploadDate = lastInfo?.getElementsContainingOwnText("Дата:")
|
||||
?.firstOrNull()
|
||||
?.html()
|
||||
?.parseDate() ?: 0L,
|
||||
branch = null,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val fullUrl = chapter.url.toAbsoluteUrl(getDomain())
|
||||
val doc = context.httpGet(fullUrl).parseHtml()
|
||||
val mangaId = chapter.url.substringAfterLast('/').substringBefore('-').toIntOrNull()
|
||||
|
||||
val script = doc.select("script").firstNotNullOfOrNull {
|
||||
it.html().takeIf { x -> x.contains(" images = new ") }
|
||||
} ?: if (isAuthorized) {
|
||||
parseFailed("Cannot find pages list")
|
||||
} else {
|
||||
throw AuthRequiredException(source)
|
||||
}
|
||||
val pagesRegex = Regex("images\\[(\\d+)].src\\s*=\\s*'([^']+)'", RegexOption.MULTILINE)
|
||||
return pagesRegex.findAll(script).map { match ->
|
||||
val i = match.groupValues[1].toInt()
|
||||
val url = match.groupValues[2]
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
referer = fullUrl,
|
||||
preview = if (i <= MAX_THUMB_INDEX && mangaId != null) {
|
||||
val part2 = url.substringBeforeLast('/')
|
||||
val part3 = url.substringAfterLast('/')
|
||||
val part1 = part2.substringBeforeLast('/')
|
||||
"$part1/thumb/$mangaId/thumb_$part3"
|
||||
} else {
|
||||
null
|
||||
},
|
||||
source = source,
|
||||
)
|
||||
}.toList()
|
||||
}
|
||||
|
||||
override suspend fun getTags(): Set<MangaTag> {
|
||||
val domain = getDomain()
|
||||
val doc = context.httpGet("https://$domain/all_manga").parseHtml()
|
||||
val root = doc.body().getElementsContainingOwnText("Поиск манги по тегам")
|
||||
.firstOrNull()?.parents()?.find { it.tag().normalName() == "tbody" }
|
||||
?.selectFirst("td.textbox")?.selectFirst("td.small")
|
||||
?: parseFailed("Tags root not found")
|
||||
return root.select("a").mapToSet {
|
||||
MangaTag(
|
||||
title = it.text().toTitleCase(),
|
||||
key = it.attr("href").substringAfterLast('/')
|
||||
.removeSuffix("+"),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getUsername(): String {
|
||||
val body = context.httpGet("https://${getDomain()}/").parseHtml()
|
||||
.body()
|
||||
return body
|
||||
.getElementsContainingOwnText("Профиль")
|
||||
.firstOrNull()
|
||||
?.attr("href")
|
||||
?.substringAfterLast('/')
|
||||
?: run {
|
||||
throw if (body.selectFirst("form[name=\"loginform\"]") != null) {
|
||||
AuthRequiredException(source)
|
||||
} else {
|
||||
ParseException("Cannot find username")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getFaviconUrl(): String {
|
||||
return "https://${getDomain()}/favicon.jpg"
|
||||
}
|
||||
|
||||
private fun getSortKey(sortOrder: SortOrder) =
|
||||
when (sortOrder) {
|
||||
SortOrder.POPULARITY -> "views"
|
||||
SortOrder.NEWEST -> "date"
|
||||
SortOrder.RATING -> "like"
|
||||
else -> "like"
|
||||
}
|
||||
|
||||
private fun String.parseDate(): Long {
|
||||
val dateString = substringBetweenFirst("Дата:", "<")?.trim() ?: return 0
|
||||
val dateFormat = SimpleDateFormat("d MMMM yyyy", Locale("ru"))
|
||||
return dateFormat.tryParse(dateString)
|
||||
}
|
||||
|
||||
private fun getReadLink(url: String): String {
|
||||
val prefix = url.substringBefore('-', "")
|
||||
val suffix = url.substringAfter('-').trimStart('-')
|
||||
return "$prefix-online-$suffix"
|
||||
}
|
||||
}
|
||||
@@ -1,278 +0,0 @@
|
||||
package org.koitharu.kotatsu.parsers.site
|
||||
|
||||
import okhttp3.Headers
|
||||
import okhttp3.Response
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParser
|
||||
import org.koitharu.kotatsu.parsers.MangaParserAuthProvider
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.exception.AuthRequiredException
|
||||
import org.koitharu.kotatsu.parsers.exception.ParseException
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import org.koitharu.kotatsu.parsers.util.json.getStringOrNull
|
||||
import org.koitharu.kotatsu.parsers.util.json.mapJSON
|
||||
import org.koitharu.kotatsu.parsers.util.json.mapJSONTo
|
||||
import org.koitharu.kotatsu.parsers.util.json.mapJSONToSet
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URLDecoder
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
private const val PAGE_SIZE = 30
|
||||
private const val STATUS_ONGOING = 1
|
||||
private const val STATUS_FINISHED = 0
|
||||
|
||||
@MangaSourceParser("REMANGA", "Remanga", "ru")
|
||||
internal class RemangaParser(
|
||||
override val context: MangaLoaderContext,
|
||||
) : MangaParser(MangaSource.REMANGA), MangaParserAuthProvider {
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain("remanga.org", null)
|
||||
override val authUrl: String
|
||||
get() = "https://${getDomain()}/user/login"
|
||||
|
||||
override val sortOrders: Set<SortOrder> = EnumSet.of(
|
||||
SortOrder.UPDATED,
|
||||
SortOrder.POPULARITY,
|
||||
SortOrder.RATING,
|
||||
SortOrder.NEWEST,
|
||||
)
|
||||
|
||||
override val isAuthorized: Boolean
|
||||
get() {
|
||||
return context.cookieJar.getCookies(getDomain()).any {
|
||||
it.name == "user"
|
||||
}
|
||||
}
|
||||
|
||||
private val regexLastUrlPath = Regex("/[^/]+/?$")
|
||||
|
||||
override suspend fun getList(
|
||||
offset: Int,
|
||||
query: String?,
|
||||
tags: Set<MangaTag>?,
|
||||
sortOrder: SortOrder,
|
||||
): List<Manga> {
|
||||
copyCookies()
|
||||
val domain = getDomain()
|
||||
val urlBuilder = StringBuilder()
|
||||
.append("https://api.")
|
||||
.append(domain)
|
||||
if (query != null) {
|
||||
urlBuilder.append("/api/search/?query=")
|
||||
.append(query.urlEncoded())
|
||||
} else {
|
||||
urlBuilder.append("/api/search/catalog/?ordering=")
|
||||
.append(getSortKey(sortOrder))
|
||||
tags?.forEach { tag ->
|
||||
urlBuilder.append("&genres=")
|
||||
urlBuilder.append(tag.key)
|
||||
}
|
||||
}
|
||||
urlBuilder
|
||||
.append("&page=")
|
||||
.append((offset / PAGE_SIZE) + 1)
|
||||
.append("&count=")
|
||||
.append(PAGE_SIZE)
|
||||
val content = context.httpGet(urlBuilder.toString(), getApiHeaders()).parseJson()
|
||||
.getJSONArray("content")
|
||||
return content.mapJSON { jo ->
|
||||
val url = "/manga/${jo.getString("dir")}"
|
||||
val img = jo.getJSONObject("img")
|
||||
Manga(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
publicUrl = "https://$domain$url",
|
||||
title = jo.getString("rus_name"),
|
||||
altTitle = jo.getString("en_name"),
|
||||
rating = jo.getString("avg_rating").toFloatOrNull()?.div(10f) ?: RATING_UNKNOWN,
|
||||
coverUrl = "https://api.$domain${img.getString("mid")}",
|
||||
largeCoverUrl = "https://api.$domain${img.getString("high")}",
|
||||
author = null,
|
||||
isNsfw = false,
|
||||
state = null,
|
||||
tags = jo.optJSONArray("genres")?.mapJSONToSet { g ->
|
||||
MangaTag(
|
||||
title = g.getString("name").toTitleCase(),
|
||||
key = g.getInt("id").toString(),
|
||||
source = MangaSource.REMANGA,
|
||||
)
|
||||
}.orEmpty(),
|
||||
source = MangaSource.REMANGA,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
copyCookies()
|
||||
val domain = getDomain()
|
||||
val slug = manga.url.find(regexLastUrlPath)
|
||||
?: throw ParseException("Cannot obtain slug from ${manga.url}")
|
||||
val data = context.httpGet(
|
||||
url = "https://api.$domain/api/titles/$slug/",
|
||||
headers = getApiHeaders(),
|
||||
).handle401().parseJson()
|
||||
val content = try {
|
||||
data.getJSONObject("content")
|
||||
} catch (e: JSONException) {
|
||||
throw ParseException(data.optString("msg"), e)
|
||||
}
|
||||
val branchId = content.getJSONArray("branches").optJSONObject(0)
|
||||
?.getLong("id") ?: throw ParseException("No branches found")
|
||||
val chapters = grabChapters(domain, branchId)
|
||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US)
|
||||
return manga.copy(
|
||||
description = content.getString("description"),
|
||||
state = when (content.optJSONObject("status")?.getInt("id")) {
|
||||
STATUS_ONGOING -> MangaState.ONGOING
|
||||
STATUS_FINISHED -> MangaState.FINISHED
|
||||
else -> null
|
||||
},
|
||||
tags = content.getJSONArray("genres").mapJSONToSet { g ->
|
||||
MangaTag(
|
||||
title = g.getString("name").toTitleCase(),
|
||||
key = g.getInt("id").toString(),
|
||||
source = MangaSource.REMANGA,
|
||||
)
|
||||
},
|
||||
chapters = chapters.mapChapters { i, jo ->
|
||||
val id = jo.getLong("id")
|
||||
val name = jo.getString("name").toTitleCase(Locale.ROOT)
|
||||
val publishers = jo.optJSONArray("publishers")
|
||||
MangaChapter(
|
||||
id = generateUid(id),
|
||||
url = "/api/titles/chapters/$id/",
|
||||
number = chapters.size - i,
|
||||
name = buildString {
|
||||
append("Том ")
|
||||
append(jo.optString("tome", "0"))
|
||||
append(". ")
|
||||
append("Глава ")
|
||||
append(jo.optString("chapter", "0"))
|
||||
if (name.isNotEmpty()) {
|
||||
append(" - ")
|
||||
append(name)
|
||||
}
|
||||
},
|
||||
uploadDate = dateFormat.tryParse(jo.getString("upload_date")),
|
||||
scanlator = publishers?.optJSONObject(0)?.getStringOrNull("name"),
|
||||
source = MangaSource.REMANGA,
|
||||
branch = null,
|
||||
)
|
||||
}.asReversed(),
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val referer = "https://${getDomain()}/"
|
||||
val content = context.httpGet(chapter.url.toAbsoluteUrl(getDomain("api")), getApiHeaders())
|
||||
.handle401()
|
||||
.parseJson()
|
||||
.getJSONObject("content")
|
||||
val pages = content.optJSONArray("pages")
|
||||
if (pages == null) {
|
||||
val pubDate = content.getStringOrNull("pub_date")?.let {
|
||||
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US).tryParse(it)
|
||||
}
|
||||
if (pubDate != null && pubDate > System.currentTimeMillis()) {
|
||||
val at = SimpleDateFormat.getDateInstance(DateFormat.LONG).format(Date(pubDate))
|
||||
parseFailed("Глава станет доступной $at")
|
||||
} else {
|
||||
parseFailed("Глава недоступна")
|
||||
}
|
||||
}
|
||||
val result = ArrayList<MangaPage>(pages.length())
|
||||
for (i in 0 until pages.length()) {
|
||||
when (val item = pages.get(i)) {
|
||||
is JSONObject -> result += parsePage(item, referer)
|
||||
is JSONArray -> item.mapJSONTo(result) { parsePage(it, referer) }
|
||||
else -> throw ParseException("Unknown json item $item")
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
override suspend fun getTags(): Set<MangaTag> {
|
||||
val domain = getDomain()
|
||||
val content = context.httpGet("https://api.$domain/api/forms/titles/?get=genres", getApiHeaders())
|
||||
.parseJson().getJSONObject("content").getJSONArray("genres")
|
||||
return content.mapJSONToSet { jo ->
|
||||
MangaTag(
|
||||
title = jo.getString("name").toTitleCase(),
|
||||
key = jo.getInt("id").toString(),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getUsername(): String {
|
||||
val jo = context.httpGet(
|
||||
url = "https://api.${getDomain()}/api/users/current/",
|
||||
headers = getApiHeaders(),
|
||||
).handle401().parseJson()
|
||||
return jo.getJSONObject("content").getString("username")
|
||||
}
|
||||
|
||||
private fun getApiHeaders(): Headers? {
|
||||
val userCookie = context.cookieJar.getCookies(getDomain()).find {
|
||||
it.name == "user"
|
||||
} ?: return null
|
||||
val jo = JSONObject(URLDecoder.decode(userCookie.value, Charsets.UTF_8.name()))
|
||||
val accessToken = jo.getStringOrNull("access_token") ?: return null
|
||||
return Headers.headersOf("authorization", "bearer $accessToken")
|
||||
}
|
||||
|
||||
private fun copyCookies() {
|
||||
val domain = getDomain()
|
||||
context.cookieJar.copyCookies(domain, "api.$domain")
|
||||
}
|
||||
|
||||
private fun getSortKey(order: SortOrder?) = when (order) {
|
||||
SortOrder.UPDATED -> "-chapter_date"
|
||||
SortOrder.POPULARITY -> "-rating"
|
||||
SortOrder.RATING -> "-votes"
|
||||
SortOrder.NEWEST -> "-id"
|
||||
else -> "-chapter_date"
|
||||
}
|
||||
|
||||
private fun parsePage(jo: JSONObject, referer: String) = MangaPage(
|
||||
id = generateUid(jo.getLong("id")),
|
||||
url = jo.getString("link"),
|
||||
preview = null,
|
||||
referer = referer,
|
||||
source = source,
|
||||
)
|
||||
|
||||
private suspend fun grabChapters(domain: String, branchId: Long): List<JSONObject> {
|
||||
val result = ArrayList<JSONObject>(100)
|
||||
var page = 1
|
||||
while (true) {
|
||||
val content = context.httpGet(
|
||||
url = "https://api.$domain/api/titles/chapters/?branch_id=$branchId&page=$page&count=100",
|
||||
headers = getApiHeaders(),
|
||||
).handle401().parseJson().getJSONArray("content")
|
||||
val len = content.length()
|
||||
if (len == 0) {
|
||||
break
|
||||
}
|
||||
result.ensureCapacity(result.size + len)
|
||||
for (i in 0 until len) {
|
||||
result.add(content.getJSONObject(i))
|
||||
}
|
||||
page++
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
private fun Response.handle401() = apply {
|
||||
if (code == HttpURLConnection.HTTP_UNAUTHORIZED) {
|
||||
throw AuthRequiredException(source)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,458 @@
|
||||
package org.koitharu.kotatsu.parsers.site.all
|
||||
|
||||
import androidx.collection.ArraySet
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import org.jsoup.nodes.Element
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParserAuthProvider
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.core.PagedMangaParser
|
||||
import org.koitharu.kotatsu.parsers.exception.ParseException
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.security.MessageDigest
|
||||
import java.util.*
|
||||
import javax.crypto.Cipher
|
||||
import javax.crypto.spec.IvParameterSpec
|
||||
import javax.crypto.spec.SecretKeySpec
|
||||
|
||||
@MangaSourceParser("BATOTO", "Bato.To")
|
||||
internal class BatoToParser(context: MangaLoaderContext) : PagedMangaParser(
|
||||
context = context,
|
||||
source = MangaParserSource.BATOTO,
|
||||
pageSize = 60,
|
||||
searchPageSize = 20,
|
||||
), MangaParserAuthProvider {
|
||||
|
||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||
super.onCreateConfig(keys)
|
||||
keys.add(userAgentKey)
|
||||
}
|
||||
|
||||
override val authUrl: String
|
||||
get() = "https://${domain}/signin"
|
||||
|
||||
override suspend fun isAuthorized(): Boolean {
|
||||
return context.cookieJar.getCookies(domain).any {
|
||||
it.name.contains("skey")
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getUsername(): String {
|
||||
val body = webClient.httpGet("https://${domain}/account/profiles").parseHtml().body()
|
||||
return body.selectFirst("ul.toggleMenu-content:has(.avatar):has(a) div.text-center div")?.text()
|
||||
?: body.parseFailed("Cannot find username")
|
||||
}
|
||||
|
||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(
|
||||
SortOrder.ALPHABETICAL,
|
||||
SortOrder.UPDATED,
|
||||
SortOrder.NEWEST,
|
||||
SortOrder.POPULARITY,
|
||||
SortOrder.POPULARITY_YEAR,
|
||||
SortOrder.POPULARITY_MONTH,
|
||||
SortOrder.POPULARITY_WEEK,
|
||||
SortOrder.POPULARITY_TODAY,
|
||||
SortOrder.POPULARITY_HOUR,
|
||||
)
|
||||
|
||||
override val filterCapabilities: MangaListFilterCapabilities
|
||||
get() = MangaListFilterCapabilities(
|
||||
isMultipleTagsSupported = true,
|
||||
isTagsExclusionSupported = true,
|
||||
isSearchSupported = true,
|
||||
isOriginalLocaleSupported = true,
|
||||
)
|
||||
|
||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||
availableTags = fetchAvailableTags(),
|
||||
availableStates = EnumSet.of(
|
||||
MangaState.ONGOING,
|
||||
MangaState.FINISHED,
|
||||
MangaState.ABANDONED,
|
||||
MangaState.PAUSED,
|
||||
MangaState.UPCOMING,
|
||||
),
|
||||
availableContentRating = EnumSet.of(ContentRating.SAFE),
|
||||
availableLocales = setOf(
|
||||
Locale.CHINESE, Locale.ENGLISH, Locale.US, Locale.FRENCH, Locale.GERMAN, Locale.ITALIAN, Locale.JAPANESE,
|
||||
Locale("af"), Locale("ar"), Locale("az"), Locale("eu"), Locale("be"),
|
||||
Locale("bn"), Locale("bs"), Locale("bg"), Locale("my"), Locale("km"),
|
||||
Locale("ceb"), Locale("zh_hk"), Locale("zh_tw"), Locale("hr"), Locale("cs"),
|
||||
Locale("da"), Locale("nl"), Locale("eo"), Locale("et"), Locale("fil"),
|
||||
Locale("fi"), Locale("ka"), Locale("el"), Locale("ht"), Locale("he"),
|
||||
Locale("hi"), Locale("hu"), Locale("id"), Locale("kk"), Locale("ko"),
|
||||
Locale("lv"), Locale("ms"), Locale("ml"), Locale("mo"), Locale("mn"),
|
||||
Locale("ne"), Locale("no"), Locale("fa"), Locale("pl"), Locale("pt"),
|
||||
Locale("pt_br"), Locale("pt_pt"), Locale("ro"), Locale("ru"), Locale("sr"),
|
||||
Locale("si"), Locale("sk"), Locale("es"), Locale("es_419"), Locale("ta"),
|
||||
Locale("te"), Locale("th"), Locale("ti"), Locale("tr"), Locale("uk"),
|
||||
Locale("vi"), Locale("zu"),
|
||||
),
|
||||
)
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain(
|
||||
"bato.to",
|
||||
"batocomic.com",
|
||||
"batocomic.net",
|
||||
"batocomic.org",
|
||||
"batotoo.com",
|
||||
"batotwo.com",
|
||||
"battwo.com",
|
||||
"comiko.net",
|
||||
"comiko.org",
|
||||
"mangatoto.com",
|
||||
"mangatoto.net",
|
||||
"mangatoto.org",
|
||||
"readtoto.com",
|
||||
"readtoto.net",
|
||||
"readtoto.org",
|
||||
"dto.to",
|
||||
"hto.to",
|
||||
"mto.to",
|
||||
"wto.to",
|
||||
"xbato.com",
|
||||
"xbato.net",
|
||||
"xbato.org",
|
||||
"zbato.com",
|
||||
"zbato.net",
|
||||
"zbato.org",
|
||||
"fto.to",
|
||||
"jto.to",
|
||||
)
|
||||
|
||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||
when {
|
||||
!filter.query.isNullOrEmpty() -> {
|
||||
return search(page, filter.query)
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
||||
val url = buildString {
|
||||
append("https://")
|
||||
append(domain)
|
||||
|
||||
append("/browse?sort=")
|
||||
when (order) {
|
||||
SortOrder.UPDATED -> append("update.za")
|
||||
SortOrder.POPULARITY -> append("views_a.za")
|
||||
SortOrder.NEWEST -> append("create.za")
|
||||
SortOrder.ALPHABETICAL -> append("title.az")
|
||||
SortOrder.POPULARITY_YEAR -> append("views_y.za")
|
||||
SortOrder.POPULARITY_MONTH -> append("views_m.za")
|
||||
SortOrder.POPULARITY_WEEK -> append("views_w.za")
|
||||
SortOrder.POPULARITY_TODAY -> append("views_d.za")
|
||||
SortOrder.POPULARITY_HOUR -> append("views_h.za")
|
||||
else -> append("update.za")
|
||||
}
|
||||
|
||||
filter.states.oneOrThrowIfMany()?.let {
|
||||
append("&release=")
|
||||
append(
|
||||
when (it) {
|
||||
MangaState.ONGOING -> "ongoing"
|
||||
MangaState.FINISHED -> "completed"
|
||||
MangaState.ABANDONED -> "cancelled"
|
||||
MangaState.PAUSED -> "hiatus"
|
||||
MangaState.UPCOMING -> "pending"
|
||||
else -> throw IllegalArgumentException("$it not supported")
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
filter.locale?.let {
|
||||
append("&langs=")
|
||||
if (it.language == "in") {
|
||||
append("id")
|
||||
} else {
|
||||
append(it.language)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
filter.originalLocale?.let {
|
||||
append("&origs=")
|
||||
if (it.language == "in") {
|
||||
append("id")
|
||||
} else {
|
||||
append(it.language)
|
||||
}
|
||||
}
|
||||
|
||||
append("&genres=")
|
||||
if (filter.tags.isNotEmpty()) {
|
||||
filter.tags.joinTo(this, ",") { it.key }
|
||||
}
|
||||
|
||||
append("|")
|
||||
if (filter.tagsExclude.isNotEmpty()) {
|
||||
filter.tagsExclude.joinTo(this, ",") { it.key }
|
||||
}
|
||||
|
||||
if (filter.contentRating.isNotEmpty()) {
|
||||
filter.contentRating.oneOrThrowIfMany()?.let {
|
||||
append(
|
||||
when (it) {
|
||||
ContentRating.SAFE -> append(",gore,bloody,violence,ecchi,adult,mature,smut,hentai")
|
||||
else -> append("")
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
append("&page=")
|
||||
append(page.toString())
|
||||
}
|
||||
|
||||
return parseList(url, page)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val root = webClient.httpGet(manga.url.toAbsoluteUrl(domain)).parseHtml()
|
||||
.requireElementById("mainer")
|
||||
val details = root.selectFirstOrThrow(".detail-set")
|
||||
val attrs = details.selectFirst(".attr-main")?.select(".attr-item")?.associate {
|
||||
it.child(0).text() to it.child(1)
|
||||
}.orEmpty()
|
||||
val author = attrs["Authors:"]?.textOrNull()
|
||||
return manga.copy(
|
||||
title = root.selectFirst("h3.item-title")?.text() ?: manga.title,
|
||||
contentRating = if (root.selectFirst("alert")?.getElementsContainingOwnText("NSFW").isNullOrEmpty()) {
|
||||
ContentRating.ADULT
|
||||
} else {
|
||||
ContentRating.SAFE
|
||||
},
|
||||
largeCoverUrl = details.selectFirst("img[src]")?.absUrl("src"),
|
||||
description = details.getElementById("limit-height-body-summary")
|
||||
?.selectFirst(".limit-html")
|
||||
?.html(),
|
||||
tags = manga.tags + attrs["Genres:"]?.parseTags().orEmpty(),
|
||||
state = when (attrs["Original work:"]?.text()) {
|
||||
"Ongoing" -> MangaState.ONGOING
|
||||
"Completed" -> MangaState.FINISHED
|
||||
"Cancelled" -> MangaState.ABANDONED
|
||||
"Hiatus" -> MangaState.PAUSED
|
||||
else -> manga.state
|
||||
},
|
||||
authors = author?.let { setOf(it) } ?: manga.authors,
|
||||
chapters = root.selectFirst(".episode-list")
|
||||
?.selectFirst(".main")
|
||||
?.children()
|
||||
?.mapChapters(reversed = true) { i, div ->
|
||||
div.parseChapter(i)
|
||||
}.orEmpty(),
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val fullUrl = chapter.url.toAbsoluteUrl(domain)
|
||||
val scripts = webClient.httpGet(fullUrl).parseHtml().select("script")
|
||||
for (script in scripts) {
|
||||
val scriptSrc = script.html()
|
||||
val p = scriptSrc.indexOf("const imgHttps =")
|
||||
if (p == -1) continue
|
||||
val start = scriptSrc.indexOf('[', p)
|
||||
val end = scriptSrc.indexOf(';', start)
|
||||
if (start == -1 || end == -1) {
|
||||
continue
|
||||
}
|
||||
val images = JSONArray(scriptSrc.substring(start, end))
|
||||
val batoPass = scriptSrc.substringBetweenFirst("batoPass =", ";")?.trim(' ', '"', '\n')
|
||||
?: script.parseFailed("Cannot find batoPass")
|
||||
val batoWord = scriptSrc.substringBetweenFirst("batoWord =", ";")?.trim(' ', '"', '\n')
|
||||
?: script.parseFailed("Cannot find batoWord")
|
||||
val password = context.evaluateJs(batoPass)?.removeSurrounding('"')
|
||||
?: script.parseFailed("Cannot evaluate batoPass")
|
||||
val args = JSONArray(decryptAES(batoWord, password))
|
||||
val result = ArrayList<MangaPage>(images.length())
|
||||
repeat(images.length()) { i ->
|
||||
val url = images.getString(i)
|
||||
result += MangaPage(
|
||||
id = generateUid(url),
|
||||
url = if (args.length() == 0) url else url + "?" + args.getString(i),
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
return result
|
||||
}
|
||||
throw ParseException("Cannot find images list", fullUrl)
|
||||
}
|
||||
|
||||
private suspend fun fetchAvailableTags(): Set<MangaTag> {
|
||||
val scripts = webClient.httpGet(
|
||||
"https://${domain}/browse",
|
||||
).parseHtml().selectOrThrow("script")
|
||||
for (script in scripts) {
|
||||
val genres = script.html().substringBetweenFirst("const _genres =", ";") ?: continue
|
||||
val jo = JSONObject(genres)
|
||||
val result = ArraySet<MangaTag>(jo.length())
|
||||
jo.keys().forEach { key ->
|
||||
val item = jo.getJSONObject(key)
|
||||
result += MangaTag(
|
||||
title = item.getString("text").toTitleCase(Locale.ENGLISH),
|
||||
key = item.getString("file"),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
return result
|
||||
}
|
||||
throw ParseException("Cannot find gernes list", scripts[0].baseUri())
|
||||
}
|
||||
|
||||
private suspend fun search(page: Int, query: String): List<Manga> {
|
||||
val url = buildString {
|
||||
append("https://")
|
||||
append(domain)
|
||||
append("/search?word=")
|
||||
append(query.replace(' ', '+'))
|
||||
append("&page=")
|
||||
append(page)
|
||||
}
|
||||
return parseList(url, page)
|
||||
}
|
||||
|
||||
private fun getActivePage(body: Element): Int = body.select("nav ul.pagination > li.page-item.active")
|
||||
.lastOrNull()
|
||||
?.text()
|
||||
?.toIntOrNull() ?: body.parseFailed("Cannot determine current page")
|
||||
|
||||
private suspend fun parseList(url: String, page: Int): List<Manga> {
|
||||
val body = webClient.httpGet(url).parseHtml().body()
|
||||
if (body.selectFirst(".browse-no-matches") != null) {
|
||||
return emptyList()
|
||||
}
|
||||
val activePage = getActivePage(body)
|
||||
if (activePage != page) {
|
||||
return emptyList()
|
||||
}
|
||||
val root = body.requireElementById("series-list")
|
||||
return root.children().map { div ->
|
||||
val a = div.selectFirstOrThrow("a")
|
||||
val href = a.attrAsRelativeUrl("href")
|
||||
val title = div.selectFirstOrThrow(".item-title").text()
|
||||
Manga(
|
||||
id = generateUid(href),
|
||||
title = title,
|
||||
altTitles = setOfNotNull(div.selectFirst(".item-alias")?.textOrNull()?.takeUnless { it == title }),
|
||||
url = href,
|
||||
publicUrl = a.absUrl("href"),
|
||||
rating = RATING_UNKNOWN,
|
||||
contentRating = null,
|
||||
coverUrl = div.selectFirst("img[src]")?.absUrl("src"),
|
||||
largeCoverUrl = null,
|
||||
description = null,
|
||||
tags = div.selectFirst(".item-genre")?.parseTags().orEmpty(),
|
||||
state = null,
|
||||
authors = emptySet(),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun Element.parseTags() = children().mapToSet { span ->
|
||||
val text = span.ownText()
|
||||
MangaTag(
|
||||
title = text.toTitleCase(),
|
||||
key = text.lowercase(Locale.ENGLISH).replace(' ', '_'),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
|
||||
private fun Element.parseChapter(index: Int): MangaChapter? {
|
||||
val a = selectFirst("a.chapt") ?: return null
|
||||
val extra = selectFirst(".extra")
|
||||
val href = a.attrAsRelativeUrl("href")
|
||||
return MangaChapter(
|
||||
id = generateUid(href),
|
||||
title = a.textOrNull(),
|
||||
number = index + 1f,
|
||||
volume = 0,
|
||||
url = href,
|
||||
scanlator = extra?.getElementsByAttributeValueContaining("href", "/group/")?.text(),
|
||||
uploadDate = runCatching {
|
||||
parseChapterDate(extra?.select("i")?.lastOrNull()?.ownText())
|
||||
}.getOrDefault(0),
|
||||
branch = null,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
|
||||
private fun parseChapterDate(date: String?): Long {
|
||||
if (date.isNullOrEmpty()) {
|
||||
return 0
|
||||
}
|
||||
val value = date.substringBefore(' ').toInt()
|
||||
val field = when {
|
||||
"sec" in date -> Calendar.SECOND
|
||||
"min" in date -> Calendar.MINUTE
|
||||
"hour" in date -> Calendar.HOUR
|
||||
"day" in date -> Calendar.DAY_OF_MONTH
|
||||
"week" in date -> Calendar.WEEK_OF_YEAR
|
||||
"month" in date -> Calendar.MONTH
|
||||
"year" in date -> Calendar.YEAR
|
||||
else -> return 0
|
||||
}
|
||||
val calendar = Calendar.getInstance()
|
||||
calendar.add(field, -value)
|
||||
return calendar.timeInMillis
|
||||
}
|
||||
|
||||
private fun decryptAES(encrypted: String, password: String): String {
|
||||
val cipherData = context.decodeBase64(encrypted)
|
||||
val saltData = cipherData.copyOfRange(8, 16)
|
||||
val (key, iv) = generateKeyAndIV(
|
||||
keyLength = 32,
|
||||
ivLength = 16,
|
||||
iterations = 1,
|
||||
salt = saltData,
|
||||
password = password.toByteArray(StandardCharsets.UTF_8),
|
||||
md = MessageDigest.getInstance("MD5"),
|
||||
)
|
||||
val encryptedData = cipherData.copyOfRange(16, cipherData.size)
|
||||
val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding")
|
||||
cipher.init(Cipher.DECRYPT_MODE, key, iv)
|
||||
return cipher.doFinal(encryptedData).toString(Charsets.UTF_8)
|
||||
}
|
||||
|
||||
@Suppress("SameParameterValue")
|
||||
private fun generateKeyAndIV(
|
||||
keyLength: Int,
|
||||
ivLength: Int,
|
||||
iterations: Int,
|
||||
salt: ByteArray,
|
||||
password: ByteArray,
|
||||
md: MessageDigest,
|
||||
): Pair<SecretKeySpec, IvParameterSpec> {
|
||||
val digestLength = md.digestLength
|
||||
val requiredLength = (keyLength + ivLength + digestLength - 1) / digestLength * digestLength
|
||||
val generatedData = ByteArray(requiredLength)
|
||||
var generatedLength = 0
|
||||
md.reset()
|
||||
while (generatedLength < keyLength + ivLength) {
|
||||
if (generatedLength > 0) {
|
||||
md.update(generatedData, generatedLength - digestLength, digestLength)
|
||||
}
|
||||
md.update(password)
|
||||
md.update(salt, 0, 8)
|
||||
md.digest(generatedData, generatedLength, digestLength)
|
||||
repeat(iterations - 1) {
|
||||
md.update(generatedData, generatedLength, digestLength)
|
||||
md.digest(generatedData, generatedLength, digestLength)
|
||||
}
|
||||
generatedLength += digestLength
|
||||
}
|
||||
|
||||
return SecretKeySpec(generatedData.copyOfRange(0, keyLength), "AES") to IvParameterSpec(
|
||||
if (ivLength > 0) {
|
||||
generatedData.copyOfRange(keyLength, keyLength + ivLength)
|
||||
} else byteArrayOf(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
package org.koitharu.kotatsu.parsers.site.all
|
||||
|
||||
import androidx.collection.ArraySet
|
||||
import androidx.collection.SparseArrayCompat
|
||||
import okhttp3.HttpUrl
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.core.PagedMangaParser
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import org.koitharu.kotatsu.parsers.util.json.*
|
||||
import org.koitharu.kotatsu.parsers.util.suspendlazy.suspendLazy
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
private const val CHAPTERS_LIMIT = 99999
|
||||
|
||||
@MangaSourceParser("COMICK_FUN", "ComicK")
|
||||
internal class ComickFunParser(context: MangaLoaderContext) :
|
||||
PagedMangaParser(context, MangaParserSource.COMICK_FUN, 20) {
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain("comick.io")
|
||||
|
||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||
super.onCreateConfig(keys)
|
||||
keys.add(userAgentKey)
|
||||
}
|
||||
|
||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(
|
||||
SortOrder.POPULARITY,
|
||||
SortOrder.UPDATED,
|
||||
SortOrder.RATING,
|
||||
SortOrder.NEWEST,
|
||||
)
|
||||
|
||||
override val filterCapabilities: MangaListFilterCapabilities
|
||||
get() = MangaListFilterCapabilities(
|
||||
isMultipleTagsSupported = true,
|
||||
isTagsExclusionSupported = true,
|
||||
isSearchSupported = true,
|
||||
isSearchWithFiltersSupported = true,
|
||||
isYearRangeSupported = true,
|
||||
)
|
||||
|
||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||
availableTags = fetchAvailableTags(),
|
||||
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED, MangaState.PAUSED, MangaState.ABANDONED),
|
||||
availableContentTypes = EnumSet.of(
|
||||
ContentType.MANGA,
|
||||
ContentType.MANHWA,
|
||||
ContentType.MANHUA,
|
||||
ContentType.OTHER,
|
||||
),
|
||||
availableDemographics = EnumSet.of(
|
||||
Demographic.SHOUNEN,
|
||||
Demographic.SHOUJO,
|
||||
Demographic.SEINEN,
|
||||
Demographic.JOSEI,
|
||||
Demographic.NONE,
|
||||
),
|
||||
)
|
||||
|
||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||
val domain = domain
|
||||
val url = urlBuilder()
|
||||
.host("api.$domain")
|
||||
.addPathSegment("v1.0")
|
||||
.addPathSegment("search")
|
||||
.addQueryParameter("type", "comic")
|
||||
.addQueryParameter("tachiyomi", "true")
|
||||
.addQueryParameter("limit", pageSize.toString())
|
||||
.addQueryParameter("page", page.toString())
|
||||
|
||||
filter.query?.let {
|
||||
url.addQueryParameter("q", filter.query)
|
||||
}
|
||||
|
||||
filter.tags.forEach {
|
||||
url.addQueryParameter("genres", it.key)
|
||||
}
|
||||
|
||||
filter.tagsExclude.forEach {
|
||||
url.addQueryParameter("excludes", it.key)
|
||||
}
|
||||
|
||||
url.addQueryParameter(
|
||||
"sort",
|
||||
when (order) {
|
||||
SortOrder.NEWEST -> "created_at"
|
||||
SortOrder.POPULARITY -> "view"
|
||||
SortOrder.RATING -> "rating"
|
||||
SortOrder.UPDATED -> "uploaded"
|
||||
else -> "uploaded"
|
||||
},
|
||||
)
|
||||
|
||||
filter.states.oneOrThrowIfMany()?.let {
|
||||
url.addQueryParameter(
|
||||
"status",
|
||||
when (it) {
|
||||
MangaState.ONGOING -> "1"
|
||||
MangaState.FINISHED -> "2"
|
||||
MangaState.ABANDONED -> "3"
|
||||
MangaState.PAUSED -> "4"
|
||||
else -> ""
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
if (filter.yearFrom != YEAR_UNKNOWN) {
|
||||
url.addQueryParameter("from", filter.yearFrom.toString())
|
||||
}
|
||||
|
||||
if (filter.yearTo != YEAR_UNKNOWN) {
|
||||
url.addQueryParameter("to", filter.yearTo.toString())
|
||||
}
|
||||
|
||||
filter.types.forEach {
|
||||
url.addQueryParameter(
|
||||
"country",
|
||||
when (it) {
|
||||
ContentType.MANGA -> "jp"
|
||||
ContentType.MANHWA -> "kr"
|
||||
ContentType.MANHUA -> "cn"
|
||||
ContentType.OTHER -> "others"
|
||||
else -> ""
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
filter.demographics.forEach {
|
||||
url.addQueryParameter(
|
||||
"demographic",
|
||||
when (it) {
|
||||
Demographic.SHOUNEN -> "1"
|
||||
Demographic.SHOUJO -> "2"
|
||||
Demographic.SEINEN -> "3"
|
||||
Demographic.JOSEI -> "4"
|
||||
Demographic.NONE -> "5"
|
||||
else -> ""
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
val ja = webClient.httpGet(url.build()).parseJsonArray()
|
||||
val tagsMap = tagsArray.get()
|
||||
return ja.mapJSON { jo ->
|
||||
val slug = jo.getString("slug")
|
||||
Manga(
|
||||
id = generateUid(slug),
|
||||
title = jo.getString("title"),
|
||||
altTitles = emptySet(),
|
||||
url = slug,
|
||||
publicUrl = "https://$domain/comic/$slug",
|
||||
rating = jo.getDoubleOrDefault("rating", -10.0).toFloat() / 10f,
|
||||
contentRating = null,
|
||||
coverUrl = jo.getStringOrNull("cover_url"),
|
||||
largeCoverUrl = null,
|
||||
description = jo.getStringOrNull("desc"),
|
||||
tags = jo.selectGenres(tagsMap),
|
||||
state = when (jo.getIntOrDefault("status", 0)) {
|
||||
1 -> MangaState.ONGOING
|
||||
2 -> MangaState.FINISHED
|
||||
3 -> MangaState.ABANDONED
|
||||
4 -> MangaState.PAUSED
|
||||
else -> null
|
||||
},
|
||||
authors = emptySet(),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val domain = domain
|
||||
val url = "https://api.$domain/comic/${manga.url}?tachiyomi=true"
|
||||
val jo = webClient.httpGet(url).parseJson()
|
||||
val comic = jo.getJSONObject("comic")
|
||||
val alt = comic.getJSONArray("md_titles").asTypedList<JSONObject>().mapNotNullToSet {
|
||||
it.getStringOrNull("title")
|
||||
}
|
||||
val authors = jo.getJSONArray("artists").mapJSONNotNullToSet { it.getStringOrNull("name") }
|
||||
return manga.copy(
|
||||
altTitles = alt,
|
||||
contentRating = when {
|
||||
comic.getBooleanOrDefault("hentai", false) -> ContentRating.ADULT
|
||||
jo.getBooleanOrDefault("matureContent", false) -> ContentRating.SUGGESTIVE
|
||||
else -> ContentRating.SAFE
|
||||
},
|
||||
description = comic.getStringOrNull("parsed") ?: comic.getStringOrNull("desc"),
|
||||
tags = manga.tags + comic.getJSONArray("md_comic_md_genres").mapJSONToSet {
|
||||
val g = it.getJSONObject("md_genres")
|
||||
MangaTag(
|
||||
title = g.getString("name"),
|
||||
key = g.getString("slug"),
|
||||
source = source,
|
||||
)
|
||||
},
|
||||
authors = authors,
|
||||
chapters = getChapters(comic.getString("hid")),
|
||||
)
|
||||
}
|
||||
|
||||
private suspend fun getChapters(hid: String): List<MangaChapter> {
|
||||
val ja = webClient.httpGet(
|
||||
url = "https://api.${domain}/comic/$hid/chapters?limit=$CHAPTERS_LIMIT",
|
||||
).parseJson().getJSONArray("chapters")
|
||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd")
|
||||
return ja.asTypedList<JSONObject>().reversed().mapChapters { _, jo ->
|
||||
val vol = jo.getIntOrDefault("vol", 0)
|
||||
val chap = jo.getFloatOrDefault("chap", 0f)
|
||||
val locale = Locale.forLanguageTag(jo.getString("lang"))
|
||||
val group = jo.optJSONArray("group_name")?.joinToString(", ")
|
||||
val branch = buildString {
|
||||
append(locale.getDisplayName(locale).toTitleCase(locale))
|
||||
if (!group.isNullOrEmpty()) {
|
||||
append(" (")
|
||||
append(group)
|
||||
append(')')
|
||||
}
|
||||
}
|
||||
MangaChapter(
|
||||
id = generateUid(jo.getLong("id")),
|
||||
title = jo.getStringOrNull("title"),
|
||||
number = chap,
|
||||
volume = vol,
|
||||
url = jo.getString("hid"),
|
||||
scanlator = jo.optJSONArray("group_name")?.asTypedList<String>()?.joinToString()
|
||||
?.takeUnless { it.isBlank() },
|
||||
uploadDate = dateFormat.parseSafe(jo.getString("created_at").substringBefore('T')),
|
||||
branch = branch,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val jo = webClient.httpGet(
|
||||
"https://api.${domain}/chapter/${chapter.url}?tachiyomi=true",
|
||||
).parseJson().getJSONObject("chapter")
|
||||
return jo.getJSONArray("images").mapJSON {
|
||||
val url = it.getString("url")
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
preview = null,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun resolveLink(resolver: LinkResolver, link: HttpUrl): Manga? {
|
||||
val slug = link.pathSegments.lastOrNull() ?: return null
|
||||
return resolver.resolveManga(this, url = slug, id = generateUid(slug))
|
||||
}
|
||||
|
||||
private val tagsArray = suspendLazy(initializer = ::loadTags)
|
||||
|
||||
private suspend fun fetchAvailableTags(): Set<MangaTag> {
|
||||
val sparseArray = tagsArray.get()
|
||||
val set = ArraySet<MangaTag>(sparseArray.size())
|
||||
for (i in 0 until sparseArray.size()) {
|
||||
set.add(sparseArray.valueAt(i))
|
||||
}
|
||||
return set
|
||||
}
|
||||
|
||||
private suspend fun loadTags(): SparseArrayCompat<MangaTag> {
|
||||
val ja = webClient.httpGet("https://api.${domain}/genre").parseJsonArray()
|
||||
val tags = SparseArrayCompat<MangaTag>(ja.length())
|
||||
for (jo in ja.asTypedList<JSONObject>()) {
|
||||
tags.append(
|
||||
jo.getInt("id"),
|
||||
MangaTag(
|
||||
title = jo.getString("name").toTitleCase(Locale.ENGLISH),
|
||||
key = jo.getString("slug"),
|
||||
source = source,
|
||||
),
|
||||
)
|
||||
}
|
||||
return tags
|
||||
}
|
||||
|
||||
private fun JSONObject.selectGenres(tags: SparseArrayCompat<MangaTag>): Set<MangaTag> {
|
||||
val array = optJSONArray("genres") ?: return emptySet()
|
||||
val res = ArraySet<MangaTag>(array.length())
|
||||
for (i in 0 until array.length()) {
|
||||
val id = array.getInt(i)
|
||||
val tag = tags[id] ?: continue
|
||||
res.add(tag)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
private fun JSONArray.joinToString(separator: String): String {
|
||||
return (0 until length()).joinToString(separator) { i -> getString(i) }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,497 @@
|
||||
package org.koitharu.kotatsu.parsers.site.all
|
||||
|
||||
import androidx.collection.ArraySet
|
||||
import androidx.collection.MutableIntLongMap
|
||||
import androidx.collection.MutableIntObjectMap
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
import okhttp3.internal.closeQuietly
|
||||
import org.jsoup.internal.StringUtil
|
||||
import org.jsoup.nodes.Element
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaParserAuthProvider
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.bitmap.Rect
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.core.PagedMangaParser
|
||||
import org.koitharu.kotatsu.parsers.exception.AuthRequiredException
|
||||
import org.koitharu.kotatsu.parsers.exception.TooManyRequestExceptions
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import java.util.Collections.emptyList
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
private const val DOMAIN_UNAUTHORIZED = "e-hentai.org"
|
||||
private const val DOMAIN_AUTHORIZED = "exhentai.org"
|
||||
private val TAG_PREFIXES = arrayOf("male:", "female:", "other:")
|
||||
private const val BANNED_RESPONSE_LENGTH = 256L
|
||||
|
||||
@MangaSourceParser("EXHENTAI", "ExHentai", type = ContentType.HENTAI)
|
||||
internal class ExHentaiParser(
|
||||
context: MangaLoaderContext,
|
||||
) : PagedMangaParser(context, MangaParserSource.EXHENTAI, pageSize = 25), MangaParserAuthProvider, Interceptor {
|
||||
|
||||
override val availableSortOrders: Set<SortOrder> = setOf(SortOrder.NEWEST)
|
||||
|
||||
override val configKeyDomain: ConfigKey.Domain
|
||||
get() {
|
||||
val isAuthorized = checkAuth()
|
||||
return ConfigKey.Domain(
|
||||
if (isAuthorized) DOMAIN_AUTHORIZED else DOMAIN_UNAUTHORIZED,
|
||||
if (isAuthorized) DOMAIN_UNAUTHORIZED else DOMAIN_AUTHORIZED,
|
||||
)
|
||||
}
|
||||
|
||||
override val authUrl: String
|
||||
get() = "https://${domain}/bounce_login.php"
|
||||
|
||||
private val ratingPattern = Regex("-?[0-9]+px")
|
||||
private val titleCleanupPattern = Regex("(\\[.*?]|\\([C0-9]*\\))")
|
||||
private val spacesCleanupPattern = Regex("(^\\s+|\\s+\$|\\s+(?=\\s))")
|
||||
private val authCookies = arrayOf("ipb_member_id", "ipb_pass_hash")
|
||||
private val suspiciousContentKey = ConfigKey.ShowSuspiciousContent(false)
|
||||
private val nextPages = MutableIntObjectMap<MutableIntLongMap>()
|
||||
|
||||
override val filterCapabilities: MangaListFilterCapabilities
|
||||
get() = MangaListFilterCapabilities(
|
||||
isMultipleTagsSupported = true,
|
||||
isTagsExclusionSupported = true,
|
||||
isSearchSupported = true,
|
||||
isSearchWithFiltersSupported = true,
|
||||
isAuthorSearchSupported = true,
|
||||
)
|
||||
|
||||
override suspend fun isAuthorized(): Boolean = checkAuth()
|
||||
|
||||
init {
|
||||
context.cookieJar.insertCookies(DOMAIN_AUTHORIZED, "nw=1", "sl=dm_2")
|
||||
context.cookieJar.insertCookies(DOMAIN_UNAUTHORIZED, "nw=1", "sl=dm_2")
|
||||
paginator.firstPage = 0
|
||||
searchPaginator.firstPage = 0
|
||||
}
|
||||
|
||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||
availableTags = mapTags(),
|
||||
availableContentTypes = EnumSet.of(
|
||||
ContentType.DOUJINSHI,
|
||||
ContentType.MANGA,
|
||||
ContentType.ARTIST_CG,
|
||||
ContentType.GAME_CG,
|
||||
ContentType.COMICS,
|
||||
ContentType.IMAGE_SET,
|
||||
ContentType.OTHER,
|
||||
),
|
||||
availableLocales = setOf(
|
||||
Locale.JAPANESE,
|
||||
Locale.ENGLISH,
|
||||
Locale.CHINESE,
|
||||
Locale("nl"),
|
||||
Locale.FRENCH,
|
||||
Locale.GERMAN,
|
||||
Locale("hu"),
|
||||
Locale.ITALIAN,
|
||||
Locale("kr"),
|
||||
Locale("pl"),
|
||||
Locale("pt"),
|
||||
Locale("ru"),
|
||||
Locale("es"),
|
||||
Locale("th"),
|
||||
Locale("vi"),
|
||||
),
|
||||
)
|
||||
|
||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||
return getListPage(page, order, filter, updateDm = false)
|
||||
}
|
||||
|
||||
private suspend fun getListPage(
|
||||
page: Int,
|
||||
order: SortOrder,
|
||||
filter: MangaListFilter,
|
||||
updateDm: Boolean,
|
||||
): List<Manga> {
|
||||
val next = synchronized(nextPages) {
|
||||
nextPages[filter.hashCode()]?.getOrDefault(page, 0L) ?: 0L
|
||||
}
|
||||
|
||||
if (page > 0 && next == 0L) {
|
||||
assert(false) { "Page timestamp not found" }
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
val url = urlBuilder()
|
||||
url.addEncodedQueryParameter("next", next.toString())
|
||||
url.addQueryParameter("f_search", filter.toSearchQuery())
|
||||
|
||||
val fCats = filter.types.toFCats()
|
||||
if (fCats != 0) {
|
||||
url.addEncodedQueryParameter("f_cats", (1023 - fCats).toString())
|
||||
}
|
||||
if (updateDm) {
|
||||
// by unknown reason cookie "sl=dm_2" is ignored, so, we should request it again
|
||||
url.addQueryParameter("inline_set", "dm_e")
|
||||
}
|
||||
url.addQueryParameter("advsearch", "1")
|
||||
if (config[suspiciousContentKey]) {
|
||||
url.addQueryParameter("f_sh", "on")
|
||||
}
|
||||
val body = webClient.httpGet(url.build()).parseHtml().body()
|
||||
val root = body.selectFirst("table.itg")?.selectFirst("tbody")
|
||||
if (root == null) {
|
||||
if (updateDm) {
|
||||
if (body.getElementsContainingText("No hits found").isNotEmpty()) {
|
||||
return emptyList()
|
||||
} else {
|
||||
body.parseFailed("Cannot find root")
|
||||
}
|
||||
} else {
|
||||
return getListPage(page, order, filter, updateDm = true)
|
||||
}
|
||||
}
|
||||
val nextTimestamp = getNextTimestamp(body)
|
||||
synchronized(nextPages) {
|
||||
nextPages.getOrPut(filter.hashCode()) {
|
||||
MutableIntLongMap()
|
||||
}.put(page + 1, nextTimestamp)
|
||||
}
|
||||
|
||||
return root.children().mapNotNull { tr ->
|
||||
if (tr.childrenSize() != 2) return@mapNotNull null
|
||||
val (td1, td2) = tr.children()
|
||||
val gLink = td2.selectFirstOrThrow("div.glink")
|
||||
val a = gLink.parents().select("a").first() ?: gLink.parseFailed("link not found")
|
||||
val href = a.attrAsRelativeUrl("href")
|
||||
val tagsDiv = gLink.nextElementSibling() ?: gLink.parseFailed("tags div not found")
|
||||
val rawTitle = gLink.text()
|
||||
val author = tagsDiv.getElementsContainingOwnText("artist:").first()
|
||||
?.nextElementSibling()?.textOrNull()
|
||||
Manga(
|
||||
id = generateUid(href),
|
||||
title = rawTitle.cleanupTitle(),
|
||||
altTitles = emptySet(),
|
||||
url = href,
|
||||
publicUrl = a.absUrl("href"),
|
||||
rating = td2.selectFirst("div.ir")?.parseRating() ?: RATING_UNKNOWN,
|
||||
contentRating = ContentRating.ADULT,
|
||||
coverUrl = td1.selectFirst("img")?.attrAsAbsoluteUrlOrNull("src"),
|
||||
tags = tagsDiv.parseTags(),
|
||||
state = when {
|
||||
rawTitle.contains("(ongoing)", ignoreCase = true) -> MangaState.ONGOING
|
||||
else -> null
|
||||
},
|
||||
authors = setOfNotNull(author),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val doc = webClient.httpGet(manga.url.toAbsoluteUrl(domain)).parseHtml()
|
||||
val root = doc.body().selectFirstOrThrow("div.gm")
|
||||
val cover = root.getElementById("gd1")?.children()?.first()
|
||||
val title = root.getElementById("gd2")
|
||||
val tagList = root.getElementById("taglist")
|
||||
val tabs = doc.body().selectFirst("table.ptt")?.selectFirst("tr")
|
||||
val gd3 = root.getElementById("gd3")
|
||||
val lang = gd3
|
||||
?.selectFirst("tr:contains(Language)")
|
||||
?.selectFirst(".gdt2")?.ownTextOrNull()
|
||||
val uploadDate = gd3
|
||||
?.selectFirst("tr:contains(Posted)")
|
||||
?.selectFirst(".gdt2")?.ownTextOrNull()
|
||||
.let { SimpleDateFormat("yyyy-MM-dd HH:mm", sourceLocale).parseSafe(it) }
|
||||
val uploader = gd3
|
||||
?.getElementsByAttributeValueContaining("href", "/uploader/")
|
||||
?.firstOrNull()
|
||||
?.ownTextOrNull()
|
||||
val tags = tagList?.parseTags().orEmpty()
|
||||
|
||||
return manga.copy(
|
||||
title = title?.getElementById("gn")?.text()?.cleanupTitle() ?: manga.title,
|
||||
altTitles = setOfNotNull(title?.getElementById("gj")?.text()?.cleanupTitle()?.nullIfEmpty()),
|
||||
publicUrl = doc.baseUri().ifEmpty { manga.publicUrl },
|
||||
rating = root.getElementById("rating_label")?.text()
|
||||
?.substringAfterLast(' ')
|
||||
?.toFloatOrNull()
|
||||
?.div(5f) ?: manga.rating,
|
||||
largeCoverUrl = cover?.styleValueOrNull("background")?.cssUrl(),
|
||||
tags = manga.tags + tags,
|
||||
description = tagList?.select("tr")?.joinToString("<br>") { tr ->
|
||||
val (tc, td) = tr.children()
|
||||
val subTags = td.select("a").joinToString { it.html() }
|
||||
"<b>${tc.html()}</b> $subTags"
|
||||
},
|
||||
chapters = tabs?.select("a")?.findLast { a ->
|
||||
a.text().toIntOrNull() != null
|
||||
}?.let { a ->
|
||||
val count = a.text().toInt()
|
||||
val chapters = ChaptersListBuilder(count)
|
||||
for (i in 1..count) {
|
||||
val url = "${manga.url}?p=${i - 1}"
|
||||
chapters += MangaChapter(
|
||||
id = generateUid(url),
|
||||
title = null,
|
||||
number = i.toFloat(),
|
||||
volume = 0,
|
||||
url = url,
|
||||
uploadDate = uploadDate,
|
||||
source = source,
|
||||
scanlator = uploader,
|
||||
branch = lang,
|
||||
)
|
||||
}
|
||||
chapters.toList()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val doc = webClient.httpGet(chapter.url.toAbsoluteUrl(domain)).parseHtml()
|
||||
val root = doc.body().requireElementById("gdt")
|
||||
return root.select("a").map { a ->
|
||||
val url = a.attrAsRelativeUrl("href")
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
preview = a.children().firstOrNull()?.extractPreview(),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getPageUrl(page: MangaPage): String {
|
||||
val doc = webClient.httpGet(page.url.toAbsoluteUrl(domain)).parseHtml()
|
||||
return doc.body().requireElementById("img").attrAsAbsoluteUrl("src")
|
||||
}
|
||||
|
||||
@Suppress("SpellCheckingInspection")
|
||||
private val tags: String
|
||||
get() = "ahegao,anal,angel,apron,bandages,bbw,bdsm,beauty mark,big areolae,big ass,big breasts,big clit,big lips," +
|
||||
"big nipples,bikini,blackmail,bloomers,blowjob,bodysuit,bondage,breast expansion,bukkake,bunny girl,business suit," +
|
||||
"catgirl,centaur,cheating,chinese dress,christmas,collar,corset,cosplaying,cowgirl,crossdressing,cunnilingus," +
|
||||
"dark skin,daughter,deepthroat,defloration,demon girl,double penetration,dougi,dragon,drunk,elf,exhibitionism,farting," +
|
||||
"females only,femdom,filming,fingering,fishnets,footjob,fox girl,furry,futanari,garter belt,ghost,giantess," +
|
||||
"glasses,gloves,goblin,gothic lolita,growth,guro,gyaru,hair buns,hairy,hairy armpits,handjob,harem,hidden sex," +
|
||||
"horns,huge breasts,humiliation,impregnation,incest,inverted nipples,kemonomimi,kimono,kissing,lactation," +
|
||||
"latex,leg lock,leotard,lingerie,lizard girl,maid,masked face,masturbation,midget,miko,milf,mind break," +
|
||||
"mind control,monster girl,mother,muscle,nakadashi,netorare,nose hook,nun,nurse,oil,paizuri,panda girl," +
|
||||
"pantyhose,piercing,pixie cut,policewoman,ponytail,pregnant,rape,rimjob,robot,scat,lolicon,schoolgirl uniform," +
|
||||
"sex toys,shemale,sister,small breasts,smell,sole dickgirl,sole female,squirting,stockings,sundress,sweating," +
|
||||
"swimsuit,swinging,tail,tall girl,teacher,tentacles,thigh high boots,tomboy,transformation,twins,twintails," +
|
||||
"unusual pupils,urination,vore,vtuber,widow,wings,witch,wolf girl,x-ray,yuri,zombie,sole male,males only,yaoi," +
|
||||
"tomgirl,tall man,oni,shotacon,prostate massage,policeman,males only,huge penis,fox boy,feminization,dog boy,dickgirl on male,big penis"
|
||||
|
||||
private fun mapTags(): Set<MangaTag> {
|
||||
val tagElements = tags.split(",")
|
||||
val result = ArraySet<MangaTag>(tagElements.size)
|
||||
for (tag in tagElements) {
|
||||
val el = tag.trim()
|
||||
if (el.isEmpty()) continue
|
||||
result += MangaTag(
|
||||
title = el.toTitleCase(Locale.ENGLISH),
|
||||
key = el,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
val response = chain.proceed(chain.request())
|
||||
if (response.headersContentLength(BANNED_RESPONSE_LENGTH) <= BANNED_RESPONSE_LENGTH) {
|
||||
val text = response.peekBody(BANNED_RESPONSE_LENGTH).use { it.string() }
|
||||
if (text.contains("IP address has been temporarily banned", ignoreCase = true)) {
|
||||
val hours = Regex("([0-9]+) hours?").find(text)?.groupValues?.getOrNull(1)?.toLongOrNull() ?: 0
|
||||
val minutes = Regex("([0-9]+) minutes?").find(text)?.groupValues?.getOrNull(1)?.toLongOrNull() ?: 0
|
||||
val seconds = Regex("([0-9]+) seconds?").find(text)?.groupValues?.getOrNull(1)?.toLongOrNull() ?: 0
|
||||
response.closeQuietly()
|
||||
throw TooManyRequestExceptions(
|
||||
url = response.request.url.toString(),
|
||||
retryAfter = TimeUnit.HOURS.toMillis(hours)
|
||||
+ TimeUnit.MINUTES.toMillis(minutes)
|
||||
+ TimeUnit.SECONDS.toMillis(seconds),
|
||||
)
|
||||
}
|
||||
}
|
||||
val imageRect = response.request.url.fragment?.split(',')
|
||||
if (imageRect != null && imageRect.size == 4) {
|
||||
// rect: top,left,right,bottom
|
||||
return context.redrawImageResponse(response) { bitmap ->
|
||||
val srcRect = Rect(
|
||||
left = imageRect[0].toInt(),
|
||||
top = imageRect[1].toInt(),
|
||||
right = imageRect[2].toInt(),
|
||||
bottom = imageRect[3].toInt(),
|
||||
)
|
||||
val dstRect = Rect(0, 0, srcRect.width, srcRect.height)
|
||||
val result = context.createBitmap(dstRect.width, dstRect.height)
|
||||
result.drawBitmap(bitmap, srcRect, dstRect)
|
||||
result
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
private fun Locale.toLanguagePath() = when (language) {
|
||||
else -> getDisplayLanguage(Locale.ENGLISH).lowercase()
|
||||
}
|
||||
|
||||
override suspend fun getUsername(): String {
|
||||
val doc = webClient.httpGet("https://forums.$DOMAIN_UNAUTHORIZED/").parseHtml().body()
|
||||
val username = doc.getElementById("userlinks")
|
||||
?.getElementsByAttributeValueContaining("href", "showuser=")
|
||||
?.firstOrNull()
|
||||
?.ownText()
|
||||
?: if (doc.getElementById("userlinksguest") != null) {
|
||||
throw AuthRequiredException(source)
|
||||
} else {
|
||||
doc.parseFailed()
|
||||
}
|
||||
return username
|
||||
}
|
||||
|
||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||
super.onCreateConfig(keys)
|
||||
keys.add(userAgentKey)
|
||||
keys.add(suspiciousContentKey)
|
||||
}
|
||||
|
||||
override suspend fun getRelatedManga(seed: Manga): List<Manga> {
|
||||
val query = seed.title
|
||||
return getListPage(
|
||||
page = 0,
|
||||
order = defaultSortOrder,
|
||||
filter = MangaListFilter(query = query),
|
||||
)
|
||||
}
|
||||
|
||||
private fun isAuthorized(domain: String): Boolean {
|
||||
val cookies = context.cookieJar.getCookies(domain).mapToSet { x -> x.name }
|
||||
return authCookies.all { it in cookies }
|
||||
}
|
||||
|
||||
private fun Element.parseRating(): Float {
|
||||
return runCatching {
|
||||
val style = requireNotNull(attr("style"))
|
||||
val (v1, v2) = ratingPattern.findAll(style).toList()
|
||||
var p1 = v1.groupValues.first().dropLast(2).toInt()
|
||||
val p2 = v2.groupValues.first().dropLast(2).toInt()
|
||||
if (p2 != -1) {
|
||||
p1 += 8
|
||||
}
|
||||
(80 - p1) / 80f
|
||||
}.getOrDefault(RATING_UNKNOWN)
|
||||
}
|
||||
|
||||
private fun String.cleanupTitle(): String {
|
||||
return replace(titleCleanupPattern, "")
|
||||
.replace(spacesCleanupPattern, "")
|
||||
}
|
||||
|
||||
private fun Element.parseTags(): Set<MangaTag> {
|
||||
|
||||
fun Element.parseTag() = textOrNull()?.let {
|
||||
MangaTag(title = it.toTitleCase(Locale.ENGLISH), key = it, source = source)
|
||||
}
|
||||
|
||||
val result = ArraySet<MangaTag>()
|
||||
for (prefix in TAG_PREFIXES) {
|
||||
getElementsByAttributeValueStarting("id", "ta_$prefix").mapNotNullTo(result, Element::parseTag)
|
||||
getElementsByAttributeValueStarting("title", prefix).mapNotNullTo(result, Element::parseTag)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
private fun Element.extractPreview(): String? {
|
||||
val bg = backgroundOrNull() ?: return null
|
||||
return buildString {
|
||||
append(bg.url)
|
||||
append('#')
|
||||
// rect: left,top,right,bottom
|
||||
append(bg.left)
|
||||
append(',')
|
||||
append(bg.top)
|
||||
append(',')
|
||||
append(bg.right)
|
||||
append(',')
|
||||
append(bg.bottom)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getNextTimestamp(root: Element): Long {
|
||||
return root.getElementById("unext")
|
||||
?.attrAsAbsoluteUrlOrNull("href")
|
||||
?.toHttpUrlOrNull()
|
||||
?.queryParameter("next")
|
||||
?.toLongOrNull() ?: 1
|
||||
}
|
||||
|
||||
private fun MangaListFilter.toSearchQuery(): String? {
|
||||
if (isEmpty()) {
|
||||
return null
|
||||
}
|
||||
val joiner = StringUtil.StringJoiner(" ")
|
||||
if (!query.isNullOrEmpty()) {
|
||||
joiner.add(query)
|
||||
}
|
||||
for (tag in tags) {
|
||||
if (tag.key.isNumeric()) {
|
||||
continue
|
||||
}
|
||||
joiner.add("tag:\"")
|
||||
joiner.append(tag.key)
|
||||
joiner.append("\"$")
|
||||
}
|
||||
for (tag in tagsExclude) {
|
||||
if (tag.key.isNumeric()) {
|
||||
continue
|
||||
}
|
||||
joiner.add("-tag:\"")
|
||||
joiner.append(tag.key)
|
||||
joiner.append("\"$")
|
||||
}
|
||||
locale?.let { lc ->
|
||||
joiner.add("language:\"")
|
||||
joiner.append(lc.toLanguagePath())
|
||||
joiner.append("\"$")
|
||||
}
|
||||
if (!author.isNullOrEmpty()) {
|
||||
joiner.add("artist:\"")
|
||||
joiner.append(author)
|
||||
joiner.append("\"$")
|
||||
}
|
||||
return joiner.complete().nullIfEmpty()
|
||||
}
|
||||
|
||||
private fun Collection<ContentType>.toFCats(): Int = fold(0) { acc, ct ->
|
||||
val cat: Int = when (ct) {
|
||||
ContentType.DOUJINSHI -> 2
|
||||
ContentType.MANGA -> 4
|
||||
ContentType.ARTIST_CG -> 8
|
||||
ContentType.GAME_CG -> 16
|
||||
ContentType.COMICS -> 512
|
||||
ContentType.IMAGE_SET -> 32
|
||||
else -> 449 // 1 or 64 or 128 or 256
|
||||
}
|
||||
acc or cat
|
||||
}
|
||||
|
||||
private fun checkAuth(): Boolean {
|
||||
val authorized = isAuthorized(DOMAIN_UNAUTHORIZED)
|
||||
if (authorized) {
|
||||
if (!isAuthorized(DOMAIN_AUTHORIZED)) {
|
||||
context.cookieJar.copyCookies(
|
||||
DOMAIN_UNAUTHORIZED,
|
||||
DOMAIN_AUTHORIZED,
|
||||
authCookies,
|
||||
)
|
||||
context.cookieJar.insertCookies(DOMAIN_AUTHORIZED, "yay=louder")
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,773 @@
|
||||
package org.koitharu.kotatsu.parsers.site.all
|
||||
|
||||
import androidx.collection.ArraySet
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.sync.Mutex
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
import okhttp3.Headers
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import org.jsoup.Jsoup
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.core.AbstractMangaParser
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import org.koitharu.kotatsu.parsers.util.json.getStringOrNull
|
||||
import org.koitharu.kotatsu.parsers.util.json.mapJSON
|
||||
import org.koitharu.kotatsu.parsers.util.suspendlazy.suspendLazy
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
import java.security.MessageDigest
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.EnumSet
|
||||
import java.util.LinkedList
|
||||
import java.util.Locale
|
||||
import kotlin.math.min
|
||||
|
||||
@OptIn(ExperimentalUnsignedTypes::class)
|
||||
@MangaSourceParser("HITOMILA", "Hitomi.La", type = ContentType.HENTAI)
|
||||
internal class HitomiLaParser(context: MangaLoaderContext) : AbstractMangaParser(context, MangaParserSource.HITOMILA) {
|
||||
override val configKeyDomain = ConfigKey.Domain("hitomi.la")
|
||||
|
||||
private val cdnDomain = "gold-usergeneratedcontent.net"
|
||||
|
||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||
super.onCreateConfig(keys)
|
||||
keys.add(userAgentKey)
|
||||
}
|
||||
|
||||
private val ltnBaseUrl get() = "https://ltn.$cdnDomain"
|
||||
|
||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(
|
||||
SortOrder.NEWEST,
|
||||
SortOrder.POPULARITY_TODAY,
|
||||
SortOrder.POPULARITY_WEEK,
|
||||
SortOrder.POPULARITY_MONTH,
|
||||
SortOrder.POPULARITY_YEAR,
|
||||
)
|
||||
|
||||
private val localeMap: Map<Locale, String> = mapOf(
|
||||
Locale.forLanguageTag("id") to "indonesian",
|
||||
Locale.forLanguageTag("jv") to "javanese",
|
||||
Locale.forLanguageTag("ca") to "catalan",
|
||||
Locale.forLanguageTag("ceb") to "cebuano",
|
||||
Locale.forLanguageTag("cs") to "czech",
|
||||
Locale.forLanguageTag("da") to "danish",
|
||||
Locale.forLanguageTag("de") to "german",
|
||||
Locale.forLanguageTag("et") to "estonian",
|
||||
Locale.ENGLISH to "english",
|
||||
Locale.forLanguageTag("es") to "spanish",
|
||||
Locale.forLanguageTag("eo") to "esperanto",
|
||||
Locale.forLanguageTag("fr") to "french",
|
||||
Locale.forLanguageTag("it") to "italian",
|
||||
Locale.forLanguageTag("hi") to "hindi",
|
||||
Locale.forLanguageTag("hu") to "hungarian",
|
||||
Locale.forLanguageTag("pl") to "polish",
|
||||
Locale.forLanguageTag("pt") to "portuguese",
|
||||
Locale.forLanguageTag("vi") to "vietnamese",
|
||||
Locale.forLanguageTag("tr") to "turkish",
|
||||
Locale.forLanguageTag("ru") to "russian",
|
||||
Locale.forLanguageTag("uk") to "ukrainian",
|
||||
Locale.forLanguageTag("ar") to "arabic",
|
||||
Locale.KOREAN to "korean",
|
||||
Locale.CHINESE to "chinese",
|
||||
Locale.JAPANESE to "japanese",
|
||||
)
|
||||
override val filterCapabilities: MangaListFilterCapabilities
|
||||
get() = MangaListFilterCapabilities(
|
||||
isMultipleTagsSupported = true,
|
||||
isSearchSupported = true,
|
||||
)
|
||||
|
||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||
availableTags = fetchAvailableTags(),
|
||||
availableLocales = localeMap.keys,
|
||||
)
|
||||
|
||||
private fun Locale?.getSiteLang(): String = when (this) {
|
||||
null -> "all"
|
||||
else -> localeMap[this] ?: "all"
|
||||
}
|
||||
|
||||
private suspend fun fetchAvailableTags(): Set<MangaTag> = coroutineScope {
|
||||
('a'..'z').map { alphabet ->
|
||||
async {
|
||||
val doc = webClient.httpGet("https://$domain/alltags-$alphabet.html").parseHtml()
|
||||
|
||||
doc.select(".posts > li").mapNotNull { element ->
|
||||
val num =
|
||||
element.ownText().let {
|
||||
Regex("""\((\d+)\)""").find(it)?.groupValues?.get(1)?.toIntOrNull() ?: 0
|
||||
}
|
||||
|
||||
if (num > 100) {
|
||||
val url = element.selectFirst("a")
|
||||
val href =
|
||||
url?.attrAsRelativeUrl("href")
|
||||
?: return@mapNotNull null
|
||||
|
||||
MangaTag(
|
||||
title = url.ownText().toTagTitle(),
|
||||
key = href.tagUrlToTag(),
|
||||
source = source,
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}.awaitAll().flatten().toSet()
|
||||
}
|
||||
|
||||
private var cachedSearchIds: List<Int> = emptyList()
|
||||
|
||||
override suspend fun getList(offset: Int, order: SortOrder, filter: MangaListFilter): List<Manga> = when {
|
||||
filter.query.isNullOrEmpty() -> {
|
||||
|
||||
if (filter.tags.isEmpty()) {
|
||||
when (order) {
|
||||
SortOrder.POPULARITY_TODAY -> {
|
||||
getGalleryIDsFromNozomi(
|
||||
"popular",
|
||||
"today",
|
||||
filter.locale.getSiteLang(),
|
||||
offset.nextOffsetRange(),
|
||||
)
|
||||
}
|
||||
|
||||
SortOrder.POPULARITY_WEEK -> {
|
||||
getGalleryIDsFromNozomi(
|
||||
"popular",
|
||||
"week",
|
||||
filter.locale.getSiteLang(),
|
||||
offset.nextOffsetRange(),
|
||||
)
|
||||
}
|
||||
|
||||
SortOrder.POPULARITY_MONTH -> {
|
||||
getGalleryIDsFromNozomi(
|
||||
"popular",
|
||||
"month",
|
||||
filter.locale.getSiteLang(),
|
||||
offset.nextOffsetRange(),
|
||||
)
|
||||
}
|
||||
|
||||
SortOrder.POPULARITY_YEAR -> {
|
||||
getGalleryIDsFromNozomi(
|
||||
"popular",
|
||||
"year",
|
||||
filter.locale.getSiteLang(),
|
||||
offset.nextOffsetRange(),
|
||||
)
|
||||
}
|
||||
|
||||
else -> {
|
||||
getGalleryIDsFromNozomi(null, "index", filter.locale.getSiteLang(), offset.nextOffsetRange())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (offset == 0) {
|
||||
cachedSearchIds =
|
||||
hitomiSearch(
|
||||
filter.tags.joinToString(" ") { it.key },
|
||||
order,
|
||||
filter.locale.getSiteLang(),
|
||||
).toList()
|
||||
}
|
||||
cachedSearchIds.subList(offset, min(offset + 25, cachedSearchIds.size))
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
if (offset == 0) {
|
||||
cachedSearchIds = hitomiSearch(filter.query, order).toList()
|
||||
}
|
||||
cachedSearchIds.subList(offset, min(offset + 25, cachedSearchIds.size))
|
||||
}
|
||||
}.toMangaList()
|
||||
|
||||
private fun Int.nextOffsetRange(): LongRange {
|
||||
val bytes = this * 4L
|
||||
return bytes.until(bytes + 100L)
|
||||
}
|
||||
|
||||
private suspend fun hitomiSearch(
|
||||
query: String,
|
||||
sortByPopularity: SortOrder = SortOrder.UPDATED,
|
||||
language: String = "all",
|
||||
): Set<Int> =
|
||||
coroutineScope {
|
||||
val terms = query
|
||||
.trim()
|
||||
.replace(Regex("""^\?"""), "")
|
||||
.lowercase()
|
||||
.splitByWhitespace()
|
||||
.map {
|
||||
it.replace('_', ' ')
|
||||
}
|
||||
|
||||
val positiveTerms = LinkedList<String>()
|
||||
val negativeTerms = LinkedList<String>()
|
||||
|
||||
for (term in terms) {
|
||||
if (term.startsWith("-")) {
|
||||
negativeTerms.push(term.removePrefix("-"))
|
||||
} else if (term.isNotBlank()) {
|
||||
positiveTerms.push(term)
|
||||
}
|
||||
}
|
||||
|
||||
val positiveResults = positiveTerms.map {
|
||||
async {
|
||||
runCatchingCancellable {
|
||||
getGalleryIDsForQuery(it, language)
|
||||
}.getOrDefault(emptySet())
|
||||
}
|
||||
}
|
||||
|
||||
val negativeResults = negativeTerms.map {
|
||||
async {
|
||||
runCatchingCancellable {
|
||||
getGalleryIDsForQuery(it, language)
|
||||
}.getOrDefault(emptySet())
|
||||
}
|
||||
}
|
||||
|
||||
val results = when {
|
||||
sortByPopularity == SortOrder.UPDATED -> getGalleryIDsFromNozomi(null, "index", language)
|
||||
sortByPopularity == SortOrder.POPULARITY_TODAY -> getGalleryIDsFromNozomi("popular", "today", language)
|
||||
sortByPopularity == SortOrder.POPULARITY_WEEK -> getGalleryIDsFromNozomi("popular", "week", language)
|
||||
sortByPopularity == SortOrder.POPULARITY_MONTH -> getGalleryIDsFromNozomi("popular", "month", language)
|
||||
sortByPopularity == SortOrder.POPULARITY_YEAR -> getGalleryIDsFromNozomi("popular", "year", language)
|
||||
positiveTerms.isEmpty() -> getGalleryIDsFromNozomi(null, "index", language)
|
||||
else -> emptySet()
|
||||
}.toMutableSet()
|
||||
|
||||
fun filterPositive(newResults: Set<Int>) {
|
||||
when {
|
||||
results.isEmpty() -> results.addAll(newResults)
|
||||
else -> results.retainAll(newResults)
|
||||
}
|
||||
}
|
||||
|
||||
fun filterNegative(newResults: Set<Int>) {
|
||||
results.removeAll(newResults)
|
||||
}
|
||||
|
||||
// positive results
|
||||
positiveResults.forEach {
|
||||
filterPositive(it.await())
|
||||
}
|
||||
|
||||
// negative results
|
||||
negativeResults.forEach {
|
||||
filterNegative(it.await())
|
||||
}
|
||||
|
||||
results
|
||||
}
|
||||
|
||||
// search.js
|
||||
private suspend fun getGalleryIDsForQuery(
|
||||
query: String,
|
||||
language: String = "all",
|
||||
): Set<Int> {
|
||||
query.replace("_", " ").let {
|
||||
if (it.indexOf(':') > -1) {
|
||||
val sides = it.split(":")
|
||||
val ns = sides[0]
|
||||
var tag = sides[1]
|
||||
|
||||
var area: String? = ns
|
||||
var lang = language
|
||||
when (ns) {
|
||||
"female", "male" -> {
|
||||
area = "tag"
|
||||
tag = it
|
||||
}
|
||||
|
||||
"language" -> {
|
||||
area = null
|
||||
lang = tag
|
||||
tag = "index"
|
||||
}
|
||||
}
|
||||
|
||||
return getGalleryIDsFromNozomi(area, tag, lang)
|
||||
}
|
||||
|
||||
val key = hashTerm(it)
|
||||
val node = getGalleryNodeAtAddress(0)
|
||||
val data = bSearch(key, node) ?: return emptySet()
|
||||
|
||||
return getGalleryIDsFromData(data)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun getGalleryIDsFromData(data: Pair<Long, Int>): Set<Int> {
|
||||
val url = "$ltnBaseUrl/galleriesindex/galleries.${galleriesIndexVersion.get()}.data"
|
||||
val (offset, length) = data
|
||||
require(length in 1..100000000) {
|
||||
"Length $length is too long"
|
||||
}
|
||||
|
||||
val inbuf = getRangedResponse(url, offset.until(offset + length))
|
||||
|
||||
val galleryIDs = mutableSetOf<Int>()
|
||||
|
||||
val buffer =
|
||||
ByteBuffer
|
||||
.wrap(inbuf)
|
||||
.order(ByteOrder.BIG_ENDIAN)
|
||||
|
||||
val numberOfGalleryIDs = buffer.int
|
||||
|
||||
val expectedLength = numberOfGalleryIDs * 4 + 4
|
||||
|
||||
require(numberOfGalleryIDs in 1..10000000) {
|
||||
"number_of_galleryids $numberOfGalleryIDs is too long"
|
||||
}
|
||||
require(inbuf.size == expectedLength) {
|
||||
"inbuf.byteLength ${inbuf.size} != expected_length $expectedLength"
|
||||
}
|
||||
|
||||
for (i in 0.until(numberOfGalleryIDs))
|
||||
galleryIDs.add(buffer.int)
|
||||
|
||||
return galleryIDs
|
||||
}
|
||||
|
||||
private suspend fun bSearch(
|
||||
key: UByteArray,
|
||||
node: Node,
|
||||
): Pair<Long, Int>? {
|
||||
fun compareArrayBuffers(
|
||||
dv1: UByteArray,
|
||||
dv2: UByteArray,
|
||||
): Int {
|
||||
val top = min(dv1.size, dv2.size)
|
||||
|
||||
for (i in 0.until(top)) {
|
||||
if (dv1[i] < dv2[i]) {
|
||||
return -1
|
||||
} else if (dv1[i] > dv2[i]) {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
fun locateKey(
|
||||
key: UByteArray,
|
||||
node: Node,
|
||||
): Pair<Boolean, Int> {
|
||||
for (i in node.keys.indices) {
|
||||
val cmpResult = compareArrayBuffers(key, node.keys[i])
|
||||
|
||||
if (cmpResult <= 0) {
|
||||
return Pair(cmpResult == 0, i)
|
||||
}
|
||||
}
|
||||
|
||||
return Pair(false, node.keys.size)
|
||||
}
|
||||
|
||||
fun isLeaf(node: Node): Boolean {
|
||||
for (subnode in node.subNodeAddresses)
|
||||
if (subnode != 0L) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
if (node.keys.isEmpty()) {
|
||||
return null
|
||||
}
|
||||
|
||||
val (there, where) = locateKey(key, node)
|
||||
if (there) {
|
||||
return node.datas[where]
|
||||
} else if (isLeaf(node)) {
|
||||
return null
|
||||
}
|
||||
|
||||
val nextNode = getGalleryNodeAtAddress(node.subNodeAddresses[where])
|
||||
return bSearch(key, nextNode)
|
||||
}
|
||||
|
||||
private suspend fun getGalleryIDsFromNozomi(
|
||||
area: String?,
|
||||
tag: String,
|
||||
language: String,
|
||||
range: LongRange? = null,
|
||||
): Set<Int> {
|
||||
val nozomiAddress = when (area) {
|
||||
null -> "$ltnBaseUrl/$tag-$language.nozomi"
|
||||
else -> "$ltnBaseUrl/$area/$tag-$language.nozomi"
|
||||
}
|
||||
|
||||
val bytes = getRangedResponse(nozomiAddress, range)
|
||||
val nozomi = mutableSetOf<Int>()
|
||||
|
||||
val arrayBuffer = ByteBuffer
|
||||
.wrap(bytes)
|
||||
.order(ByteOrder.BIG_ENDIAN)
|
||||
|
||||
while (arrayBuffer.hasRemaining())
|
||||
nozomi.add(arrayBuffer.int)
|
||||
|
||||
return nozomi
|
||||
}
|
||||
|
||||
private val galleriesIndexVersion = suspendLazy {
|
||||
webClient.httpGet("$ltnBaseUrl/galleriesindex/version?_=${System.currentTimeMillis()}").parseRaw()
|
||||
}
|
||||
|
||||
private data class Node(
|
||||
val keys: List<UByteArray>,
|
||||
val datas: List<Pair<Long, Int>>,
|
||||
val subNodeAddresses: List<Long>,
|
||||
)
|
||||
|
||||
private fun decodeNode(data: ByteArray): Node {
|
||||
val buffer = ByteBuffer
|
||||
.wrap(data)
|
||||
.order(ByteOrder.BIG_ENDIAN)
|
||||
|
||||
val uData = data.toUByteArray()
|
||||
|
||||
val numberOfKeys = buffer.int
|
||||
val keys = ArrayList<UByteArray>()
|
||||
|
||||
for (i in 0.until(numberOfKeys)) {
|
||||
val keySize = buffer.int
|
||||
|
||||
check(keySize in 1..32) { "Invalid key size $keySize" }
|
||||
|
||||
keys.add(uData.sliceArray(buffer.position().until(buffer.position() + keySize)))
|
||||
buffer.position(buffer.position() + keySize)
|
||||
}
|
||||
|
||||
val numberOfDatas = buffer.int
|
||||
val datas = ArrayList<Pair<Long, Int>>()
|
||||
|
||||
for (i in 0.until(numberOfDatas)) {
|
||||
val offset = buffer.long
|
||||
val length = buffer.int
|
||||
|
||||
datas.add(Pair(offset, length))
|
||||
}
|
||||
|
||||
val numberOfSubNodeAddresses = 16 + 1
|
||||
val subNodeAddresses = ArrayList<Long>()
|
||||
|
||||
for (i in 0.until(numberOfSubNodeAddresses)) {
|
||||
val subNodeAddress = buffer.long
|
||||
subNodeAddresses.add(subNodeAddress)
|
||||
}
|
||||
|
||||
return Node(keys, datas, subNodeAddresses)
|
||||
}
|
||||
|
||||
private suspend fun getGalleryNodeAtAddress(address: Long): Node {
|
||||
val url = "$ltnBaseUrl/galleriesindex/galleries.${galleriesIndexVersion.get()}.index"
|
||||
|
||||
val nodedata = getRangedResponse(url, address.until(address + 464))
|
||||
|
||||
return decodeNode(nodedata)
|
||||
}
|
||||
|
||||
private suspend fun getRangedResponse(
|
||||
url: String,
|
||||
range: LongRange? = null,
|
||||
): ByteArray {
|
||||
val rangeHeaders = when (range) {
|
||||
null -> Headers.headersOf()
|
||||
else -> Headers.headersOf("Range", "bytes=${range.first}-${range.last}")
|
||||
}
|
||||
|
||||
return webClient.httpGet(url, rangeHeaders).parseBytes()
|
||||
}
|
||||
|
||||
private fun hashTerm(term: String): UByteArray {
|
||||
return sha256(term.toByteArray()).copyOfRange(0, 4).toUByteArray()
|
||||
}
|
||||
|
||||
private fun sha256(data: ByteArray): ByteArray {
|
||||
return MessageDigest.getInstance("SHA-256").digest(data)
|
||||
}
|
||||
|
||||
private suspend fun Collection<Int>.toMangaList(): List<Manga> = coroutineScope {
|
||||
map { id ->
|
||||
async {
|
||||
runCatchingCancellable {
|
||||
val doc = webClient.httpGet("$ltnBaseUrl/galleryblock/$id.html").let {
|
||||
val baseUri = it.request.url.toString()
|
||||
val html = it.parseRaw()
|
||||
Jsoup.parse(rewriteTnPaths(html), baseUri)
|
||||
}
|
||||
|
||||
Manga(
|
||||
id = generateUid(id.toString()),
|
||||
title = doc.selectFirstOrThrow("h1").text(),
|
||||
url = id.toString(),
|
||||
coverUrl =
|
||||
"https:" +
|
||||
doc.selectFirstOrThrow("picture > img")
|
||||
.attr("data-src"),
|
||||
publicUrl =
|
||||
doc.selectFirstOrThrow("h1 > a")
|
||||
.attrAsRelativeUrl("href")
|
||||
.toAbsoluteUrl(domain),
|
||||
authors = emptySet(),
|
||||
tags = emptySet(),
|
||||
contentRating = ContentRating.ADULT,
|
||||
rating = RATING_UNKNOWN,
|
||||
altTitles = emptySet(),
|
||||
state = null,
|
||||
source = source,
|
||||
)
|
||||
}.getOrNull()
|
||||
}
|
||||
}.awaitAll().filterNotNull()
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val json = webClient.httpGet("$ltnBaseUrl/galleries/${manga.url}.js")
|
||||
.parseRaw()
|
||||
.substringAfter("var galleryinfo = ")
|
||||
.let(::JSONObject)
|
||||
val author =
|
||||
json.optJSONArray("artists")
|
||||
?.mapJSON { it.getString("artist").toCamelCase() }
|
||||
?.joinToString()
|
||||
|
||||
return manga.copy(
|
||||
title = json.getString("title"),
|
||||
largeCoverUrl =
|
||||
json.getJSONArray("files").getJSONObject(0).let {
|
||||
val hash = it.getString("hash")
|
||||
val imageId = imageIdFromHash(hash)
|
||||
val subDomain = 'a' + subdomainOffset(imageId)
|
||||
|
||||
"https://${subDomain}tn.$cdnDomain/webpbigtn/${thumbPathFromHash(hash)}/$hash.webp"
|
||||
},
|
||||
authors = setOfNotNull(author),
|
||||
publicUrl = json.getString("galleryurl").toAbsoluteUrl(domain),
|
||||
tags =
|
||||
buildSet
|
||||
{
|
||||
json.optJSONArray("characters")
|
||||
?.mapToTags("character")
|
||||
?.let(::addAll)
|
||||
json.optJSONArray("tags")
|
||||
?.mapToTags("tag")
|
||||
?.let(::addAll)
|
||||
json.optJSONArray("artists")
|
||||
?.mapToTags("artist")
|
||||
?.let(::addAll)
|
||||
json.optJSONArray("parodys")
|
||||
?.mapToTags("parody")
|
||||
?.let(::addAll)
|
||||
json.optJSONArray("groups")
|
||||
?.mapToTags("group")
|
||||
?.let(::addAll)
|
||||
},
|
||||
chapters = listOf(
|
||||
MangaChapter(
|
||||
id = generateUid(manga.url),
|
||||
url = manga.url,
|
||||
title = json.getStringOrNull("title"),
|
||||
scanlator = json.getString("type").toTitleCase(),
|
||||
number = 1f,
|
||||
volume = 0,
|
||||
branch = json.getString("language_localname"),
|
||||
source = source,
|
||||
uploadDate = dateFormat.parseSafe(json.getString("date").substringBeforeLast("-")),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
private val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH)
|
||||
|
||||
private fun JSONArray.mapToTags(key: String): Set<MangaTag> {
|
||||
val tags = ArraySet<MangaTag>(length())
|
||||
mapJSON {
|
||||
MangaTag(
|
||||
title =
|
||||
it.getString(key).toCamelCase().let { title ->
|
||||
if (it.getStringOrNull("female")?.toIntOrNull() == 1) {
|
||||
"$title ♀"
|
||||
} else if (it.getStringOrNull("male")?.toIntOrNull() == 1) {
|
||||
"$title ♂"
|
||||
} else {
|
||||
title
|
||||
}
|
||||
},
|
||||
key = it.getString("url").tagUrlToTag(),
|
||||
source = source,
|
||||
).let(tags::add)
|
||||
}
|
||||
return tags
|
||||
}
|
||||
|
||||
private fun String.tagUrlToTag(): String {
|
||||
val urlContent = this.split("/")
|
||||
val ns = urlContent[1]
|
||||
val tag =
|
||||
urlContent[2]
|
||||
.substringBeforeLast("-")
|
||||
.urlDecode()
|
||||
.replace(" ", "_")
|
||||
|
||||
return if (tag.split(":")[0] in listOf("female", "male")) {
|
||||
tag
|
||||
} else {
|
||||
"$ns:$tag"
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getRelatedManga(seed: Manga): List<Manga> {
|
||||
val json = webClient.httpGet("$ltnBaseUrl/galleries/${seed.url}.js")
|
||||
.parseRaw()
|
||||
.substringAfter("var galleryinfo = ")
|
||||
.let(::JSONObject)
|
||||
|
||||
// any better way to get List<Int> from this json?
|
||||
return json.getJSONArray("related").let {
|
||||
0.until(it.length()).map { i -> it.getInt(i) }
|
||||
}.toMangaList()
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val json = webClient.httpGet("$ltnBaseUrl/galleries/${chapter.url}.js")
|
||||
.parseRaw()
|
||||
.substringAfter("var galleryinfo = ")
|
||||
.let(::JSONObject)
|
||||
|
||||
return json.getJSONArray("files").mapJSON { image ->
|
||||
val hash = image.getString("hash")
|
||||
val commonId = commonImageId()
|
||||
val imageId = imageIdFromHash(hash)
|
||||
val subDomain = subdomainOffset(imageId) + 1
|
||||
val thumbSubdomain = 'a' + subdomainOffset(imageId)
|
||||
MangaPage(
|
||||
id = generateUid(hash),
|
||||
url = "https://a${subDomain}.$cdnDomain/$commonId$imageId/$hash.avif",
|
||||
preview = "https://${thumbSubdomain}tn.$cdnDomain/webpsmallsmalltn/${thumbPathFromHash(hash)}/$hash.webp",
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// / --->
|
||||
|
||||
private var scriptLastRetrieval: Long = -1L
|
||||
private val mutex = Mutex()
|
||||
private var subdomainOffsetDefault = 0
|
||||
private val subdomainOffsetMap = mutableMapOf<Int, Int>()
|
||||
private var commonImageId = ""
|
||||
|
||||
private suspend fun refreshScript() = mutex.withLock {
|
||||
if (scriptLastRetrieval == -1L || (scriptLastRetrieval + 60000) < System.currentTimeMillis()) {
|
||||
val ggScript = webClient.httpGet("$ltnBaseUrl/gg.js?_=${System.currentTimeMillis()}").parseRaw()
|
||||
|
||||
subdomainOffsetDefault = Regex("var o = (\\d)").find(ggScript)!!.groupValues[1].toInt()
|
||||
val o = Regex("o = (\\d); break;").find(ggScript)!!.groupValues[1].toInt()
|
||||
|
||||
subdomainOffsetMap.clear()
|
||||
Regex("case (\\d+):").findAll(ggScript).forEach {
|
||||
val case = it.groupValues[1].toInt()
|
||||
subdomainOffsetMap[case] = o
|
||||
}
|
||||
|
||||
commonImageId = Regex("b: '(.+)'").find(ggScript)!!.groupValues[1]
|
||||
|
||||
scriptLastRetrieval = System.currentTimeMillis()
|
||||
}
|
||||
}
|
||||
|
||||
// m <-- gg.js
|
||||
private suspend fun subdomainOffset(imageId: Int): Int {
|
||||
refreshScript()
|
||||
return subdomainOffsetMap[imageId] ?: subdomainOffsetDefault
|
||||
}
|
||||
|
||||
// b <-- gg.js
|
||||
private suspend fun commonImageId(): String {
|
||||
refreshScript()
|
||||
return commonImageId
|
||||
}
|
||||
|
||||
// s <-- gg.js
|
||||
private fun imageIdFromHash(hash: String): Int {
|
||||
val match = Regex("(..)(.)$").find(hash)
|
||||
return match!!.groupValues.let { it[2] + it[1] }.toInt(16)
|
||||
}
|
||||
|
||||
// real_full_path_from_hash <-- common.js
|
||||
private fun thumbPathFromHash(hash: String): String {
|
||||
return hash.replace(Regex("""^.*(..)(.)$"""), "$2/$1")
|
||||
}
|
||||
|
||||
// rewrite_tn_paths <-- common.js
|
||||
private suspend fun rewriteTnPaths(html: String): String {
|
||||
val thumbUrlRegex = Regex(
|
||||
"""(?<protocol>//)(?<host>[a-z0-9.-]+\.(?:hitomi\.la|${Regex.escape(cdnDomain)}))/(?<pathAfterHost>(?:avif|webp)?(?:small)?(?:big|small|medium)tn/[0-9a-f]/[0-9a-f]{2}/[0-9a-f]{64}\.(?:webp|avif|gif|png|jpe?g))""",
|
||||
)
|
||||
|
||||
var resultHtml = html
|
||||
thumbUrlRegex.findAll(html).forEach { matchResult ->
|
||||
val originalUrl = matchResult.value
|
||||
val groups = matchResult.groups
|
||||
|
||||
val pathAfterHost = groups["pathAfterHost"]?.value ?: return@forEach
|
||||
val newTnSubdomain = subdomainFromURL(originalUrl, "tn")
|
||||
val correctedUrl = "${groups["protocol"]!!.value}$newTnSubdomain.$cdnDomain/$pathAfterHost"
|
||||
|
||||
if (originalUrl != correctedUrl) {
|
||||
resultHtml = resultHtml.replace(originalUrl, correctedUrl)
|
||||
}
|
||||
}
|
||||
return resultHtml
|
||||
}
|
||||
|
||||
private suspend fun subdomainFromURL(url: String, base: String?): String {
|
||||
val resultSubdomain = base ?: "b"
|
||||
|
||||
// This regex extracts the last 3 hex characters from the hash in the URL
|
||||
// The hash is 64 characters, so we look for the 61st character onward
|
||||
val hashRegex = Regex("""/([0-9a-f]{61}[0-9a-f]{3})[./]""")
|
||||
val fullHashMatch = hashRegex.find(url)
|
||||
?: // If no hash is found, default to "a" + base (typically "atn")
|
||||
return "a$resultSubdomain"
|
||||
|
||||
val fullHash = fullHashMatch.groupValues[1]
|
||||
|
||||
val lastThreeChars = fullHash.takeLast(3)
|
||||
val lastDigit = lastThreeChars.last()
|
||||
val lastTwoDigits = lastThreeChars.take(2)
|
||||
|
||||
val imageId = "$lastDigit$lastTwoDigits".toIntOrNull(16)
|
||||
|
||||
return if (imageId != null) {
|
||||
('a' + subdomainOffset(imageId)).toString() + resultSubdomain
|
||||
} else {
|
||||
"a$resultSubdomain"
|
||||
}
|
||||
}
|
||||
|
||||
private fun String.toTagTitle(): String {
|
||||
return toCamelCase()
|
||||
.replace("♂", "(male)")
|
||||
.replace("♀", "(female)")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package org.koitharu.kotatsu.parsers.site.all
|
||||
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.core.PagedMangaParser
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.generateUid
|
||||
import org.koitharu.kotatsu.parsers.util.parseHtml
|
||||
import org.koitharu.kotatsu.parsers.util.selectFirstOrThrow
|
||||
import org.koitharu.kotatsu.parsers.util.parseSafe
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
|
||||
@MangaSourceParser("HOLOEARTH", "HoloEarth")
|
||||
internal class HoloEarthParser(context: MangaLoaderContext) :
|
||||
PagedMangaParser(context, MangaParserSource.HOLOEARTH, 3) {
|
||||
|
||||
override val configKeyDomain: ConfigKey.Domain
|
||||
get() = ConfigKey.Domain("holoearth.com")
|
||||
|
||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||
super.onCreateConfig(keys)
|
||||
keys.add(userAgentKey)
|
||||
}
|
||||
|
||||
override val availableSortOrders: Set<SortOrder> = setOf(SortOrder.NEWEST)
|
||||
|
||||
override val filterCapabilities: MangaListFilterCapabilities
|
||||
get() = MangaListFilterCapabilities(
|
||||
isSearchSupported = false,
|
||||
)
|
||||
|
||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||
availableLocales = setOf(
|
||||
Locale("en"),
|
||||
Locale.JAPANESE,
|
||||
Locale("id"),
|
||||
),
|
||||
)
|
||||
|
||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||
val url = buildString {
|
||||
append("https://$domain")
|
||||
|
||||
filter.locale?.let {
|
||||
append(
|
||||
when (it) {
|
||||
Locale("en") -> "/en"
|
||||
Locale.JAPANESE -> ""
|
||||
Locale("id") -> "/id"
|
||||
else -> "" // default
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
append("/alt/holonometria/manga")
|
||||
}
|
||||
|
||||
val doc = webClient.httpGet(url).parseHtml()
|
||||
val root = doc.body().selectFirstOrThrow(".manga__list")
|
||||
val mangaList = root.select("li .manga__item-inner")
|
||||
|
||||
if (mangaList.isEmpty()) return emptyList()
|
||||
|
||||
return mangaList.mapNotNull { li ->
|
||||
val coverUrl = li.getElementsByTag("img").attr("src")
|
||||
val title = li.getElementsByClass("manga__title").text()
|
||||
val altTitle = li.getElementsByClass("manga__copy").text()
|
||||
val description = li.getElementsByClass("manga__caption").text()
|
||||
val url = li.getElementsByTag("a").attr("href")
|
||||
|
||||
Manga(
|
||||
id = generateUid(url),
|
||||
title = title,
|
||||
altTitles = setOf(altTitle),
|
||||
url = url,
|
||||
publicUrl = url,
|
||||
rating = RATING_UNKNOWN,
|
||||
contentRating = null,
|
||||
coverUrl = coverUrl,
|
||||
tags = emptySet(),
|
||||
state = null,
|
||||
authors = emptySet(),
|
||||
source = source,
|
||||
description = description,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val doc = webClient.httpGet(manga.url).parseHtml()
|
||||
val dateFormat = SimpleDateFormat("yyyy.MM.dd", Locale.US)
|
||||
val root = doc.body().selectFirstOrThrow(".manga-detail__wrapper")
|
||||
val coverUrl = root.selectFirstOrThrow(".manga-detail__thumb img").attr("src")
|
||||
val chapters = root.select(".manga-detail__list-item")
|
||||
val mangaChapters = chapters.mapIndexed { index, li ->
|
||||
val url = li.selectFirstOrThrow(".manga-detail__list-link").attr("href")
|
||||
val title = li.selectFirstOrThrow(".manga-detail__list-title").text()
|
||||
val dateStr = li.selectFirstOrThrow(".manga-detail__list-date").text()
|
||||
val uploadDate = dateFormat.parseSafe(dateStr) ?: 0L
|
||||
val scanlator = root.selectFirst(".manga-detail__person")?.text()
|
||||
|
||||
MangaChapter(
|
||||
id = generateUid(url),
|
||||
title = title,
|
||||
number = index + 1f,
|
||||
volume = 0,
|
||||
url = url,
|
||||
scanlator = scanlator,
|
||||
uploadDate = uploadDate,
|
||||
branch = null,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
|
||||
return manga.copy(
|
||||
coverUrl = coverUrl,
|
||||
chapters = mangaChapters,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val doc = webClient.httpGet(chapter.url).parseHtml()
|
||||
val imageList = doc.body().selectFirstOrThrow(".manga-detail__swiper-wrapper")
|
||||
val images = imageList.select(".manga-detail__swiper-slide").reversed()
|
||||
|
||||
return images.mapNotNull { page ->
|
||||
val img = page.selectFirst("img") ?: return@mapNotNull null
|
||||
val src = img.attr("src")
|
||||
MangaPage(
|
||||
id = generateUid(src),
|
||||
url = src,
|
||||
preview = src,
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
package org.koitharu.kotatsu.parsers.site.all
|
||||
|
||||
import androidx.collection.ArraySet
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import org.jsoup.nodes.Element
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.core.PagedMangaParser
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.util.*
|
||||
|
||||
@MangaSourceParser("IMHENTAI", "ImHentai", type = ContentType.HENTAI)
|
||||
internal class ImHentai(context: MangaLoaderContext) :
|
||||
PagedMangaParser(context, MangaParserSource.IMHENTAI, pageSize = 20) {
|
||||
|
||||
override val availableSortOrders: Set<SortOrder> =
|
||||
EnumSet.of(SortOrder.UPDATED, SortOrder.POPULARITY, SortOrder.RATING)
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain("imhentai.xxx")
|
||||
|
||||
override val filterCapabilities: MangaListFilterCapabilities
|
||||
get() = MangaListFilterCapabilities(
|
||||
isMultipleTagsSupported = true,
|
||||
isSearchSupported = true,
|
||||
)
|
||||
|
||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||
availableTags = fetchAvailableTags(),
|
||||
availableLocales = setOf(
|
||||
Locale.ENGLISH,
|
||||
Locale.JAPANESE,
|
||||
Locale("es"),
|
||||
Locale.FRENCH,
|
||||
Locale("kr"),
|
||||
Locale.GERMAN,
|
||||
Locale("ru"),
|
||||
),
|
||||
availableContentTypes = EnumSet.of(
|
||||
ContentType.MANGA,
|
||||
ContentType.DOUJINSHI,
|
||||
ContentType.COMICS,
|
||||
ContentType.IMAGE_SET,
|
||||
ContentType.ARTIST_CG,
|
||||
ContentType.GAME_CG,
|
||||
),
|
||||
)
|
||||
|
||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||
super.onCreateConfig(keys)
|
||||
keys.add(userAgentKey)
|
||||
}
|
||||
|
||||
override suspend fun getListPage(
|
||||
page: Int,
|
||||
order: SortOrder,
|
||||
filter: MangaListFilter,
|
||||
): List<Manga> {
|
||||
val url = buildString {
|
||||
append("https://")
|
||||
append(domain)
|
||||
append("/search/?page=")
|
||||
append(page.toString())
|
||||
when {
|
||||
!filter.query.isNullOrEmpty() -> {
|
||||
append("&key=")
|
||||
append(filter.query.urlEncoded())
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
||||
if (filter.tags.isNotEmpty()) {
|
||||
append("&key=")
|
||||
filter.tags.joinTo(this, separator = ",") { it.key }
|
||||
}
|
||||
|
||||
var types = "&m=1&d=1&w=1&i=1&a=1&g=1"
|
||||
if (filter.types.isNotEmpty()) {
|
||||
types = "&m=0&d=0&w=0&i=0&a=0&g=0"
|
||||
filter.types.forEach {
|
||||
when (it) {
|
||||
ContentType.MANGA -> types = types.replace("&m=0", "&m=1")
|
||||
ContentType.DOUJINSHI -> types = types.replace("&d=0", "&d=1")
|
||||
ContentType.COMICS -> types = types.replace("&w=0", "&w=1")
|
||||
ContentType.IMAGE_SET -> types = types.replace("&i=0", "&i=1")
|
||||
ContentType.ARTIST_CG -> types = types.replace("&a=0", "&a=1")
|
||||
ContentType.GAME_CG -> types = types.replace("&g=0", "&g=1")
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
append(types)
|
||||
|
||||
|
||||
var lang = "&en=1&jp=1&es=1&fr=1&kr=1&de=1&ru=1"
|
||||
filter.locale?.let {
|
||||
lang = "&en=0&jp=0&es=0&fr=0&kr=0&de=0&ru=0"
|
||||
lang = lang.replace("${it.language}=0", "${it.language}=1")
|
||||
}
|
||||
append(lang)
|
||||
|
||||
when (order) {
|
||||
SortOrder.UPDATED -> append("<=1&pp=0")
|
||||
SortOrder.POPULARITY -> append("<=0&pp=1")
|
||||
SortOrder.RATING -> append("<=0&pp=0")
|
||||
else -> append("<=1&pp=0")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
val doc = webClient.httpGet(url).parseHtml()
|
||||
return doc.select("div.galleries div.thumb").map { div ->
|
||||
val a = div.selectFirstOrThrow(".inner_thumb a")
|
||||
val href = a.attrAsRelativeUrl("href")
|
||||
Manga(
|
||||
id = generateUid(href),
|
||||
url = href,
|
||||
publicUrl = href.toAbsoluteUrl(domain),
|
||||
coverUrl = a.selectFirst("img")?.src(),
|
||||
title = div.selectFirst(".caption")?.text().orEmpty(),
|
||||
altTitles = emptySet(),
|
||||
rating = RATING_UNKNOWN,
|
||||
tags = emptySet(),
|
||||
authors = emptySet(),
|
||||
state = null,
|
||||
source = source,
|
||||
contentRating = if (isNsfwSource) ContentRating.ADULT else null,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
//Tags are deliberately reduced because there are too many and this slows down the application.
|
||||
//only the most popular ones are taken.
|
||||
private suspend fun fetchAvailableTags(): Set<MangaTag> {
|
||||
return coroutineScope {
|
||||
(1..3).map { page ->
|
||||
async { fetchTagsPage(page) }
|
||||
}
|
||||
}.awaitAll().flattenTo(ArraySet(360))
|
||||
}
|
||||
|
||||
private suspend fun fetchTagsPage(page: Int): Set<MangaTag> {
|
||||
val url = "https://$domain/tags/popular/?page=$page"
|
||||
val root = webClient.httpGet(url).parseHtml()
|
||||
return root.parseTags()
|
||||
}
|
||||
|
||||
private fun Element.parseTags() = select("div.stags a.tag_btn").mapToSet {
|
||||
val href = it.attr("href").substringAfterLast("tag/").substringBeforeLast('/')
|
||||
MangaTag(
|
||||
key = href,
|
||||
title = it.selectFirstOrThrow("h3.list_tag").text().toTitleCase(sourceLocale),
|
||||
source = source,
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga = coroutineScope {
|
||||
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
||||
val doc = webClient.httpGet(fullUrl).parseHtml()
|
||||
val author = doc.selectFirst("li:contains(Artists) a.tag")?.ownTextOrNull()
|
||||
manga.copy(
|
||||
tags = doc.body().select("li:contains(Tags) a.tag").mapNotNullToSet {
|
||||
val href = it.attr("href").substringAfterLast("tag/").substringBeforeLast('/')
|
||||
MangaTag(
|
||||
key = href,
|
||||
title = it.ownText().toTitleCase(sourceLocale),
|
||||
source = source,
|
||||
)
|
||||
},
|
||||
authors = setOfNotNull(author),
|
||||
chapters = listOf(
|
||||
MangaChapter(
|
||||
id = manga.id,
|
||||
title = null,
|
||||
number = 1f,
|
||||
volume = 0,
|
||||
url = manga.url,
|
||||
scanlator = null,
|
||||
uploadDate = 0,
|
||||
branch = doc.selectFirst("li:contains(Language) a.tag")?.ownTextOrNull()?.toTitleCase(sourceLocale),
|
||||
source = source,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getRelatedManga(seed: Manga): List<Manga> {
|
||||
val doc = webClient.httpGet(seed.url.toAbsoluteUrl(domain)).parseHtml()
|
||||
val root = doc.body().selectFirstOrThrow("div.related")
|
||||
return root.select("div.thumb").mapNotNull { div ->
|
||||
val a = div.selectFirstOrThrow(".inner_thumb a")
|
||||
val href = a.attrAsRelativeUrl("href")
|
||||
Manga(
|
||||
id = generateUid(href),
|
||||
url = href,
|
||||
publicUrl = href.toAbsoluteUrl(domain),
|
||||
coverUrl = a.selectFirst("img")?.src(),
|
||||
title = div.selectFirst(".caption")?.text().orEmpty(),
|
||||
altTitles = emptySet(),
|
||||
rating = RATING_UNKNOWN,
|
||||
tags = emptySet(),
|
||||
authors = emptySet(),
|
||||
state = null,
|
||||
source = source,
|
||||
contentRating = null,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val fullUrl = chapter.url.toAbsoluteUrl(domain)
|
||||
val doc = webClient.httpGet(fullUrl).parseHtml()
|
||||
val totalPages = doc.selectFirstOrThrow(".pages").text().replace("Pages: ", "").toInt()
|
||||
val baseImg = doc.requireElementById("append_thumbs").selectFirstOrThrow("img")
|
||||
val baseUrl = baseImg.selectFirstParentOrThrow("a").attrAsRelativeUrl("href").replace("/1/", "/\$/")
|
||||
val baseThumbUrl = baseImg.src()?.replace("/1t.", "/\$t.")
|
||||
val pages = ArrayList<MangaPage>(totalPages)
|
||||
repeat(totalPages) { i ->
|
||||
val url = baseUrl.replace("\$", (i + 1).toString())
|
||||
pages.add(
|
||||
MangaPage(
|
||||
id = generateUid(url),
|
||||
url = url,
|
||||
preview = baseThumbUrl?.replace("\$", (i + 1).toString()),
|
||||
source = source,
|
||||
),
|
||||
)
|
||||
}
|
||||
return pages
|
||||
}
|
||||
|
||||
override suspend fun getPageUrl(page: MangaPage): String {
|
||||
val doc = webClient.httpGet(page.url.toAbsoluteUrl(domain)).parseHtml()
|
||||
val img = doc.body().requireElementById("gimg")
|
||||
return img.requireSrc()
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user