How to use rss-parser - 10 common examples

To help you get started, we’ve selected a few rss-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flysteur-dev / pager / src / Components / Feed / Feeds.js View on Github external
}

		// Loader
		this.setState({ loading: true });

		let feed = {
			_id:     rss,
			uri:     rss,
			title:   rss,
			icon:    '',
			created: (fromOPML) ? parseInt(Date.now() / 100) : 0
		};

		//Trying to fetch xml feed
		try {
			let parser = new Parser();
			let uri = `${PROXY_PATH}${rss}`;

			let info = await parser.parseURL(uri);
			if (info.title) {
				//Add feed title
				feed.title = info.title;
			}

			//Use google as favicon provider (o_O)
			if (window.fetch) {
				let base = info.link || rss;
				let icon = await fetch(`${PROXY_PATH}${FAVICON_PROVIDER}${base}`);
				await icon.arrayBuffer().then((buffer) => {
					//Read stream
					var binary     = '';
					var bytes      = [].slice.call(new Uint8Array(buffer));
github biskuitorg / biskuit / app / system / modules / dashboard / app / components / widget-feed.vue View on Github external
load() {
                const vm = this;
                this.feed = {};
                this.status = '';
                if (!this.widget.url) {
                    return;
                }

                this.status = 'loading';
                // TODO: CORS policies might block the request
                const parser = new RSSParser();
                parser.parseURL(this.widget.url)
                    .then((feed) => {
                        vm.feed = feed;
                        vm.status = 'done';
                    }, (err) => {
                        vm.status = 'error';
                    }
                );
            }
        }
github ArkEcosystem / desktop-wallet / __tests__ / unit / services / feed.spec.js View on Github external
it('should retrieve the feed and parse it', async () => {
      parseURLMock.mockImplementation(url => url === feed.feedUrl ? feed : null)

      expect(await feedService.fetchAndParse(feed.feedUrl)).toEqual(feed)
    })
github alirawashdeh / rss-reader-alexa / index.js View on Github external
case "entertainment":
        url = "http://feeds.bbci.co.uk/news/entertainment_and_arts/rss.xml?edition=uk";
        break;

        default:
        response.tellWithCard("Unable to understand " + intent.slots.FeedName.value, "RSS Headlines", "Couldn't understand " + intent.slots.FeedName.value);
        return;
      }
    }
    else
    {
      response.tellWithCard("Unable to understand that request", "RSS Headlines", "Couldn't understand the request");
      return;
    }

    parser.parseURL(url, function(err,parsed){

      var output = "" + parsed.feed.title + ". <break time=\"0.8s\"/> ";

      var i = 0;
      parsed.feed.entries.forEach(function(entry){
        if(i <= 4)
        {
          console.log(entry.title);
          output = output + entry.title + ". <break time=\"0.6s\"/> "
          i++;
        }
      })

      var ssmlOutput = {
        speech: '<speak>' + output + '</speak>',
        type: AlexaSkill.speechOutputType.SSML
github PublicI / fec-loader / src / util / fec / rss.js View on Github external
function queueFilingsToCheck() {
    console.log('checking RSS');


    parser.parseURL('http://efilingapps.fec.gov/rss/generate?preDefinedFilingType=ALL', function(err, parsed) {
        if (!err && parsed && parsed.feed && parsed.feed.entries) {
            var newFilings = parsed.feed.entries.map(function (filing) {
                return parseInt(filing.link.replace('http://docquery.fec.gov/dcdev/posted/','').replace('.fec',''));
            });

            models.fec_filing.findAll({
                    attributes: ['filing_id'],
                    where: {
                        filing_id: {
                            gte: _.min(newFilings)
                        }
                    }
                })
                .then(function(filings) {
                    filings = filings.map(function(filing) {
                        return filing.filing_id;
github magda-io / magda / magda-web-client / src / actions / newsActions.ts View on Github external
.then(text => {
                parser.parseString(text, (err, result) => {
                    if (err) {
                        console.warn(err);
                        dispatch(
                            requestNewsError({
                                title: "error",
                                detail: "can not get news"
                            })
                        );
                    } else {
                        dispatch(receiveNews(result.feed.entries));
                    }
                });
            })
            .catch(error =>
github DataFire / DataFire / src / commands / integrate.js View on Github external
return acb => {
      if (op.parameters.length) return acb();
      rssParser.parseURL(spec.schemes[0] + '://' + spec.host + path, (err, feed) => {
        if (err) return acb(err);
        feed = feed.feed;
        spec.paths[path].get.summary = feed.title;
        spec.paths[path].get.description = feed.description;
        acb();
      })
    }
  }), err => {
github jondubin / gatsby-source-rss / gatsby-node.js View on Github external
return new Promise((resolve, reject) => {
    parser.parseURL(url, (err, data) => {
      if (err) {
        reject(err);
      }
      resolve(data.feed);
    });
  });
}
github isdampe / music-for-programming / lib / mfp-api.js View on Github external
fetchTracks(callback) {

		rssParser.parseURL(this.rssFeedUri,(err,parsed) => {
			if ( err ) {
				callback(true,[]);
				return false;
			}

			callback(false,parsed.feed.entries);

		});

	}
github DataFire / DataFire / distribution / commands / integrate.js View on Github external
host: urlObj.hostname,
    basePath: '/',
    schemes: [urlObj.protocol.substring(0, urlObj.protocol.length - 1)],
    paths: {},
    definitions: { Feed: RSS_SCHEMA }
  };
  spec.paths[urlObj.pathname] = {
    get: {
      operationId: 'getItems',
      description: "Retrieve the RSS feed",
      responses: {
        '200': { description: "OK", schema: { $ref: '#/definitions/Feed' } }
      }
    }
  };
  rssParser.parseURL(url, function (err, feed) {
    if (err) return callback(err);
    feed = feed.feed;
    spec.info = {
      title: feed.title,
      description: feed.description
    };
    addIntegration(name, 'rss', spec, callback);
  });
};

rss-parser

A lightweight RSS parser, for Node and the browser

MIT
Latest version published 2 years ago

Package Health Score

61 / 100
Full package analysis