After successfully downloading the mp4 file using the Lua script on the Android phone, the system Videos cannot detect the 1.mp4 file, and the video cannot be found in TikTok to
I think "body" in your script is actually the "OK status" being returned. Also, you attempting to open an https socket with http. This should do, just change URL and path.
#! /usr/bin/env lua
-- luarocks install luasocket
-- luarocks install luasec
-- local http = require( 'socket.http' )
local https = require( 'ssl.https' )
local ltn12 = require( 'ltn12' )
local URL = "https://raw.githubusercontent.com/doyousketch2/the3dPen/master/icon.png"
local path = "/home/sketch2/Downloads/icon.png"
local oput = io.open( path, 'wb' )
local ok, code, headers, text = https .request { url = URL, sink = ltn12.sink.file( oput ) }
print( 'ok:', ok )
print( 'code:', code, text )
if headers then
print( 'headers:' )
for i, v in pairs( headers ) do
print( ' ' ..i ..':', v )
end
end
based off of -- https://gist.github.com/Core-commits/0eaaa00eac5e89e68631fedd72831675
luasec is similar to luasocket, but allows https connections.
http://w3.impa.br/~diego/software/luasocket/http.html
http://w3.impa.br/~diego/software/luasocket/ltn12.html