Skip to main content

An offline CSV bridge from video API JSON to an Airtable review table

  • Nov 19, 2026 3:53 AM UTC
  • 0 replies
  • 5 views

zhangbo

When a team reviews public social posts in Airtable, the useful columns are usually the original post, a title, the platform and a short media summary. Copying a full API response into a long-text field makes that review harder. Temporary media URLs also make poor long-term reference fields.

Here is a small Python adapter that turns a saved JSON response into one CSV row. The CSV can be imported into a review table; this version makes no network calls and needs only Python’s standard library.

Disclosure: I maintain EasyDown, the paid developer API whose response contract this example uses. AI assisted with drafting and code. Verification for this example consists of ten local tests using synthetic data; an import into a live Airtable base has not been performed for this write-up.

Input and output

Use a saved response from the common POST /api/v1/parse endpoint. Its successful envelope has an integer status of 200, with the normalized media object directly in data. Platform-specific endpoints have a different wrapper and are outside this adapter’s input contract.

The script keeps Source URL, Platform, Title, Video options, Images and Audio options. Video options counts returned entries, which can include multiple encodings of the same video. It is not a count of distinct social posts.

Supply the public source-post URL alongside the response file. The adapter deliberately omits thumbnails, media URLs, headers and arbitrary response fields from the CSV. That keeps the review table focused on metadata. It does not delete or sanitize the original JSON file.

The adapter

Save the following as media_csv.py. A response with an error status or the wrong wrapper stops the conversion instead of producing a misleading blank row. Text that looks like a spreadsheet formula receives a leading apostrophe as a precaution for later spreadsheet use; depending on import settings, that apostrophe can remain visible.

"""Create an Airtable import CSV from a saved common-endpoint response.

This program makes no network requests and never copies media URLs.
"""
import csv
import json
import sys
from urllib.parse import urlsplit


FIELDS = ["Source URL", "Platform", "Title", "Video options", "Images", "Audio options"]


def summarize(source_url, payload):
source = urlsplit(source_url)
if source.scheme not in ("http", "https") or not source.hostname or source.username or source.password:
raise ValueError("Use a public HTTP(S) post URL without credentials")
if not isinstance(payload, dict) or payload.get("status") != 200:
raise ValueError("Expected a successful common-endpoint response")
data = payload.get("data")
if not isinstance(data, dict) or not isinstance(data.get("platform"), str) or not data["platform"]:
raise ValueError("Expected the normalized media object directly in data")
if not isinstance(data.get("title"), str):
raise ValueError("Expected a text title")
names = ("videos", "images", "audios")
if not any(name in data for name in names):
raise ValueError("No media arrays found")
arrays = [data.get(name, []) for name in names]
if any(not isinstance(items, list) for items in arrays):
raise ValueError("Media fields must be arrays")
return dict(zip(FIELDS, [source_url, data["platform"], data["title"], *map(len, arrays)]))


def csv_cell(value):
# Defense for later spreadsheet exports; test your destination's CSV handling.
if isinstance(value, str) and value.lstrip().startswith(("=", "+", "-", "@")):
return "'" + value
return value


def write_csv(source_url, payload, destination):
row = summarize(source_url, payload)
writer = csv.DictWriter(destination, fieldnames=FIELDS)
writer.writeheader()
writer.writerow({key: csv_cell(value) for key, value in row.items()})


if __name__ == "__main__":
if len(sys.argv) != 3:
raise SystemExit("Usage: python3 media_csv.py PUBLIC_POST_URL response.json > import.csv")
with open(sys.argv[2], encoding="utf-8") as source_file:
payload = json.load(source_file)
write_csv(sys.argv[1], payload, sys.stdout)

Try it with a synthetic fixture

Save this synthetic fixture as response.json. The example.invalid addresses are placeholders and are not real media or parsing results.

{
"status": 200,
"data": {
"platform": "tiktok",
"title": "Synthetic example post",
"videos": [{"url": "https://media.example.invalid/temporary.mp4"}],
"images": [],
"audios": []
}
}

Run the command below, replacing the placeholder source URL when processing a real response. Keeping the existing response file lets you regenerate the CSV without making another API request.

python3 media_csv.py https://example.invalid/public-post/1 response.json > import.csv

Map the CSV into Airtable

In Airtable, import import.csv into a new review table and check the field mapping. Use a URL or text field for Source URL, text fields for Platform and Title, and number fields for the three counts. Review field-type detection before confirming the import.

This example creates a single-row import, with no automatic merge or duplicate handling. For repeated imports, decide how you will match Source URL before adding rows to an existing workflow. It also does not copy media into an Attachment field or archive the underlying files.

For the API step upstream, use an account, a Bearer token and available API credits. Only supported public single-post URLs are in scope. Keep that token in your own API client; it has no place in the CSV, a shared Airtable field or this forum post.

The main benefit is a small, inspectable boundary: API parsing produces a response, the local adapter produces an explicit CSV schema, and the Airtable table stays readable for the people doing the review.

The response model is described in the EasyDown API reference.