Skip to content
fb

Search and discovery

Search across Facebook's surfaces, and classify any id or URL with fb id.

Two commands cover discovery: search finds entities by keyword, and id classifies any handle or URL into a typed identity with no network access.

Searching

search queries across Facebook's surfaces and streams typed results:

fb search "climate" -o jsonl

Narrow to one kind with --type:

fb search "climate" --type page --limit 50 -o jsonl
fb search "nasa" --type group -o jsonl

The accepted types are page, profile, group, post, photo, video, event, and all (the default). Each result carries its type, name, URL, and a snippet, so you can pipe the URLs straight into another command:

fb search "nasa" --type page -o url | fb page - -o jsonl

Classifying ids and URLs

fb id is the fastest command in the tool: it does no network work and no login, it just parses. It recognises every shape Facebook uses:

fb id nasa
fb id "https://www.facebook.com/nasa/posts/pfbid0xyz"
fb id "story.php?story_fbid=111&id=222"
fb id "https://www.facebook.com/groups/123456789"
fb id "https://www.facebook.com/watch/?v=987654321"
fb id "profile.php?id=100000000000001"

Each prints a typed identity: the kind (page, profile, group, post, photo, video, event), the ids it pulled out, and the canonical and mbasic URLs.

{"input":"https://www.facebook.com/nasa/posts/pfbid0xyz","kind":"post","post_id":"pfbid0xyz","owner_id":"nasa","canonical_url":"https://www.facebook.com/nasa/posts/pfbid0xyz","mbasic_url":"https://mbasic.facebook.com/nasa/posts/pfbid0xyz"}

fb.watch, fb.me, and share/ links cannot be classified by their text alone, so fb id follows the redirect to resolve them to a real id:

fb id "https://fb.watch/xxxxx" -o json

This is the one case where fb id makes a network request. Everything else is pure parsing.