Skip to content

Instantly share code, notes, and snippets.

@orf
Created August 7, 2015 15:37
Show Gist options
  • Save orf/87825a18e6685144ae3b to your computer and use it in GitHub Desktop.
Save orf/87825a18e6685144ae3b to your computer and use it in GitHub Desktop.
import requests
import sys
import bs4
found_excuses = set()
duplicate_counter = 0
while True:
page = requests.get("http://programmingexcuses.com/")
parsed = bs4.BeautifulSoup(page.content, "html.parser")
text = parsed.find("a", {"rel": "nofollow"}).text
if text in found_excuses:
duplicate_counter += 1
if duplicate_counter == 15:
sys.exit()
else:
duplicate_counter = 0
found_excuses.add(text)
print(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment