koztv-blog-tools 1.2.13 → 1.2.14
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.
- package/bin/export-telegram.js +3 -5
- package/package.json +1 -1
package/bin/export-telegram.js
CHANGED
|
@@ -44,9 +44,8 @@ Options:
|
|
|
44
44
|
--session-file ./path Session file location (default: ./.telegram-session)
|
|
45
45
|
--log-file ./path Processed posts log (default: ./.processed-posts.json)
|
|
46
46
|
--limit N Max posts to export
|
|
47
|
-
--langs en,de Target languages (
|
|
47
|
+
--langs en,de Target languages (required for translation)
|
|
48
48
|
--keep-original Keep original language version
|
|
49
|
-
--no-translate Skip translation
|
|
50
49
|
--help, -h Show this help
|
|
51
50
|
|
|
52
51
|
Environment variables:
|
|
@@ -70,7 +69,6 @@ const LIMIT = parseInt(getArg('limit') || '0', 10);
|
|
|
70
69
|
const TARGET_LANGS_RAW = getArg('langs') || process.env.TARGET_LANGS || '';
|
|
71
70
|
const TARGET_LANGS = TARGET_LANGS_RAW ? TARGET_LANGS_RAW.split(',').map(s => s.trim()) : [];
|
|
72
71
|
const KEEP_ORIGINAL = hasFlag('keep-original') || process.env.KEEP_ORIGINAL === 'true';
|
|
73
|
-
const NO_TRANSLATE = hasFlag('no-translate');
|
|
74
72
|
|
|
75
73
|
// Credentials
|
|
76
74
|
const API_ID = parseInt(process.env.TELEGRAM_API_ID || '0', 10);
|
|
@@ -118,7 +116,7 @@ async function main() {
|
|
|
118
116
|
console.log(`Output: ${OUTPUT_DIR}`);
|
|
119
117
|
console.log(`Media: ${MEDIA_DIR}`);
|
|
120
118
|
if (LIMIT) console.log(`Limit: ${LIMIT}`);
|
|
121
|
-
if (
|
|
119
|
+
if (TARGET_LANGS.length > 0 && LLM_API_KEY) {
|
|
122
120
|
console.log(`Translate to: ${TARGET_LANGS.join(', ')}`);
|
|
123
121
|
console.log(`Keep original: ${KEEP_ORIGINAL}`);
|
|
124
122
|
} else {
|
|
@@ -139,7 +137,7 @@ async function main() {
|
|
|
139
137
|
limit: LIMIT || undefined,
|
|
140
138
|
downloadMedia: true,
|
|
141
139
|
|
|
142
|
-
translate: (
|
|
140
|
+
translate: (TARGET_LANGS.length > 0 && LLM_API_KEY) ? {
|
|
143
141
|
apiKey: LLM_API_KEY,
|
|
144
142
|
apiUrl: LLM_API_URL,
|
|
145
143
|
model: LLM_MODEL,
|