From a221f68c3bdf1e72baa190199699292151b42437 Mon Sep 17 00:00:00 2001 From: yannickreiss Date: Sun, 18 Feb 2024 12:59:26 +0100 Subject: [PATCH] Replace sockets --- lua/sourcer/init.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/sourcer/init.lua b/lua/sourcer/init.lua index 3b443da..bf5f36c 100644 --- a/lua/sourcer/init.lua +++ b/lua/sourcer/init.lua @@ -5,14 +5,14 @@ function M.lookup() local url = "https://dl.acm.org/action/doSearch?AllField=" .. keywords -- Setup a http socket and request - local http = require("socket.http") - local response, status_code, headers = http.request(url) + local command = string.format("curl -s '%s'", url) - if status_code == 200 then - print(response) - else - print("Getting sources failed with error code " .. status_code .. "!") - end + -- Execute the curl command and capture its output + local handle = io.popen(command) + local response = handle:read("*a") + handle:close() + + print(reponse) end return M