Created
August 7, 2015 15:37
-
-
Save orf/87825a18e6685144ae3b to your computer and use it in GitHub Desktop.
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
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