1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! Platform-specific chat export parsers.
//!
//! This module provides parser implementations for each supported messaging platform.
//! All parsers implement the [`Parser`] trait, providing a consistent interface.
//!
//! # Available Parsers
//!
//! | Parser | Feature | Export Format | Special Handling |
//! |--------|---------|---------------|------------------|
//! | [`TelegramParser`] | `telegram` | JSON | Service messages, forwards |
//! | [`WhatsAppParser`] | `whatsapp` | TXT | Auto-detects 4 date formats |
//! | [`InstagramParser`] | `instagram` | JSON | Fixes Mojibake encoding |
//! | [`DiscordParser`] | `discord` | JSON/TXT/CSV | Attachments, stickers |
//!
//! # Examples
//!
//! ## Direct Parser Usage
//!
//! ```no_run
//! # #[cfg(feature = "telegram")]
//! # fn main() -> chatpack::Result<()> {
//! use chatpack::parser::Parser;
//! use chatpack::parsers::TelegramParser;
//!
//! let parser = TelegramParser::new();
//! let messages = parser.parse("result.json".as_ref())?;
//!
//! println!("Parsed {} messages", messages.len());
//! # Ok(())
//! # }
//! # #[cfg(not(feature = "telegram"))]
//! # fn main() {}
//! ```
//!
//! ## Dynamic Parser Selection
//!
//! ```no_run
//! # #[cfg(feature = "telegram")]
//! # fn main() -> chatpack::Result<()> {
//! use chatpack::parser::{Parser, Platform, create_parser};
//!
//! let parser = create_parser(Platform::Telegram);
//! let messages = parser.parse("result.json".as_ref())?;
//! # Ok(())
//! # }
//! # #[cfg(not(feature = "telegram"))]
//! # fn main() {}
//! ```
//!
//! ## Streaming Large Files
//!
//! ```no_run
//! # #[cfg(all(feature = "telegram", feature = "streaming"))]
//! # fn main() -> chatpack::Result<()> {
//! use chatpack::parser::{Parser, Platform, create_streaming_parser};
//!
//! let parser = create_streaming_parser(Platform::Telegram);
//! for result in parser.stream("large_export.json".as_ref())? {
//! let msg = result?;
//! // Process one message at a time
//! }
//! # Ok(())
//! # }
//! # #[cfg(not(all(feature = "telegram", feature = "streaming")))]
//! # fn main() {}
//! ```
pub use DiscordParser;
pub use InstagramParser;
pub use TelegramParser;
pub use WhatsAppParser;
// Re-export the unified Parser trait and Platform
pub use crate;