mirror of
https://github.com/RussellChamp/tilde-projects.git
synced 2026-10-28 00:22:34 +00:00
another big diff. tested some things
This commit is contained in:
17 files changed
+180
-553
No files matched your search
@@ -5,7 +5,7 @@ import random
|
||||
|
||||
def define(word):
|
||||
defs = []
|
||||
url = "http://www.merriam-webster.com/dictionary/%s" % word
|
||||
url = "http://www.merriam-webster.com/dictionary/{}".format(word)
|
||||
soup = BeautifulSoup(urllib.urlopen(url).read(), "html.parser")
|
||||
head = soup.find("div", id="headword")
|
||||
if head:
|
||||
@@ -19,9 +19,8 @@ key = open("/home/krowbar/.secret/key").readline().rstrip()
|
||||
|
||||
def defWord(word, short=True):
|
||||
defs = []
|
||||
url = "http://www.dictionaryapi.com/api/v1/references/collegiate/xml/%s?key=%s" % (
|
||||
word,
|
||||
key,
|
||||
url = "http://www.dictionaryapi.com/api/v1/references/collegiate/xml/{}?key={}".format(
|
||||
word, key
|
||||
)
|
||||
soup = BeautifulSoup(urllib.urlopen(url).read(), "html5lib")
|
||||
entry = soup.find("entry")
|
||||
|
||||
Reference in new issue
Block a user