7
The GNews Scraping API is a Node.js server-side application designed to scrape news articles from Google News. It utilizes the Axios library for making HTTP requests, Cheerio for web scraping, and Express for creating a RESTful API. The API provides endpoints for searching news based on a query term and retrieving news from specific topics such as health, sports, entertainment, business, science, technology, world, and India.
-
Clone the repository:
git clone https://github.com/vaxad/GnewsScraper.git
-
Install dependencies:
cd GnewsScraper-main npm install
-
Start the server:
node index.js
The server will run at
http://localhost:4000/
.
- Endpoint:
/
- Method:
GET
- Description: Check if the server is live.
-
Endpoint:
/gnews/search/:term
-
Method:
GET
-
Description: Get news articles based on the specified search term.
Example:
/gnews/search/technology
-
Endpoint:
/gnews/topic/:term
-
Method:
GET
-
Description: Get news articles from specific topics (health, sports, entertainment, business, science, technology, world, India).
Example:
/gnews/topic/health
The API is deployed on gNewsApi. You can use this deployed instance to fetch news data in your applications.
A sample frontend application using this API is available at NewsDekho.
- Node.js
- Express.js
- Axios
- Cheerio
- Thanks to the contributors of Axios, Cheerio, and Express for creating and maintaining these amazing libraries.
- Special thanks to Google News for providing a platform to access news content.