本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
ListTranscriptionJobs
搭配 AWS SDK或 使用 CLI
下列程式碼範例示範如何使用 ListTranscriptionJobs
。
- .NET
-
- AWS SDK for .NET
-
注意
還有更多功能 GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 /// <summary> /// List transcription jobs, optionally with a name filter. /// </summary> /// <param name="jobNameContains">Optional name filter for the transcription jobs.</param> /// <returns>A list of transcription job summaries.</returns> public async Task<List<TranscriptionJobSummary>> ListTranscriptionJobs(string? jobNameContains = null) { var response = await _amazonTranscribeService.ListTranscriptionJobsAsync( new ListTranscriptionJobsRequest() { JobNameContains = jobNameContains }); return response.TranscriptionJobSummaries; }
-
如需API詳細資訊,請參閱 AWS SDK for .NET API 參考ListTranscriptionJobs中的 。
-
- CLI
-
- AWS CLI
-
列出您的轉錄作業
下列
list-transcription-jobs
範例列出與 AWS 您的帳戶和區域相關聯的轉錄任務。aws transcribe list-transcription-jobs
輸出:
{ "NextToken": "NextToken", "TranscriptionJobSummaries": [ { "TranscriptionJobName": "speak-id-job-1", "CreationTime": "2020-08-17T21:06:15.391000+00:00", "StartTime": "2020-08-17T21:06:15.416000+00:00", "CompletionTime": "2020-08-17T21:07:05.098000+00:00", "LanguageCode": "language-code", "TranscriptionJobStatus": "COMPLETED", "OutputLocationType": "SERVICE_BUCKET" }, { "TranscriptionJobName": "job-1", "CreationTime": "2020-08-17T20:50:24.207000+00:00", "StartTime": "2020-08-17T20:50:24.230000+00:00", "CompletionTime": "2020-08-17T20:52:18.737000+00:00", "LanguageCode": "language-code", "TranscriptionJobStatus": "COMPLETED", "OutputLocationType": "SERVICE_BUCKET" }, { "TranscriptionJobName": "sdk-test-job-4", "CreationTime": "2020-08-17T20:32:27.917000+00:00", "StartTime": "2020-08-17T20:32:27.956000+00:00", "CompletionTime": "2020-08-17T20:33:15.126000+00:00", "LanguageCode": "language-code", "TranscriptionJobStatus": "COMPLETED", "OutputLocationType": "SERVICE_BUCKET" }, { "TranscriptionJobName": "Diarization-speak-id", "CreationTime": "2020-08-10T22:10:09.066000+00:00", "StartTime": "2020-08-10T22:10:09.116000+00:00", "CompletionTime": "2020-08-10T22:26:48.172000+00:00", "LanguageCode": "language-code", "TranscriptionJobStatus": "COMPLETED", "OutputLocationType": "SERVICE_BUCKET" }, { "TranscriptionJobName": "your-transcription-job-name", "CreationTime": "2020-07-29T17:45:09.791000+00:00", "StartTime": "2020-07-29T17:45:09.826000+00:00", "CompletionTime": "2020-07-29T17:46:20.831000+00:00", "LanguageCode": "language-code", "TranscriptionJobStatus": "COMPLETED", "OutputLocationType": "SERVICE_BUCKET" } ] }
如需詳細資訊,請參閱《Amazon Transcribe 開發人員指南》中的入門 (AWS 命令列界面)。
-
如需API詳細資訊,請參閱 AWS CLI 命令參考ListTranscriptionJobs
中的 。
-
- Java
-
- SDK 適用於 Java 2.x
-
注意
還有更多功能 GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 public class ListTranscriptionJobs { public static void main(String[] args) { TranscribeClient transcribeClient = TranscribeClient.builder() .region(Region.US_EAST_1) .build(); listTranscriptionJobs(transcribeClient); } public static void listTranscriptionJobs(TranscribeClient transcribeClient) { ListTranscriptionJobsRequest listJobsRequest = ListTranscriptionJobsRequest.builder() .build(); transcribeClient.listTranscriptionJobsPaginator(listJobsRequest).stream() .flatMap(response -> response.transcriptionJobSummaries().stream()) .forEach(jobSummary -> { System.out.println("Job Name: " + jobSummary.transcriptionJobName()); System.out.println("Job Status: " + jobSummary.transcriptionJobStatus()); System.out.println("Output Location: " + jobSummary.outputLocationType()); // Add more information as needed // Retrieve additional details for the job if necessary GetTranscriptionJobResponse jobDetails = transcribeClient.getTranscriptionJob( GetTranscriptionJobRequest.builder() .transcriptionJobName(jobSummary.transcriptionJobName()) .build()); // Display additional details System.out.println("Language Code: " + jobDetails.transcriptionJob().languageCode()); System.out.println("Media Format: " + jobDetails.transcriptionJob().mediaFormat()); // Add more details as needed System.out.println("--------------"); }); } }
-
如需API詳細資訊,請參閱 AWS SDK for Java 2.x API 參考ListTranscriptionJobs中的 。
-
- JavaScript
-
- SDK for JavaScript (v3)
-
注意
還有更多功能 GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 列出轉錄作業。
// Import the required AWS SDK clients and commands for Node.js import { ListTranscriptionJobsCommand } from "@aws-sdk/client-transcribe"; import { transcribeClient } from "./libs/transcribeClient.js"; // Set the parameters export const params = { JobNameContains: "KEYWORD", // Not required. Returns only transcription // job names containing this string }; export const run = async () => { try { const data = await transcribeClient.send( new ListTranscriptionJobsCommand(params), ); console.log("Success", data.TranscriptionJobSummaries); return data; // For unit tests. } catch (err) { console.log("Error", err); } }; run();
建立用戶端。
import { TranscribeClient } from "@aws-sdk/client-transcribe"; // Set the AWS Region. const REGION = "REGION"; //e.g. "us-east-1" // Create an Amazon Transcribe service client object. const transcribeClient = new TranscribeClient({ region: REGION }); export { transcribeClient };
-
如需詳細資訊,請參閱《AWS SDK for JavaScript 開發人員指南》https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/transcribe-examples-section.html#transcribe-list-jobs。
-
如需API詳細資訊,請參閱 AWS SDK for JavaScript API 參考ListTranscriptionJobs中的 。
-
- Python
-
- SDK for Python (Boto3)
-
注意
還有更多功能 GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 def list_jobs(job_filter, transcribe_client): """ Lists summaries of the transcription jobs for the current AWS account. :param job_filter: The list of returned jobs must contain this string in their names. :param transcribe_client: The Boto3 Transcribe client. :return: The list of retrieved transcription job summaries. """ try: response = transcribe_client.list_transcription_jobs(JobNameContains=job_filter) jobs = response["TranscriptionJobSummaries"] next_token = response.get("NextToken") while next_token is not None: response = transcribe_client.list_transcription_jobs( JobNameContains=job_filter, NextToken=next_token ) jobs += response["TranscriptionJobSummaries"] next_token = response.get("NextToken") logger.info("Got %s jobs with filter %s.", len(jobs), job_filter) except ClientError: logger.exception("Couldn't get jobs with filter %s.", job_filter) raise else: return jobs
-
如需API詳細資訊,請參閱 ListTranscriptionJobs 中的 AWS SDK for Python (Boto3) API參考。
-
如需開發人員指南和程式碼範例的完整清單 AWS SDK,請參閱 搭配 AWS SDK 使用此服務。本主題也包含入門的相關資訊,以及先前SDK版本的詳細資訊。