Skip to content

Commit

Permalink
style: auto format
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 15, 2023
1 parent 92a376d commit ad99b02
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions lib/v2/rsshub/transform/sitemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ module.exports = async (ctx) => {
const routeParams = new URLSearchParams(ctx.params.routeParams);
const $ = cheerio.load(response.data, { xmlMode: true });

const rssTitle = routeParams.get('title') ? routeParams.get('title') : ($('urlset url').length && $('urlset url').first().find('loc').text() ? $('urlset url').first().find('loc').text() : 'Sitemap');
const rssTitle = routeParams.get('title') ? routeParams.get('title') : $('urlset url').length && $('urlset url').first().find('loc').text() ? $('urlset url').first().find('loc').text() : 'Sitemap';

let items;
const urls = $('urlset url').toArray();
if (urls && urls.length) {
items = urls.map((item) => {
try {
const title = $(item).find('loc').text() || '';
const link = $(item).find('loc').text() || '';
const description = $(item).find('loc').text() || '';
const pubDate = $(item).find('lastmod').text() || undefined;
items = urls
.map((item) => {
try {
const title = $(item).find('loc').text() || '';
const link = $(item).find('loc').text() || '';
const description = $(item).find('loc').text() || '';
const pubDate = $(item).find('lastmod').text() || undefined;

return {
title,
link,
description,
pubDate,
};
} catch (e) {
return null;
}
})
.filter(Boolean);
}
else {
return {
title,
link,
description,
pubDate,
};
} catch (e) {
return null;
}
})
.filter(Boolean);
} else {
items = [];
}

Expand Down

0 comments on commit ad99b02

Please sign in to comment.