使用Lua脚本下载了mp4文件,但是TikTok(或其他应用)无法找到视频

在Android手机上成功使用Lua脚本下载mp4文件后,系统无法检测到1.mp4文件,无法在TikTok上找到视频进行发布。

我使用脚本下载了1.mp4。

我手动将1.mp4复制为copy.mp4。

TikTok无法检测到1.mp4

copy.mp4可以被TikTok检测到

两个文件都没有被隐藏

我检查了这两个文件的权限:

-rw-rw---- root sdcard_ rw 6939904 2020-11-12 22:07 1. mp4

-rw-rw---- root sdcard_ rw 6939904 2020-11-12 22:15 copy. mp4

我不知道为什么无法找到1.mp4

有没有办法让TikTok(或其他应用)识别1.mp4?

我的代码:

local http = require("socket.http")
severfileTXTpath = "https://ttmakemoney.oss-cn-hangzhou.aliyuncs.com/1.mp4"
localfileTXTpath = "/sdcard/Download/aliyunPZ/1/1.mp4"
local body, code = http.request(severfileTXTpath)
if not body then error(code) end
local f = assert(io.open(localfileTXTpath, 'wb'))
f:write(body)
f:close()

你可以通过图片看到效果

1


在复制成功后,系统无法检测到copy.mp4视频,也无法在TikTok上找到要发布的copy.mp4视频。

 local ts = require("ts")
 path1 = "/sdcard/Download/aliyunPZ/1/copy.mp4"
 path2 = "/sdcard/Download/aliyunPZ/1/1.mp4"
 os.execute("cp " ..path1.. " "..path2)

1.mp4可以被TikTok检测到

copy.mp4无法被TikTok检测到

我不知道出了什么问题?

我检查了这两个文件的权限(adb):

-rw-rw---- root sdcard_rw 6939904 2020-11-13 20:21 1. mp4

-rw-rw---- root sdcard_rw 6939904 2020-11-14 1:54 copy. mp4

你可以通过图片看到效果

enter image description here

点赞
用户3342050
用户3342050

我认为你脚本中的“body”实际上是返回的“OK状态”。此外,你试图使用http打开https套接字。应该可以,只需更改URL和路径。

#! /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

基于 - https://gist.github.com/Core-commits/0eaaa00eac5e89e68631fedd72831675


luasec类似于luasocket,但允许https连接。

http://w3.impa.br/~diego/software/luasocket/http.html

http://w3.impa.br/~diego/software/luasocket/ltn12.html

2020-11-13 23:24:39