Nutze anderen A

This commit is contained in:
Akamaru 2016-01-31 19:08:28 +01:00
parent 7c0d906b9e
commit 8721f76ba4
2 changed files with 10 additions and 6 deletions

View File

@ -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

View File

@ -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