Extractor¶
claude_conversation_extractor.extractor ¶
Core conversation extraction logic.
ConversationExtractor ¶
Extracts conversations from Claude export files using streaming JSON parsing.
Source code in src/claude_conversation_extractor/extractor.py
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 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
__init__ ¶
__init__(export_file_path)
Initialize with path to Claude export file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
export_file_path
|
str | Path
|
Path to the JSON export file |
required |
Source code in src/claude_conversation_extractor/extractor.py
14 15 16 17 18 19 20 |
|
extract_conversation ¶
extract_conversation(uuid)
Extract conversation by UUID using streaming.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uuid
|
str
|
The conversation UUID to extract |
required |
Returns:
Type | Description |
---|---|
Conversation | None
|
The conversation if found, None otherwise |
Source code in src/claude_conversation_extractor/extractor.py
64 65 66 67 68 69 70 71 72 73 |
|
find_conversation ¶
find_conversation(uuid)
Find a conversation by its UUID using streaming.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uuid
|
str
|
The conversation UUID to search for |
required |
Returns:
Type | Description |
---|---|
Conversation | None
|
The conversation if found, None otherwise |
Source code in src/claude_conversation_extractor/extractor.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
get_conversation_count ¶
get_conversation_count()
Get the total number of conversations in the export file.
Returns:
Type | Description |
---|---|
int
|
Number of conversations |
Source code in src/claude_conversation_extractor/extractor.py
75 76 77 78 79 80 81 82 83 84 |
|
list_conversations ¶
list_conversations(limit=10)
List conversations up to a limit using streaming.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
Maximum number of conversations to return |
10
|
Returns:
Type | Description |
---|---|
list[Conversation]
|
List of conversations |
Source code in src/claude_conversation_extractor/extractor.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
stream_conversations ¶
stream_conversations()
Stream conversations from the export file without loading everything into memory.
Yields:
Type | Description |
---|---|
Conversation
|
Conversation objects one at a time |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If export file doesn't exist |
JSONError
|
If file is not valid JSON |
Source code in src/claude_conversation_extractor/extractor.py
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 |
|