Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
-- fbcache3.lua: implements fbget.
-- This file:
-- http://angg.twu.net/fbcache/fbcache3.lua
-- http://angg.twu.net/fbcache/fbcache3.lua.html
--  (find-angg        "fbcache/fbcache3.lua")

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

fbcachedir_lua = "/home/edrx/fbcache/luapp/"

Fbcache = Class {
  type    = "Fbcache",
  __index = {
    fname = function (fc, query)
        return fbcachedir_lua .. (query:gsub("[/]", "_"))
      end,
    save = function (fc, query, tbl)
        writefile(fc:fname(query), pp0(tbl))
      end,
    readcache = function (fc, query)
        local bigstr = filecontents0(fc:fname(query))
        if bigstr then return expr(bigstr) end
      end,
    readcurl = function (fc, query)
        local tbl = fbcurl(query)
        if tbl then fc:save(query, tbl) end
        return tbl
      end,
    get = function (fc, query)
        return fc:readcache(query) or fc:readcurl(query)
      end,
    --
    del = function (fc, query)
        return getoutput("rm -fv "..fc:fname(query))
      end,
  },
}

fc0 = Fbcache {}
fbget = function (query) return fc0:get(query) end



--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "fbcache3.lua"
testid = function (query) pp(fbcurl(query)) end
testid = function (query) pp(fbget(query)) end

testid("1433035430297888")
testid("1433056046962493")

testid(                               "531549197")
testid(                    "1073741851")
testid(                    "1073741851.531549197")
testid(                    "1073741851_531549197")
testid(  "10151933894649198")


--]]

--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "fbcache3.lua"
require "fbnameid"
nameids_read()
-- (find-es "facebook" "good-fbkinds")
f = function (query) pp(fbget(query)) end

-- eventnpn
-- (find-es "facebook" "eventnpn")
-- https://www.facebook.com/events/1397247553878845/permalink/1412951502308450/
f "1397247553878845"
f "1412951502308450"
f "1397247553878845_1412951502308450"
-- g(a[1]); g(a[2]); g(a[1].."_"..a[2])

-- eventnn
-- (find-es "facebook" "eventnn")
-- https://www.facebook.com/events/1553809231523002/1563468630557062/
f "1553809231523002"
f "1563468630557062"
f "1553809231523002_1563468630557062"
-- g(a[1]); g(a[2]); g(a[1].."_"..a[2])

-- eventn
-- (find-es "facebook" "eventn")
-- https://www.facebook.com/events/1006218776073768/
f "1006218776073768"
-- g(a[1])

-- groupnpn
-- (find-es "facebook" "groupnpn")
-- https://www.facebook.com/groups/249360678448319/permalink/621939097857140/
f "249360678448319"
f "621939097857140"
f "249360678448319_621939097857140"
-- g(a[1]); g(a[2]); g(a[1].."_"..a[2])

-- groupwpn
-- (find-es "facebook" "groupwpn")
-- https://www.facebook.com/groups/contatimprovbra/permalink/947586865274406/
f "162450337121400"
f "947586865274406"
f "162450337121400_947586865274406"
-- g(nid(a[1])); g(a[2]); g(nid(a[1]).."_"..a[2])
--
-- Doesn't work on closed groups:
-- https://www.facebook.com/groups/CronicasDoEstadoDeExcecao/permalink/660592440747894/
-- = nameid "CronicasDoEstadoDeExcecao"
f "543333892473750"
f "543333892473750_660592440747894"

-- groupnn
-- (find-es "facebook" "groupnn")
-- https://www.facebook.com/groups/105487286280461/240851649410690/
f "105487286280461"
f "240851649410690"
f "105487286280461_240851649410690"

-- groupwn
-- (find-es "facebook" "groupwn")
-- https://www.facebook.com/groups/transgente/639092892836474/
f "487680691311029"
f "639092892836474"
f "487680691311029_639092892836474"
-- g(nid(a[1])); g(a[2]); g(nid(a[1]).."_"..a[2])

-- groupn
-- (find-es "facebook" "groupn")
-- https://www.facebook.com/groups/1398505100440487/
f "1398505100440487"
-- g(a[1])

-- groupw
-- (find-es "facebook" "groupw")
-- https://www.facebook.com/groups/transgente
f "487680691311029"
-- g(nid(a[1]))




-- mediawannn
-- (find-es "facebook" "mediawannn")
-- https://www.facebook.com/paulakossatz/media_set?set=a.10202222226170686.1073741844.1040842293&type=1
= nameid "paulakossatz"
f "1040842293"
-- f "1040842293_10202222226170686"
-- f "1040842293_1073741844"
-- f "1040842293_1040842293"
-- f "10202222226170686_1073741844_1040842293"

-- mediawnnn
-- (find-es "facebook" "mediawnnn")

-- mediawn
-- (find-es "facebook" "mediawn")

-- noteswwn
-- (find-es "facebook" "noteswwn")

-- notesn
-- (find-es "facebook" "notesn")

-- pageswn
-- (find-es "facebook" "pageswn")
-- https://www.facebook.com/pages/Viomundo/109725279084911
--       https://www.facebook.com/Viomundo-109725279084911/
f "109725279084911"

-- storynn
-- (find-es "facebook" "storynn")
-- https://www.facebook.com/permalink.php?story_fbid=10152640860900894&id=696685893&fref=nf
f "10152640860900894"
f "696685893"

-- photonn
-- (find-es "facebook" "photonn")
-- https://www.facebook.com/photo.php?fbid=10151256245188625&set=t.100002233344951
f "10151256245188625"
f "100002233344951"

-- photonnnn
-- (find-es "facebook" "photonnnn")
-- https://www.facebook.com/photo.php?fbid=10201336092313990&set=a.1569106477271.73917.1523735650&type=1&permPage=1
f "1523735650"
f "10201336092313990"
f "10201336092313990/comments"

-- photono
-- (find-es "facebook" "photono")

-- photot
-- (find-es "facebook" "photot")
-- https://www.facebook.com/102015223300293/photos/t.100000842030889/317158085119338/
f "102015223300293"
f "100000842030889"
f "317158085119338"
f "317158085119338/likes"

-- photogm
-- (find-es "facebook" "photogm")
# (find-fburlsofkind "photogm")
# (find-fbcache "fbcache2.lua" "fbkinds" "photogm" "/N/photos/gm.N/N/R")
-- https://www.facebook.com/1442002182737691/photos/gm.1466213243643988/1471817019756207/?type=1
f "1442002182737691"
f "1466213243643988"
f "1471817019756207"

-- photona
-- (find-es "facebook" "photona")
-- https://www.facebook.com/21038112178/photos/a.441569537178.245171.21038112178/10152790891782179/?type=1&fref=nf
f "21038112178"
f "441569537178"
f "10152790891782179"

-- photowa
-- (find-es "facebook" "photowa")
-- https://www.facebook.com/AKPress/photos/a.215376115248.261941.205965845248/10154741098510249/?type=1
f "215376115248"
f "205965845248"
f "10154741098510249"

-- photovs
-- (find-es "facebook" "photovs")

-- photov
-- (find-es "facebook" "photov")
-- https://www.facebook.com/photo.php?v=10152413352959175
f "10152413352959175"

-- postwn
-- (find-es "facebook" "postwn")
-- https://www.facebook.com/CopBlock/posts/10152706679833189
= nameid "CopBlock"
f "281961363188"
f "281961363188_10152706679833189"

-- videon
-- (find-es "facebook" "videon")
-- https://www.facebook.com/video.php?v=823660551012161
f "823660551012161"



* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
-- Download all messages from a group
dofile "fbcache3.lua"
require "fbnameid"
nameids_read()
-- (find-es "facebook" "good-fbkinds")
f = function (query) pp(fbget(query)) end
f "672137799470276/feed"
PP(fbget("672137799470276/feed").paging)
PP(fbget("672137799470276/feed").paging.next)

-- (find-fbcache "fbcurl.lua")
nu = fbget("672137799470276/feed").paging.next
tbl = json_parse(curl(nu))
pp(tbl)
nu = tbl.paging.next
tbl = json_parse(curl(nu))
pp(tbl)
nu = tbl.paging.next
tbl = json_parse(curl(nu))
pp(tbl)
nu = tbl.paging.next
tbl = json_parse(curl(nu))
pp(tbl)
nu = tbl.paging.next
tbl = json_parse(curl(nu))
pp(tbl)

f "672137799470276_672239192793470"
f "672137799470276_672239192793470/likes"

fnxt = function (o) return o and o.paging and o.paging.next end
fnxts = function (o, fnxt)
    local A = {}
    if fnxt(o) then end
  end


--]]





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