Skip to content

Commit

Permalink
Fix:CBC Radio podcast RSS feeds not accepting our user-agent string a…
Browse files Browse the repository at this point in the history
  • Loading branch information
advplyr committed Nov 15, 2024
1 parent 2a62992 commit 45f8b06
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/utils/podcastUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,21 @@ module.exports.parsePodcastRssFeedXml = async (xml, excludeEpisodeMetadata = fal
module.exports.getPodcastFeed = (feedUrl, excludeEpisodeMetadata = false) => {
Logger.debug(`[podcastUtils] getPodcastFeed for "${feedUrl}"`)

let userAgent = 'audiobookshelf (+https://audiobookshelf.org; like iTMS)'
// Workaround for CBC RSS feeds rejecting our user agent string
// See: https://github.com/advplyr/audiobookshelf/issues/3322
if (feedUrl.startsWith('https://www.cbc.ca')) {
userAgent = 'audiobookshelf (+https://audiobookshelf.org; like iTMS) - CBC'
}

return axios({
url: feedUrl,
method: 'GET',
timeout: 12000,
responseType: 'arraybuffer',
headers: {
Accept: 'application/rss+xml, application/xhtml+xml, application/xml, */*;q=0.8',
'User-Agent': 'audiobookshelf (+https://audiobookshelf.org; like iTMS)'
'User-Agent': userAgent
},
httpAgent: global.DisableSsrfRequestFilter ? null : ssrfFilter(feedUrl),
httpsAgent: global.DisableSsrfRequestFilter ? null : ssrfFilter(feedUrl)
Expand Down

0 comments on commit 45f8b06

Please sign in to comment.