koztv-blog-tools 1.2.18 → 1.2.19

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/index.d.mts CHANGED
@@ -155,8 +155,10 @@ interface TelegramExportOptions {
155
155
  session?: string;
156
156
  /** Target channel username, link or ID */
157
157
  target: string;
158
- /** Output directory for exported data */
158
+ /** Output directory for exported data (posts go to outputDir/posts) */
159
159
  outputDir: string;
160
+ /** Media output directory (default: outputDir/media) */
161
+ mediaDir?: string;
160
162
  /** Maximum number of posts to export (0 = all) */
161
163
  limit?: number;
162
164
  /** Only export posts since this date */
package/dist/index.d.ts CHANGED
@@ -155,8 +155,10 @@ interface TelegramExportOptions {
155
155
  session?: string;
156
156
  /** Target channel username, link or ID */
157
157
  target: string;
158
- /** Output directory for exported data */
158
+ /** Output directory for exported data (posts go to outputDir/posts) */
159
159
  outputDir: string;
160
+ /** Media output directory (default: outputDir/media) */
161
+ mediaDir?: string;
160
162
  /** Maximum number of posts to export (0 = all) */
161
163
  limit?: number;
162
164
  /** Only export posts since this date */
package/dist/index.js CHANGED
@@ -203,7 +203,7 @@ function parsePost(fileContent, options = {}) {
203
203
  const { data, content } = (0, import_gray_matter.default)(fileContent);
204
204
  const { generateSlug: shouldGenerateSlug = true, extractAttachments: shouldExtractAttachments = true } = options;
205
205
  return {
206
- idx: data.idx || 0,
206
+ idx: data.idx || data.msg_id || 0,
207
207
  msg_id: data.msg_id || 0,
208
208
  date: data.date || "",
209
209
  channel_id: data.channel_id || 0,
@@ -509,6 +509,7 @@ async function exportTelegramChannel(options) {
509
509
  session = "",
510
510
  target,
511
511
  outputDir,
512
+ mediaDir: mediaDirOption,
512
513
  limit = 0,
513
514
  since,
514
515
  until,
@@ -521,7 +522,7 @@ async function exportTelegramChannel(options) {
521
522
  onSession
522
523
  } = options;
523
524
  const postsDir = path.join(outputDir, "posts");
524
- const mediaDir = path.join(outputDir, "media");
525
+ const mediaDir = mediaDirOption || path.join(outputDir, "media");
525
526
  fs.mkdirSync(postsDir, { recursive: true });
526
527
  fs.mkdirSync(mediaDir, { recursive: true });
527
528
  const stringSession = new import_sessions.StringSession(session);
package/dist/index.mjs CHANGED
@@ -145,7 +145,7 @@ function parsePost(fileContent, options = {}) {
145
145
  const { data, content } = matter(fileContent);
146
146
  const { generateSlug: shouldGenerateSlug = true, extractAttachments: shouldExtractAttachments = true } = options;
147
147
  return {
148
- idx: data.idx || 0,
148
+ idx: data.idx || data.msg_id || 0,
149
149
  msg_id: data.msg_id || 0,
150
150
  date: data.date || "",
151
151
  channel_id: data.channel_id || 0,
@@ -451,6 +451,7 @@ async function exportTelegramChannel(options) {
451
451
  session = "",
452
452
  target,
453
453
  outputDir,
454
+ mediaDir: mediaDirOption,
454
455
  limit = 0,
455
456
  since,
456
457
  until,
@@ -463,7 +464,7 @@ async function exportTelegramChannel(options) {
463
464
  onSession
464
465
  } = options;
465
466
  const postsDir = path.join(outputDir, "posts");
466
- const mediaDir = path.join(outputDir, "media");
467
+ const mediaDir = mediaDirOption || path.join(outputDir, "media");
467
468
  fs.mkdirSync(postsDir, { recursive: true });
468
469
  fs.mkdirSync(mediaDir, { recursive: true });
469
470
  const stringSession = new StringSession(session);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koztv-blog-tools",
3
- "version": "1.2.18",
3
+ "version": "1.2.19",
4
4
  "description": "Shared utilities for Telegram-based blog sites",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",