clearcaption 0.1.0__tar.gz → 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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clearcaption
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: YouTube transcripts that work from cloud servers (AWS, GCP, Colab): drop-in fallback for youtube-transcript-api, with timestamped translation.
5
5
  Author-email: ClearCaption <21karrat@gmail.com>
6
6
  License-Expression: MIT
@@ -72,3 +72,15 @@ Pay per use on Apify, no subscription. The free Apify plan includes monthly cred
72
72
  | Billing | proxy plan | monthly plan | per video, $0 without captions |
73
73
 
74
74
  MIT license. Issues and PRs welcome.
75
+
76
+ ## Command line
77
+
78
+ ```bash
79
+ clearcaption dQw4w9WgXcQ # plain text
80
+ clearcaption dQw4w9WgXcQ --to de --srt # German SRT, timestamps kept
81
+ clearcaption https://www.youtube.com/@freecodecamp --json
82
+ ```
83
+
84
+ ## Other ways to use it
85
+ - **JavaScript / TypeScript:** `npm i clearcaption` ([clearcaption-js](https://github.com/Andrii2203/clearcaption-js))
86
+ - **n8n:** community node `n8n-nodes-clearcaption` ([repo](https://github.com/Andrii2203/n8n-nodes-clearcaption))
@@ -54,3 +54,15 @@ Pay per use on Apify, no subscription. The free Apify plan includes monthly cred
54
54
  | Billing | proxy plan | monthly plan | per video, $0 without captions |
55
55
 
56
56
  MIT license. Issues and PRs welcome.
57
+
58
+ ## Command line
59
+
60
+ ```bash
61
+ clearcaption dQw4w9WgXcQ # plain text
62
+ clearcaption dQw4w9WgXcQ --to de --srt # German SRT, timestamps kept
63
+ clearcaption https://www.youtube.com/@freecodecamp --json
64
+ ```
65
+
66
+ ## Other ways to use it
67
+ - **JavaScript / TypeScript:** `npm i clearcaption` ([clearcaption-js](https://github.com/Andrii2203/clearcaption-js))
68
+ - **n8n:** community node `n8n-nodes-clearcaption` ([repo](https://github.com/Andrii2203/n8n-nodes-clearcaption))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clearcaption
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: YouTube transcripts that work from cloud servers (AWS, GCP, Colab): drop-in fallback for youtube-transcript-api, with timestamped translation.
5
5
  Author-email: ClearCaption <21karrat@gmail.com>
6
6
  License-Expression: MIT
@@ -72,3 +72,15 @@ Pay per use on Apify, no subscription. The free Apify plan includes monthly cred
72
72
  | Billing | proxy plan | monthly plan | per video, $0 without captions |
73
73
 
74
74
  MIT license. Issues and PRs welcome.
75
+
76
+ ## Command line
77
+
78
+ ```bash
79
+ clearcaption dQw4w9WgXcQ # plain text
80
+ clearcaption dQw4w9WgXcQ --to de --srt # German SRT, timestamps kept
81
+ clearcaption https://www.youtube.com/@freecodecamp --json
82
+ ```
83
+
84
+ ## Other ways to use it
85
+ - **JavaScript / TypeScript:** `npm i clearcaption` ([clearcaption-js](https://github.com/Andrii2203/clearcaption-js))
86
+ - **n8n:** community node `n8n-nodes-clearcaption` ([repo](https://github.com/Andrii2203/n8n-nodes-clearcaption))
@@ -5,5 +5,6 @@ pyproject.toml
5
5
  clearcaption.egg-info/PKG-INFO
6
6
  clearcaption.egg-info/SOURCES.txt
7
7
  clearcaption.egg-info/dependency_links.txt
8
+ clearcaption.egg-info/entry_points.txt
8
9
  clearcaption.egg-info/requires.txt
9
10
  clearcaption.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ clearcaption = clearcaption:main
@@ -57,3 +57,31 @@ def fetch(video, translate_to=None, token=None):
57
57
  if isinstance(seg, Exception):
58
58
  raise seg
59
59
  return seg
60
+
61
+
62
+ def main(argv=None):
63
+ """CLI: clearcaption VIDEO [VIDEO ...] [--to de] [--srt] (needs APIFY_TOKEN)"""
64
+ import argparse, json, sys
65
+ ap = argparse.ArgumentParser(prog="clearcaption", description="YouTube transcripts from any server (videos, channels, playlists).")
66
+ ap.add_argument("videos", nargs="+", help="video / channel / playlist URLs or video IDs")
67
+ ap.add_argument("--to", dest="translate_to", help="translate to language code (de, es, uk...), timestamps kept")
68
+ ap.add_argument("--srt", action="store_true", help="print SRT instead of plain text")
69
+ ap.add_argument("--json", action="store_true", help="print raw segments as JSON")
70
+ a = ap.parse_args(argv)
71
+ res = fetch_many(a.videos, a.translate_to)
72
+ for vid, seg in res.items():
73
+ if isinstance(seg, Exception):
74
+ print(f"# {vid}: {seg}", file=sys.stderr)
75
+ continue
76
+ if a.json:
77
+ print(json.dumps({vid: seg}, ensure_ascii=False))
78
+ elif a.srt:
79
+ ts = lambda s: "%02d:%02d:%02d,%03d" % (s // 3600, s % 3600 // 60, s % 60, round(s % 1 * 1000) % 1000)
80
+ for i, s in enumerate(seg, 1):
81
+ print(f"{i}\n{ts(s['start'])} --> {ts(s['start'] + s['duration'])}\n{s['text']}\n")
82
+ else:
83
+ print(f"# {vid}\n" + " ".join(s["text"] for s in seg) + "\n")
84
+
85
+
86
+ if __name__ == "__main__":
87
+ main()
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "clearcaption"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "YouTube transcripts that work from cloud servers (AWS, GCP, Colab): drop-in fallback for youtube-transcript-api, with timestamped translation."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -14,6 +14,9 @@ dependencies = ["requests>=2.20"]
14
14
  keywords = ["youtube", "transcript", "subtitles", "captions", "youtube-transcript-api", "srt", "vtt", "translation", "apify"]
15
15
  classifiers = ["Programming Language :: Python :: 3", "Operating System :: OS Independent", "Topic :: Multimedia :: Video"]
16
16
 
17
+ [project.scripts]
18
+ clearcaption = "clearcaption:main"
19
+
17
20
  [project.urls]
18
21
  Homepage = "https://apify.com/clearcaption/youtube-transcript-translate"
19
22
  Repository = "https://github.com/Andrii2203/clearcaption-youtube-transcript"
File without changes
File without changes