Added some more debugging stuffs to banterbot. Fixed some utils

This commit is contained in:
RussellChamp committed 2018-11-20 16:41:16 -05:00
1 parent f2dbad05af
commit d7842734ac
7 files changed
+87 -55

No files matched your search

+3 -2
View File
@@ -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: