fix FML module
This commit is contained in:
parent
9de4990d69
commit
2e71e2d6db
6
fml.py
6
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user