Update:Filter out podcasts from search that dont have an RSS feed url #1514

This commit is contained in:
advplyr 2023-07-01 09:00:40 -05:00
parent e07e2cd359
commit d86a3b3dc2

View File

@ -146,11 +146,15 @@ export default {
async submitSearch(term) { async submitSearch(term) {
this.processing = true this.processing = true
this.termSearched = '' this.termSearched = ''
var results = await this.$axios.$get(`/api/search/podcast?term=${encodeURIComponent(term)}`).catch((error) => { let results = await this.$axios.$get(`/api/search/podcast?term=${encodeURIComponent(term)}`).catch((error) => {
console.error('Search request failed', error) console.error('Search request failed', error)
return [] return []
}) })
console.log('Got results', results) console.log('Got results', results)
// Filter out podcasts without an RSS feed
results = results.filter((r) => r.feedUrl)
for (let result of results) { for (let result of results) {
let podcast = this.existentPodcasts.find((p) => p.itunesId === result.id || p.title === result.title.toLowerCase()) let podcast = this.existentPodcasts.find((p) => p.itunesId === result.id || p.title === result.title.toLowerCase())
if (podcast) { if (podcast) {
@ -173,7 +177,7 @@ export default {
return return
} }
this.processing = true this.processing = true
var payload = await this.$axios.$post(`/api/podcasts/feed`, {rssFeed: podcast.feedUrl}).catch((error) => { const payload = await this.$axios.$post(`/api/podcasts/feed`, { rssFeed: podcast.feedUrl }).catch((error) => {
console.error('Failed to get feed', error) console.error('Failed to get feed', error)
this.$toast.error('Failed to get podcast feed') this.$toast.error('Failed to get podcast feed')
return null return null