You use the "generic" form http.request (), which requires storing the body through the LTN12 receiver. It is not as difficult as it seems, try this code:
local socket = require "socket.http"
local ltn12 = require "ltn12"; -- LTN12 lib provided by LuaSocket
-- This table will store the body (possibly in multiple chunks):
local result_table = {};
client,r,c,h = socket.request{
url = "http://example.com/",
sink = ltn12.sink.table(result_table),
proxy="<my proxy and port here>"
}
-- Join the chunks together into a string:
local result = table.concat(result_table);
-- Hacky solution to extract the title:
local title = result:match("<[Tt][Ii][Tt][Ll][Ee]>([^<]*)<");
print(title);
, http.request() - http.PROXY:
local http = require "socket.http"
http.PROXY="<my proxy and port here>"
local result = http.request("http://www.youtube.com/watch?v=_eT40eV7OiI")
local title = result:match("<[Tt][Ii][Tt][Ll][Ee]>([^<]*)<");
print(title);
:
Flanders and Swann - A song of the weather
- YouTube