mirror of
https://github.com/RussellChamp/tilde-projects.git
synced 2026-10-28 00:22:34 +00:00
Fix a bunch of bot code and checkin systemd files
This commit is contained in:
1 parent
6770c70068
commit
2a2ed1e064
26 files changed
+222
-137
No files matched your search
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
import urllib
|
||||
|
||||
# from lxml.html import fromstring
|
||||
@@ -8,7 +9,7 @@ import random
|
||||
def getRhymes(word):
|
||||
words = []
|
||||
url = "http://www.rhymer.com/RhymingDictionaryLast/%s.html" % word
|
||||
soup = BeautifulSoup(urllib.urlopen(url).read(), "html.parser")
|
||||
soup = BeautifulSoup(urllib.request.urlopen(url).read(), "html.parser")
|
||||
|
||||
for t in soup.find_all("table", "table"):
|
||||
words.append(
|
||||
@@ -29,11 +30,11 @@ def rhymeZone(word):
|
||||
"http://rhymezone.com/r/rhyme.cgi?Word=%s&typeofrhyme=perfect&org1=syl&org2=l&org3=y"
|
||||
% word
|
||||
)
|
||||
soup = BeautifulSoup(urllib.urlopen(url).read(), "html.parser")
|
||||
soup = BeautifulSoup(urllib.request.urlopen(url).read(), "html.parser")
|
||||
|
||||
for t in soup.find_all("a", "d"):
|
||||
w = t.text.rstrip()
|
||||
if w not in [u"", u"\xa0"] and "?" not in t:
|
||||
words.append(w.encode("ascii", "ignore"))
|
||||
words.append(w)
|
||||
random.shuffle(words)
|
||||
return words[0:5]
|
||||
Reference in new issue
Block a user