style: auto format

This commit is contained in:
github-actions[bot] 2025-08-14 02:55:48 +00:00
parent 4e8c8fb27a
commit 25f8cd5e63
34 changed files with 45 additions and 45 deletions

View File

@ -135,7 +135,7 @@ async function handler(ctx) {
const $ = load(iconv.decode(response.data, 'gbk'));
const list = $('div.tabContents')
.eq(timeRange[time].index + (category === 'whole' ? (type === 'click' ? -1 : 2) : (type === 'click' ? 0 : 2)))
.eq(timeRange[time].index + (category === 'whole' ? (type === 'click' ? -1 : 2) : type === 'click' ? 0 : 2))
.find('table tbody tr td a')
.toArray()
.map((item) => {

View File

@ -32,7 +32,7 @@ async function handler(ctx) {
const rootUrl = 'https://club.6parkbbs.com';
const indexUrl = `${rootUrl}/${id}/index.php`;
const currentUrl = `${indexUrl}${type === '' || keyword === '' ? '' : (type === 'gold' ? '?app=forum&act=gold' : `?action=search&act=threadsearch&app=forum&${type}=${keyword}&submit=${type === 'type' ? '查询' : '栏目搜索'}`)}`;
const currentUrl = `${indexUrl}${type === '' || keyword === '' ? '' : type === 'gold' ? '?app=forum&act=gold' : `?action=search&act=threadsearch&app=forum&${type}=${keyword}&submit=${type === 'type' ? '查询' : '栏目搜索'}`}`;
const response = await got({
method: 'get',

View File

@ -29,7 +29,7 @@ async function handler(ctx) {
if (filterMatches) {
const filterRegion = filterMatches[1];
const filterType = filterMatches[2] === 'tag' ? 'tags' : (filterMatches[2] === 'category' ? 'categories' : filterMatches[2]);
const filterType = filterMatches[2] === 'tag' ? 'tags' : filterMatches[2] === 'category' ? 'categories' : filterMatches[2];
const filterKeyword = decodeURI(filterMatches[3].split('/').pop());
const filterApiUrl = new URL(`${filterRegion}/${apiSlug}/${filterType}?search=${filterKeyword}`, rootUrl).href;

View File

@ -54,7 +54,7 @@ async function handler(): Promise<Data> {
const $timeElement = $anchor.find('time');
const datetimeAttr = $timeElement.attr('datetime');
const timeText = $timeElement.text().trim();
const pubDate = datetimeAttr ? parseDate(datetimeAttr) : (timeText ? parseDate(timeText) : undefined);
const pubDate = datetimeAttr ? parseDate(datetimeAttr) : timeText ? parseDate(timeText) : undefined;
const summaryDescription = $anchor.find('p[class*="line-clamp-3"]').html()?.trim() || '';
const author = 'Black Forest Labs';

View File

@ -42,7 +42,7 @@ async function handler(ctx: Context) {
const { id = 'bbs4', type = 'home', keyword } = ctx.req.param();
const rootUrl = 'https://www.cool18.com/' + id + '/index.php';
const params = type === 'home' ? '' : (type === 'gold' ? '?app=forum&act=gold' : `?action=search&act=threadsearch&app=forum&keywords=${keyword}&submit=查询`);
const params = type === 'home' ? '' : type === 'gold' ? '?app=forum&act=gold' : `?action=search&act=threadsearch&app=forum&keywords=${keyword}&submit=查询`;
const currentUrl = rootUrl + params;

View File

@ -58,7 +58,7 @@ async function fetchPage() {
title: item.post_title || item.title || 'No Title',
link: item.post_url || item.link || '',
description: item.post_excerpt || item.excerpt || '',
pubDate: item.post_date ? new Date(item.post_date).toUTCString() : (item.date ? new Date(item.date).toUTCString() : ''),
pubDate: item.post_date ? new Date(item.post_date).toUTCString() : item.date ? new Date(item.date).toUTCString() : '',
category: item.category_link ? item.category_link.replaceAll(/(<([^>]+)>)/gi, '') : '', // Clean HTML if category_link exists
image: item.image_url ? item.image_url.replace(/\?.*$/, '') : '', // Remove query parameters if image_url exists
}));

View File

@ -29,10 +29,10 @@ async function handler(ctx) {
const data = JSON.parse(response.data.match(/window.__INITIAL_STATE__= (.*);<\/script>/)[1]);
let items = (category === 'news' ? data.news : (category === 'figure' ? data.figure : data.videoList)).map((item) => ({
let items = (category === 'news' ? data.news : category === 'figure' ? data.figure : data.videoList).map((item) => ({
title: item.title,
pubDate: parseDate(item.online_time),
link: `${rootUrl}/${category === 'news' ? 'article/' : (category === 'figure' ? 'people/' : '')}${item.online_time.split('T')[0].split('-').join('')}/${item.token}`,
link: `${rootUrl}/${category === 'news' ? 'article/' : category === 'figure' ? 'people/' : ''}${item.online_time.split('T')[0].split('-').join('')}/${item.token}`,
}));
items = await Promise.all(
@ -53,7 +53,7 @@ async function handler(ctx) {
);
return {
title: `得到${category === 'video' ? '' : '大事件'} - ${category === 'news' ? '新闻' : (category === 'figure' ? '人物故事' : '视频')}`,
title: `得到${category === 'video' ? '' : '大事件'} - ${category === 'news' ? '新闻' : category === 'figure' ? '人物故事' : '视频'}`,
link: rootUrl,
item: items,
description: data.description,

View File

@ -36,7 +36,7 @@ async function handler(ctx) {
$('.itd').parent().remove();
let items = $('table.gltc tbody tr')
.slice(1, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) + 1 : (needImages ? 16 : 26))
.slice(1, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) + 1 : needImages ? 16 : 26)
.toArray()
.map((item) => {
item = $(item);

View File

@ -78,9 +78,9 @@ async function handler(ctx) {
let linkSlug =
item.catalogNs.mappings && item.catalogNs.mappings.length > 0
? item.catalogNs.mappings[0].pageSlug
: (item.offerMappings && item.offerMappings.length > 0
: item.offerMappings && item.offerMappings.length > 0
? item.offerMappings[0].pageSlug
: (item.productSlug ?? item.urlSlug));
: (item.productSlug ?? item.urlSlug);
if (item.offerType === 'ADD_ON') {
linkSlug = item.offerMappings[0].pageSlug;
}

View File

@ -69,7 +69,7 @@ export const route: Route = {
author: itemDetail.byline,
pubDate: item.date,
// for videos and shortstops, no need to extract full text below
description: itemType === 'Media' ? renderMedia(itemDetail.video[0]) : (itemType === 'Shortstop' ? itemDetail.headline : ''),
description: itemType === 'Media' ? renderMedia(itemDetail.video[0]) : itemType === 'Shortstop' ? itemDetail.headline : '',
};
});

View File

@ -151,7 +151,7 @@ async function handler(ctx) {
const rootUrl = 'https://fantia.jp';
const apiUrl = `${rootUrl}/api/v1/search/${type}?keyword=${keyword}&peroid=${period}&brand_type=0&category=${caty === 'all' ? '' : caty}&order=${order}${
rating === 'all' ? '' : (rating === 'general' ? '&rating=general' : '&adult=1')
rating === 'all' ? '' : rating === 'general' ? '&rating=general' : '&adult=1'
}&per_page=30`;
const response = await got({
method: 'get',

View File

@ -36,7 +36,7 @@ async function handler(ctx: Context): Promise<Data> {
const handleOrId = ctx.req.param('uid');
const host = 'https://api.follow.is';
const handle = isBizId(handleOrId || '') ? handleOrId : (handleOrId.startsWith('@') ? handleOrId.slice(1) : handleOrId);
const handle = isBizId(handleOrId || '') ? handleOrId : handleOrId.startsWith('@') ? handleOrId.slice(1) : handleOrId;
const searchParams = new URLSearchParams({ handle });

View File

@ -49,7 +49,7 @@ async function handler(ctx) {
const items = await Promise.all(list.map((item) => parseItem(item, cache.tryGet)));
return {
title: `${lang === 'en' ? 'News' : (lang === 'vi' ? 'Bản tin' : '快讯')} - Followin`,
title: `${lang === 'en' ? 'News' : lang === 'vi' ? 'Bản tin' : '快讯'} - Followin`,
link: `${baseUrl}/${lang}/news`,
image: favicon,
language: lang,

View File

@ -45,7 +45,7 @@ const processItems = async (apiUrl, limit, ...parameters) => {
let items = JSON.parse(String(zlib.inflateSync(Buffer.from(response.data?.list ?? response.data, 'base64'))));
items = (items?.list ?? items).slice(0, limit).map((item) => {
const sourceType = item.source_type ?? (item.source_link ? (item.column?.title ? 'article' : 'news') : (item.event_type ? 'event' : constants.defaultType));
const sourceType = item.source_type ?? (item.source_link ? (item.column?.title ? 'article' : 'news') : item.event_type ? 'event' : constants.defaultType);
item = item.source_type ? item[item.source_type] : item;

View File

@ -32,7 +32,7 @@ async function handler(ctx) {
const defaultPath = 'announcement';
const pathname = getSubPath(ctx).replaceAll(/(^\/beijing\/bphc|\/$)/g, '');
const key = pathname === '' ? defaultPath : (pathname.endsWith('/') ? pathname.slice(0, -1) : pathname);
const key = pathname === '' ? defaultPath : pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;
const obj = mapping[key];
const currentUrl = `${rootUrl}${obj.list}`;

View File

@ -13,7 +13,7 @@ async function handler(ctx) {
const defaultPath = '/yaowenn/';
let pathname = getSubPath(ctx).replaceAll(/(^\/ccdi|\/$)/g, '');
pathname = pathname === '' ? defaultPath : (pathname.endsWith('/') ? pathname : pathname + '/');
pathname = pathname === '' ? defaultPath : pathname.endsWith('/') ? pathname : pathname + '/';
const currentUrl = `${rootUrl}${pathname}`;
const { list, title } = await parseNewsList(currentUrl, '.list_news_dl2 li', ctx);

View File

@ -101,7 +101,7 @@ const gdgov = async (info, ctx) => {
path.splice(0, 2 + pathstartat);
let pathname = path.join('/');
pathname = pathname === '' ? defaultPath : (pathname.endsWith('/') ? pathname : pathname + '/');
pathname = pathname === '' ? defaultPath : pathname.endsWith('/') ? pathname : pathname + '/';
const currentUrl = `${rootUrl}/${pathname}`;
let $ = '';

View File

@ -25,7 +25,7 @@ export const route: Route = {
async function handler(ctx) {
let type = ctx.req.param('type') ?? 'tiobe';
type = type === 'webserver' ? 'netcraft' : (type === 'db' ? 'db-engines' : type);
type = type === 'webserver' ? 'netcraft' : type === 'db' ? 'db-engines' : type;
const rootUrl = 'https://hellogithub.com';
const currentUrl = `${rootUrl}/report/${type}`;

View File

@ -62,7 +62,7 @@ async function handler(ctx) {
const items = response.info.slice(0, limit).map((item) => {
const ip = item.ip;
const latency = item.latency === undefined ? undefined : `${item.latency}ms`;
const line = item.line === undefined ? undefined : (Object.hasOwn(lines, item.line) ? lines[item.line] : item.line);
const line = item.line === undefined ? undefined : Object.hasOwn(lines, item.line) ? lines[item.line] : item.line;
const loss = item.loss === undefined ? undefined : `${item.loss}%`;
const node = item.node;
const speed = item.speed === undefined ? undefined : `${item.speed} KB/s`;

View File

@ -82,7 +82,7 @@ async function handler(ctx) {
);
return {
title: `《明日方舟》${group === 'SYSTEM' ? '系统' : (group === 'ACTIVITY' ? '活动' : '全部')}公告`,
title: `《明日方舟》${group === 'SYSTEM' ? '系统' : group === 'ACTIVITY' ? '活动' : '全部'}公告`,
link: 'https://ak.hypergryph.com/',
item: items,
};

View File

@ -57,10 +57,10 @@ const utils = {
switch (l) {
case 'ja':
customFormat = dayjs(t, formatJaDate, true).isValid() ? formatJaDate : (dayjs(t, formatJaDateTime, true).isValid() ? formatJaDateTime : undefined);
customFormat = dayjs(t, formatJaDate, true).isValid() ? formatJaDate : dayjs(t, formatJaDateTime, true).isValid() ? formatJaDateTime : undefined;
break;
case 'en':
customFormat = dayjs(t, formatEnDate, true).isValid() ? formatEnDate : (dayjs(t, formatEnDateTime, true).isValid() ? formatEnDateTime : undefined);
customFormat = dayjs(t, formatEnDate, true).isValid() ? formatEnDate : dayjs(t, formatEnDateTime, true).isValid() ? formatEnDateTime : undefined;
break;
}

View File

@ -58,7 +58,7 @@ async function handler(ctx) {
return {
title: `${board === 'all' ? '全部看板' : boardInfo.title} | Meteor 學生社群`,
description: board === 'all' ? null : boardInfo.feedDescription,
image: board === 'all' ? null : (boardInfo.imgUrl === 'not_set' ? null : boardInfo.imgUrl),
image: board === 'all' ? null : boardInfo.imgUrl === 'not_set' ? null : boardInfo.imgUrl,
link: `${board === 'all' ? `${baseUrl}/board/all` : boardInfo.link}/new`,
item: items,
};

View File

@ -80,10 +80,10 @@ async function handler(ctx) {
type: article.address.split('.').pop(),
},
})
: (type === 'breaking'
: type === 'breaking'
? article.content
: article.summary),
pubDate: article.start_time ? parseDate(article.start_time, 'X') : (article.push_time ? parseDate(article.push_time, 'X') : undefined),
: article.summary,
pubDate: article.start_time ? parseDate(article.start_time, 'X') : article.push_time ? parseDate(article.push_time, 'X') : undefined,
id: article.id,
link: `https://www.mittrchina.com/news/detail/${article.id}`,
}));

View File

@ -39,7 +39,7 @@ async function handler(ctx) {
const route = category === '' ? '' : `/${category}${subCategory === '' ? '' : `/${subCategory}`}`;
const rootUrl = `https://${type === '' ? 'www' : 'list'}.oilchem.net`;
const currentUrl = `${rootUrl}${type === '' ? '/1/' : (type === 'list' ? route : `/${routes[`/${type}${route}`]}`)}`;
const currentUrl = `${rootUrl}${type === '' ? '/1/' : type === 'list' ? route : `/${routes[`/${type}${route}`]}`}`;
const response = await got({
method: 'get',

View File

@ -54,7 +54,7 @@ async function handler(ctx) {
const toApiUrl = (date) => `${rootUrl}/cnt/utf8/content/${date}/articleList/list_${id}_all.js`;
let apiUrl = id === 'ipo' ? ipoApiUrl : (id === 'industry' ? industryApiUrl : toApiUrl(dayjs().format('YYYYMMDD'))),
let apiUrl = id === 'ipo' ? ipoApiUrl : id === 'industry' ? industryApiUrl : toApiUrl(dayjs().format('YYYYMMDD')),
hasArticle = false,
items = [],
i = 0,

View File

@ -173,7 +173,7 @@ async function handler(ctx) {
const labels = parseTree(labelTree);
const industryObj = industry ? industries.find((i) => i.key === industry || i.value === industry) : undefined;
const labelObj = label ? labels.find((i) => i.key === label || i.value === label) : (industryObj ? undefined : labels.find((i) => i.key === industry || i.value === industry));
const labelObj = label ? labels.find((i) => i.key === label || i.value === label) : industryObj ? undefined : labels.find((i) => i.key === industry || i.value === industry);
const industryId = industryObj?.key ?? -1;
const labelId = labelObj?.key ?? -1;

View File

@ -64,7 +64,7 @@ async function handler(ctx) {
'filter[until]': 0,
id: symbol.toLowerCase(),
include: 'author,primaryTickers,secondaryTickers,sentiments',
'page[size]': ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : (category === 'news' ? 40 : 20),
'page[size]': ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : category === 'news' ? 40 : 20,
'page[number]': 1,
},
});

View File

@ -44,7 +44,7 @@ export const route: Route = {
handler: async (ctx) => {
const baseUrl = 'https://isabelle-dev.sketis.net';
const { blog } = ctx.req.param();
const blogName = blog === '1' ? 'News' : (blog === '2' ? 'Release' : 'UNKNOWN');
const blogName = blog === '1' ? 'News' : blog === '2' ? 'Release' : 'UNKNOWN';
const url = `${baseUrl}/phame/blog/view/${blog}/`;
const response = await ofetch(url);
const $ = load(response);

View File

@ -515,7 +515,7 @@ async function handler(ctx) {
const mapBackground = locationObj.find('.tgme_widget_message_location').css('background-image');
const mapBackgroundUrl = mapBackground && mapBackground.match(/url\('(.*)'\)/);
const mapBackgroundUrlSrc = mapBackgroundUrl && mapBackgroundUrl[1];
const mapImgHtml = mapBackgroundUrlSrc ? `<img src="${mapBackgroundUrlSrc}">` : (showMediaTagAsEmoji ? mediaTagDict[LOCATION][1] : mediaTagDict[LOCATION][0]);
const mapImgHtml = mapBackgroundUrlSrc ? `<img src="${mapBackgroundUrlSrc}">` : showMediaTagAsEmoji ? mediaTagDict[LOCATION][1] : mediaTagDict[LOCATION][0];
return locationLink ? `<a href="${locationLink}">${mapImgHtml}</a>` : mapImgHtml;
} else {
return '';

View File

@ -132,7 +132,7 @@ async function handler(ctx) {
pageSize: limit,
pageNumber: 0,
benefitCategoryId: categoryObject?.id ?? undefined,
category: categoryObject ? undefined : (category === '充电免停' ? 2 : undefined),
category: categoryObject ? undefined : category === '充电免停' ? 2 : undefined,
city,
},
});

View File

@ -416,6 +416,6 @@ async function handler(ctx) {
item,
allowEmpty: ctx.req.param('id') === 'allow_empty',
description:
ctx.req.param('id') === 'complicated' ? '<img src="http://mock.com/DIYgod/DIYgod/RSSHub">' : (ctx.req.param('id') === 'multimedia' ? '<video src="http://mock.com/DIYgod/DIYgod/RSSHub"></video>' : 'A test route for RSSHub'),
ctx.req.param('id') === 'complicated' ? '<img src="http://mock.com/DIYgod/DIYgod/RSSHub">' : ctx.req.param('id') === 'multimedia' ? '<video src="http://mock.com/DIYgod/DIYgod/RSSHub"></video>' : 'A test route for RSSHub',
};
}

View File

@ -254,7 +254,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
}
quote += formatMedia(quoteData);
picsPrefix += generatePicsPrefix(quoteData);
quoteInTitle += showEmojiForRetweetAndReply ? ' 💬 ' : (showSymbolForRetweetAndReply ? ' RT ' : '');
quoteInTitle += showEmojiForRetweetAndReply ? ' 💬 ' : showSymbolForRetweetAndReply ? ' RT ' : '';
quoteInTitle += `${author.name}: ${formatText(quoteData)}`;
if (readable) {
@ -286,15 +286,15 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
const isQuote = item.is_quote_status;
if (!isRetweet && (!isQuote || showRetweetTextInTitle)) {
if (item.in_reply_to_screen_name) {
title += showEmojiForRetweetAndReply ? '↩️ ' : (showSymbolForRetweetAndReply ? 'Re ' : '');
title += showEmojiForRetweetAndReply ? '↩️ ' : showSymbolForRetweetAndReply ? 'Re ' : '';
}
title += replaceBreak(originalItem.full_text);
}
if (isRetweet) {
title += showEmojiForRetweetAndReply ? '🔁 ' : (showSymbolForRetweetAndReply ? 'RT ' : '');
title += showEmojiForRetweetAndReply ? '🔁 ' : showSymbolForRetweetAndReply ? 'RT ' : '';
title += item.user.name + ': ';
if (item.in_reply_to_screen_name) {
title += showEmojiForRetweetAndReply ? ' ↩️ ' : (showSymbolForRetweetAndReply ? ' Re ' : '');
title += showEmojiForRetweetAndReply ? ' ↩️ ' : showSymbolForRetweetAndReply ? ' Re ' : '';
}
title += replaceBreak(item.full_text);
}
@ -330,7 +330,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
}
description += '&ensp;';
}
description += showEmojiForRetweetAndReply ? '🔁' : (showSymbolForRetweetAndReply ? 'RT' : '');
description += showEmojiForRetweetAndReply ? '🔁' : showSymbolForRetweetAndReply ? 'RT' : '';
if (!showAuthorInDesc) {
description += '&ensp;';
if (readable) {
@ -373,7 +373,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
description += `:&ensp;`;
}
if (item.in_reply_to_screen_name) {
description += showEmojiForRetweetAndReply ? '↩️ ' : (showSymbolForRetweetAndReply ? 'Re ' : '');
description += showEmojiForRetweetAndReply ? '↩️ ' : showSymbolForRetweetAndReply ? 'Re ' : '';
}
description += item.full_text;

View File

@ -94,7 +94,7 @@ async function handler(ctx) {
const response = await got(item.link);
const $ = load(response.data);
return $('.v_news_content').length ? $('.v_news_content').html().trim() : ($('.prompt').length ? $('.prompt').html() : item.title);
return $('.v_news_content').length ? $('.v_news_content').html().trim() : $('.prompt').length ? $('.prompt').html() : item.title;
} catch {
return item.title;
}

View File

@ -57,7 +57,7 @@ const ProcessFeed = async () => {
return playList.map((item) => {
const title = item.episode.title + ' - ' + item.episode.podcast.title;
const eid = item.episode.eid;
const itunes_item_image = item.episode.image ? item.episode.image.picUrl : (item.episode.podcast.image ? item.episode.podcast.image.picUrl : '');
const itunes_item_image = item.episode.image ? item.episode.image.picUrl : item.episode.podcast.image ? item.episode.podcast.image.picUrl : '';
const link = `https://www.xiaoyuzhoufm.com/episode/${eid}`;
const pubDate = item.pubDate;
const itunes_duration = item.episode.duration;