Request contents from ACM
This commit is contained in:
parent
617fbea06b
commit
2ace3d3726
|
@ -1,9 +1,18 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.lookup()
|
function M.lookup()
|
||||||
local keywords = vim.fn.getreg("*")
|
local keywords = vim.fn.getreg("") -- receive highlighted text
|
||||||
|
local url = "https://dl.acm.org/action/doSearch?AllField=" .. keywords
|
||||||
|
|
||||||
print(keywords)
|
-- Setup a http socket and request
|
||||||
|
local http = require("socket.http")
|
||||||
|
local response, status_code, headers = http.request(url)
|
||||||
|
|
||||||
|
if status_code == 200 then
|
||||||
|
print(response)
|
||||||
|
else
|
||||||
|
print("Getting sources failed with error code " .. status_code .. "!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Reference in New Issue