'google-alerts-api' library issues fix

in utopian-io •  3 months ago  (edited)

google alerts
image source


PR: https://github.com/adasq/google-alerts-api/pull/20

Bug Fixes

What is Google Alerts?

For those who are not familiar with Google Alerts - it is a simple service which lets you create kind of "Internet Watcher" for given search terms.

Some of the search term you can create a watcher for:

  • "STEEM OR SBD OR steemit"
  • "blockchain"
  • "Donald Trump"

Go google.com/alerts and give it a try.


The only one problem with the service, is that Google does not provide a public API for it.

That is why I created an nodejs wrapper for the service which allows you to manage your alerts within npm package.

I have been writing about the service almost a year ago. At the time, I faced a problem with authentication process. This time, Google has changed alert model, so it required additional changes to the library - which is the scope of the contribution. Entire process of creating, fetching and modifying alerts has changed. The problem itself was raised on this github issue by package user.

The way Google serializes alerts for the sake of HTTP communication is really tough to read. Here is an example:


Awful, huh?

In order to build human readable alert object there needs to be defined special mappers:


Such mappers says us, where given alert attribute (name, id, etc.) are being located. I.e. alert's name (NAME_LOC = '1.2.0') stands for:

  1. Go to array element with index 1.
  2. Inside the array search for array located on index 2.
  3. Inside found array, on the first position (index 0) there is an alert name.

Almost all of them has been updated due to the google changes. What is more, in order to get alerts I had to change the way an alerts state is being parsed:


Modifying / creating API requests has been updated as well. More details in PR.

What is more, a complete set of test for modifing alerts has been added (sorry for an incorrect screenshot indention)


We are no longer able to authenticate within mail / password, so a new function for generating cookies has been added.

See unit test:


How to get SID, HSID and SSID? Entire process is described in README.md:

According to the PR changes, version 0.4.2 has been published to the npm registry.

GitHub Account


Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

It's really a shame for google to not expose an API for that. You're doing a great job. This requires constant maintenance everytime google changes things in their website structure, and looks like you're keeping up.


Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.

Need help? Chat with us on Discord.


Thank you for your review, @emrebeyler! Keep up the good work!

Hi, @adasq!

You just got a 0.07% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Hi @adasq!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @adasq!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!