Created
May 30, 2017 20:20
-
-
Save avuko/98da6e98b00ec029025aaf394fccdc6e to your computer and use it in GitHub Desktop.
Simple tool to monitor the number of followers of RealDonaldTrump
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
import datetime | |
import pytz | |
from bs4 import BeautifulSoup | |
import time | |
import sys | |
while True: | |
r = requests.get('https://twitter.com/realdonaldtrump') | |
broth = r.content | |
soup = BeautifulSoup(broth, "html.parser") | |
spoon = soup.find_all("a", {"data-nav": "followers"}) | |
balls = BeautifulSoup(str(spoon[0]), "html.parser") | |
grease = balls.find("span", {"class": "ProfileNav-value"}) | |
dinnersready = datetime.datetime.now(pytz.timezone("America/New_York")) | |
cookingtime = dinnersready.replace(microsecond=0).isoformat() | |
sys.stdout.write(cookingtime + " - @realDonaldTrump followers: " + grease.text + "\n") | |
sys.stdout.flush() | |
time.sleep(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment