|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- fbcurl.lua: download things from Facebook using curl (and the Graph API)
-- This file:
-- http://angg.twu.net/fbcache/fbcurl.lua
-- http://angg.twu.net/fbcache/fbcurl.lua.html
-- (find-angg "fbcache/fbcurl.lua")
-- 2016jan09
-- query fbtoken
-- \ |
-- \ |
-- v v
-- url
-- |
-- | curl
-- v
-- json
-- |
-- | json_parse
-- v
-- luatable
-- (find-angg "LUA/lua50init.lua" "curl")
require "fbtoken" -- (find-fbcache "fbtoken.lua")
require "fbjson" -- (find-fbcache "fbjson.lua")
require "fbpp" -- (find-fbcache "fbpp.lua")
makegraphurl = function (query)
local c = query:match"%?" and "&" or "?"
return "https://graph.facebook.com/v2.5/"..
query .. c .. "access_token=" .. fbtoken
end
fbcurl0 = function (url)
local tbl = json_parse(curl(url))
return tbl
end
fbcurl = function (query)
local tbl = json_parse(curl(makegraphurl(query)))
return tbl
end
-- testid = function (id)
-- print(fbcurl(id):sub(1,500))
-- end
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "fbcurl.lua"
testid = function (query) pp(fbcurl(query)) end
testid("1433035430297888")
testid("1433056046962493")
testid( "531549197")
testid( "1073741851")
testid( "1073741851.531549197")
testid( "1073741851_531549197")
testid( "10151933894649198")
pp(fbcurl "user")
pp(fbcurl "1523735650")
pp(fbcurl "1523735650/feed")
query = ""
query = "1523735650/feed"
query = "1523735650_feed"
query = "me/feed"
= curl(makegraphurl(query))
testid "me/feed"
--]]
-- Local Variables:
-- coding: raw-text-unix
-- End: