-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed recursive fetch when new url is unchanged #10
base: master
Are you sure you want to change the base?
Conversation
Is this PR ready? I'm experiencing the same issue and would love to have the new version with fixes included! |
index.js
Outdated
@@ -443,8 +443,10 @@ const getPodcastFromURL = exports.getPodcastFromURL = async function (url, param | |||
const feedResponse = await fetchFeed(url) | |||
const channel = feedResponse.rss.channel[0] | |||
|
|||
if (channel["itunes:new-feed-url"]) { | |||
return await getPodcastFromURL(channel["itunes:new-feed-url"][0], params) | |||
const newURL = channel["itunes:new-feed-url"][0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no property "itunes:new-feed-url"
, accessing the 0th element will fail.
added null check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a null check
Thanks @doeixd for working on this--I ran into this bug today and had to patch my local version. It looks like the Travis CI build failed b/c of the optional chaining syntax ( If you remove that syntax, I bet it will be merged w/out issues. In fact, this PR could be a one liner, e.g. if (channel["itunes:new-feed-url"] && channel["itunes:new-feed-url"][0] !== url) { |
As is, the script will infinitely fetch this podcast this pr will fix that