getyoutubetranscript 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ name: tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ unit-tests:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - name: Install package with dev dependencies
20
+ run: pip install -e ".[dev]"
21
+ - name: Run unit tests
22
+ run: pytest tests -v --ignore=tests/live
@@ -0,0 +1,15 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .eggs/
5
+ .pytest_cache/
6
+ .mypy_cache/
7
+ .ruff_cache/
8
+ build/
9
+ dist/
10
+ .venv/
11
+ venv/
12
+ .env
13
+ .env.*
14
+ *.log
15
+ .DS_Store
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tubeagentkit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,186 @@
1
+ Metadata-Version: 2.5
2
+ Name: getyoutubetranscript
3
+ Version: 0.2.0
4
+ Summary: Python SDK for the GetYouTubeTranscript REST API - transcripts, search, channels, and playlists
5
+ Project-URL: Homepage, https://getyoutubetranscript.com
6
+ Project-URL: Documentation, https://getyoutubetranscript.com/docs
7
+ Project-URL: Repository, https://github.com/tubeagentkit/youtube-transcript-api-python
8
+ Project-URL: Bug Tracker, https://github.com/tubeagentkit/youtube-transcript-api-python/issues
9
+ Author: tubeagentkit
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: api-client,sdk,transcript,youtube,youtube-api
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Internet :: WWW/HTTP
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.9
27
+ Requires-Dist: requests>=2.28
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7.0; extra == 'dev'
30
+ Requires-Dist: responses>=0.23; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # YouTube Transcript API: Python SDK
34
+
35
+ [![License](https://img.shields.io/badge/License-MIT-4CAF50?style=for-the-badge)](./LICENSE)
36
+ [![Website](https://img.shields.io/badge/Website-getyoutubetranscript.com-FF3B00?style=for-the-badge)](https://getyoutubetranscript.com)
37
+ [![Python](https://img.shields.io/badge/Python-3.9%2B-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://www.python.org)
38
+
39
+ The official Python SDK (`getyoutubetranscript`) for the [GetYouTubeTranscript](https://getyoutubetranscript.com) YouTube Transcript API. Get YouTube video transcripts in Python without a Google API key, yt-dlp, or a headless browser. Get YouTube transcripts, search videos and channels, resolve channel handles, browse a channel's full upload history, search inside a channel, pull playlist contents, and check your credit balance, all with one typed client.
40
+
41
+ Not published to PyPI yet - install straight from this repo.
42
+
43
+ ## Install
44
+
45
+ ```bash
46
+ pip install git+https://github.com/tubeagentkit/youtube-transcript-api-python.git
47
+ ```
48
+
49
+ Requires Python 3.9+.
50
+
51
+ ## Quickstart
52
+
53
+ ```python
54
+ from getyoutubetranscript import Client
55
+
56
+ client = Client(api_key="sk_live_...")
57
+
58
+ transcript = client.get_transcript("https://www.youtube.com/watch?v=jNQXAC9IVRw")
59
+ print(transcript["title"], transcript["word_count"])
60
+ print(transcript["transcript"])
61
+ ```
62
+
63
+ ## Getting an API key
64
+
65
+ Every request needs an API key. There are two ways to get one:
66
+
67
+ 1. **Dashboard** - sign up at [getyoutubetranscript.com](https://getyoutubetranscript.com). Free tier: 100 credits, no card required.
68
+ 2. **Self-serve, in code** - use the `signup`/`verify_signup` helpers below. No key required for either call.
69
+
70
+ ```python
71
+ from getyoutubetranscript import signup, verify_signup
72
+
73
+ signup("you@example.com") # sends a 6-digit code, valid 10 minutes
74
+ # ... read the code from your inbox ...
75
+ api_key = verify_signup("you@example.com", "123456") # -> "sk_live_..."
76
+ ```
77
+
78
+ The raw key is returned once by `verify_signup` and can't be retrieved again - store it yourself (env var, secret manager, etc).
79
+
80
+ ## Usage
81
+
82
+ Every method costs 1 credit unless noted "free" below. Failed and rate-limited requests are never charged. All methods raise `GetYouTubeTranscriptError` on failure - see [Error handling](#error-handling).
83
+
84
+ ### Transcripts
85
+
86
+ ```python
87
+ client.get_transcript("jNQXAC9IVRw", language="en")
88
+ ```
89
+
90
+ Pass `timestamps=True` to also get one entry per caption line in `segments` (same 1 credit). Without it, the response has no `segments` key.
91
+
92
+ ```python
93
+ result = client.get_transcript("5e37ZT3SQbk", timestamps=True)
94
+ print(result["segments"][0])
95
+ # {"start": 3.96, "duration": 4.56, "text": "So, Reed, education, which a lot of"}
96
+ ```
97
+
98
+ Each segment is `{"start", "duration", "text"}` with `start` and `duration` in seconds. The `Segment` and `TranscriptData` typed dicts are importable from `getyoutubetranscript`.
99
+
100
+ ### Search
101
+
102
+ ```python
103
+ client.search("lofi beats", type="video", limit=10)
104
+
105
+ # Pagination
106
+ page2 = client.search(page_token=first_page["pagination"]["next_page_token"])
107
+ ```
108
+
109
+ ### Channels
110
+
111
+ ```python
112
+ client.resolve_channel("@mkbhd") # free - handle/URL -> channel ID
113
+ client.get_channel_latest("@mkbhd") # free - metadata + latest uploads
114
+ client.search_channel("@mkbhd", "iphone") # search within a channel
115
+ client.list_channel_videos("@mkbhd") # full paginated upload history
116
+
117
+ # Pagination (search_channel and list_channel_videos both work the same way)
118
+ page = client.list_channel_videos("@mkbhd")
119
+ while page["has_more"]:
120
+ page = client.list_channel_videos(continuation=page["continuation_token"])
121
+ ```
122
+
123
+ ### Playlists
124
+
125
+ ```python
126
+ page = client.get_playlist("PLillGF-RfqbYE6Ik_EuXA2iZFcE082B3s")
127
+ while page["has_more"]:
128
+ page = client.get_playlist(continuation=page["continuation_token"])
129
+ ```
130
+
131
+ ### Account
132
+
133
+ ```python
134
+ client.get_credits() # free - plan_credits_left, topup_credits_left, plan, rate_limit_per_minute
135
+ ```
136
+
137
+ ## Error handling
138
+
139
+ Every non-2xx or `{"success": false}` response raises `GetYouTubeTranscriptError` with the API's parsed error shape:
140
+
141
+ ```python
142
+ from getyoutubetranscript import Client, GetYouTubeTranscriptError
143
+
144
+ client = Client(api_key="sk_live_...")
145
+
146
+ try:
147
+ client.get_transcript("no-captions-here")
148
+ except GetYouTubeTranscriptError as e:
149
+ print(e.code) # e.g. "NOT_FOUND"
150
+ print(e.message) # human-readable message from the API
151
+ print(e.status_code) # 400 / 401 / 402 / 404 / 429 / 503, or 0 for a local network failure
152
+ print(e.response_body) # full parsed error body, e.g. {"creditsLeft": 0} on PAYMENT_REQUIRED
153
+ ```
154
+
155
+ ## Development
156
+
157
+ ```bash
158
+ pip install -e ".[dev]"
159
+
160
+ # Unit tests - mocked HTTP, no network or API key needed, always safe to run
161
+ pytest tests -v --ignore=tests/live
162
+
163
+ # Live integration tests - hits the real API, spends credits, needs a key
164
+ GYT_API_KEY=sk_live_... pytest tests/live -v
165
+ ```
166
+
167
+ ## Links
168
+
169
+ - [Full API docs](https://getyoutubetranscript.com/docs)
170
+ - [OpenAPI spec](https://getyoutubetranscript.com/openapi.json)
171
+ - [MCP server](https://getyoutubetranscript.com/youtube-mcp-server) - if you want an AI agent to call this API directly instead of via Python
172
+
173
+ ## Related projects
174
+
175
+ Other ways to use the [GetYouTubeTranscript API](https://getyoutubetranscript.com):
176
+
177
+ - [youtube-transcript-api](https://github.com/tubeagentkit/youtube-transcript-api): YouTube Transcript API docs, endpoint reference, OpenAPI spec and examples in curl, Python, JavaScript, Go and PHP
178
+ - [youtube-transcript-api-node](https://github.com/tubeagentkit/youtube-transcript-api-node): YouTube Transcript API SDK for Node.js / TypeScript
179
+ - [youtube-mcp](https://github.com/tubeagentkit/youtube-mcp): Remote YouTube MCP server for Claude, ChatGPT, Cursor and VS Code
180
+ - [youtube-transcript-skills](https://github.com/tubeagentkit/youtube-transcript-skills): YouTube transcript Agent Skill for Claude Code, Cursor, Codex and OpenClaw
181
+ - [youtube-transcript-cursor-plugin](https://github.com/tubeagentkit/youtube-transcript-cursor-plugin): YouTube Transcript Cursor plugin bundling the MCP server, skills, commands and a research agent
182
+ - [n8n-nodes-getyoutubetranscript](https://github.com/tubeagentkit/n8n-nodes-getyoutubetranscript): YouTube transcript n8n community node, also usable as an AI Agent tool
183
+
184
+ ## License
185
+
186
+ MIT - see [LICENSE](./LICENSE).
@@ -0,0 +1,154 @@
1
+ # YouTube Transcript API: Python SDK
2
+
3
+ [![License](https://img.shields.io/badge/License-MIT-4CAF50?style=for-the-badge)](./LICENSE)
4
+ [![Website](https://img.shields.io/badge/Website-getyoutubetranscript.com-FF3B00?style=for-the-badge)](https://getyoutubetranscript.com)
5
+ [![Python](https://img.shields.io/badge/Python-3.9%2B-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://www.python.org)
6
+
7
+ The official Python SDK (`getyoutubetranscript`) for the [GetYouTubeTranscript](https://getyoutubetranscript.com) YouTube Transcript API. Get YouTube video transcripts in Python without a Google API key, yt-dlp, or a headless browser. Get YouTube transcripts, search videos and channels, resolve channel handles, browse a channel's full upload history, search inside a channel, pull playlist contents, and check your credit balance, all with one typed client.
8
+
9
+ Not published to PyPI yet - install straight from this repo.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pip install git+https://github.com/tubeagentkit/youtube-transcript-api-python.git
15
+ ```
16
+
17
+ Requires Python 3.9+.
18
+
19
+ ## Quickstart
20
+
21
+ ```python
22
+ from getyoutubetranscript import Client
23
+
24
+ client = Client(api_key="sk_live_...")
25
+
26
+ transcript = client.get_transcript("https://www.youtube.com/watch?v=jNQXAC9IVRw")
27
+ print(transcript["title"], transcript["word_count"])
28
+ print(transcript["transcript"])
29
+ ```
30
+
31
+ ## Getting an API key
32
+
33
+ Every request needs an API key. There are two ways to get one:
34
+
35
+ 1. **Dashboard** - sign up at [getyoutubetranscript.com](https://getyoutubetranscript.com). Free tier: 100 credits, no card required.
36
+ 2. **Self-serve, in code** - use the `signup`/`verify_signup` helpers below. No key required for either call.
37
+
38
+ ```python
39
+ from getyoutubetranscript import signup, verify_signup
40
+
41
+ signup("you@example.com") # sends a 6-digit code, valid 10 minutes
42
+ # ... read the code from your inbox ...
43
+ api_key = verify_signup("you@example.com", "123456") # -> "sk_live_..."
44
+ ```
45
+
46
+ The raw key is returned once by `verify_signup` and can't be retrieved again - store it yourself (env var, secret manager, etc).
47
+
48
+ ## Usage
49
+
50
+ Every method costs 1 credit unless noted "free" below. Failed and rate-limited requests are never charged. All methods raise `GetYouTubeTranscriptError` on failure - see [Error handling](#error-handling).
51
+
52
+ ### Transcripts
53
+
54
+ ```python
55
+ client.get_transcript("jNQXAC9IVRw", language="en")
56
+ ```
57
+
58
+ Pass `timestamps=True` to also get one entry per caption line in `segments` (same 1 credit). Without it, the response has no `segments` key.
59
+
60
+ ```python
61
+ result = client.get_transcript("5e37ZT3SQbk", timestamps=True)
62
+ print(result["segments"][0])
63
+ # {"start": 3.96, "duration": 4.56, "text": "So, Reed, education, which a lot of"}
64
+ ```
65
+
66
+ Each segment is `{"start", "duration", "text"}` with `start` and `duration` in seconds. The `Segment` and `TranscriptData` typed dicts are importable from `getyoutubetranscript`.
67
+
68
+ ### Search
69
+
70
+ ```python
71
+ client.search("lofi beats", type="video", limit=10)
72
+
73
+ # Pagination
74
+ page2 = client.search(page_token=first_page["pagination"]["next_page_token"])
75
+ ```
76
+
77
+ ### Channels
78
+
79
+ ```python
80
+ client.resolve_channel("@mkbhd") # free - handle/URL -> channel ID
81
+ client.get_channel_latest("@mkbhd") # free - metadata + latest uploads
82
+ client.search_channel("@mkbhd", "iphone") # search within a channel
83
+ client.list_channel_videos("@mkbhd") # full paginated upload history
84
+
85
+ # Pagination (search_channel and list_channel_videos both work the same way)
86
+ page = client.list_channel_videos("@mkbhd")
87
+ while page["has_more"]:
88
+ page = client.list_channel_videos(continuation=page["continuation_token"])
89
+ ```
90
+
91
+ ### Playlists
92
+
93
+ ```python
94
+ page = client.get_playlist("PLillGF-RfqbYE6Ik_EuXA2iZFcE082B3s")
95
+ while page["has_more"]:
96
+ page = client.get_playlist(continuation=page["continuation_token"])
97
+ ```
98
+
99
+ ### Account
100
+
101
+ ```python
102
+ client.get_credits() # free - plan_credits_left, topup_credits_left, plan, rate_limit_per_minute
103
+ ```
104
+
105
+ ## Error handling
106
+
107
+ Every non-2xx or `{"success": false}` response raises `GetYouTubeTranscriptError` with the API's parsed error shape:
108
+
109
+ ```python
110
+ from getyoutubetranscript import Client, GetYouTubeTranscriptError
111
+
112
+ client = Client(api_key="sk_live_...")
113
+
114
+ try:
115
+ client.get_transcript("no-captions-here")
116
+ except GetYouTubeTranscriptError as e:
117
+ print(e.code) # e.g. "NOT_FOUND"
118
+ print(e.message) # human-readable message from the API
119
+ print(e.status_code) # 400 / 401 / 402 / 404 / 429 / 503, or 0 for a local network failure
120
+ print(e.response_body) # full parsed error body, e.g. {"creditsLeft": 0} on PAYMENT_REQUIRED
121
+ ```
122
+
123
+ ## Development
124
+
125
+ ```bash
126
+ pip install -e ".[dev]"
127
+
128
+ # Unit tests - mocked HTTP, no network or API key needed, always safe to run
129
+ pytest tests -v --ignore=tests/live
130
+
131
+ # Live integration tests - hits the real API, spends credits, needs a key
132
+ GYT_API_KEY=sk_live_... pytest tests/live -v
133
+ ```
134
+
135
+ ## Links
136
+
137
+ - [Full API docs](https://getyoutubetranscript.com/docs)
138
+ - [OpenAPI spec](https://getyoutubetranscript.com/openapi.json)
139
+ - [MCP server](https://getyoutubetranscript.com/youtube-mcp-server) - if you want an AI agent to call this API directly instead of via Python
140
+
141
+ ## Related projects
142
+
143
+ Other ways to use the [GetYouTubeTranscript API](https://getyoutubetranscript.com):
144
+
145
+ - [youtube-transcript-api](https://github.com/tubeagentkit/youtube-transcript-api): YouTube Transcript API docs, endpoint reference, OpenAPI spec and examples in curl, Python, JavaScript, Go and PHP
146
+ - [youtube-transcript-api-node](https://github.com/tubeagentkit/youtube-transcript-api-node): YouTube Transcript API SDK for Node.js / TypeScript
147
+ - [youtube-mcp](https://github.com/tubeagentkit/youtube-mcp): Remote YouTube MCP server for Claude, ChatGPT, Cursor and VS Code
148
+ - [youtube-transcript-skills](https://github.com/tubeagentkit/youtube-transcript-skills): YouTube transcript Agent Skill for Claude Code, Cursor, Codex and OpenClaw
149
+ - [youtube-transcript-cursor-plugin](https://github.com/tubeagentkit/youtube-transcript-cursor-plugin): YouTube Transcript Cursor plugin bundling the MCP server, skills, commands and a research agent
150
+ - [n8n-nodes-getyoutubetranscript](https://github.com/tubeagentkit/n8n-nodes-getyoutubetranscript): YouTube transcript n8n community node, also usable as an AI Agent tool
151
+
152
+ ## License
153
+
154
+ MIT - see [LICENSE](./LICENSE).
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "getyoutubetranscript"
7
+ version = "0.2.0"
8
+ description = "Python SDK for the GetYouTubeTranscript REST API - transcripts, search, channels, and playlists"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "tubeagentkit" }]
13
+ keywords = ["youtube", "transcript", "youtube-api", "api-client", "sdk"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: Internet :: WWW/HTTP",
26
+ "Topic :: Software Development :: Libraries :: Python Modules",
27
+ "Typing :: Typed",
28
+ ]
29
+ dependencies = [
30
+ "requests>=2.28",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ dev = [
35
+ "pytest>=7.0",
36
+ "responses>=0.23",
37
+ ]
38
+
39
+ [project.urls]
40
+ Homepage = "https://getyoutubetranscript.com"
41
+ Documentation = "https://getyoutubetranscript.com/docs"
42
+ Repository = "https://github.com/tubeagentkit/youtube-transcript-api-python"
43
+ "Bug Tracker" = "https://github.com/tubeagentkit/youtube-transcript-api-python/issues"
44
+
45
+ [tool.hatch.build.targets.wheel]
46
+ packages = ["src/getyoutubetranscript"]
47
+
48
+ [tool.pytest.ini_options]
49
+ testpaths = ["tests"]
@@ -0,0 +1,25 @@
1
+ """Python SDK for the GetYouTubeTranscript REST API.
2
+
3
+ from getyoutubetranscript import Client
4
+
5
+ client = Client(api_key="sk_live_...")
6
+ transcript = client.get_transcript("https://www.youtube.com/watch?v=jNQXAC9IVRw")
7
+
8
+ See https://getyoutubetranscript.com/docs for the full API reference.
9
+ """
10
+
11
+ from .client import Client, signup, verify_signup
12
+ from .exceptions import GetYouTubeTranscriptError
13
+ from .types import Segment, TranscriptData
14
+
15
+ __version__ = "0.2.0"
16
+
17
+ __all__ = [
18
+ "Client",
19
+ "GetYouTubeTranscriptError",
20
+ "Segment",
21
+ "TranscriptData",
22
+ "signup",
23
+ "verify_signup",
24
+ "__version__",
25
+ ]