Compare commits
No commits in common. "2c166ecdb2a0fdb89acc10106740003f9fd1cffa" and "0b989fb317a800ff0edd6ce4c2ffd7de1901f9ca" have entirely different histories.
2c166ecdb2
...
0b989fb317
@ -24,7 +24,7 @@ client.on("messageCreate", async message => {
|
|||||||
let json = html.match(/<meta name="preload-data" id="meta-preload-data" content='(.*)'>/)[1];
|
let json = html.match(/<meta name="preload-data" id="meta-preload-data" content='(.*)'>/)[1];
|
||||||
let data = JSON.parse(json);
|
let data = JSON.parse(json);
|
||||||
let url = Object.values(data.illust)[0].urls.original;
|
let url = Object.values(data.illust)[0].urls.original;
|
||||||
await message.channel.send(url.replace("https://i.pximg.net/", `https://${config.web_hostname}/pixiv-proxy/`));
|
await message.channel.send(url.replace("https://i.pximg.net/", `https://${config.web_hostname}/pixiv-cache/`));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("pixiv error,", error.message);
|
console.error("pixiv error,", error.message);
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ client.on("messageCreate", async message => {
|
|||||||
|
|
||||||
app.use("/pixiv-proxy/", (req, res, next) => {
|
app.use("/pixiv-proxy/", (req, res, next) => {
|
||||||
if (req.method != "GET") return next();
|
if (req.method != "GET") return next();
|
||||||
let local_file_path = config.data_dir + "pixiv-cache/" + req.url.split('?')[0].replace(/\//g, '\\');
|
let local_file_path = config.data_dir + "pixiv-cache/" + req.url.replace(/\//g, '\\');
|
||||||
if (fs.existsSync(local_file_path)) res.sendFile(local_file_path);
|
if (fs.existsSync(local_file_path)) res.sendFile(local_file_path);
|
||||||
else {
|
else {
|
||||||
https.get(`https://i.pximg.net${req.url}`, {
|
https.get(`https://i.pximg.net${req.url}`, {
|
||||||
|
Loading…
Reference in New Issue
Block a user