fix(route/ehentai): update thumbnail fetching and parsing logic (#19996)

This commit is contained in:
Tsuyumi25
2025-09-08 18:59:33 +08:00
committed by GitHub
parent 6f08d322f7
commit 20571c1479
+3 -3
View File
@@ -29,8 +29,8 @@ function ehgot(url) {
function ehgot_thumb(cache, thumb_url) {
return cache.tryGet(thumb_url, async () => {
try {
const buffer = await got({ method: 'get', url: thumb_url, headers });
const data = new Buffer.from(buffer.rawBody).toString('base64');
const buffer = await got({ method: 'get', responseType: 'buffer', url: thumb_url, headers });
const data = buffer.body.toString('base64');
const ext = path.extname(thumb_url).slice(1);
return `data:image/${ext};base64,${data}`;
} catch (error) {
@@ -72,7 +72,7 @@ async function parsePage(cache, data, get_bittorrent = false, embed_thumb = fals
async function parseElement(cache, element) {
const el = $(element);
const title = el.find('div.glink').html();
const title = el.find('.glink').html();
const rawDate = el.find('div[id^="posted_"]').text();
const pubDate = rawDate ? timezone(rawDate, 0) : rawDate;
let el_a;