Translate HubI have a room code
← All guides

Sermon transcripts as subtitle files for YouTube

When a room saves its transcripts, every service leaves behind what was said and each language it went out in. With a key, a short script fetches them once the service has ended: as SRT or WebVTT subtitles for the sermon’s video on YouTube or on the church’s website, or as plain text for the archive. This guide gets a sermon’s Spanish subtitles.

What you need

  • A room that saves transcripts. In the studio’s set-up for the room, open the Settings tab, where the advanced settings are, and turn on “Save a transcript of every service in this room”. It is off until someone turns it on, and a service before then has no transcript.
  • A key for reading, made by an owner of the church in the studio’s Settings, under Integrations: choose “Custom” and tick only “Read past services, transcripts, summaries and usage”. Such a key controls nothing. We will open the API to a few churches first: if Integrations is not there yet and you would like yours to be one of them, write to us.
  • PowerShell or a terminal. Windows has PowerShell. On a Mac or Linux, the script below also needs jq, a small free program that reads JSON.

What you get

  • SRT or WebVTT: subtitle files, each line with its time. YouTube takes either, and a website’s video player usually takes WebVTT.
  • Plain text of the whole service, line after line, or JSON with each line’s time, for your own tools.
  • In each language the service went out in, or in the words as spoken. A language the service was not translated into is refused.

When it is there, and for how long

A transcript is there once the service has ended; while it is on air, the answer is “not found”. The list of services can be a little behind the studio’s, so run the script a few minutes after the service.

Transcripts are kept until you delete the room or your account, or for a year after your church’s last activity (a service, or anyone on the team opening the studio), and the owners are emailed before. To keep them for good, save them each week. The whole rule is on the Privacy page.

The script, in PowerShell

Put the key in the window once, as $env:TRANSLATE_HUB_KEY = "…", and run the first three lines: the third lists the rooms the key reaches, each with its name and id. Put your room’s id in place of ROOM_ID and run the rest. They find that room’s newest ended service with a transcript, save its Spanish subtitles as sermon-es.srt, and show the file’s first lines: check that they are the sermon’s words before you upload it. If a call fails, PowerShell stops with the error and saves nothing.

$api = "https://translate-hub.com/api/v1"$h = @{ Authorization = "Bearer $env:TRANSLATE_HUB_KEY" }(Invoke-RestMethod "$api/me" -Headers $h).rooms$room = "ROOM_ID"$s = (Invoke-RestMethod "$api/services?roomId=$room&limit=10" -Headers $h).data | Where-Object { $_.endedAt -and $_.hasTranscript } | Select-Object -First 1Invoke-WebRequest "$api/services/$($s.id)/transcript?format=srt&language=es" -Headers $h -OutFile "sermon-es.srt" -UseBasicParsingGet-Content "sermon-es.srt" -TotalCount 8 -Encoding UTF8

For WebVTT, write format=vtt and name the file .vtt; for plain text, format=text and .txt. Leave out &language=es for the words as spoken.

The script, in bash

The same on a Mac or Linux, with the key in the environment as TRANSLATE_HUB_KEY: the second line lists the rooms, and your room’s id goes in place of ROOM_ID. With -f, curl stops at a failed call and saves nothing.

AUTH="Authorization: Bearer $TRANSLATE_HUB_KEY"; API=https://translate-hub.com/api/v1curl -fsS -H "$AUTH" "$API/me" | jq '.rooms'ROOM=ROOM_IDID=$(curl -fsS -H "$AUTH" "$API/services?roomId=$ROOM&limit=10" | jq -r '[.data[] | select(.endedAt != null and .hasTranscript)][0].id')curl -fsS -H "$AUTH" -o sermon-es.srt "$API/services/$ID/transcript?format=srt&language=es"head -n 8 sermon-es.srt

Either script can run by itself on Sunday afternoon, from Task Scheduler on Windows or cron on a Mac or Linux: check their own help for how.

On YouTube or the website

  • On YouTube, open the video in YouTube Studio, choose Subtitles, add the language, and upload the file with its timing. YouTube’s menus move, so check YouTube’s own help.
  • The times count from the start of the service in the studio. If the video begins at another moment, shift the subtitles by the difference; most subtitle editors can.
  • Read it before you publish. Its times are approximate, and it is what the room heard and translated, live: names and verses are worth a look by someone who knows the language.

Keep the key safe

The key goes in a header, never in the address: a key that appears in the address of a call to our API is revoked at once, and one put in any other address is yours to revoke. Keep it out of scripts you share, as above, and revoke it in Settings, Integrations when the script is gone. Every call is on the developers’ page and in the API reference, in English.