mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-24 23:42:40 +08:00
fix(route/ehentai): update thumbnail fetching and parsing logic (#19996)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user