style: auto format
This commit is contained in:
parent
a4f0bbe67c
commit
c1d7abaa2e
|
|
@ -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 };
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -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(/:/)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue