Closed ghost closed 6 years ago
running this: let audioData = a.map((obj,i) => {if(!obj.enclosures[0])return;console.log('%s i=%s',obj.enclosures[0].url,i)}); on returned items gives:
http://www.ncbi.ie/wp-content/uploads/podcasts/podcast_august_2018.mp3 i=0 http://www.ncbi.ie/wp-content/uploads/2018/07/GMT20180726_180201_Virtual_Te.mp3 i=1 http://www.ncbi.ie/wp-content/uploads/podcasts/podcast_july_2018.mp3 i=2 http://www.ncbi.ie/wp-content/uploads/2018/06/GMT20180628_180225_NCBI_Virtu.mp3 i=3 http://www.ncbi.ie/wp-content/uploads/podcasts/podcast_june_2018.mp3 i=5 http://www.ncbi.ie/wp-content/uploads/2018/05/GMT20180531_180303_NCBI_Virtu.mp3 i=6 http://www.ncbi.ie/wp-content/uploads/podcasts/podcast_may_2018.mp3 i=7 http://www.ncbi.ie/wp-content/uploads/podcasts/podcast_april_2018.mp3 i=8 http://www.ncbi.ie/wp-content/uploads/2018/03/GMT20180329_181148_Virtual_Te.mp3 i=9
indicating (at the time I ran it) item with index 4 had no media objects.
You need to verify the objects exist before you try to use them.
Oh, thanks so much! So it's a broken feed, nothing I'm doing wrong? Thanks for the code tip, too!
Feeds are very free form. Feedparser only returns what's in the feed. Just because it's supposed to be there doesn't mean it will be.
Sounds like you're all set @digitaltoast. Thanks @rdbcci!
Node-feedparser 1.0.1 (from NPM) feedparser 2.2.9 Node 8.10
EVERY other RSS feed seems to work perfectly with Node-feedparser, but I cannot get this one to work.
https://feeds.feedburner.com/technologypodcastncbi
I've looked at the parsed feed, and I've tried:
All give me
TypeError: Cannot read property 'media:content' of undefined
even though I can stringify out the object and it's fine. Weird. Is it something I'm doing wrong? ThanksBefore submitting your issue, please make sure these boxes are checked. Thank you!