Server/NodeJS & NestJS

Node) google news rss로 읽어오기

Juzdalua 2023. 3. 7. 18:58

npm i rss-parser

import Parser from "rss-parser";


const parser = new Parser({
  customFields: {
    item: ["source"],
  },
});

// 24시간 이내 영어로 작성된 nba 기사 가져오기
const rss = await parser.parseURL(`https://news.google.com/rss/search?q=when:24h+nba&hl=en-US&gl=US&ceid=US:en`);
console.log(rss.items);
}

https://www.npmjs.com/package/rss-parser

 

rss-parser

A lightweight RSS parser, for Node and the browser. Latest version: 3.12.0, last published: 2 years ago. Start using rss-parser in your project by running `npm i rss-parser`. There are 283 other projects in the npm registry using rss-parser.

www.npmjs.com

 

'Server > NodeJS & NestJS' 카테고리의 다른 글

NodeJS) 서버에서 HTML 파일 읽기  (0) 2023.04.03
Node) google news에서 많이 사용된 단어 추출하기  (0) 2023.03.07
NestJS) ChatGPT API 사용후기  (0) 2023.02.01
NestJS) supertest  (0) 2023.01.11
NestJS) Jest TDD Setting  (0) 2023.01.10