Skip to the page
Social CrawlDocs

The Post schema

Updated
View as Markdown

The shape of a saved post as data: the Post, its media, article blocks, video, title, repository and playlist parts, the bundle manifest and the capture request.

On this page

Every saved post is described by one zod schema in packages/schema/src/index.ts. The extension builds it, the API validates and stores it as post.json, and the renderer draws it. If you write your own reader or importer, this is the contract.

TypeScript
import { postSchema, captureRequestSchema, bundleManifestSchema } from "@social-crawl/schema";

Post#

FieldTypeNotes
idstringThe platform's own id. Unique together with platform.
platformenumbluesky, mastodon, reddit, youtube, facebook, instagram, x, pinterest, linkedin, web (any other site, saved as an article).
urlURLThe post's address.
sourceenumapi, extension or oembed: how it reached the service.
authorAuthorSee below.
textstringPlain text. For an article it is the plain-text version of the body.
titlestring, optional
articleArticle, optionalThe long body as blocks.
videoVideoInfo, optionalWhat a video page shows around the video (YouTube).
createdAtISO date, optionalWhen it was posted.
capturedAtISO dateWhen it was saved.
mediaMedia[]Pictures, videos, sound and files. Default empty.
metrics{ likes, comments, shares, views }, each optionalDefault empty.
titleInfoTitleInfo, optionalA film or show's page.
quotedQuotedPost, optionalA post shown inside this one (X's quoted post).
repoRepoInfo, optionalA code repository's page.
playlistPlaylistInfo, optionalA YouTube playlist's page.
linkPreviewsLinkPreview[] (at most 8)Cards for the links in the text.
extrarecordPlatform-specific extras. Never rendered raw.

Author#

displayName (required), id, handle, url, avatar (a Media) and verified.

Media#

FieldNotes
idRequired. Blocks and previews refer to it.
kindimage, video, gif, audio or file (anything else a page offers for download, kept as it is and never opened by the app).
remoteUrl, statusThe original address, and local (stored in the bundle) or remote-only (only the address is known).
localPath, mimeType, size, fileNameWhere it is stored in the bundle, its type, its real size, and for a file the name to show.
alt, width, heightText and size.
posterUrl, posterPathA picture to download as the thumbnail, and where it is stored.
audioUrl, partUrlsFor videos the page streams as separate sound, or as numbered pieces with no playlist. The server joins them.
label, audioFormatThe name the extension's list showed; for sound, original, mp3 or flac.
uploadId, audioUploadIdA video the extension downloaded itself and uploaded in pieces (POST /capture/uploads).
expectedBytes, secondsThe size a video saved without its file had, and a saved video's length.
renditions (up to 8)Smaller copies of a saved video: height, width, path, size.
captions (up to 20)Subtitle files: path (WebVTT), language, name.
transcript{ path, language, lines }: what speech recognition found, as its own file.

Article#

blocks (at most 5000), siteName, siteLogo (a media id), excerpt and readingMinutes. A block is one of:

typeFields
headinglevel 1 to 6, inlines
paragraph, quoteinlines
listordered, items (each a list of inlines)
codetext, language
imagemediaId, caption, href (an http(s) link the picture leads to)
video, filemediaId, caption
tableheader, rows of cells of inlines (at most 500 rows, 40 cells)
rulenone

An inline is text plus optional bold, italic, code, href (web, ftp, sftp, magnet, mailto or tel, never javascript: or data:) and image (a small picture in the line, such as a README badge). An article is plain data and never HTML.

VideoInfo#

seconds, subscribers, dateText, viewsText, likesText, category, description (runs of text, links and times you can click), hashtags, keywords, chapters (seconds, title, thumbnail), transcript (lines with start and text), transcriptLanguage, captions (each language, name, kind of manual, auto or translated, and vtt text that the server stores as a file), commentsText and up to 100 comments.

LinkPreview#

url (as it appears in the text), finalUrl, kind (page or image), title, description, siteName, imageUrl, imagePath. Made by the server when the post is saved.

TitleInfo, RepoInfo, PlaylistInfo, QuotedPost#

  • TitleInfo: kind (movie, series, episode, other), name, year, plot, genres, contentRating, runtime, released, scores, trailer, people (name, role, character, photo), details (label and value), sections (strips such as seasons and more like this) and textSections (storyline, trivia, reviews).
  • RepoInfo: host, owner, name, description, homepage, topics, stars, forks, watchers, license, defaultBranch, clone (https, ssh, cli), zipMediaId, languages (name, percent, colour), releases, contributors, createdAt, pushedAt.
  • PlaylistInfo: listId, total, description, viewsText, updatedText, videos (at most 300: id, url, title, channel, views, age, duration, thumbnail, unavailable) and truncated. The videos are not downloaded.
  • QuotedPost: url, authorName, handle, avatarUrl, text, imageUrl, video, createdAt. Only a preview that links to the post.

BundleManifest (post.json)#

JSON
{
  "version": 1,
  "post": { "...": "a Post" },
  "files": [{ "path": "images/0.jpg", "bytes": 12345, "sha256": "…64 hex digits…" }],
  "createdAt": "2026-12-02T10:00:00.000Z"
}

version is BUNDLE_VERSION (1). Every file has a SHA-256, so a bundle can be verified without the server.

CaptureRequest#

What the extension sends to POST /capture:

JSON
{
  "post": { "...": "a Post without capturedAt and source" },
  "tags": ["travel", "recipes"]
}

tags (at most 100 entries) are added to the tags the post already has. They are checked with the rules in Tags.

Using the schema#

  • Parse before you trust: postSchema.parse(data) throws with the exact path of a wrong field.
  • Add a new kind of data by extending the schema first (with limits on every string and array), then the reader, then the renderer. The tests in packages/schema/src/index.test.ts show the style.