You Tube Chapter Wizard

You Tube Chapter Wizard · GPT Actions

Transcript API

API for fetching transcript of a video.

  • GET /youtube/transcriptGet transcripts for a specific page of a video
  • GET /youtube/videoGet info of a video
原始 API 定义
{
  "openapi": "3.0.0",
  "info": {
    "title": "Transcript API",
    "version": "1.0.0",
    "description": "API for fetching transcript of a video."
  },
  "servers": [
    {
      "url": "https://api.tantou.ai"
    }
  ],
  "paths": {
    "/youtube/transcript": {
      "get": {
        "summary": "Get transcripts for a specific page of a video",
        "operationId": "getTranscripts",
        "tags": [
          "transcripts"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "The unique identifier for the video",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "language",
            "in": "query",
            "required": true,
            "description": "Language code for the transcript",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": true,
            "description": "Page number of transcript to fetch",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": true,
            "description": "Number of transcript entries per page",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with transcript data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "transcript": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "start": {
                            "type": "float",
                            "description": "Timestamp of the transcript in seconds"
                          },
                          "text": {
                            "type": "string",
                            "description": "Text content of the transcript"
                          }
                        }
                      }
                    },
                    "transcript_count": {
                      "type": "integer",
                      "description": "Total number of transcript for the video"
                    },
                    "transcript_left": {
                      "type": "integer",
                      "description": "Number of transcript left after the current page"
                    },
                    "transcript_type": {
                      "type": "string",
                      "description": "Type of transcript, such as manually or generated"
                    },
                    "language_list": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "Language code exist of the video(only use when no other properties)"
                      }
                    },
                    "message": {
                      "type": "string",
                      "description": "A message indicating the status of the transcript fetch"
                    }
                  }
                }
              }
            }
          },
          "204": {
            "description": "No transcript found for the given parameters"
          },
          "400": {
            "description": "Bad request, e.g., missing or invalid parameters"
          },
          "404": {
            "description": "Video not found"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/youtube/video": {
      "get": {
        "summary": "Get info of a video",
        "operationId": "getVideoInfo",
        "tags": [
          "info"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "The unique identifier for the video",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with infomation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string",
                      "description": "Title of the video"
                    },
                    "duration": {
                      "type": "integer",
                      "description": "Total length of the video in seconds"
                    },
                    "description": {
                      "type": "string",
                      "description": "The description of the video"
                    },
                    "channel": {
                      "type": "string",
                      "description": "The name of the channel the video belongs to"
                    },
                    "language": {
                      "type": "string",
                      "description": "Language of the video"
                    },
                    "categories": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "Categories of  the video"
                      }
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "tags of  the video"
                      }
                    },
                    "chapters": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "description": "tags of  the video"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request, e.g., missing or invalid parameters"
          },
          "404": {
            "description": "Video not found"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    }
  }
}