style: auto format

This commit is contained in:
github-actions[bot] 2024-06-16 07:21:21 +00:00
parent a4f0bbe67c
commit c1d7abaa2e
7 changed files with 9 additions and 14 deletions

View File

@ -8,7 +8,7 @@ const GetFilterId = async (type, name) => {
const { data: filterResponse } = await got(filterApiUrl);
return filterResponse.filter((f) => f.name === name).pop()?.id ?? undefined;
return filterResponse.findLast((f) => f.name === name)?.id ?? undefined;
};
export { rootUrl, apiSlug, GetFilterId };

View File

@ -70,19 +70,16 @@ async function handler(ctx) {
const agencyEl = content('table.bd1')
.find('td')
.toArray()
.filter((a) => content(a).text().startsWith('发文机关'))
.pop();
.findLast((a) => content(a).text().startsWith('发文机关'));
const sourceEl = content('span.font-zyygwj')
.toArray()
.filter((a) => content(a).text().startsWith('来源'))
.pop();
.findLast((a) => content(a).text().startsWith('来源'));
const subjectEl = content('table.bd1')
.find('td')
.toArray()
.filter((a) => content(a).text().startsWith('主题分类'))
.pop();
.findLast((a) => content(a).text().startsWith('主题分类'));
const agency = agencyEl ? processElementText(agencyEl) : undefined;
const source = sourceEl ? processElementText(sourceEl) : undefined;

View File

@ -40,7 +40,7 @@ async function handler(ctx) {
url: tabUrl,
});
const listing = moduleResponse.data.modules.filter((item) => item.source === 'CATEGORY_MOST_VIEW').pop().listings[0];
const listing = moduleResponse.data.modules.findLast((item) => item.source === 'CATEGORY_MOST_VIEW').listings[0];
title = moduleResponse.data.name;
moduleUrl =

View File

@ -109,8 +109,7 @@ async function handler(ctx) {
content(
content('div.video_info_item, div.lc-infos div')
.toArray()
.filter((i) => /\d{4}-\d{2}-\d{2}/.test(content(i).text()))
.pop()
.findLast((i) => /\d{4}-\d{2}-\d{2}/.test(content(i).text()))
)
.text()
.split(//)

View File

@ -39,8 +39,7 @@ export const handler = async (ctx) => {
const language = $('html').prop('lang');
const themeEl = $('link[rel="modulepreload"]')
.toArray()
.filter((l) => /theme\.\w+\.js$/.test($(l).prop('href')))
.pop();
.findLast((l) => /theme\.\w+\.js$/.test($(l).prop('href')));
const themeUrl = themeEl ? new URL($(themeEl).prop('href'), rootUrl).href : undefined;
const { data: themeResponse } = await got(themeUrl);

View File

@ -154,7 +154,7 @@ const processItems = async (i, downLinkType, itemSelector, categorySelector, dow
author: i.author,
category: [...i.category, ...categories].filter(Boolean),
pubDate: i.pubDate,
enclosure_url: downLinks.filter((l) => l.title === downLinkType).pop()?.link ?? downLinks[0].link,
enclosure_url: downLinks.findLast((l) => l.title === downLinkType)?.link ?? downLinks[0].link,
enclosure_type: 'application/x-bittorrent',
};
});

View File

@ -127,7 +127,7 @@ async function handler(ctx) {
},
});
const categoryObject = categoryResponse.data.filter((c) => c.name === category).pop();
const categoryObject = categoryResponse.data.findLast((c) => c.name === category);
const { data: response } = await got(apiUrl, {
searchParams: {