Correct http encoding and string cleaning

This commit is contained in:
Yannick Reiß 2024-02-18 13:58:54 +01:00
parent 2e85e2e9d5
commit 00ebaafc26
No known key found for this signature in database
GPG Key ID: 5A3AF456F0A0338C
1 changed files with 2 additions and 0 deletions

View File

@ -3,6 +3,8 @@ local M = {}
function M.lookup() function M.lookup()
local keywords = vim.fn.getreg("*") -- receive yanked text local keywords = vim.fn.getreg("*") -- receive yanked text
local url = "https://dl.acm.org/action/doSearch?AllField=" .. keywords local url = "https://dl.acm.org/action/doSearch?AllField=" .. keywords
url = url:sub(2, #url)
url, empty = url:gsub(" ", "+")
-- Setup a http socket and request -- Setup a http socket and request
local command = string.format("curl -s '%s'", url) local command = string.format("curl -s '%s'", url)