Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
-- fbmemget.lua: download Facebook structures like feeds and comments into memory.
-- Idea: It doesn't make sense to save these structures in the disk cache
-- without processing, because they contain ".paging.next" fields that become
-- invalid very quickly - so we load things into memory, and then glue their
-- parts.
--
-- This file:
-- http://angg.twu.net/fbcache/fbmemget.lua
-- http://angg.twu.net/fbcache/fbmemget.lua.html
--  (find-angg        "fbcache/fbmemget.lua")
--
-- (find-es "facebook" "download-all-posts-in-group")

require "fbcurl" -- (find-fbcache "fbcurl.lua")
require "fbpp"   -- (find-fbcache "fbpp.lua")

fbmem = {}
fbmemget0 = function (query)
    local f = (query:match"^https?:") and fbcurl0 or fbcurl
    local o = f(query)
    fbmem[query] = o
    return o
  end
fbmemget = function (query)
    if fbmem[query] then return fbmem[query] end
    return fbmemget0(query)
  end
fbmemgetn = function (query, n, gnxt)
    local o = fbmemget(query)
    local A = {o}
    gnxt = gnxt or function (o) return o and o.paging and o.paging.next end
    while true do
      if #A == n then break end
      local next = gnxt(o)
      if next then
        o = fbmemget(next)
        table.insert(A, o)
      else
        break
      end
    end
    return A
  end

fbglue = function (A)
    local B = {}
    for i=1,#A do
      for j=1,#(A[i].data) do
        table.insert(B, A[i].data[j])
      end
    end
    if B[#B] == "[]" then B[#B] = nil end
    return B
  end


fbmemget_feed = function (query, n)
    return fbmemgetn(query, n)
  end

fbmemget_feed_glued = function (query)
    local A = fbmemget_feed(query)
    local B = {}
    for i=1,#A do
      for j=1,#(A[i].data) do
        table.insert(B, A[i].data[j])
      end
    end
    if B[#B] == "[]" then B[#B] = nil end
    return B
  end

--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "fbmemget.lua"
query = "672137799470276/feed"
n = 2
A =        fbmemgetn(query, n)
B = fbglue(fbmemgetn(query, n))

require "fbcache3" -- (find-fbcache "fbcache3.lua")
pp(A)
pp(B)
for i,S in ipairs(B) do print(type(S)) end
for i,S in ipairs(B) do PP(keys(S)) end
for i,S in ipairs(B) do PP(sorted(keys(S))) end
for i,S in ipairs(B) do print(S.id) end
for i,S in ipairs(B) do print(S.id, S.updated_time); fbget(S.id) end

-- https://developers.facebook.com/docs/graph-api/reference/user
require "fbnameid" -- (find-fbcache "fbnameid.lua")
nameids_read()
= nameid "eduardo.ochs"
query = nameid "eduardo.ochs" .. "/feed"
query = "1523735650"
query = "1523735650/feed"
query = "1523735650_feed"
pp(fbmemget0(query))

https://graph.facebook.com/v2.5/1523735650
https://graph.facebook.com/v2.5/eduardo.ochs



pp(A)

fbget "672137799470276_672239192793470"
pp(fbget "672137799470276_672239192793470")


PP(keys(A[1]))
PP(keys(A[1].data))
PP(keys(A[2].data))
PP(keys(A[3].data))
PP(keys(A[4].data))
PP(keys(A[5].data))
PP(keys(A[6].data))
pp(A[1].data[1])
pp(A[1].data[1].updated_time)
pp(A[1].data[2].updated_time)
pp(A[1].data[3].updated_time)

local 

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "fbmemget.lua"
query = "100002199205236/feed"
n = 2
A =        fbmemgetn(query, n)
B = fbglue(fbmemgetn(query, n))
pp(fbcurl(query))

--]]


-- Local Variables:
-- coding: raw-text-unix
-- End: