unescape html

This commit is contained in:
Lamp 2024-05-03 01:01:47 -07:00
parent 2f26520c41
commit f2f4a012a3
4 changed files with 32 additions and 3 deletions

1
.gitignore vendored

@ -3,3 +3,4 @@ known_ids
logindata
._*
output.txt
node_modules

@ -1,3 +1,4 @@
import {unescape} from 'html-escaper';
import credentials from "./credentials.json" assert { type: 'json' };
import Bot from "./Bot.js";
import { getPostDataById, getNewPixivPosts } from "./pixiv.js";
@ -35,7 +36,7 @@ posts: for (let post of newPosts) {
try {
let {images, illust} = await getPostDataById(post.id);
let date = new Date(illust.createDate).toLocaleString("en-US", {timeZone: "JST", month: "long", day: "numeric", year: "numeric"});
let status = `<b>${illust.title}</b> / ${illust.userName} / ${date}<br>${illust.description}<br>${illust.aiType == 2 ? `#AIgenerated ` : ''}${post.tags.map(tag => `#${tag}`).join(" ")}<br>${url}<br>https://www.pixiv.net/en/users/${illust.userId}`;
let status = `<b>${illust.title}</b> / ${illust.userName} / ${date}<br>${unescape(illust.description)}<br>${illust.aiType == 2 ? `#AIgenerated ` : ''}${post.tags.map(tag => `#${tag}`).join(" ")}<br>${url}<br>https://www.pixiv.net/en/users/${illust.userId}`;
if (images.length > 4) {
status += `<br>⚠ There are ${images.length} images.`;
}
@ -56,4 +57,4 @@ posts: for (let post of newPosts) {
status: `${url}\n#error\n${error.stack}`,
visibility: "public"
});
}
}

24
package-lock.json generated Normal file

@ -0,0 +1,24 @@
{
"name": "pixiv",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"dependencies": {
"html-escaper": "^3.0.3"
}
},
"node_modules/html-escaper": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz",
"integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ=="
}
},
"dependencies": {
"html-escaper": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz",
"integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ=="
}
}
}

@ -1,3 +1,6 @@
{
"type": "module"
"type": "module",
"dependencies": {
"html-escaper": "^3.0.3"
}
}