Git Product home page Git Product logo

feed's Introduction

Hi there, I'm Jean-Philippe Monette 👋🏻

Work and Travel

Whether through my experience as a Senior Software Engineer delivering projects in Europe, North America and the Middle East, across various industries - that's how I was able to perfect my abilities to solve real world challenges using technologies.

feed's People

Contributors

alx avatar artskydj avatar benilovj avatar bewest avatar dependabot[bot] avatar download13 avatar gustavkj avatar haszari avatar jooola avatar jpmonette avatar kevinsimper avatar kyleamathews avatar leereamsnyder avatar lenovouser avatar mannil avatar mattimbrain avatar smebberson avatar sonniesedge avatar varunbatrait avatar vinnl avatar zfoster avatar zsolt-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

feed's Issues

item.id is ignored in rss output

Describe the bug
src/rss2.ts looks at entry.guid, not entry.id as documented (implied) in the readme.
https://github.com/jpmonette/feed/blob/master/src/rss2.ts#L117-L121

Expected behavior

  • entry.guid should be documented OR
  • the code should look at entry.id instead

Actual behavior
entry.guid is not documented, but is being used.

Versions (please complete the following information):

  • feed: I think since version 1.

Additional context
Workaround: submit both the entry.guid and the entry.id

Also, the test didn't catch this issue. If this test line was changed then the tests would catch the issue.
https://github.com/jpmonette/feed/blob/master/src/__tests__/setup.ts#L34

  sampleFeed.addItem({
    title: "Hello World",
-   id: "https://example.com/hello-world",
+   id: "0123456789abcdef-0123-4567-89abcdef"
    link: "https://example.com/hello-world",
    description: "This is an article about Hello World.",

FeedOptions require both "feed" and "feedLinks"

Describe the bug
The FeedOptions interface lists feed and feedLinks as required (without ?) which means that both of these keys must be set or TypeScript complains.

To Reproduce
Copy the actual example from the readme.

Expected behavior
Example compiles and works cleanly.

Actual behavior
TypeScript outputs an error:

routes/blog.ts:119:24 - error TS2345: Argument of type '{ title: string; description: string; id: string; link: string; image: string; favicon: string; copyright: string; updated: Date; generator: string; feedLinks: { json: string; atom: string; }; author: { ...; }; }' is not assignable to parameter of type 'FeedOptions'.
  Property 'feed' is missing in type '{ title: string; description: string; id: string; link: string; image: string; favicon: string; copyright: string; updated: Date; generator: string; feedLinks: { json: string; atom: string; }; author: { ...; }; }'.

It still compiles and works 🤷‍♂️

Versions (please complete the following information):

  • NodeJS: 10.7.0
  • TypeScript: 3.0.1
  • npm/yarn: 6.3.0
  • feed: 2.0.1

Additional context
I see no reason why either of these keys should be required as everything works fine without them.

adding attribute type="image/*" to enclosure tags

Is your feature request related to a problem? Please describe.
Same problem as this issue and opening a new issue due to this comment

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

when checking the xml output with a feed validator I get an error that the type attribute is required. + feedly requires the type in order to render images

Describe the solution you'd like

Add option to add type attribute to enclosure tags or automatically add type according to the file type

Extra properties

Hello! Is there a way to add extra attributes to main RSS tag, like this?

xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"

Tests

For obvious reasons.

Since you claim it's performant, it should also contain benchmark tests.

npm package broken

Describe the bug
The current npm release exposes a typescript class not a javascript class

To Reproduce
Steps to reproduce the behavior:

  1. Create a pure javascript nodejs file
  2. require feed
  3. try to instantiate the Feed class
  4. See error

Expected behavior
Works as before

Actual behavior
Kills server

Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

  • NodeJS: 10
  • TypeScript: none
  • npm/yarn: 5.6.0 (npm)
  • feed: latest

Additional context
None

Example Code, `posts` Undefined

Describe the bug
Unless the example code is not meant to be copy/pasted to work out of the box, the variable posts needs needs to be defined.

To Reproduce
Steps to reproduce the behavior:

  1. Go to example code
  2. copy and paste code into local env
  3. run code
  4. See error, "ReferenceError: posts is not defined"

Expected behavior
Code should run.

Actual behavior
Error from above.

Screenshots
none

Versions (please complete the following information):

  • NodeJS: v10.10
  • TypeScript: none
  • npm/yarn: v6.4.1
  • feed: n/a

Additional context
n/a

content encoding

in your code I see the following:

if(items[i].content)
bContent = true;
item.push({ 'content:encoded': { _cdata: items[i].content }});

I guess you forgot the "{}"

RESULT

If no content is present, 'content:encoded' is pushed to item. this results in an encoding problem because no namespace is present. Adding content is a quick fix.

Namespace prefix content on encoded is not defined

I'm using the following code to create a feed

app.get('/rss/:s1',function(req,res,next){
    console.log('Attempting to return feeds for:',req.params.s1);
    var feedObj = new Feed({
        title: 'Karan Kapoor',
        description: 'Karan Kapoor\'s content feed',
        link: 'http://somenet/rss/karan_kapoor',
        author : {
            name:'Karan Kapoor',
            link:'http://somenet/#!/karan_kapoor'   
        }
    });
    feedObj.addItem({
        title:  'Intro to Karan Kapoor',
        description: 'Something Something',
        link: 'http://somenet/#!/karan_kapoor', 
        date: new Date()
    });
    var feedXml = feedObj.render();//feed.xml({indent:true});
    res.set('Content-Type', 'text/xml');
    res.send(feedXml);
    console.log('Feed XML is :: ',feedXml);
});

And I get the following error on the page when I open the feed

This page contains the following errors:
error on line 16 at column 29: Namespace prefix content on encoded is not defined
Below is a rendering of the page up to the first error.

Karan Kapoor Karan Kapoor's content feed http://somenet/rss/karan_kapoor Wed, 12 Aug 2015 11:18:19 GMT http://blogs.law.harvard.edu/tech/rss Feed for Node.js http://somenet/#!/karan_kapoor http://somenet/#!/karan_kapoor Wed, 12 Aug 2015 11:18:19 GMT Something something

How can I fix this?

When I print the output of the feed on the console, I get

Feed XML is ::  <?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
    <title>Karan Kapoor</title>
    <description>Karan Kapoor&apos;s content feed</description>
    <link>http://somenet/rss/karan_kapoor</link>
    <lastBuildDate>Wed, 12 Aug 2015 11:18:19 GMT</lastBuildDate>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>Feed for Node.js</generator>
    <item>
        <title><![CDATA[Intro to Karan Kapoor]]></title>
        <link>http://somenet/#!/karan_kapoor</link>
        <guid>http://somenet/#!/karan_kapoor</guid>
        <pubDate>Wed, 12 Aug 2015 11:18:19 GMT</pubDate>
        <description><![CDATA[Something Something]]></description>
        <content:encoded/>
    </item>
</channel>

Also, how do I get rid of the CDATA in the feed content?

RSS author tag for each post should contain only email

Many thanks for this module. Really made things easy for me. :0)

But I am running into a validation problem: https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fblog.scottnonnenberg.com%2Frss.xml

The <author> tag is specified with three child tags, and the validator expects just a string, the author's email:

line 119, column 16: Undefined author element: name (20 occurrences) [help]
                <name>Scott Nonnenberg</name>
                ^
line 120, column 16: Undefined author element: email (20 occurrences) [help]
                <email>[email protected]</email>
                ^
line 121, column 16: Undefined author element: link (20 occurrences) [help]
                <link>https://scottnonnenberg.com</link>
                ^
line 122, column 12: Invalid email address: (20 occurrences) [help]
            </author>
            ^

Atom doesn't have the same problem: https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fblog.scottnonnenberg.com%2Fatom.xml

Maybe for the RSS feed only, we could take the email key from the provided author object and promote it? I'd be happy to submit a pull request.

Author fields in feed items?

Hi

Thank you for this efficient little lib. Just one question. Are you going to add author fields to the feed items? From your code, it looks like you are planning on doing it.

How to generate <dc:creator>

I'm trying to generate an RSS feed and see that the standards are quite messed up. Does this module support dc:module, an alternative to 'author' used by a few aggregators like Flipboard? I tried looking up the documentation for the feed module, but there's no mention of it. Is there any workaround?

Date formatting to ISO string invalid (adding timezone computation)

Describe the bug
When you create a date from an iso8601 string, and when you try to "render" it, e.g. with date.toISOString() (source: lib/atom.1.js:67),
it computes it and works with the time-zone.

I'm in a case in which I want to have absolutely 0 change from the original timestamp, but the JS conversion removes 2 hours from the actual timestamp on render.

Wouldn't it be possible for "updated" to take an iso-formatted string, either validating it or trusting the developer to not fuck up the format ?

To Reproduce
Steps to reproduce the behavior:

Tested in UTC+2 time zone

new Date("2018/09/09")
// Returns Date 2018-09-08T22:00:00.000Z

Expected behavior

I'd expect it to return Date 2018-09-09T00:00:00.000Z

More informations

The obtained error is:

TypeError: Cannot read property 'toISOString' of undefined
index.js:36
    at /home/nyx/git/Blog/node_modules/feed/lib/atom1.js:67:34

Because, since I pass a correctly-formatted ISO string and not a Date instance, the validator doesn't take the value, so it evaluates to undefined.

Cannot display the publish time of essay correctly.

Hi, I used feed to generate an Atom 1.0 feed. All works well except the publish time of essay cannot display correctly.
There is my page in inoreader and the page I expect it can be.
mine page
page example
And I noticed the difference between my xml file and the xml file which can display publish time correctly.
mine xml
a xml example
Is it the reason that it has the published tag but mine didn't ?
I only find the option date in readme, so could you tell me how to write the config to display the publish time correctly?

order ?

Hi

I'm trying your (very usefull) module and I've got a little problem... I append entries in the right order (date desc). On my console, I can see titles in the right order.

But, xml is sorted with bad order... some old ticket are on top, then I see newest, and so on... any idea ?

Feed items added asynchronously are not sorted by date

If my recordset is not sorted by descending date my feed is out of order. It would be nice if there was a sort before the render.

I noticed this behavior this when I added items to the feed from multiple async sources.

writing feed as a stream of articles [feature request]

Hi,
The feed object collects all the articles before rendering them out. Is it possible to have a stream based solution, where instead of collecting the articles by addItem method it actually renders the corresponding XML, once the stream os articles is exhausted, done method can be called to finish the XML rendering?

The code breaks when atom feed is requested

It happens every time. It looks like this is an issue that popped up in the latest version. Here is a console output

TypeError: Cannot read property 'author' of undefined
    at atom_1_0 (/home/akshat/Desktop/specter/node_modules/feed/lib/feed.js:148:36)
    at Feed.render (/home/akshat/Desktop/specter/node_modules/feed/lib/feed.js:46:24)
    at Request._callback (/home/akshat/Desktop/specter/routes/feed.js:44:25)
    at Request.self.callback (/home/akshat/Desktop/specter/node_modules/request/request.js:129:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request.<anonymous> (/home/akshat/Desktop/specter/node_modules/request/request.js:873:14)
    at Request.EventEmitter.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/home/akshat/Desktop/specter/node_modules/request/request.js:824:12)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16


Lots of commits missing in npm

Howdy - thanks for your work on this package. Would it be possible to bump your version and publish to npm? I see a number of good fixes that aren't available on the npm version from 2 years ago.

Thanks!

Feedly.com not accepting it

Hi, first of all thank you for the plugin! It is very nice!

So, I made an implementation of the feed plugin, and it seemed to be working well. However, once I tried to use it on Feedly.com, it did not accept it. It gave me a red error alert saying "Error".

You can replicate it by creating a feedly account and trying to add either the RSS or Atom feed.

Feed List:
http://fabionolasco.com:3322/

RSS:
http://fabionolasco.com:3322/rss

Atom:
http://fabionolasco.com:3322/atom

Implementation (source code):
https://github.com/fabionolasco/fire-feed

Add optional scheme and label parameters to the category element - Atom feeds

Describe the solution you'd like
It would be nice to allow the passing of scheme and label parameters to the Category element.
Also, Category element should be available for Entry element (i.e. https://validator.w3.org/feed/docs/atom.html#optionalFeedElements).

We don't have the option to pass scheme and label parameter in the addCategory function.

For example -

<entry>
.........
<category scheme="topic" term="491"/>
</entry>

Thanks

</link> stripped out

my code;

exports.feed = async (req, res, next) => {
  try {
    const options = {
      perPage: 10,
      sortBy: { createdAt: -1 },
      criteria: { status: 'published' }
    };

    let posts = await BlogPost.list(options);
    let feed = feedCreator.create({
      title: 'Blog',
      description: 'blogundan en yeni gelişmeler.',
      url: `${res.locals.baseUrl}/blog/feed/`
    });

    _.forEach(posts, function (entry) {
      feed.addItem({
        title: entry.title,
        description: S(entry.content).stripTags().decodeHTMLEntities().truncate(155).s,
        link: `${res.locals.baseUrl}/blog/${entry.slug}/`,
        id: `${res.locals.baseUrl}/blog/${entry.slug}/`,
        image: entry.image,
        date: entry.createdAt
      });
    });

    res.type('application/rss+xml');
    return res.send(feed.rss2('rss-2.0'));
  } catch (err) {
    return next(createError.InternalServerError(err));
  }
};

getting invalid feed with validator; https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fbuharmetre.com%2Fblog%2Ffeed

This feed does not validate.
line 1, column 140: Undefined link element: description [help]
... ><link>https://buharmetre.com/blog/feed/<description>BuharMetre blogunda ...
                                             ^
line 1, column 207: Undefined link element: lastbuilddate [help]
... gundan en yeni gelişmeler.</description><lastbuilddate>Tue, 25 Apr 2017  ...
                                             ^
line 1, column 267: Undefined link element: docs [help]
... 25 Apr 2017 12:15:53 GMT</lastbuilddate><docs>http://blogs.law.harvard.e ...
                                             ^
line 1, column 317: Undefined link element: generator [help]
... ://blogs.law.harvard.edu/tech/rss</docs><generator>Feed for Node.js</gen ...
                                             ^
line 1, column 356: Undefined link element: image [help]
... ><generator>Feed for Node.js</generator><image><title>BuharMetre.com Blo ...
                                             ^
line 1, column 457: XML parsing error: <unknown>:1:492: mismatched tag [help]
... tre.com/images/logo/logo.png</url><link>https://buharmetre.com/blog/feed ...

some how my 's are stripped any ideas?

New line is not transformed to <BR>

If I add \n to the text in the "description" field of a feed entry, it is not transformed in <br> or something equivalent in the RSS feed. Is that a bug? Thanks.

Allow for manual setting of the feed updated date

I'd like to use this package for a static site generator I'm putting together, but I want to set the feed updated date to the date of the latest published post. Unfortunately, every time I generate the site, the atom.xml file I'm generating has a different updated date, which doesn't reflect the actual date that content was updated for the site.

"updated" broken

The documentation says that the 'updated' field is 'now' by default if omitted, but when generating an atom feed the generation fails with: "[TypeError: Cannot read property 'getUTCFullYear' of undefined]"

Which comes down to the fact that updated is not set.

TypeError: Object July 21, 1983 01:15:00 has no method 'toUTCString'

hi, the feed module is awesome. But when I was using this module by typing:

app.get('/rss', function (req, res) {
  var feed = new Feed({
   title:          'My Feed Title',
   description:    'This is my personnal feed!',
   link:           'http://example.com/',
   image:          'http://example.com/logo.png',
   copyright:      'Copyright © 2013 John Doe. All rights reserved',

   author: {
             name:       '',
             email:      '',
             link:       ''
           }
  });

  feed.item({
    id : 'kpi',
    title : 'kpi',
    link : 'http://10.154.145.48:3456/packageApp/kpi',
    date:   'July 21, 1983 01:15:00'
  });

  feed.category('Technologie');

  res.set('Content-Type', 'text/xml');
  res.send(feed.render('rss-2.0'));

});

and the result of running is:

TypeError: Object July 21, 1983 01:15:00 has no method 'toUTCString'
    at rss_2_0 (/Users/shao19/Code/my Coding/node/rss/node_modules/feed/lib/feed.js:242:43)
    at Feed.render (/Users/shao19/Code/my Coding/node/rss/node_modules/feed/lib/feed.js:42:24)
    at /Users/shao19/Code/my Coding/node/rss/app.js:60:17
    at callbacks (/Users/shao19/Code/my Coding/node/rss/node_modules/express/lib/router/index.js:161:37)
    at param (/Users/shao19/Code/my Coding/node/rss/node_modules/express/lib/router/index.js:135:11)

I was no idea why it could happy. Bacause when I typing :

"docs field in rss2 is hard coded to http://blogs.law.harvard.edu/tech/rss

Describe the bug
When generating an RSS version 2 feed the "docs" field is hard coded to http://blogs.law.harvard.edu/tech/rss and cannot be overridden by config parameters.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Actual behavior
A clear and concise description of what is the actual outcome.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

  • NodeJS:
  • TypeScript:
  • npm/yarn:
  • feed:

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.