Does anyone know how to fetch the definitions for different words? Is there a http request url that exists?
Just load the search page on any dictionary website with a word. Like this:
word = "Dictionary"
http.request("http://dictionary.reference.com/browse/Dictionary", success, fail)
Note that for this website it has to have a capital first letter, so you can do something like this:
word = "dIcTiOnArY"
lword = word:lower()
word = string.upper(lword:sub(1, 1)) .. string.lower(lword:sub(2, lword:len()))
This is just returning a large piece of script though.
You have to parse the script and pull out what you want
Okay, Thanks!
@austinmccoy Here’s a quick example.
function setup()
word="Dictionary"
http.request("http://dictionary.reference.com/browse/"..word, success, fail)
end
function success(data,status,headers)
a=string.find(data,'name="description"')
b=string.find(data,"See more.",a)
print(string.sub(data,a+27,b-1))
end
Thanks