Scrape and notify

Enrico Bergamini
Dec 27, 2016 · 2 min read

Once you start using IFTTT there’s no going back. For many things it’s just way too comfortable and does not require any sort of programming skills to get stuff done.

So assuming you know a little bit about it, here’s a method to connect your Python (or whatever) script to a Maker Channel on IFTTT. The aim? Building a small web scraper that sends a notification to your phone with the scraped data.

This recipe is based on this blog post (which is really well done), that teaches you how to setup a Maker Channel on IFTTT to trigger with your script, you should check out (at least) the first part of that post in order to create your Maker Channel.

There are just two components here: a Python scraper and the Channel to trigger. If you’ve got the channel ready, here’s how to build the script.

What do we want it to do?

  • Make a request to a website
  • Get the data (and maybe work on it)
  • Send that data to the Maker Channel

Here is the full code, let’s go through it:

import requests
from bs4 import BeautifulSoup
url = ‘'#load and scrape
response = requests.get(url)
html = response.content
soup = BeautifulSoup(html, “lxml”)
number = soup.find(‘h1’, id=’number’).text
def notification(message):
report = {}
report[“value1”] = message“", data=report)


First we’ll import two (amazingly good) Python libraries: BeautifulSoup and Requests.

I’ve set up a sample page to scrape, here. That we set as ‘url’ variable. The scraping is really basic, we are just loading the page with a GET request, and looking for the ‘h1’ tag with a “number” id in its HTML code.

The notification method is exactly the same explained in the blog post linked above, with just one “value”.

I’ve set my IFTTT recipe to send a notification to my phone when the Channel is triggered, but you can really do whatever with IFTTT.

Why is this useful?

The cool thing is that you can do a thousand things with this kinda game, since you can scrape data somewhere and use it as a IFTTT variable!

You can, for example, put the script in Cron and make it check something for you everyday or a few times a day. Maybe there’s something with a moving price that you wanna buy online but you bother check often. You could also put something like (‘if this number is lower then … notify me’) in your script so you’ll be the first one knowing it.

Or maybe you wanna scrape and tweet, or scrape and store somewhere, or scrape and IOT.

This post just explains the link between the two techniques, the number of applications are enormous :)

mai più senza

di tutto quel superfluo che è indispensabile

Enrico Bergamini

Written by

Ferrarese a Bruxelles, orgogliosamente emiliano. Amo Internet nelle sue declinazioni. Ogni tanto scrivo. Faccio cose con i dati.

mai più senza

di tutto quel superfluo che è indispensabile

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade