fixed a problem with homepage by parsing lists better
This commit is contained in:
parent
9cc22fa15d
commit
7eecad1bd5
@ -223,7 +223,7 @@ async def on_message(message):
|
||||
if message.content.startswith('!homepage'):
|
||||
await client.send_message(
|
||||
message.channel,
|
||||
wallpaper.get_picture(message.content)
|
||||
wallpaper.get_picture()
|
||||
)
|
||||
|
||||
if message.content.startswith('!docker'):
|
||||
|
@ -30,16 +30,12 @@ def get_wall(message):
|
||||
else:
|
||||
return response
|
||||
|
||||
def get_picture(find):
|
||||
|
||||
def get_picture():
|
||||
url = requests.get("http://fuckinghomepage.com")
|
||||
soup = BeautifulSoup(url.content)
|
||||
soup.prettify(formatter=None)
|
||||
for parse in soup.find_all("p"):
|
||||
if 'SWEET-ASS PICTURE' in ''.join(parse.findAll(text=True)):
|
||||
link = parse.find_next_sibling('p')
|
||||
for pic in soup.find_all("p"):
|
||||
if 'SWEET-ASS PICTURE' in ''.join(pic.findAll(text=True)):
|
||||
link = pic.find_next_sibling('p')
|
||||
if "http://" or "https://" in link.get('href', ''):
|
||||
link = link.find('small').find_next('a', href=True)['href']
|
||||
return urllib.parse.unquote(link.split('http://t.umblr.com/redirect?z=')[1].split('&')[0])
|
||||
|
||||
|
||||
return urllib.parse.unquote(link.split('=')[1].split('&')[0])
|
||||
|
Loading…
x
Reference in New Issue
Block a user