Skip to content

Commit 395a4b6

Browse files
committed
Update pvcep_rules.js
1 parent 3c47622 commit 395a4b6

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

Picviewer CE+/pvcep_rules.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,10 +1027,25 @@ var siteInfo = [
10271027
},
10281028
{
10291029
name: "Rule34",
1030-
url: /\brule34\.xxx/,
1030+
url: /\b(rule34\.xxx|realbooru\.com)/,
10311031
src: /\/(thumbnails|samples)\/(.*)\/(thumbnail|sample)_/i,
1032-
r: /\/(thumbnails|samples)\/(.*)\/(thumbnail|sample)_(.*)\..*/i,
1033-
s: ["/images/$2/$4.jpeg","/images/$2/$4.png","/images/$2/$4.jpg"]
1032+
xhr: {
1033+
url: function(a, p) {
1034+
if (!a) return;
1035+
const re = /^https?:\/\/(?:www\.)?(?:(realbooru\.com|rule34\.xxx))\/index\.php\?page=post&s=view&id=(\d+).*/;
1036+
const m = a.href.match(re);
1037+
if (m) {
1038+
return m[1] == "rule34.xxx" ? `https://api.${m[1]}/index.php?page=dapi&s=post&q=index&id=${m[2]}&json=1` : `https://${m[1]}/index.php?page=dapi&s=post&q=index&id=${m[2]}&json=1`;
1039+
}
1040+
},
1041+
query: function(html, doc, url) {
1042+
try {
1043+
const o = JSON.parse(html);
1044+
let url = o[0];
1045+
return url.file_url || `https://${location.hostname}/images/${url.directory}/${url.image}`;
1046+
} catch { }
1047+
}
1048+
}
10341049
},
10351050
{
10361051
name: "Photosight",

0 commit comments

Comments
 (0)