Request contents from ACM

This commit is contained in:
Yannick Reiß 2024-02-18 12:39:40 +01:00
parent 617fbea06b
commit 2ace3d3726
No known key found for this signature in database
GPG Key ID: 5A3AF456F0A0338C
1 changed files with 11 additions and 2 deletions

View File

@ -1,9 +1,18 @@
local M = {}
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
return M