How to use the rss-parser.parseString function in rss-parser

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 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 / lib / openapi-action.js View on Github external
}
          if (!isRetry && resp.statusCode === 401 && hasRefreshToken) {
            refreshOAuthToken(err => {
              if (err) reject(new Response({statusCode: 401}));
              else sendRequest(resolve, reject, true);
            })
            return;
          } else if (resp.statusCode >= 300) {
            return reject(new Response({statusCode: resp.statusCode, body}));
          }
          let ctype = resp.headers['content-type'] || '';
          if (body && ctype.indexOf('application/json') !== -1) {
            body = JSON.parse(body);
            resolve(body);
          } else if (openapi.info['x-datafire'] && openapi.info['x-datafire'].type === 'rss') {
            rssParser.parseString(body, (err, feed) => {
              if (err) reject(err);
              else resolve(feed);
            })
          } else {
            resolve(body);
          }
        })
      }