All Projects → adasq → google-alerts-api

adasq / google-alerts-api

Licence: other
Google Alerts API for NodeJS

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to google-alerts-api

laravel-alert-notifications
Send alert to email, microsoft teams from laravel app, when an exception occurs. Throttle is enabled by default.
Stars: ✭ 22 (-78.64%)
Mutual labels:  alerts
angular-8-alert-notifications
Angular 8 - Alert (Toaster) Notifications
Stars: ✭ 32 (-68.93%)
Mutual labels:  alerts
soloalert
A customizable lightweight Alert Library with Material UI and awesome features.
Stars: ✭ 18 (-82.52%)
Mutual labels:  alerts
dbaTDPMon
dbaTDPMon - Troubleshoot Database Performance and Monitoring
Stars: ✭ 20 (-80.58%)
Mutual labels:  alerts
epaper-clock-and-more
e-paper clock + weather + AQI + traffic delays - using Waveshare 2.7inch & 4.2inch eink displays running on Raspberry Pi
Stars: ✭ 34 (-66.99%)
Mutual labels:  alerts
InteractiveAlert-Xamarin
Interactive alerts to Xamarin
Stars: ✭ 17 (-83.5%)
Mutual labels:  alerts
trovilo
trovilo collects and prepares files from Kubernetes ConfigMaps for Prometheus & friends
Stars: ✭ 16 (-84.47%)
Mutual labels:  alerts
Alertism
A Good Replacement For Default JavaScript Alerts Which Also Makes Good Pop-Ups
Stars: ✭ 19 (-81.55%)
Mutual labels:  alerts
SuperGreenOS
🧠 SuperGreenOS home farming automation software for esp32, all in one package, and controllable from your smartphone, pc, mac, linux, toaster, plumbus, whatnot...
Stars: ✭ 83 (-19.42%)
Mutual labels:  alerts
website
Prometheus monitoring mixins
Stars: ✭ 91 (-11.65%)
Mutual labels:  alerts
VideoRecognition-realtime-autotrainer-alerts
State of the art object detection in real-time using YOLOV3 algorithm. Augmented with a process that allows easy training of the classifier as a plug & play solution . Provides alert if an item in an alert list is detected.
Stars: ✭ 36 (-65.05%)
Mutual labels:  alerts
purppura
A server for receiving and processing alerts & events.
Stars: ✭ 18 (-82.52%)
Mutual labels:  alerts
terraform-provider-logzio
Terraform provider for logz.io alerts, endpoints and users
Stars: ✭ 18 (-82.52%)
Mutual labels:  alerts
BTPS-SecPack
This repository contains a collection of PowerShell tools that can be utilized to protect and defend an environment based on the recommendations of multiple cyber security researchers at Microsoft. These tools were created with a small to medium size enterprise environment in mind as smaller organizations do not always have the type of funding a…
Stars: ✭ 33 (-67.96%)
Mutual labels:  alerts
newrelic-quickstarts
New Relic One quickstarts help accelerate your New Relic journey by providing immediate value for your specific use cases.
Stars: ✭ 46 (-55.34%)
Mutual labels:  alerts
tradingview-webhooks
Backend service converting tradingview alerts into action.
Stars: ✭ 44 (-57.28%)
Mutual labels:  alerts
nws alerts
An updated version of the nws_alerts custom integration for Home Assistant
Stars: ✭ 24 (-76.7%)
Mutual labels:  alerts
apprise-api
A lightweight REST framework that wraps the Apprise Notification Library
Stars: ✭ 147 (+42.72%)
Mutual labels:  alerts
terraform-aws-ecs-cloudwatch-sns-alarms
Terraform module to create CloudWatch Alarms on ECS Service level metrics.
Stars: ✭ 23 (-77.67%)
Mutual labels:  alerts
ngx-toasta
Simple and clean Toast notification library for AngularX (Angular2 and beyond)
Stars: ✭ 20 (-80.58%)
Mutual labels:  alerts

Actions Status NPM Downloads NPM Downloads

google-alerts-api

Google Alerts API for nodejs. See tests for all features coverage.

Features

  • Creating alerts (no support for few parameters)
  • Fetching alerts
  • Modifing alerts (no support for few parameters)
  • Removing alerts

Getting started

$ npm i -S google-alerts-api
const alerts = require('google-alerts-api');

Configuration

IMPORTANT: Due to the latest changes in Google, authentication with disabled JavaScript is permited. Still, you can generate cookies on your own and reuse it later on (see how to get cookies)

alerts.configure({
    cookies: 'W3sia2V5IjoiR0FQUyIsInZhbHVlIjoiMTpCRXRtZEpjc...saGRasC==',
});

How to use

Fetch alerts:

const alerts = require('google-alerts-api');
const { HOW_OFTEN, DELIVER_TO, HOW_MANY, SOURCE_TYPE } = alerts;

alerts.configure({
    cookies: 'W3sia2V5IjoiR0FQUyIsInZhbHVlIjoiMTpCRXRtZEpjc...saGRasC==',
});

alerts.sync((err) => {
    if(err) return console.log(err);
    const alertList = alerts.getAlerts();
    alertList.forEach(alert => printAlertInfo);
});

function printAlertInfo(alert) {
    console.log('name:', alert.name);
    //'How Many' property information:
    if (alert.howMany === HOW_MANY.BEST) {
    	console.log('How many: Only the best results');
    } else if (alert.howMany === HOW_MANY.ALL) {
    	console.log('How many: All Results');
    }
}

Example alert object:

{
    name: '"Donald Trump * ISIS"',
    id: '4f94515ec736ef62:ade5b03803caa237:com:en:PL:R',
    howOften: 2, //use HOW_OFTEN enum to find out proper meaning
    sources: '...', // some of SOURCE_TYPE enum property, SOURCE_TYPE.AUTOMATIC by default
    lang: 'en',
    region: 'PL',
    howMany: 3, //use HOW_MANY enum to find out proper meaning
    deliverTo: 2, //use DELIVER_TO enum to find out proper meaning
    deliverToData: '', //email address, available when deliverTo === DELIVER_TO.MAIL
    rss: 'https://google.com/alerts/feeds/00357582442749620569/11537740808718742679' //field available, when deliverTo === DELIVER_TO.RSS
}

Modify alert (see tests for more examples):

const { HOW_OFTEN, DELIVER_TO, HOW_MANY } = alerts;

alerts.sync((err) => {
    if(err) return console.log(err);
    const alertToModify = alerts.getAlerts()[0];
    alerts.modify(alertToModify.id, {
    	name: '"(Donald OR Melania) Trump"'
    }, () => {
        alerts.sync(() => {
            const syncedAlertsList = alerts.getAlerts();
            //search in syncedAlertsList to check updated alert
        });
    });
});

function printAlertInfo(alert){
    console.log('name:', alert.name);
    //'How Many' property information:
    if (alert.howMany === HOW_MANY.BEST) {
    	console.log('How many: Only the best results');
    } else if (alert.howMany === HOW_MANY.ALL) {
    	console.log('How many: All Results');
    }
}

Available source types:

const SOURCE_TYPE = {
    AUTOMATIC,
    NEWS,
    BLOGS,
    WEB,

    NEWS_AND_BLOGS,
    NEWS_AND_WEB,
    BLOGS_AND_WEB,

    VIDEO,
    BOOKS,
    DISCUSSIONS,
    FINANCE,
};

Create alert:

alerts.sync(() => {
    const alertToCreate = {
    	howOften: HOW_OFTEN.AT_MOST_ONCE_A_DAY,
	sources: SOURCE_TYPE.AUTOMATIC, // default one
        lang: 'en',
        name: 'NodeJS AND "Chrome V8"',
        region: 'PL', // or "any", if you want "All Regions"
        howMany: HOW_MANY.BEST,
        deliverTo: DELIVER_TO.RSS,
        deliverToData: ''
    };

    alerts.create(alertToCreate, (err, alert) => {
        console.log(alert);
    });
});

Remove alert:

alerts.sync((err) => {
    const alertToRemove = alerts.getAlerts()[0];
    alerts.remove(alertToRemove.id, (err) => {
    	alerts.sync((err) => {
            const syncedAlertsList = alerts.getAlerts(); //alertToRemove does not exists here.
        });
    });   
});

Generate cookies:

You can authenticate once, and then use your cookies. Unfortunatelly it requires an additional action from you:

STEP 1: Authenticate in browser

  1. Open Chrome Browser in Incognito mode
  2. Navigate http://myaccount.google.com
  3. Log into your account

STEP 2: Find your SID, HSID, SSID cookie values

  1. Open Chrome Dev Tools
  2. Navigate Application tab, select Cookies preview for http://myaccount.google.com domain
  3. Copy SID, HSID and SSID cookie values

copy SID, HSID, SSID cookie values

STEP 3: Prepare your auth cookie string

  1. Put your SID, HSID, SSID values into value field of the code:
window.btoa(JSON.stringify(
    [{
            key: 'SID',
            value: '',
            domain: 'google.com'
        },
        {
            key: 'HSID',
            value: '',
            domain: 'google.com'
        },
        {
            key: 'SSID',
            value: '',
            domain: 'google.com'
        },
    ]
));
  1. Run this code in Console tab
  2. The output is your auth cookie string

enter image description here

  1. Put auth cookie string configuration:
const fs = require('fs')
const alerts = require('google-alerts-api')

alerts.configure({
    cookies: "your 'auth cookie string' goes here..."
});

alerts.sync((err) => {
    if(err) return console.log(err)
    const alertList = alerts.getAlerts()
});

Problem with authentication?

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].