🚀 Socket Launch Week 🚀 Day 2: Introducing Repository Labels and Security Policies.Learn More

jsonify-that-feed

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonify-that-feed

A simple library for turning Atom, RSS and JSON feeds into JSON Feed.

1.2.2
latest
Version published
Weekly downloads
3
-40%
Maintainers
1
Weekly downloads
 
Created

jsonify-that-feed

Parse Atom, RSS, JSON feeds to JSON Feed 1.1.

Or OPML to JSON and vice versa.

This module is specifically developed for Ghost Reader

Install

# with npm: npm i jsonify-that-feed
yarn add jsonify-that-feed

Atom, RSS, JSON > JSON 1.1

import axios from 'axios';
import * as jsonify from 'jsonify-that-feed';

const { data } = await axios.get(url);
const feed = jsonify.toJson(data);
console.log(feed);
/*
  {
    "version": "https://jsonfeed.org/version/1.1",
    "title": "My Example Feed",
    "home_page_url": "https://example.org/",
    "feed_url"?: "https://example.org/feed.json",
    "items": [
      {
        "id": "1",
        "content_html"?: "<p>Hello, world!</p>",
        "url"?: "https://example.org/initial-post"
      }
    ]
  }
*/

OPML > JSON

const json = jsonify.opmlToJson(data);
console.log(json);
/**
  {
    version: 2,
    head: { title: 'Ghost Reader Subscriptions' },
    body: {
      outline: [
        {
          text: 'Example',
          title: 'Example',
          type: 'rss',
          xmlUrl: 'https://example.com/feed',
          htmlUrl: 'https://example.com',
        },
      ],
    },
  }
*/

JSON > OPML

const opml = jsonify.jsonToOpml(data);
console.log(opml);
/**
  <version>2</version>
  <head>
    <title>Ghost Reader Subscriptions</title>
  </head>
  <body>
    <outline>
      <text>Example</text>
      <title>Example</title>
      <type>rss</type>
      <xmlUrl>https://example.com/feed</xmlUrl>
      <htmlUrl>https://example.com</htmlUrl>
    </outline>
  </body>
*/

FAQs

Package last updated on 05 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts