fix FML module
This commit is contained in:
parent
9de4990d69
commit
2e71e2d6db
6
fml.py
6
fml.py
|
@ -3,16 +3,12 @@
|
||||||
import requests
|
import requests
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
|
||||||
url = "http://www.fmylife.com/random"
|
|
||||||
|
|
||||||
|
|
||||||
def get_fml(url):
|
def get_fml(url):
|
||||||
r = requests.get(url)
|
r = requests.get(url)
|
||||||
data = r.text
|
data = r.text
|
||||||
r.close
|
r.close
|
||||||
soup = BeautifulSoup(data, 'html.parser')
|
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
|
del soup
|
||||||
return fml
|
return fml
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user