Giter Club home page Giter Club logo

rss-to-json's Introduction

rss to json

Util for parse ATOM and RSS feed resources and normalize them to JSON object.

Install

npm install rss-to-json --save
yarn add rss-to-json

Example

const { parse } = require('rss-to-json');
// async await
(async () => {

    var rss = await parse('https://blog.ethereum.org/feed.xml');

    console.log(JSON.stringify(rss, null, 3));

})();
// Promise

parse('https://blog.ethereum.org/feed.xml').then(rss => {
    console.log(JSON.stringify(rss, null, 3));
});

Result

{
   "title": "Ethereum Blog",
   "description": "",
   "link": "https://blog.ethereum.org",
   "image": "",
   "category": [],
   "items": [
      {
         "title": "Road to Devcon Meetup and Event Grants",
         "description": "Community organizers are the glue that holds the Ethereum ecosystem together, and whether they’re leading large-scale events, local meetups, hackathons or seminars, we might all be wandering in the dark forest of the analog world without them. But where’s the fun in relying on chance encounters with kindred spirits identified...",
         "link": "https://blog.ethereum.org/2021/07/15/r2d-meetup-and-event-grants/",
         "published": 1626332400000,
         "created": 1626332400000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "London Mainnet Announcement",
         "description": "After a successful testnet deployement, the London upgrade is now ready to be activated on the Ethereum mainnet. It will go live on block 12 965 000, which is expected between August 3-5, 2021. Client Versions In order to be compatible with the London upgrade, node operators will need to...",
         "link": "https://blog.ethereum.org/2021/07/15/london-mainnet-announcement/",
         "published": 1626332400000,
         "created": 1626332400000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Allocation Update: Q1 2021",
         "description": "Happy July! Read on for the list of projects funded in Q1 of this year. But first: office hours are in session! Signups are open now through this Sunday (July 4) for teams or individuals to request a one-on-one call with the ESP team during the week of July 5-9....",
         "link": "https://blog.ethereum.org/2021/07/01/esp-allocation-update-q1-2021/",
         "published": 1625122800000,
         "created": 1625122800000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "London Testnets Announcement",
         "description": "The long-anticipated London upgrade is now ready for deployement on the Ethereum testnets! The upgrade will first go live on Ropsten, at block 10499401, which is expected to happen around June 24, 2021. This upgrade follows Berlin, which was activated only a few months ago on the Ethereum mainnet. By...",
         "link": "https://blog.ethereum.org/2021/06/18/london-testnets-announcement/",
         "published": 1623999600000,
         "created": 1623999600000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Grantee Roundup: May 2021",
         "description": "It’s always fun to hear about new grants as they’re awarded, but what happens after the announcement? In this series, we’ll check in on a couple of projects that are well underway - or already at the finish line. Read on to learn about some recent milestones and achievements by...",
         "link": "https://blog.ethereum.org/2021/06/02/esp-grantee-roundup-may-2021/",
         "published": 1622617200000,
         "created": 1622617200000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Finalized no. 26",
         "description": "the Ethereum consensus-layer - \n          Steady progress tl;dr Altair progress Rayonism wrapped up; The Merge progresses Altair progress Altair, the first planned upgrade of the Beacon Chain, continues to make steady progress. Last week, we released Beacon Chain spec v1.1.0-alpha.6 – Protostellar Evolution. While this is an alpha release, barring a security or practical engineering...",
         "link": "https://blog.ethereum.org/2021/05/25/finalized-no-26/",
         "published": 1621926000000,
         "created": 1621926000000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Quests along the Road to Devcon",
         "description": "Friends, As the Ethereum ecosystem continues to grow and mature at break-neck speeds, we continue to work hard on delivering an amazing Devcon 6. Though the timing is still unclear as to when we’ll all be able to reunite in Bogota, we want to keep our community involved along the...",
         "link": "https://blog.ethereum.org/2021/05/19/quests-along-the-road/",
         "published": 1621407600000,
         "created": 1621407600000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Dodging a bullet: Ethereum State Problems",
         "description": "With this blog post, the intention is to officially disclose a severe threat against the Ethereum platform, which was a clear and present danger up until the Berlin hardfork. State Let’s begin with some background on Ethereum and State. The Ethereum state consists of a patricia-merkle trie, a prefix-tree. This...",
         "link": "https://blog.ethereum.org/2021/05/18/eth_state_problems/",
         "published": 1621321200000,
         "created": 1621321200000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "A country's worth of power, no more!",
         "description": "TL;DR: Ethereum will use at least ~99.95% less energy post merge. Ethereum will be completing the transition to Proof-of-Stake in the upcoming months, which brings a myriad of improvements that have been theorized for years. But now that the Beacon chain has been running for a few months, we can...",
         "link": "https://blog.ethereum.org/2021/05/18/country-power-no-more/",
         "published": 1621321200000,
         "created": 1621321200000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Core Developer Apprenticeship Program",
         "description": "Get involved in developing at the protocol level! - \n          Have you have ever been interested in getting involved in the development of the core Ethereum protocols? If so, there is a new program to discuss that’s targeted at you. As part of an EF procotol-support initiative, I’m very excited to announce the “Core Developer Apprenticeship Program”. What to expect...",
         "link": "https://blog.ethereum.org/2021/05/13/core-dev-apprenticeship/",
         "published": 1620889200000,
         "created": 1620889200000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Ethereum for the Next Billion: Announcing the EF Fellowship Program",
         "description": "The progress being made in the Ethereum ecosystem lately is really inspiring. Whether you’re excited by the adoption of proof of stake (and a faster, more secure, greener Ethereum), the coming Merge and other big upgrades, or by some of the many applications and solutions that have the power to...",
         "link": "https://blog.ethereum.org/2021/05/07/ethereum-for-the-next-billion/",
         "published": 1620370800000,
         "created": 1620370800000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Grantee Roundup: April 2021",
         "description": "It’s always fun to hear about new grants as they’re awarded, but what happens after the announcement? In this series, we’ll check in on a couple of projects that are well underway - or already at the finish line. Read on to learn about some recent milestones and achievements by...",
         "link": "https://blog.ethereum.org/2021/05/03/esp-grantee-roundup-april-2021/",
         "published": 1620025200000,
         "created": 1620025200000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "EF-Supported Teams: Research & Development Update",
         "description": "2021 Pt. 1 - \n          Friends, The year ahead will be filled with upgrades and big ideas from across the Ethereum ecosystem. Since our last Supported Teams post (which followed the launch of the beacon chain), the network has seen 3.8+ million Ether staked, and 120K+ active validators online across multiple clients. In recent days,...",
         "link": "https://blog.ethereum.org/2021/04/26/ef-supported-teams-research-and-development-update-2021-pt-1/",
         "published": 1619420400000,
         "created": 1619420400000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Finalized no. 25",
         "description": "the Ethereum consensus-layer - \n          tl;dr Rayonism☀️, hacking the Merge together blst security advisory Reminder! Beacon Chain security+testing RfP Rayonism☀️, hacking the Merge together This week, protolambda and others released plans for Rayonism, an ambitious month-long hack to create Merge devnets based on current specs with a stretch goal of adding sharding to these devnets...",
         "link": "https://blog.ethereum.org/2021/04/02/finalized-no-25/",
         "published": 1617346800000,
         "created": 1617346800000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Grantee Roundup: March 2021",
         "description": "It’s always fun to hear about new grants as they’re awarded, but what happens after the announcement? In this series, we’ll check in on projects that are well underway - or already at the finish line. Read on to learn about some recent milestones and achievements by grantees! Baseline The...",
         "link": "https://blog.ethereum.org/2021/04/01/esp-grantee-roundup-march-2021/",
         "published": 1617260400000,
         "created": 1617260400000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Finalized no. 24",
         "description": "the Ethereum consensus-layer - \n          tl;dr Altair prereleases: Stargazer and Half of ‘em just look like dots Security RfP Merge progress Altair pre-release is out Over the past week, beacon chain Altair pre-release specs – Stargazer v1.1.0-alpha.1 and Half of ‘em just look like dots v1.1.0-alpha.2 – were released. These represent the first feature complete...",
         "link": "https://blog.ethereum.org/2021/03/24/finalized-no-24/",
         "published": 1616569200000,
         "created": 1616569200000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Supporting Ethereum’s Client Ecosystem",
         "description": "Execution & consensus layer funding updates - \n          With the arrival of the beacon chain in 2020, Ethereum today supports two types of clients: those focusing on the execution-layer (often referred to as eth1) and those powering the proof-of-stake consensus layer (aka eth2). As those running validators are well aware (since they run both client types), each serves...",
         "link": "https://blog.ethereum.org/2021/03/23/supporting-ethereums-client-ecosystem/",
         "published": 1616482800000,
         "created": 1616482800000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Allocation Update: Q4 2020",
         "description": "2021 is just getting started, but it’s already been quite an eventful year! We’ve got the list of Q4 funded projects below, but we also want to share some updates from the ESP team. We’re always looking for more ways to support the ecosystem as it grows and evolves, so...",
         "link": "https://blog.ethereum.org/2021/03/22/esp-allocation-update-q4-2020/",
         "published": 1616396400000,
         "created": 1616396400000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Finalized no. 23",
         "description": "the Ethereum consensus-layer - \n          tl;dr Finalized: rebranding the blog Upgrade your nodes! Finalized, rebranding the blog If you’ve read my recent writings or listened to me speak about Ethereum and this grand upgrade that’s in the works, you’ve perhaps noticed that I’m not only shying away from discussing “phases” (instead, referring to a series...",
         "link": "https://blog.ethereum.org/2021/03/11/finalized-no-23/",
         "published": 1615449600000,
         "created": 1615449600000,
         "category": [],
         "enclosures": [],
         "media": {}
      },
      {
         "title": "Ethereum Berlin Upgrade Announcement",
         "description": "TL;DR Berlin is ready to be deployed! We’re moving fast: the first testnet to upgrade, Ropsten, is scheduled to upgrade on March 10th. Mainnet is scheduled for April 15th. If you are running an Ethereum node, you should upgrade it to a Berlin-compatible version ASAP for testnets and before April...",
         "link": "https://blog.ethereum.org/2021/03/08/Ethereum-berlin-upgrade-announcement/",
         "published": 1615190400000,
         "created": 1615190400000,
         "category": [],
         "enclosures": [],
         "media": {}
      }
   ]
}

Extract Title, Description, Keywords and Images from URLs with Node.js

An infinite scroll paginate plugin for Vue.js 3.0

Contributing

Please refer to each project's style and contribution guidelines for submitting patches and additions. In general, we follow the "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull request so that we can review your changes

NOTE: Be sure to merge the latest from "upstream" before making a pull request!

Community

Stay up to date on the development of Morioh UI and reach out to the community with these helpful resources.

Follow @codek_tv and @im_a_developer on Twitter.

Follow Morioh and Javascript Developers on FaceBook.

Join the official Discord room: https://discord.gg/sqxU6un.

rss-to-json's People

Contributors

abdou031 avatar chriscoindeskindices avatar cvburgess avatar ekoeryanto avatar emanuelclaesson avatar jaredaat avatar lyle avatar mikkelsandberg avatar nasa8x 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  avatar  avatar

rss-to-json's Issues

Should add option limit

Should add option limit.
Sometime you can get hundred of results and its slow,
you may pass options to the number of results.
&limit=10

Rss feed causing an error

Using latest rss-to-json: 2.0.2

This code is causing an error to be thrown:

const { parse } = require('rss-to-json');  

const abc = async () => {
    const b = await parse('https://status.aws.amazon.com/rss/apigateway-eu-west-2.rss').catch((err) => {console.log(err)});
    console.log(b)
}

abc()

The error:

TypeError: Cannot read property 'length' of undefined
at t.default in rss-to-json/dist/index.js — line 1

The RSS feed is, at the time of posting, returning:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title><![CDATA[Amazon API Gateway (London) Service Status]]></title>
    <link>http://status.aws.amazon.com/</link>
    <language>en-us</language>
    <lastBuildDate>Fri, 17 Dec 2021 00:05:40 PST</lastBuildDate>
    <generator>AWS Service Health Dashboard RSS Generator</generator>
    <description><![CDATA[Amazon API Gateway (London) Service Status]]></description>
    <ttl>5</ttl>
    <!-- You seem to care about knowing about your events, why not check out https://docs.aws.amazon.com/health/latest/ug/getting-started-api.html -->

	
  </channel>
</rss>

Value is not JSON

Niggle: this output is NOT JSON. JSON is a string, it's always a string that represents a primitive value, array or object structure in JavaScript notation.

What you have is an RSS parser for JS.

Feed.load is not a function

I have added this package and try to work with it but it is giving an error :
Feed.load is not a function.

Please provide a solution for this.

Items Array is Empty When Only A Single Item Exists

Problem: The returned items property is an empty array when fetching from sources that only have a single item present. (Did something change recently? This was working for me previously)

Expected Behaviour: For sources with one item, the items property of the returned object should be an array with a single element that is the parsed item.

Reproduction:

const Feed = require('rss-to-json');

// this RSS link may have more than one item in the future, ATOW it only has one
Feed.load('https://anchor.fm/s/30e91ea4/podcast/rss')
.then((rssData) => {
  if (rssData.items.length === 0) console.error('Items is empty!');
});

Investigation: When an RSS feed returns a single <item> entry, the channel.item value is the object, not an array as it would be when multiple <item> entries are present.

Solution: Add a type check on the items value to check if it's an array, and coerce it to an array if it is not.

[Feature suggestion] Ability to inject the HTTP client

Hey! Thanks a lot for this great library 🙂 I'm using it in a production project already, and currently implementing it in another.

I think one great improvement would be to allow passing a custom HTTP client in case you don't want to use Axios. This can be super helpful if you're using a custom client with added features such as deduping, caching, etc. For example, I'm currently working with Next.js and React Server Components, and the recommended way to fetch data only once server-side is to use a monkey-patched fetch client that caches requests forever.

The API could look something like this (here, using window.fetch):

import { parse } from 'rss-to-json';

const client = (url: string) => fetch(url).then((r) => r.text()).then((data) => ({ data }));

(async () => {
  const rss = await parse('https://blog.ethereum.org/feed.xml', client);

  console.log(JSON.stringify(rss, null, 3));
})();

I know the parse function currently takes Axios options as its second argument, but this can be circumvented by simply checking the type (object vs. function).

If you're open to this feature, check my PR 🙂

Category not being parsed

Hi,

I am using rss-to-json for fetching the RSS from a URL however I am facing a problem with the Category field.

I see that the Category is not being parsed in the JSON that I am getting from this library.

Is there anything that we can do to fix this problem?

I am copy pasting the RSS for reference:

<?xml version="1.0" encoding="UTF-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><title><![CDATA[All jobs | upwork.com]]></title><link><![CDATA[https://www.upwork.com/ab/feed/jobs/rss?api_params=1&amp;orgUid=424304544539983873&amp;paging=0%3B2&amp;q=&amp;securityToken=0cb40bb13bc3a7fe404a7c99a9bb814a8e47fb371f1ab2e29e6ba451924a7371a8845044b2fc6bf6e652a4dcf4f910db6859488f7be9534fb8b687b4ddb2638b&amp;sort=recency&amp;userUid=424304544535789568]]></link><description><![CDATA[All jobs as of October 11, 2022 19:01 UTC]]></description><language>en-us</language><pubDate>Tue, 11 Oct 2022 19:01:25 +0000</pubDate><copyright>© 2003-2022 Upwork Corporation</copyright><docs>http://blogs.law.harvard.edu/tech/rss</docs><generator>Upwork Corporation</generator><managingEditor>[email protected] (Upwork Corporation)</managingEditor><image><url>https://www.upwork.com/images/rss_logo.png</url><title><![CDATA[All jobs | upwork.com]]></title><link><![CDATA[https://www.upwork.com/ab/feed/jobs/rss?api_params=1&amp;orgUid=424304544539983873&amp;paging=0%3B2&amp;q=&amp;securityToken=0cb40bb13bc3a7fe404a7c99a9bb814a8e47fb371f1ab2e29e6ba451924a7371a8845044b2fc6bf6e652a4dcf4f910db6859488f7be9534fb8b687b4ddb2638b&amp;sort=recency&amp;userUid=424304544535789568]]></link></image><item><title><![CDATA[LOGO &amp; BRANDBOOK - Entertainment venue - Upwork]]></title><link>https://www.upwork.com/jobs/LOGO-amp-BRANDBOOK-Entertainment-venue_%7E0156dfc3b898be26ad?source=rss</link><description><![CDATA[We are developing a logo for an RC car racing concept. We&#039;re looking for a group that&#039;s able to aid in the brainstorming and development of a company logo, and brand identity kit. We need the logo in a few different styles, as the uses for this will be on digital marketing campaigns, screen prints and other physical advertising. <br /><br />
If interested, message me and we can discuss the project in further detail and I will narrow down the selection to 2-3 people before making a final decision. <br /><br /><br /><b>Budget</b>: $100
<br /><b>Posted On</b>: October 11, 2022 18:57 UTC<br /><b>Category</b>: Brand Identity Design<br /><b>Skills</b>:Logo Design,     Brand Guidelines,     Brand Identity &amp; Guidelines    
<br /><b>Country</b>: United States
<br /><a href="https://www.upwork.com/jobs/LOGO-amp-BRANDBOOK-Entertainment-venue_%7E0156dfc3b898be26ad?source=rss">click to apply</a>
]]></description><content:encoded><![CDATA[We are developing a logo for an RC car racing concept. We&#039;re looking for a group that&#039;s able to aid in the brainstorming and development of a company logo, and brand identity kit. We need the logo in a few different styles, as the uses for this will be on digital marketing campaigns, screen prints and other physical advertising. <br /><br />
If interested, message me and we can discuss the project in further detail and I will narrow down the selection to 2-3 people before making a final decision. <br /><br /><br /><b>Budget</b>: $100
<br /><b>Posted On</b>: October 11, 2022 18:57 UTC<br /><b>Category</b>: Brand Identity Design<br /><b>Skills</b>:Logo Design,     Brand Guidelines,     Brand Identity &amp; Guidelines    
<br /><b>Country</b>: United States
<br /><a href="https://www.upwork.com/jobs/LOGO-amp-BRANDBOOK-Entertainment-venue_%7E0156dfc3b898be26ad?source=rss">click to apply</a>
]]></content:encoded><pubDate>Tue, 11 Oct 2022 18:57:17 +0000</pubDate><guid>https://www.upwork.com/jobs/LOGO-amp-BRANDBOOK-Entertainment-venue_%7E0156dfc3b898be26ad?source=rss</guid></item><item><title><![CDATA[Content writer for new YouTube channel for F1 sports - Upwork]]></title><link>https://www.upwork.com/jobs/Content-writer-for-new-YouTube-channel-for-sports_%7E01abb956f3a00f0706?source=rss</link><description><![CDATA[Need someone to write script for my new YouTube video sports F1 (formula 1)<br />
Like this one <br />
Basketball one (but yeah without counting)<br /><br />
https://www.youtube.com/watch?v=0Rh_hZ8VrFs<br /><br />
F1 video I like<br />
https://www.youtube.com/watch?v=aziba6-IdMI<br /><br />
Well if someone know much about F1 this will be better&nbsp;&nbsp;<br />
Am posting this job on cheap price because it&#039;s my starting point surely if we suit will be working together<br /><br /><b>Hourly Range</b>: $13.00-$35.00

<br /><b>Posted On</b>: October 11, 2022 18:57 UTC<br /><b>Category</b>: Other Content Writing<br /><b>Skills</b>:Content Writing,     Search Engine Optimization,     Creative Writing,     Blog Writing,     Article Writing    
<br /><b>Country</b>: United Kingdom
<br /><a href="https://www.upwork.com/jobs/Content-writer-for-new-YouTube-channel-for-sports_%7E01abb956f3a00f0706?source=rss">click to apply</a>
]]></description><content:encoded><![CDATA[Need someone to write script for my new YouTube video sports F1 (formula 1)<br />
Like this one <br />
Basketball one (but yeah without counting)<br /><br />
https://www.youtube.com/watch?v=0Rh_hZ8VrFs<br /><br />
F1 video I like<br />
https://www.youtube.com/watch?v=aziba6-IdMI<br /><br />
Well if someone know much about F1 this will be better&nbsp;&nbsp;<br />
Am posting this job on cheap price because it&#039;s my starting point surely if we suit will be working together<br /><br /><b>Hourly Range</b>: $13.00-$35.00

<br /><b>Posted On</b>: October 11, 2022 18:57 UTC<br /><b>Category</b>: Other Content Writing<br /><b>Skills</b>:Content Writing,     Search Engine Optimization,     Creative Writing,     Blog Writing,     Article Writing    
<br /><b>Country</b>: United Kingdom
<br /><a href="https://www.upwork.com/jobs/Content-writer-for-new-YouTube-channel-for-sports_%7E01abb956f3a00f0706?source=rss">click to apply</a>
]]></content:encoded><pubDate>Tue, 11 Oct 2022 18:57:17 +0000</pubDate><guid>https://www.upwork.com/jobs/Content-writer-for-new-YouTube-channel-for-sports_%7E01abb956f3a00f0706?source=rss</guid></item></channel></rss>

Support cover_image tag

I'm trying to parse some HashNode RSS feeds (multiple other popular feeds use these tags too) which use cover_image tags to store the images. This solution does not output this data, making it unusable.

Most of the Wordpress rss crash

Most of the Wordpress RSS crash.
On Heroky you have to deploy the app again.
I do not know why but some RSS do not appear the same way as others RSS.
If you use the Chrome RSS extension: https://chrome.google.com/webstore/detail/rss-subscription-extensio/nlbjncdgjeocebhnmkbbbdekmmmcbfjd

Wordpress RSS are not well parsed: https://codesniff.com/feed
Normal RSS Example: https://www.cbsnews.com/latest/rss/main
But this one will crash to with rss-to-json.

This one will be fine: https://www.rt.com/rss/news/

Try both RSS in Chrome with the RSS extension

The Chrome extension RSS viewer can help.
https://chrome.google.com/webstore/detail/feed-intent-viewer/oceapojkdgeophkjdijkpbjifdnfimdh

I can't find difference between both.

Unable to use

I'm getting the following error, when trying to use it.
Not sure where I am going wrong.

I am using webpack 3 with webpack-dev-sever

`ERROR in ./node_modules/rss-to-json/node_modules/request/lib/har.js
Module not found: Error: Can't resolve 'fs' in 'D:\Projects\React Redux News Feed App\node_modules\rss-to-json\node_modules\request\lib'
@ ./node_modules/rss-to-json/node_modules/request/lib/har.js 3:9-22
@ ./node_modules/rss-to-json/node_modules/request/request.js
@ ./node_modules/rss-to-json/node_modules/request/index.js
@ ./node_modules/rss-to-json/src/rss.js
@ ./node_modules/rss-to-json/index.js
@ ./src/actions/channelActions.js
@ ./src/app.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.js

ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'net' in 'D:\Projects\React Redux News Feed App\node_modules\forever-agent'
@ ./node_modules/forever-agent/index.js 6:10-24
@ ./node_modules/rss-to-json/node_modules/request/request.js
@ ./node_modules/rss-to-json/node_modules/request/index.js
@ ./node_modules/rss-to-json/src/rss.js
@ ./node_modules/rss-to-json/index.js
@ ./src/actions/channelActions.js
@ ./src/app.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.js

ERROR in ./node_modules/tough-cookie/lib/cookie.js
Module not found: Error: Can't resolve 'net' in 'D:\Projects\React Redux News Feed App\node_modules\tough-cookie\lib'
@ ./node_modules/tough-cookie/lib/cookie.js 32:10-24
@ ./node_modules/rss-to-json/node_modules/request/lib/cookies.js
@ ./node_modules/rss-to-json/node_modules/request/index.js
@ ./node_modules/rss-to-json/src/rss.js
@ ./node_modules/rss-to-json/index.js
@ ./src/actions/channelActions.js
@ ./src/app.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.js

ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'net' in 'D:\Projects\React Redux News Feed App\node_modules\tunnel-agent'
@ ./node_modules/tunnel-agent/index.js 3:10-24
@ ./node_modules/rss-to-json/node_modules/request/lib/tunnel.js
@ ./node_modules/rss-to-json/node_modules/request/request.js
@ ./node_modules/rss-to-json/node_modules/request/index.js
@ ./node_modules/rss-to-json/src/rss.js
@ ./node_modules/rss-to-json/index.js
@ ./src/actions/channelActions.js
@ ./src/app.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.js

ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'D:\Projects\React Redux News Feed App\node_modules\forever-agent'
@ ./node_modules/forever-agent/index.js 7:10-24
@ ./node_modules/rss-to-json/node_modules/request/request.js
@ ./node_modules/rss-to-json/node_modules/request/index.js
@ ./node_modules/rss-to-json/src/rss.js
@ ./node_modules/rss-to-json/index.js
@ ./src/actions/channelActions.js
@ ./src/app.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.js

ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'D:\Projects\React Redux News Feed App\node_modules\tunnel-agent'
@ ./node_modules/tunnel-agent/index.js 4:10-24
@ ./node_modules/rss-to-json/node_modules/request/lib/tunnel.js
@ ./node_modules/rss-to-json/node_modules/request/request.js
@ ./node_modules/rss-to-json/node_modules/request/index.js
@ ./node_modules/rss-to-json/src/rss.js
@ ./node_modules/rss-to-json/index.js
@ ./src/actions/channelActions.js
@ ./src/app.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.js
webpack: Failed to compile.
error
`

Date isn't right!

const rs = await parse("https://blog.ryankert.cc/atom.xml");
    fs.writeFile("./assests/test.json", JSON.stringify(rs), err => {
      if(err) {
          console.log(err);                
      }
  }) 

It returns 3 items (post), but the Date of the three objects is the same, which is definitely wrong in its rss feed.

"items": [
    {
      "published": 1661450424213,
      "created": 1661362853489,
      ...
    },
    {
      "published": 1661450424213,
      "created": 1661362853489,
      ...
    },
    {
      "published": 1661450424213,
      "created": 1661362853489,
      ...
    }
]

move from axios to fetch

Currently, fetch is available in Node.js natively.
From other side axios doesn't work at serverless env (Cloudflare workers as an example)

It would be nice to move from axios to builtin fetch

ionic - nothing happens on device

I've tried use rss-to-json width ionic but I can't use it on a device.

Here is my ts page:

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';

import { Observable } from 'rxjs/Observable';
import { HttpClient } from '@angular/common/http';

import rss2json from 'rss-to-json'; //the character - provoque an error if I write "import rss-to-json" or "import  { rss-to-json }" 

@IonicPage()
@Component({
  selector: 'page-actualites',
  templateUrl: 'actualites.html',
})
export class ActualitesPage {
    
    actus:Observable<any>;

  constructor(public navCtrl: NavController, public navParams: NavParams, public httpClient: HttpClient) {  
   
      //let Feed = require('rss-to-json'); //-> error: Cannot find name 'require'
      const Feed = rss2json;
      
        let localactus;
       
        Feed.load('http://www.zdnet.fr/feeds/rss/actualites/internet/', function(err, rss){
            console.log('rss: ',rss.items);
            console.log('error: ',err);
            
            localactus = rss.items;
            console.log('localactus : ',localactus);
        });
      
        setTimeout(function() {
            this.actus = localactus;
            console.log('this.actus : ',this.actus);
            
        }, 1000);
      
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad ActualitesPage');
  }

}

On Chrome (on a laptop) it works fine and the console.logs I did displays an object but on a device, it doesn't seems to enter in Feed.load() because the console.logs I did in it doesn't appears.

I'm a noob in ionic and Angular so please be nice with me sempai...

Not working with Medium RSS feed

Hello. I'm using this with a Medium feed and its not returning the full object. It grabs the link and title but no the content or image of the posts. Have you tried this with Medium at all? Any ideas why this would happen?

Safari / Firefox triggering OPTIONS calls

Front-end app - the feed doesn't work for us in Safari and Firefox. It appears that setting the userAgent in the code causes those browsers to do an OPTIONS request. (In our case, the options request fails because of CORS and we don't have access to the source application)

Would be nice if setting the user agent was an optional setting.
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Firefox/45.0',

Thx-

Hellworld4431080

*Cyber Security
*Admin
Bug hunting
CVE
Investigation reporting
Networking
Cloud
Dev Ops
Digital _Creater

_
Here

Azure

Unable to GET namespace on the JSON response from RSS feed.

Currently, I'm able to get the JSON response from an RSS feed however it does not return the namespace for even as shown in the following image.
image

I would like to extract the data from the namespace event add it to the JSON response that currently looks as follow:

    "items": [
        {
            "title": "Kids and Families Le Petit Art",
            "description": "<p>Date: February 26, 2019</p><p><p><strong>Themes:</strong></p> <p><strong>January</strong><br />\nWinter Character Shaker: Kids and families create cute winter character out of small containers and other materials.</p> <p><strong>February</strong><br />\nCardboard Checkers Game: DIY your very own mini checkers game out of cardboard.</p> <p><strong>March</strong><br />\nMake and illustrate your own mini storybook.<br /> </p></p><p>Start time: 2:30 pm</p><p>End time: 4:30 pm</p><p>Contact phone: (718) 365-5516</p><p>Location: Poe Park Visitor Center (in Poe Park)</p>",
            "link": "http://www.nycgovparks.org/events/2019/02/26/kids-and-families-le-petit-art",
            "url": "http://www.nycgovparks.org/events/2019/02/26/kids-and-families-le-petit-art",
            "created": 1545402500000
        },
        {
            "title": "Kids & Families Recycle to Art",
            "description": "<p>Date: February 27, 2019</p><p><p>Kids and families have fun making cute art from recyclable materials.</p> <p><strong>Themes:</strong></p> <p>January: Make a Building Set<br />\nFebruary: Cardboard Letters<br />\nMarch: Paper Plate Self Portrait<br /> </p></p><p>Start time: 2:30 pm</p><p>End time: 4:30 pm</p><p>Contact phone: (718) 365-5516</p><p>Location: Poe Park Visitor Center (in Poe Park)</p>",
            "link": "http://www.nycgovparks.org/events/2019/02/27/kids-families-recycle-to-art",
            "url": "http://www.nycgovparks.org/events/2019/02/27/kids-families-recycle-to-art",
            "created": 1544559216000
        }```

Uncaught (in promise) TypeError: (0 , i.default) is not a function

Installed new empty project in react v^18.2.0

Page is blank. Getting error in console.

index.js:1 Uncaught (in promise) TypeError: (0 , i.default) is not a function at t.default (index.js:1:1) at App.js:7:1 at App (App.js:10:1) at renderWithHooks (react-dom.development.js:16305:1) at mountIndeterminateComponent (react-dom.development.js:20145:1) at beginWork (react-dom.development.js:21587:1) at beginWork$1 (react-dom.development.js:27426:1) at performUnitOfWork (react-dom.development.js:26557:1) at workLoopSync (react-dom.development.js:26466:1) at renderRootSync (react-dom.development.js:26434:1) t.default @ index.js:1 (anonymous) @ App.js:7 App @ App.js:10 renderWithHooks @ react-dom.development.js:16305 mountIndeterminateComponent @ react-dom.development.js:20145 beginWork @ react-dom.development.js:21587 beginWork$1 @ react-dom.development.js:27426 performUnitOfWork @ react-dom.development.js:26557 workLoopSync @ react-dom.development.js:26466 renderRootSync @ react-dom.development.js:26434 performConcurrentWorkOnRoot @ react-dom.development.js:25738 workLoop @ scheduler.development.js:266 flushWork @ scheduler.development.js:239 performWorkUntilDeadline @ scheduler.development.js:533 await in performWorkUntilDeadline (async) App @ App.js:10 renderWithHooks @ react-dom.development.js:16305 mountIndeterminateComponent @ react-dom.development.js:20145 beginWork @ react-dom.development.js:21587 beginWork$1 @ react-dom.development.js:27426 performUnitOfWork @ react-dom.development.js:26557 workLoopSync @ react-dom.development.js:26466 renderRootSync @ react-dom.development.js:26434 performConcurrentWorkOnRoot @ react-dom.development.js:25738 workLoop @ scheduler.development.js:266 flushWork @ scheduler.development.js:239 performWorkUntilDeadline @ scheduler.development.js:533

Package.json
{ "name": "test-rss-to-json", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-scripts": "5.0.1", "rss-to-json": "^2.1.1", "web-vitals": "^2.1.4" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } }

import instead of require

How do you recommend we import the pacakges vs require.

Something like:
import { parse } from 'rss-to-json';

Currently, this requires the AxiosRequestConfig and doesn't behave correctly.

Thoughts?

Cannot process some Feedburner Feeds

I was testing a url like this one:
http://feeds.gimletmedia.com/crimetownshow
Which kept returning a feed burner HTML page. This caused the entire parser to fail with "cannot access rss of undefined" error.

I had to change the headers to this for it to work properly. specifically I changed text/html to text/xml

{ 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Firefox/45.0', accept: 'text/xml,application/xhtml+xml' }

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.