instagram: Änderungen rückgängig geacht
This commit is contained in:
parent
1a98fb1a15
commit
274541c6cd
@ -8,58 +8,41 @@ end
|
|||||||
|
|
||||||
function instagram:get_instagram(url)
|
function instagram:get_instagram(url)
|
||||||
local api_key = cred_data.iframely_api_key
|
local api_key = cred_data.iframely_api_key
|
||||||
local res, code = https.request('https://iframe.ly/api/iframely?url=https://www.instagram.com/p/'..URL.escape(url)..'&api_key='..api_key)
|
local res, code = https.request('https://iframe.ly/api/oembed?url=https://www.instagram.com/p/'..URL.escape(url)..'&api_key='..api_key)
|
||||||
if code ~= 200 then return end
|
if code ~= 200 then return end
|
||||||
local data = json.decode(res)
|
local data = json.decode(res)
|
||||||
|
|
||||||
if data.meta.title then
|
if data.title then
|
||||||
title = data.meta.title:gsub('"', '\\"')
|
title = data.title:gsub('"', '\\"')
|
||||||
else
|
else
|
||||||
title = 'Kein Titel'
|
title = 'Kein Titel'
|
||||||
end
|
end
|
||||||
|
|
||||||
if data.meta.description then
|
if data.description then
|
||||||
description = data.meta.description:gsub('"', '\\"')
|
description = data.description:gsub('"', '\\"')
|
||||||
description_in_text = description
|
description_in_text = '\n'..description
|
||||||
else
|
else
|
||||||
description_in_text = ''
|
description_in_text = ''
|
||||||
description = 'Keine Beschreibung verfügbar'
|
description = 'Keine Beschreibung verfügbar'
|
||||||
end
|
end
|
||||||
|
|
||||||
if data.links.player then
|
local pic = data.thumbnail_url
|
||||||
video = 'https:'..data.links.player[1].href
|
local text = title..'\n'..description_in_text
|
||||||
else
|
|
||||||
video = 'NOVID'
|
|
||||||
end
|
|
||||||
|
|
||||||
if data.links.image then
|
|
||||||
pic = '<a href="'..data.links.image[1].href..'"> </a>'
|
|
||||||
else
|
|
||||||
pic = '<a href="'..data.links.thumbnail[2].href..'"> </a>'
|
|
||||||
end
|
|
||||||
|
|
||||||
local text = '<b>'..title..'</b> '..pic..'\n<i>'..description_in_text..'</i>'
|
|
||||||
|
|
||||||
return video, text
|
return pic, text
|
||||||
end
|
end
|
||||||
|
|
||||||
function instagram:action(msg, config, matches)
|
function instagram:action(msg, config, matches)
|
||||||
local url = matches[1]
|
local url = matches[1]
|
||||||
local video, text = instagram:get_instagram(url)
|
local pic, text = instagram:get_instagram(url)
|
||||||
|
|
||||||
if not url then
|
if not url then
|
||||||
utilities.send_reply(msg, 'Fehler')
|
utilities.send_reply(msg, 'Fehler')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if video == 'NOVID' then
|
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||||
return
|
utilities.send_photo(msg.chat.id, pic, text, msg.message_id)
|
||||||
else
|
|
||||||
utilities.send_typing(msg.chat.id, 'upload_video')
|
|
||||||
utilities.send_video(msg.chat.id, video, nil, msg.message_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
utilities.send_message(msg.chat.id, text, false, msg.message_id, 'html')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return instagram
|
return instagram
|
Reference in New Issue
Block a user