I downloaded the mp4 file using Lua script, but TikTok(Other apps) cannot find the video

后端 未结 1 759
萌比男神i
萌比男神i 2021-01-23 14:07

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

1条回答
  •  生来不讨喜
    2021-01-23 15:04

    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

    0 讨论(0)
提交回复
热议问题