tk120404 / node-rssparser

🚀RSS/ATOM feed parser that returns the requested feed urls in a simple json object
http://www.laymansite.com
63 stars 20 forks source link

TypeError #19

Closed samuelgilman closed 6 years ago

samuelgilman commented 10 years ago

Getting a type error from a few feeds:

feed

http://www.economist.com/feeds/print-sections/71/united-states.xml

obj.summary = val.comments[0] != null ? val.comments[0] : '';
TypeError: Cannot read property '0' of undefined
tk120404 commented 10 years ago

Not sure how you are getting these errors, but these seems to be working fine. Can you run the test.js with this url and let me know what error are you getting? Do share the OS and node version details

aidvu commented 10 years ago

Samuel, try doing a npm update. There were some changes to lib2xml recently, and if you have older versions of dependencies, that might have broken it.

samuelgilman commented 10 years ago

aidvu, I'm assuming 0.0.7 is the latest. If not then I'm totall wrong. Before submitting these issues I've udpated everything just to make sure.

samuelgilman commented 10 years ago

tk120404, most recent Mavericks and Ubuntu. node v0.11.13 on both machines. I will run the test tomorrow and see if anything fails.

Basically you need to get this error:

obj.summary = val.comments[0] != null ? val.comments[0] : '';
TypeError: Cannot read property '0' of undefined

In order to trigger the dbl callbacks. I might create a fake endpoint so it stays around because these errors come from apis that usually work, and sometimes do not because of bad xml or what not.

aidvu commented 10 years ago

Ubuntu 14.04, nodejs v0.10.28, npm v1.4.9

npm install rssparser rssparser@0.0.7 node_modules/rssparser ├── underscore@1.4.4 ├── vows@0.7.0 (eyes@0.1.8, diff@1.0.4) ├── xml2js@0.2.6 (sax@0.4.2) └── request@2.16.6 (forever-agent@0.2.0, aws-sign@0.2.0, tunnel-agent@0.2.0, oauth-sign@0.2.0, json-stringify-safe@3.0.0, cookie-jar@0.2.0, node-uuid@1.4.0, mime@1.2.9, qs@0.5.5, hawk@0.10.2, form-data@0.0.7)

Parses above feed properly.

tk120404 commented 10 years ago

It parses all the urls properly mentioned in the other issues as well

samuelgilman commented 10 years ago

npm tests are all good.

You cannot reproduce the errors because the data from the feeds changes. When I get these errors I will capture the xml output and make fake endpoints. I just have to follow my logs and capture the response. From what I've seen it triggers the dbl cb on a specific error which is bad xml but it still goes through and therefore the callback is called twice once with the err and once with the data.

Will update tomorrow.

tk120404 commented 6 years ago

no activity. closing the issue