v0.2.0
A new discover command walks the Facebook graph from a page, profile, group, or post breadth first, following posts, authors, and comments.
Every other command answers one question about one object: a Page's feed, a
post's comments, the author of a story. This release adds discover, which
chains them into a single breadth-first walk.
discover: walk the graph
fb discover nasa
fb discover "https://www.facebook.com/nasa/posts/123" --depth 2
A seed is anything fb resolves to a page, profile, group, or post: a slug, a
numeric id, or any Facebook URL. The first row is the seed at depth 0; each later
row is tagged with the edge it arrived by, so the output reads as a graph.
What gets followed
There are five node kinds, three actors (page, profile, group) and the
content hanging off them (post, comment), and three edges: posts (an actor
to its feed), author (a post back to its actor), and comments (a post to its
preview comments, a leaf).
--follow takes a preset or a comma-separated edge list:
fb discover nasa # content (the default)
fb discover nasa --follow threads --depth 2 # posts, then their comments
fb discover nasa --follow all --depth 2
fb discover "<post-url>" --follow author
The presets are content (an actor's posts, and from a post seed back to its
author), threads (posts and the preview comments under them), and all.
Because the anonymous crawler surface is a shallow star, comments sit one hop
below their post: reach them from an actor seed with --depth 2, or seed a post
directly and --depth 1 is enough.
Bounding the walk
Three independent limits keep a walk finite, so a bare discover always
terminates: --depth (hops, default 1; 0 emits only the seeds), --fanout
(neighbors per edge, default 25; 0 for unlimited), and -n (total nodes,
default 500). A seed that cannot be fetched fails the walk; a failure deeper in
the walk becomes a one-line note on stderr and the traversal carries on.
discover streams one row per node, and fb discover - -o url bridges a walk
into crawl, so a walk can produce the very URL stream a dataset build consumes.
See the Discovering guide for the full tour.
Install
go install github.com/tamnd/facebook-cli/cmd/fb@latest
Prebuilt archives for Linux, macOS, and Windows, plus Linux packages (deb, rpm, apk) and checksums, are on the release page. The container image is on GHCR:
docker run --rm ghcr.io/tamnd/fb:0.2.0 discover nasa -n 10