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

Problem with parsing "image" property #178

Closed
alabeduarte opened this issue Aug 10, 2016 · 5 comments
Closed

Problem with parsing "image" property #178

alabeduarte opened this issue Aug 10, 2016 · 5 comments

Comments

@alabeduarte
Copy link

alabeduarte commented Aug 10, 2016

Hi,

I found an issue during fetching images from a feed. I've got empty javascript objects.

The issue can be reproduced with the code snippet bellow, using feedparser v1.1.4:

var FeedParser = require('feedparser')
  , request = require('request');

var req = request('https://jovemnerd.com.br/feed-nerdcast/')
  , feedparser = new FeedParser();

req.on('response', function (res) {
  var stream = this;

  if (res.statusCode != 200) return this.emit('error', new Error('Bad status code'));

  stream.pipe(feedparser);
});

feedparser.on('readable', function() {  
  var stream = this
    , item;

  while (item = stream.read()) { 
    // should print the right value here but currently the result is Object {}  

    console.log(item.image);
  }
});

I'm wondering if the expected result, according to the docs should be:

{ link: "...", url: "...", title: "..." }
@alabeduarte alabeduarte changed the title Article image properties is not been parsed Problem with parsing "image" property Aug 10, 2016
@tschellenbach
Copy link

similar result with this feed: https://dribbble.com/shots/popular.rss
all the articles have images but the library somehow ignores them

@tschellenbach
Copy link

btw, this is a pretty amazing library, thank you for the hard work. we're going to create an open source demo app with this library and Sails, React/Redux and getstream.io

@danmactough
Copy link
Owner

@alabeduarte Sorry for the long delay in replying. You happened to post your issue while I was on vacation and I never caught up, I guess. 😊

The feed you linked to doesn't appear to have images in the items, only a feed-level image, which is available on the meta object.

feedparser.on('readable', function() {  
  var stream = this
    , item;

  while (item = stream.read()) { 
    console.log(this.meta.image); // should log the image many, many times because that feed is AWESOME and includes every podcast from its inception!
  }
});

@danmactough
Copy link
Owner

@tschellenbach Thank you for your kind feedback (and waking up this thread)!

I see the same issue in your feed as I mentioned above: no image tag on the item, only at the feed level.

In your feed's case, the description in made up of HTML that happens to include an HTML <img> tag, but we don't parse the HTML. I hope that makes sense.

@alabeduarte
Copy link
Author

Thanks @danmactough

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

No branches or pull requests

3 participants