diff --git a/plugins/akasblog.lua b/plugins/akasblog.lua index bb4d63d..c3b75d7 100644 --- a/plugins/akasblog.lua +++ b/plugins/akasblog.lua @@ -7,9 +7,9 @@ local makeOurDate = function(dateString) end local function get_post(post) - local url = 'http://akamaru.de/?json=get_post&post_id=blub' + local url = 'http://akamaru.de/?json=get_recent_posts' local res,code = http.request(url) - local data = json:decode(res).post + local data = json:decode(res).posts[1] if code ~= 200 then return "HTTP-Fehler" end if not data then return "HTTP-Fehler" end @@ -62,11 +62,13 @@ local function get_post(post) local url = data.url if data.thumbnail then image_url = data.thumbnail + elseif data.attachments then + image_url = data.attachments[1].url end local text = title..' ('..from..' am '..date..')\n\n'..content..'...\n'..url - if data.thumbnail then + if data.thumbnail or data.attachments then return text, image_url else return text diff --git a/plugins/ponywave.lua b/plugins/ponywave.lua index e7f22c9..bf3f9c0 100644 --- a/plugins/ponywave.lua +++ b/plugins/ponywave.lua @@ -7,9 +7,9 @@ local makeOurDate = function(dateString) end local function get_post(post) - local url = 'https://ponywave.de/?json=get_post&post_id=blub' + local url = 'https://ponywave.de/?json=get_recent_posts' local res,code = https.request(url) - local data = json:decode(res).post + local data = json:decode(res).posts[1] if code ~= 200 then return "HTTP-Fehler" end if not data then return "HTTP-Fehler" end @@ -62,11 +62,13 @@ local function get_post(post) local url = data.url if data.thumbnail then image_url = data.thumbnail + elseif data.attachments then + image_url = data.attachments[1].url end local text = title..' ('..from..' am '..date..')\n\n'..content..'...\n'..url - if data.thumbnail then + if data.thumbnail or data.attachments then return text, image_url else return text