1.0.2 • Published 3 years ago

@golfsierra/newsscraper v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

NewsScraper

This is a news scraper which can be useful for scraping data from inshorts website.This web scraper will provide latest news as it will be scraping latest news.To use this in your project import this in your server or js file using require statement.Save this file in your directory and import it

First run this to install

npm i @golfsierra/newsscraper
import inshorts from "@golfsierra/newsscraper";
This Scraper expects an object of the form
var options = {
      lang: "en",
      category: "national",
      numOfResults: 10, max 25
      click: true,
    };
    inshorts.get(options, function (result) {
      console.log(result);
    });

lang key can have 2 values

  • en for english
  • hi for hindi

categories can be of type:

  • /Leave empty for getting all news
  • national (India)
  • business
  • sports
  • world
  • politics
  • technology
  • startup
  • entertainment
  • miscellaneous
  • hatke (unusual)
  • science
  • automobile

you will get back a result in form of json which will have

{
author: "Sakshita Khosla"
content: "Delhi government on Monday declared 14 private hospitals in the city as "full COVID-19" hospitals and directed them not to admit any non-COVID patients till further orders. The hospitals include Indraprastha Apollo, Sir Ganga Ram, Holy Family, Max Hospital Shalimar Bagh, Fortis Hospital Shalimar Bagh etc. Nineteen private hospitals were also told to reserve 80% ICU beds for COVID-19 patients."
imgURL: "url('https://static.inshorts.com/inshorts/images/v1/variants/jpg/m/2021/04_apr/12_mon/img_1618242163076_314.jpg?')"
postedAt: "09:30 pm 12 Apr"
sourceURL: "https://inshorts.com/en/read/national"
title: "Delhi govt declares 14 pvt hospitals as COVID-only facilities; releases list"
}