koztv-blog-tools 1.3.0 → 1.3.1
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/dist/node.d.mts +2 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.js +8 -0
- package/dist/node.mjs +8 -0
- package/package.json +1 -1
package/dist/node.d.mts
CHANGED
|
@@ -25,6 +25,8 @@ interface TelegramExportOptions {
|
|
|
25
25
|
until?: Date;
|
|
26
26
|
/** Download media files */
|
|
27
27
|
downloadMedia?: boolean;
|
|
28
|
+
/** Skip posts that already have markdown files */
|
|
29
|
+
skipExisting?: boolean;
|
|
28
30
|
/** Number of concurrent media downloads */
|
|
29
31
|
mediaWorkers?: number;
|
|
30
32
|
/** Callback for progress updates */
|
package/dist/node.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ interface TelegramExportOptions {
|
|
|
25
25
|
until?: Date;
|
|
26
26
|
/** Download media files */
|
|
27
27
|
downloadMedia?: boolean;
|
|
28
|
+
/** Skip posts that already have markdown files */
|
|
29
|
+
skipExisting?: boolean;
|
|
28
30
|
/** Number of concurrent media downloads */
|
|
29
31
|
mediaWorkers?: number;
|
|
30
32
|
/** Callback for progress updates */
|
package/dist/node.js
CHANGED
|
@@ -514,6 +514,7 @@ async function exportTelegramChannel(options) {
|
|
|
514
514
|
since,
|
|
515
515
|
until,
|
|
516
516
|
downloadMedia = true,
|
|
517
|
+
skipExisting = false,
|
|
517
518
|
mediaWorkers = 3,
|
|
518
519
|
onProgress,
|
|
519
520
|
onPhoneNumber = () => defaultReadline("Phone number: "),
|
|
@@ -611,7 +612,14 @@ async function exportTelegramChannel(options) {
|
|
|
611
612
|
}
|
|
612
613
|
const msgId = message.id;
|
|
613
614
|
const paddedId = String(msgId).padStart(6, "0");
|
|
615
|
+
const postPath = path.join(postsDir, `${paddedId}.md`);
|
|
614
616
|
const postMediaDir = path.join(mediaDir, paddedId);
|
|
617
|
+
if (skipExisting && fs.existsSync(postPath)) {
|
|
618
|
+
if (onProgress) {
|
|
619
|
+
onProgress(processedCount, totalMessages, `Skipping ${paddedId} (exists)`);
|
|
620
|
+
}
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
615
623
|
const mediaFiles = [];
|
|
616
624
|
if (downloadMedia && message.media) {
|
|
617
625
|
const existingFiles = fs.existsSync(postMediaDir) ? fs.readdirSync(postMediaDir).filter((f) => f.startsWith("media.")) : [];
|
package/dist/node.mjs
CHANGED
|
@@ -164,6 +164,7 @@ async function exportTelegramChannel(options) {
|
|
|
164
164
|
since,
|
|
165
165
|
until,
|
|
166
166
|
downloadMedia = true,
|
|
167
|
+
skipExisting = false,
|
|
167
168
|
mediaWorkers = 3,
|
|
168
169
|
onProgress,
|
|
169
170
|
onPhoneNumber = () => defaultReadline("Phone number: "),
|
|
@@ -261,7 +262,14 @@ async function exportTelegramChannel(options) {
|
|
|
261
262
|
}
|
|
262
263
|
const msgId = message.id;
|
|
263
264
|
const paddedId = String(msgId).padStart(6, "0");
|
|
265
|
+
const postPath = path.join(postsDir, `${paddedId}.md`);
|
|
264
266
|
const postMediaDir = path.join(mediaDir, paddedId);
|
|
267
|
+
if (skipExisting && fs.existsSync(postPath)) {
|
|
268
|
+
if (onProgress) {
|
|
269
|
+
onProgress(processedCount, totalMessages, `Skipping ${paddedId} (exists)`);
|
|
270
|
+
}
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
265
273
|
const mediaFiles = [];
|
|
266
274
|
if (downloadMedia && message.media) {
|
|
267
275
|
const existingFiles = fs.existsSync(postMediaDir) ? fs.readdirSync(postMediaDir).filter((f) => f.startsWith("media.")) : [];
|