diff --git a/fml.py b/fml.py index fd42e98..447b350 100644 --- a/fml.py +++ b/fml.py @@ -3,16 +3,12 @@ import requests from bs4 import BeautifulSoup - -url = "http://www.fmylife.com/random" - - def get_fml(url): r = requests.get(url) data = r.text r.close soup = BeautifulSoup(data, 'html.parser') - fml = soup.find("article", class_="art-panel").find_all("a")[2].string.strip().replace("\\", "").replace(" FML", "") + fml = soup.select_one("article > a.block").string.strip().replace("\\", "").rstrip(" FML") del soup return fml