Merge pull request #231 from acid-info/fix-rss

error handeling for rss
This commit is contained in:
amir houieh 2024-01-29 14:45:06 +01:00 committed by GitHub
commit 9f1663cfde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 35 additions and 26 deletions

View File

@ -1,14 +1,15 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
images: {
domains: [
'localhost',
'127.0.0.1',
'image.simplecastcdn.com',
'img.youtube.com',
],
},
reactStrictMode: true,
images: {
domains: [
'localhost',
'127.0.0.1',
'image.simplecastcdn.com',
'img.youtube.com',
'strapi.logos.co'
],
},
}
module.exports = nextConfig

View File

@ -43,10 +43,14 @@ export const getStaticProps: GetStaticProps<PageProps> = async () => {
const { data: tags = [] } = await strapiApi.getTopics()
const rss = new LPERssFeed('main')
await rss.init()
latest.data.forEach((post) => rss.addPost(post))
await rss.save()
try {
const rss = new LPERssFeed('main')
await rss.init()
latest.data.forEach((post) => rss.addPost(post))
await rss.save()
} catch (e) {
console.log('Error generating RSS feed', e)
}
return {
props: {

View File

@ -98,19 +98,23 @@ export const getStaticProps = async ({ params }: GetStaticPropsContext) => {
showSlug: showSlug as string,
})
const rss = new LPERssFeed(showSlug as string, {
title: shows[0].title,
description: shows[0].descriptionText,
image: shows[0].logo.url,
language: 'en',
id: shows[0].id ?? (showSlug as string),
copyright: `All rights reserved ${new Date().getFullYear()}, ${
shows[0].title
}`,
})
await rss.init()
latestEpisodes.data.forEach((post: LPE.Post.Document) => rss.addPost(post))
await rss.save()
try {
const rss = new LPERssFeed(showSlug as string, {
title: shows[0].title,
description: shows[0].descriptionText,
image: shows[0].logo.url,
language: 'en',
id: shows[0].id ?? (showSlug as string),
copyright: `All rights reserved ${new Date().getFullYear()}, ${
shows[0].title
}`,
})
await rss.init()
latestEpisodes.data.forEach((post: LPE.Post.Document) => rss.addPost(post))
await rss.save()
} catch (e) {
console.log('Error generating RSS feed', e)
}
return {
props: {