Skip to content

Jetfuel wire format ​

jetfuel.decode(buffer) ​

Decodes a payload you already fetched (a Buffer, ArrayBuffer, typed array or binary string) into a structured tree. page, remote and res.decode() use the same decoder.

js
const res = await client.jetfuel.raw("creators/inspiration/top_posts");
const tree = client.jetfuel.decode(res.buffer);

Returns:

FieldDescription
frame{ payloadLen, count, footer }: the 11-byte framing header.
tokensEvery decoded element in order, each tagged string / node / atom / list / raw with its byte offset.
stringsEvery length-prefixed UTF-8 string, in order.
nodes[{ type, key }]: each component node (0x11 intro) paired with the two strings that name it.
atoms[{ field, hash }]: interned style/property references (the hash is a FarmHash u32).
lists[{ kind, count, hashes }]: typed reference lists (children, style sets, variants).
timelineTokensAny base64 Timeline: tokens embedded in the payload.
js
tree.frame;            // { payloadLen: 27389, count: 181, footer: "b40600" }
tree.strings;          // ["page", "inspiration_top_posts", "Country", "United States", ...]
tree.nodes;            // [{ type: "page", key: "inspiration_top_posts" }, { type: "select_country", key: "event_info" }, ...]
tree.timelineTokens;   // ["VGltZWxpbmU6..."]

The format, briefly ​

  • Framing. uint16 LE payload length, three zero bytes, a uint8 count/version, then the payload, ending in a 3-byte footer.
  • Strings. Inline, single-byte length prefix, UTF-8: <len> <bytes>.
  • Node intro 0x11. Begins a component, followed by its [typeString, keyString].
  • Atom reference 02 <fieldId> 00 00 00 <hash:u32>. Binds a property slot to a globally interned style atom, identified by a 4-byte FarmHash. The same hash recurs across pages (a content-addressed dictionary), which is why the decoder surfaces them but cannot name them: the atom dictionary lives in a lazy client chunk.
  • Reference list 03 <kind> <count> 00 00 00 00 <hash:u32 × count>. A typed collection of references.

The decode is best-effort and structural. It reliably recovers framing, strings, the node tree, atom references and reference lists. It does not resolve interned atoms to their style definitions, and the leading symbol-table region produces some short noise strings. Treat the output as inspectable structure, not a stable schema.

Timeline: tokens ​

The creator inspiration feed (remote/urt) doesn't return tweets. It returns a base64 Timeline:<thrift> token, which the main timeline service resolves through GenericTimelineById. The thrift struct has three string fields: engagement (id 1), country (id 3) and period (id 6).

jetfuel.topPostsTimelineId() builds these offline, and jetfuel.topPostsFeed() decodes the one the server sends into params:

js
client.jetfuel.topPostsTimelineId({ engagement: "Likes", country: "PRT", period: "Daily" });
// "VGltZWxpbmU6DADKCwABAAAABUxpa2VzCwADAAAAA1BSVAsABgAAAAVEYWlseQAA"

(await client.jetfuel.topPostsFeed({ engagement: "Likes", country: "PRT" })).params;
// { engagement: "Likes", country: "PRT", period: "Daily" }

The token is deterministic, and the locally built one is byte-identical to what the server returns for the same parameters, so topPosts builds it locally and skips the binary feed.

Every decode also scans the payload for embedded tokens and returns them as timelineTokens:

js
const res = await client.jetfuel.raw("creators/inspiration/remote/urt", { params: { engagement: "Likes" } });
client.jetfuel.decode(res.buffer).timelineTokens; // ["VGltZWxpbmU6..."]

not affiliated with X Corp.