clearcaption 0.1.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,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ClearCaption
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,74 @@
1
+ Metadata-Version: 2.4
2
+ Name: clearcaption
3
+ Version: 0.1.0
4
+ Summary: YouTube transcripts that work from cloud servers (AWS, GCP, Colab): drop-in fallback for youtube-transcript-api, with timestamped translation.
5
+ Author-email: ClearCaption <21karrat@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://apify.com/clearcaption/youtube-transcript-translate
8
+ Project-URL: Repository, https://github.com/Andrii2203/clearcaption-youtube-transcript
9
+ Keywords: youtube,transcript,subtitles,captions,youtube-transcript-api,srt,vtt,translation,apify
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: Multimedia :: Video
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: requests>=2.20
17
+ Dynamic: license-file
18
+
19
+ # ClearCaption: YouTube transcripts that work from the cloud
20
+
21
+ `youtube-transcript-api` works on your laptop, then fails on AWS, GCP, Colab, Vercel or Render with
22
+ `RequestBlocked`, `IpBlocked`, `TranscriptsDisabled` (when captions clearly exist) or `429 Too Many Requests`.
23
+ YouTube blocks cloud IP ranges, and translated captions (`transcript.translate('de')`) return 429 from almost any IP.
24
+
25
+ ClearCaption is a drop-in fallback: the same output (`[{"text", "start", "duration"}]`), but the request runs on
26
+ Apify's rotating proxies, so it works from any server. It can also translate: it fetches the original track and translates it.
27
+
28
+ **Free:** ~1,000 videos/month with a free Apify account ($5 monthly credit, no credit card).
29
+
30
+ ```bash
31
+ pip install clearcaption
32
+ export APIFY_TOKEN=your_token # free account: https://console.apify.com/sign-up
33
+ ```
34
+
35
+ ```python
36
+ from clearcaption import fetch, fetch_many
37
+
38
+ fetch("dQw4w9WgXcQ") # [{'text': ..., 'start': 18.64, 'duration': 3.24}, ...]
39
+ fetch("dQw4w9WgXcQ", translate_to="de") # translated
40
+ fetch_many(["https://youtu.be/dQw4w9WgXcQ", "https://www.youtube.com/@channel"]) # videos, channels, playlists
41
+ ```
42
+
43
+ ### Keep youtube-transcript-api and fall back only when blocked
44
+
45
+ ```python
46
+ from youtube_transcript_api import YouTubeTranscriptApi
47
+ from youtube_transcript_api._errors import RequestBlocked, IpBlocked
48
+ from clearcaption import fetch
49
+
50
+ def transcript(video_id):
51
+ try:
52
+ return YouTubeTranscriptApi().fetch(video_id).to_raw_data()
53
+ except (RequestBlocked, IpBlocked):
54
+ return fetch(video_id)
55
+ ```
56
+
57
+ ### Other ways to call it
58
+ - **REST / any language:** `POST https://api.apify.com/v2/acts/clearcaption~youtube-transcript-translate/run-sync-get-dataset-items?token=...` with `{"videos": ["dQw4w9WgXcQ"]}`.
59
+ - **AI agents (Claude, Cursor, n8n) via MCP:** add `https://mcp.apify.com?tools=clearcaption/youtube-transcript-translate` as an MCP server (header `Authorization: Bearer <APIFY_TOKEN>`, or sign in to Apify on first connection).
60
+ - **No code:** [Apify Store page](https://apify.com/clearcaption/youtube-transcript-translate): paste URLs, download JSON / CSV / SRT / VTT.
61
+
62
+ ### Price
63
+ $0.005 per video with captions. Videos without captions cost $0. Translation costs $0.005 per started 10 minutes of video, and is free when YouTube already has a track in that language.
64
+ Pay per use on Apify, no subscription. The free Apify plan includes monthly credit.
65
+
66
+ ### Compared with
67
+ | | youtube-transcript-api + residential proxy | Hosted subscription APIs | ClearCaption |
68
+ |---|---|---|---|
69
+ | Works from cloud | yes, if you run proxy rotation | yes | yes |
70
+ | Translated captions | 429 on `tlang` | varies | yes |
71
+ | Channels / playlists / search | no | some | yes |
72
+ | Billing | proxy plan | monthly plan | per video, $0 without captions |
73
+
74
+ MIT license. Issues and PRs welcome.
@@ -0,0 +1,56 @@
1
+ # ClearCaption: YouTube transcripts that work from the cloud
2
+
3
+ `youtube-transcript-api` works on your laptop, then fails on AWS, GCP, Colab, Vercel or Render with
4
+ `RequestBlocked`, `IpBlocked`, `TranscriptsDisabled` (when captions clearly exist) or `429 Too Many Requests`.
5
+ YouTube blocks cloud IP ranges, and translated captions (`transcript.translate('de')`) return 429 from almost any IP.
6
+
7
+ ClearCaption is a drop-in fallback: the same output (`[{"text", "start", "duration"}]`), but the request runs on
8
+ Apify's rotating proxies, so it works from any server. It can also translate: it fetches the original track and translates it.
9
+
10
+ **Free:** ~1,000 videos/month with a free Apify account ($5 monthly credit, no credit card).
11
+
12
+ ```bash
13
+ pip install clearcaption
14
+ export APIFY_TOKEN=your_token # free account: https://console.apify.com/sign-up
15
+ ```
16
+
17
+ ```python
18
+ from clearcaption import fetch, fetch_many
19
+
20
+ fetch("dQw4w9WgXcQ") # [{'text': ..., 'start': 18.64, 'duration': 3.24}, ...]
21
+ fetch("dQw4w9WgXcQ", translate_to="de") # translated
22
+ fetch_many(["https://youtu.be/dQw4w9WgXcQ", "https://www.youtube.com/@channel"]) # videos, channels, playlists
23
+ ```
24
+
25
+ ### Keep youtube-transcript-api and fall back only when blocked
26
+
27
+ ```python
28
+ from youtube_transcript_api import YouTubeTranscriptApi
29
+ from youtube_transcript_api._errors import RequestBlocked, IpBlocked
30
+ from clearcaption import fetch
31
+
32
+ def transcript(video_id):
33
+ try:
34
+ return YouTubeTranscriptApi().fetch(video_id).to_raw_data()
35
+ except (RequestBlocked, IpBlocked):
36
+ return fetch(video_id)
37
+ ```
38
+
39
+ ### Other ways to call it
40
+ - **REST / any language:** `POST https://api.apify.com/v2/acts/clearcaption~youtube-transcript-translate/run-sync-get-dataset-items?token=...` with `{"videos": ["dQw4w9WgXcQ"]}`.
41
+ - **AI agents (Claude, Cursor, n8n) via MCP:** add `https://mcp.apify.com?tools=clearcaption/youtube-transcript-translate` as an MCP server (header `Authorization: Bearer <APIFY_TOKEN>`, or sign in to Apify on first connection).
42
+ - **No code:** [Apify Store page](https://apify.com/clearcaption/youtube-transcript-translate): paste URLs, download JSON / CSV / SRT / VTT.
43
+
44
+ ### Price
45
+ $0.005 per video with captions. Videos without captions cost $0. Translation costs $0.005 per started 10 minutes of video, and is free when YouTube already has a track in that language.
46
+ Pay per use on Apify, no subscription. The free Apify plan includes monthly credit.
47
+
48
+ ### Compared with
49
+ | | youtube-transcript-api + residential proxy | Hosted subscription APIs | ClearCaption |
50
+ |---|---|---|---|
51
+ | Works from cloud | yes, if you run proxy rotation | yes | yes |
52
+ | Translated captions | 429 on `tlang` | varies | yes |
53
+ | Channels / playlists / search | no | some | yes |
54
+ | Billing | proxy plan | monthly plan | per video, $0 without captions |
55
+
56
+ MIT license. Issues and PRs welcome.
@@ -0,0 +1,74 @@
1
+ Metadata-Version: 2.4
2
+ Name: clearcaption
3
+ Version: 0.1.0
4
+ Summary: YouTube transcripts that work from cloud servers (AWS, GCP, Colab): drop-in fallback for youtube-transcript-api, with timestamped translation.
5
+ Author-email: ClearCaption <21karrat@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://apify.com/clearcaption/youtube-transcript-translate
8
+ Project-URL: Repository, https://github.com/Andrii2203/clearcaption-youtube-transcript
9
+ Keywords: youtube,transcript,subtitles,captions,youtube-transcript-api,srt,vtt,translation,apify
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: Multimedia :: Video
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: requests>=2.20
17
+ Dynamic: license-file
18
+
19
+ # ClearCaption: YouTube transcripts that work from the cloud
20
+
21
+ `youtube-transcript-api` works on your laptop, then fails on AWS, GCP, Colab, Vercel or Render with
22
+ `RequestBlocked`, `IpBlocked`, `TranscriptsDisabled` (when captions clearly exist) or `429 Too Many Requests`.
23
+ YouTube blocks cloud IP ranges, and translated captions (`transcript.translate('de')`) return 429 from almost any IP.
24
+
25
+ ClearCaption is a drop-in fallback: the same output (`[{"text", "start", "duration"}]`), but the request runs on
26
+ Apify's rotating proxies, so it works from any server. It can also translate: it fetches the original track and translates it.
27
+
28
+ **Free:** ~1,000 videos/month with a free Apify account ($5 monthly credit, no credit card).
29
+
30
+ ```bash
31
+ pip install clearcaption
32
+ export APIFY_TOKEN=your_token # free account: https://console.apify.com/sign-up
33
+ ```
34
+
35
+ ```python
36
+ from clearcaption import fetch, fetch_many
37
+
38
+ fetch("dQw4w9WgXcQ") # [{'text': ..., 'start': 18.64, 'duration': 3.24}, ...]
39
+ fetch("dQw4w9WgXcQ", translate_to="de") # translated
40
+ fetch_many(["https://youtu.be/dQw4w9WgXcQ", "https://www.youtube.com/@channel"]) # videos, channels, playlists
41
+ ```
42
+
43
+ ### Keep youtube-transcript-api and fall back only when blocked
44
+
45
+ ```python
46
+ from youtube_transcript_api import YouTubeTranscriptApi
47
+ from youtube_transcript_api._errors import RequestBlocked, IpBlocked
48
+ from clearcaption import fetch
49
+
50
+ def transcript(video_id):
51
+ try:
52
+ return YouTubeTranscriptApi().fetch(video_id).to_raw_data()
53
+ except (RequestBlocked, IpBlocked):
54
+ return fetch(video_id)
55
+ ```
56
+
57
+ ### Other ways to call it
58
+ - **REST / any language:** `POST https://api.apify.com/v2/acts/clearcaption~youtube-transcript-translate/run-sync-get-dataset-items?token=...` with `{"videos": ["dQw4w9WgXcQ"]}`.
59
+ - **AI agents (Claude, Cursor, n8n) via MCP:** add `https://mcp.apify.com?tools=clearcaption/youtube-transcript-translate` as an MCP server (header `Authorization: Bearer <APIFY_TOKEN>`, or sign in to Apify on first connection).
60
+ - **No code:** [Apify Store page](https://apify.com/clearcaption/youtube-transcript-translate): paste URLs, download JSON / CSV / SRT / VTT.
61
+
62
+ ### Price
63
+ $0.005 per video with captions. Videos without captions cost $0. Translation costs $0.005 per started 10 minutes of video, and is free when YouTube already has a track in that language.
64
+ Pay per use on Apify, no subscription. The free Apify plan includes monthly credit.
65
+
66
+ ### Compared with
67
+ | | youtube-transcript-api + residential proxy | Hosted subscription APIs | ClearCaption |
68
+ |---|---|---|---|
69
+ | Works from cloud | yes, if you run proxy rotation | yes | yes |
70
+ | Translated captions | 429 on `tlang` | varies | yes |
71
+ | Channels / playlists / search | no | some | yes |
72
+ | Billing | proxy plan | monthly plan | per video, $0 without captions |
73
+
74
+ MIT license. Issues and PRs welcome.
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ clearcaption.py
4
+ pyproject.toml
5
+ clearcaption.egg-info/PKG-INFO
6
+ clearcaption.egg-info/SOURCES.txt
7
+ clearcaption.egg-info/dependency_links.txt
8
+ clearcaption.egg-info/requires.txt
9
+ clearcaption.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests>=2.20
@@ -0,0 +1 @@
1
+ clearcaption
@@ -0,0 +1,59 @@
1
+ """ClearCaption: hosted fallback for youtube-transcript-api when YouTube blocks your cloud IP.
2
+
3
+ Same output shape as youtube-transcript-api (list of {"text", "start", "duration"}),
4
+ but the request runs on Apify with rotating proxies, so AWS / GCP / Colab / Vercel work.
5
+ Translation works too (original track + LLM translation), which tlang= in the library cannot do (issue #572).
6
+
7
+ pip install requests
8
+ export APIFY_TOKEN=... # free account: https://console.apify.com/sign-up
9
+ from clearcaption import fetch
10
+ fetch("dQw4w9WgXcQ") # original language
11
+ fetch("dQw4w9WgXcQ", translate_to="de") # translated, with timestamps
12
+
13
+ Pricing: $0.005 per video with captions, $0 for videos without captions; translation $0.005 per started 10 min
14
+ (free when YouTube already has a track in that language). Billed by Apify per event, no subscription.
15
+ """
16
+ import os
17
+
18
+ import requests
19
+
20
+ ACTOR = os.environ.get("YTT_CLOUD_ACTOR", "clearcaption~youtube-transcript-translate")
21
+ API = "https://api.apify.com/v2/acts/{actor}/run-sync-get-dataset-items"
22
+
23
+
24
+ class TranscriptError(Exception):
25
+ """The video has no captions, is private, or the input was not a YouTube video."""
26
+
27
+
28
+ def _segments(segs):
29
+ return [{"text": s["text"], "start": s["start"], "duration": s["dur"]} for s in segs or []]
30
+
31
+
32
+ def fetch_many(videos, translate_to=None, token=None, timeout=300):
33
+ """videos: ids or URLs (also channel / playlist URLs) -> {video_id: [segments]} or TranscriptError per video"""
34
+ token = token or os.environ["APIFY_TOKEN"]
35
+ body = {"videos": list(videos), "outputFormats": ["segments"], "includeTimestamps": True}
36
+ if translate_to:
37
+ body["targetLanguage"] = translate_to
38
+ r = requests.post(API.format(actor=ACTOR), params={"token": token}, json=body, timeout=timeout)
39
+ r.raise_for_status()
40
+ out = {}
41
+ for item in r.json():
42
+ vid = item.get("videoId") or item.get("input")
43
+ if item.get("status") != "OK":
44
+ out[vid] = TranscriptError(item.get("status"))
45
+ continue
46
+ tr = item.get("translation") or {}
47
+ out[vid] = _segments(tr.get("segments") if translate_to and tr.get("segments") else item.get("segments"))
48
+ return out
49
+
50
+
51
+ def fetch(video, translate_to=None, token=None):
52
+ """one video -> [{"text", "start", "duration"}], like YouTubeTranscriptApi().fetch(video).to_raw_data()"""
53
+ res = fetch_many([video], translate_to, token)
54
+ if not res:
55
+ raise TranscriptError("no result")
56
+ seg = next(iter(res.values()))
57
+ if isinstance(seg, Exception):
58
+ raise seg
59
+ return seg
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "clearcaption"
7
+ version = "0.1.0"
8
+ description = "YouTube transcripts that work from cloud servers (AWS, GCP, Colab): drop-in fallback for youtube-transcript-api, with timestamped translation."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = "MIT"
12
+ authors = [{ name = "ClearCaption", email = "21karrat@gmail.com" }]
13
+ dependencies = ["requests>=2.20"]
14
+ keywords = ["youtube", "transcript", "subtitles", "captions", "youtube-transcript-api", "srt", "vtt", "translation", "apify"]
15
+ classifiers = ["Programming Language :: Python :: 3", "Operating System :: OS Independent", "Topic :: Multimedia :: Video"]
16
+
17
+ [project.urls]
18
+ Homepage = "https://apify.com/clearcaption/youtube-transcript-translate"
19
+ Repository = "https://github.com/Andrii2203/clearcaption-youtube-transcript"
20
+
21
+ [tool.setuptools]
22
+ py-modules = ["clearcaption"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+