fix FML module

This commit is contained in:
jkhsjdhjs 2023-07-17 00:07:28 +00:00
parent 9de4990d69
commit 2e71e2d6db

6
fml.py
View File

@ -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