GithubHelp home page GithubHelp logo

laudebugs / feed-core Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 875 KB

Generate RSS Feeds that play nice with Google News

License: GNU General Public License v3.0

JavaScript 5.26% Shell 1.74% TypeScript 93.00%

feed-core's Introduction

Welcome to feed-core ๐Ÿ‘‹

Version Documentation Maintenance License: ISC Twitter: lbugasu

Generate RSS Feeds that play nice with Google News

๐Ÿ  Homepage

Install

npm install feed-core

Usage

The two main types provided are RSSFeed and FeedItem

Constructing a Feed

To create a new RSS feed, the RSSFeed class can be used and takes the following parameters:

const feed = new RSSFeed({
    title: 'Awesome Feed about Cats and Dogs',
    description: 'This is a feed about Cats vs Dogs',
    link: 'https://cats-v-dogs.com/rss',
})

The rest of the feed properties that can be set are:

  • feedAuthor: FeedAuthor:
        const author = new FeedAuthor({
          name: 'Giomari Martinez',
          email: '[email protected]'
          link: 'giomari-m.com'
        })
        feed.feedAuthor = author
  • categories: string[]:
    feed.categories = ['cats', 'dogs']
  • updatedAt: Date:
    feed.updatedAt = new Date()
  • language: string
    feed.language = 'en'
  • image: string This represents the image url for the feed:
    feed.image = 'https://example.com/cat-v-dogs.jpg'

Adding Feed Items

Feed can be added to a feed's items property - an array of type FeedItem[]

Each item should follow the signature of FeedItem:

const feedImage = new FeedItemImage({
    url: 'https://unsplash.com/photos/EV9_vVMZTcg', // Image url
    width: 1280, // number - image width
    height: 720, // number - image height
    thumbnail: 'https://unsplash.com/photos/EV9_vVMZTcg', // (optional)image thumbnail url (optional)
    description: '', // string (optional) - the image description
    credit: '', // string (optional) - can be something like 'Image couretesy of Unsplash'
})
const feedItem = new FeedItem(
    // Required
    'In the subways, cats and dogs have to play nice', // the item title
    'https://https://cats-v-dogs.com/where-it-all-began', // Link to the item
    'A story of what really happened', // Item Summary/description
    'The story begins', // Content
    // Optional
    new Date(), // (optional) the publication date of the item - defaults to new Date()
    'https://https://cats-v-dogs.com/assets/where-it-all-began.jpg'[author], // (optional) FeedAuthor[] - authors
    [author], // (optional) FeedAuthor[] - contributors
)

Author

๐Ÿ‘ค Laurence B. Ininda

๐Ÿค Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a โญ๏ธ if this project helped you!

๐Ÿ“ License

Copyright ยฉ 2021 Laurence B. Ininda.
This project is ISC licensed.


This README was generated with โค๏ธ by readme-md-generator

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.