koztv-blog-tools 1.2.13 → 1.2.15
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 +5 -7
- 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 (
|
|
48
|
-
--
|
|
49
|
-
--no-translate Skip translation
|
|
47
|
+
--langs en,de Target languages (required for translation)
|
|
48
|
+
--no-original Don't keep original language version
|
|
50
49
|
--help, -h Show this help
|
|
51
50
|
|
|
52
51
|
Environment variables:
|
|
@@ -69,8 +68,7 @@ const LOG_FILE = getArg('log-file') || './.processed-posts.json';
|
|
|
69
68
|
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
|
-
const KEEP_ORIGINAL = hasFlag('
|
|
73
|
-
const NO_TRANSLATE = hasFlag('no-translate');
|
|
71
|
+
const KEEP_ORIGINAL = !hasFlag('no-original') && process.env.KEEP_ORIGINAL !== 'false';
|
|
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,
|