mirror of
https://github.com/RussellChamp/tilde-projects.git
synced 2026-10-28 00:22:34 +00:00
Added some more debugging stuffs to banterbot. Fixed some utils
This commit is contained in:
1 parent
f2dbad05af
commit
d7842734ac
7 files changed
+87
-55
No files matched your search
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
import urllib
|
||||
from bs4 import BeautifulSoup
|
||||
import random
|
||||
@@ -9,7 +10,7 @@ def get_philosophy(word, max_steps=20):
|
||||
|
||||
url = "https://en.wikipedia.org/wiki/%s" % word
|
||||
while steps < max_steps:
|
||||
soup = BeautifulSoup(urllib.urlopen(url).read(), "html.parser")
|
||||
soup = BeautifulSoup(urllib.request.urlopen(url).read(), "html.parser")
|
||||
title = soup.find("h1", id="firstHeading")
|
||||
content = soup.find("div", id="mw-content-text")
|
||||
if not content:
|
||||
@@ -49,7 +50,7 @@ def get_philosophy_lower(word, max_steps=20):
|
||||
|
||||
url = "https://en.wikipedia.org/wiki/%s" % word
|
||||
while steps < max_steps:
|
||||
soup = BeautifulSoup(urllib.urlopen(url).read(), "html.parser")
|
||||
soup = BeautifulSoup(urllib.request.urlopen(url).read(), "html.parser")
|
||||
title = soup.find("h1", id="firstHeading")
|
||||
content = soup.find("div", id="mw-content-text")
|
||||
if not content:
|
||||
|
||||
Reference in new issue
Block a user