Fixe Twitter-Videos

This commit is contained in:
Andreas Bielawski 2016-10-09 22:36:43 +02:00
parent c317305723
commit 78bfe1cb99

View File

@ -89,12 +89,12 @@ function get_tweet(response)
for k, v in pairs(response.extended_entities.media) do for k, v in pairs(response.extended_entities.media) do
local url = v.url local url = v.url
if v.video_info then if v.video_info then
if v.video_info.variants[#v.video_info.variants].bitrate == 2176000 then for i in pairs(v.video_info.variants) do
local vid = v.video_info.variants[#v.video_info.variants].url if v.video_info.variants[i].content_type == 'video/mp4' then -- first mp4 is usually the highest res
videos[#videos+1] = vid local vid = v.video_info.variants[i].url
else
local vid = v.video_info.variants[1].url
videos[#videos+1] = vid videos[#videos+1] = vid
break;
end
end end
else else
images[#images+1] = v.media_url_https images[#images+1] = v.media_url_https
@ -166,7 +166,8 @@ function twitter:action(msg, config, matches)
utilities.send_photo(msg.chat.id, v, nil, msg.message_id) utilities.send_photo(msg.chat.id, v, nil, msg.message_id)
end end
for k, v in pairs(videos) do for k, v in pairs(videos) do
utilities.send_video(msg.chat.id, v, nil, msg.message_id) local file = download_to_file(v)
utilities.send_video(msg.chat.id, file, nil, msg.message_id)
end end
end end