Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fixed recursive fetch when new url is unchanged #10

wants to merge 3 commits into from

Conversation

doeixd
Copy link

@doeixd doeixd commented Jul 17, 2020

As is, the script will infinitely fetch this podcast this pr will fix that

@amoran
Copy link

amoran commented Jul 28, 2020

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]
Copy link

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
Copy link
Author

@doeixd doeixd left a 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

@micahjon
Copy link

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 (?.), which isn't supported until Node 14. I appreciate the fact that this project still works on supported versions of Node like 10 & 12.

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) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants