npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rss-to-facebook

v1.0.6

Published

This is the module that you need to send rss news to a facebook page.

Downloads

2

Readme

rss-to-facebook

This is the module that you need to send rss news to a facebook page.

support for:

  • Cron sintaxis to flexible time publishing.
  • Filter function, to filter your content.
  • Preprocess function to add extra data to meessages.
  • Enabled link preview option.
  • Flexible message template with handlebar.

Install

npm i rss-to-facebook

use

const rssToFacebook = require("rss-to-facebook");
const {
  FACEBOOK_APP_ID, FACEBOOK_APP_SECRET, FACEBOOK_PAGE_ACCES_TOKEN, FACEBOOK_PAGE_ID,
} = process.env;

rssToFacebook({
  facebookAppID: FACEBOOK_APP_ID,
  facebookAppSecret: FACEBOOK_APP_SECRET,
  facebookPageAccesToken: FACEBOOK_PAGE_ACCES_TOKEN,
  facebookPageID: FACEBOOK_PAGE_ID,
  cron: "*/15 * * * * *", // publish every 15 seconds, cron sintaxis
  timezone: "America/Havana", // your defined timezone
  // rss source
  source: "https://feed.informer.com/digests/ZO8A5LZCGA/feeder.rss", // can be an async function or and array of objects
  // source: async () => {
  //   return db.get({ limit: 10 }); // your custom db
  // },
  // source: [{colo:"red"}],
  // add new fields to show in the message
  preprocess: async (item) => {
    item.color = "green";
    return item;
  },
  // define you own message template
  template:
    'Color is {{color}}, <a href="{{image}}"> </a> <b><a href="{{link}}">{{title}}</a></b>\n @{{channel}}',
  // filter news of the day, use this function to filter already published posts
  filter: async ({ date }) => { // async functtion
    // must be async
    const d = new Date();
    return (
      date.getDate() === d.getDate() &&
      date.getMonth() === d.getMonth() &&
      date.getFullYear() === d.getFullYear()
    );
  },
  // add extra common fields to all items,
  extraFields: { colo: "red", line: "stroke" }, // add line field to all items and overwrite color field
});

Cron sintaxis

 # ┌────────────── second (optional)
 # │ ┌──────────── minute
 # │ │ ┌────────── hour
 # │ │ │ ┌──────── day of month
 # │ │ │ │ ┌────── month
 # │ │ │ │ │ ┌──── day of week
 # │ │ │ │ │ │
 # │ │ │ │ │ │
 # * * * * * *
  • every five minutes. 0 */5 * * * *
  • every quarter hour. 0 */15 * * * *
  • every hour at minute 30. 0 30 * * * *
  • three times every hour, at minute 0, 5 and 10 0 0,5,10 * * * *
  • every half hour 0 */30 * * * *

More example https://crontab.guru/examples.html

Timezone

https://github.com/moment/moment-timezone/blob/develop/data/packed/latest.json

Template fields

  • title
  • link
  • image
  • channel
  • description
  • date

use the preprocess function to add fields, then modify the template to show the new fields in the message

rssToTelegram({
...
 preprocess: async (item) => {
   item.color = "green";
   return item; 
 },
 template: 'Color is {{color}}, Link is {{link}}, Title is {{title}} \n @{{channel}}',
...
})

Donate Bitcoin:

bitcoin:3GqQcxFk5y7onUyoTKqZHwoWXvLusqJSVG

3GqQcxFk5y7onUyoTKqZHwoWXvLusqJSVG

Contact: [email protected]