mirror of
https://notabug.org/scuti/pleroma-comments
synced 2024-12-22 19:09:45 +05:30
made get_epoch_time function
This commit is contained in:
parent
86d397b548
commit
baa9ebc17f
@ -22,7 +22,7 @@ function get(link)
|
||||
return parsed
|
||||
end
|
||||
|
||||
function short_date(timestamp)
|
||||
function get_epoch_time(timestamp)
|
||||
local pattern = "(%d+)-(%d+)-(%d+)T(%d+):(%d+):(%d+).000Z"
|
||||
local year, month, day, hour, min, sec = timestamp:match(pattern)
|
||||
local epoch = os.time({
|
||||
@ -33,7 +33,13 @@ function short_date(timestamp)
|
||||
min = min,
|
||||
sec = sec
|
||||
})
|
||||
return os.date("%a, %B %d, %Y", epoch)
|
||||
return epoch
|
||||
end
|
||||
|
||||
function get_short_date(timestamp)
|
||||
return os.date(
|
||||
"%a, %B %d, %Y", get_epoch_time(timestamp)
|
||||
)
|
||||
end
|
||||
|
||||
function write_comments(pleroma_posts, instance)
|
||||
@ -50,7 +56,7 @@ function write_comments(pleroma_posts, instance)
|
||||
local replies = pleroma_posts["descendants"]
|
||||
for _, post in ipairs(replies) do
|
||||
local pid = post["id"]
|
||||
local datetime = short_date(post["created_at"])
|
||||
local datetime = get_short_date(post["created_at"])
|
||||
local uid = post["account"]["id"]
|
||||
local alias = post["account"]["acct"]
|
||||
local text = post["pleroma"]["content"]["text/plain"]
|
||||
@ -73,8 +79,8 @@ end
|
||||
|
||||
|
||||
function Meta(meta)
|
||||
local elem = meta["pleroma-url"]
|
||||
-- print(elem)
|
||||
local elem = meta["pleroma-urls"]
|
||||
print(elem)
|
||||
if elem == nil then
|
||||
return -- abort
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user