local function getStreamFinder(url)
local child = spawn('youtube-dl', {
args = {'-g','-i','--audio-format','mp3','--audio-quality','0','--prefer-ffmpeg','ytsearch:'..url,'-v','--dump-pages','--print-traffic','-i'},
stdio = { nil, true, 2 }
})
local stream
local name
print("######### FIND VALID LINK START")
for chunk in [child.stdout.read](http://child.stdout.read) do
local urls = chunk:split('\n')
for _, yturl in pairs(urls) do
name = yturl
local mime = parse(yturl, true).query.mime
if mime and mime:find('audio') == 1 then
stream = yturl
break
end
end
if stream then break end
end
print("######### FIND VALID LINK END")
return name,stream
end
Самая долгая часть между 2-я принтами