fix(route): eprice hk (#11550)

This commit is contained in:
Tony 2023-01-03 13:52:55 -03:00 committed by GitHub
parent a948dac993
commit 0a943aa592
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 18 deletions

View File

@ -17,9 +17,7 @@ module.exports = async (ctx) => {
const items = await Promise.all(
feed.items.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const response = await got({
method: 'get',
url: item.link,
const response = await got(item.link, {
headers: {
Referer: `https://www.eprice.com.${region}`,
},
@ -48,7 +46,6 @@ module.exports = async (ctx) => {
art(path.join(__dirname, 'templates/image.art'), {
alt: e.attr('title'),
src: e.attr('href'),
title: e.attr('title'),
})
);
e.remove();
@ -57,14 +54,7 @@ module.exports = async (ctx) => {
$('img').each((_, e) => {
e = $(e);
if (e.attr('data-original')) {
e.after(
art(path.join(__dirname, 'templates/image.art'), {
alt: e.attr('title'),
src: e.attr('data-original'),
title: e.attr('title'),
})
);
e.remove();
e.attr('src', e.attr('data-original'));
}
});
@ -76,10 +66,8 @@ module.exports = async (ctx) => {
delete item.enclosure;
delete item.isoDate;
item.description = art(path.join(__dirname, 'templates/description.art'), {
// tw || tw || hk || hk
desc: $('div.user-comment-block').html() || $('div.content').html() || $('li.inner').html() || $('div.section-content').html(),
});
// tw || tw || hk || hk || hk
item.description = $('div.user-comment-block').html() || $('div.content').html() || $('li.inner').html() || $('div.section-content').html() || $('.article__content').html();
item.pubDate = parseDate(item.pubDate);
return item;

View File

@ -1 +0,0 @@
{{@ desc }}

View File

@ -1 +1,4 @@
<img alt="{{ alt }}" src="{{ src }}" title="{{ alt }}">
<figure>
<img src="{{ src }}" alt="{{ alt }}" title="{{ alt }}">
<figcaption>{{ alt }}</figcaption>
</figure>