Skip to content

Commit 8a710e3

Browse files
committed
add function for generate transcript
1 parent efcd7a4 commit 8a710e3

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

videodb/video.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,30 @@ def get_transcript_text(
249249
)
250250
return self.transcript_text
251251

252+
def generate_transcript(
253+
self,
254+
force: bool = None,
255+
) -> str:
256+
"""Generate transcript for the video.
257+
258+
:param bool force: Force generate new transcript
259+
:return: Full transcript text as string
260+
:rtype: str
261+
"""
262+
transcript_data = self._connection.post(
263+
path=f"{ApiPath.video}/{self.id}/{ApiPath.transcription}",
264+
data={
265+
"force": True if force else False,
266+
},
267+
)
268+
transcript = transcript_data.get("word_timestamps", [])
269+
if transcript:
270+
return {
271+
"success": True,
272+
"message": "Transcript generated successfully",
273+
}
274+
return transcript_data
275+
252276
def translate_transcript(
253277
self,
254278
language: str,

0 commit comments

Comments
 (0)