Update podcast search page to support manually entering podcast RSS feed

This commit is contained in:
advplyr 2022-04-13 16:55:48 -05:00
parent 2c6e1cc2b5
commit 4edba20e9e
6 changed files with 87 additions and 37 deletions

View file

@ -94,17 +94,18 @@ class PodcastController {
if (!url) {
return res.status(400).send('Bad request')
}
var includeRaw = req.query.raw == 1 // Include raw json
axios.get(url).then(async (data) => {
if (!data || !data.data) {
Logger.error('Invalid podcast feed request response')
return res.status(500).send('Bad response from feed request')
}
var podcast = await parsePodcastRssFeedXml(data.data)
if (!podcast) {
var payload = await parsePodcastRssFeedXml(data.data, includeRaw)
if (!payload) {
return res.status(500).send('Invalid podcast RSS feed')
}
res.json(podcast)
res.json(payload)
}).catch((error) => {
console.error('Failed', error)
res.status(500).send(error)