claude-export
claude-export copied to clipboard
enhancement -
make it able to take the exported account conversations.json -( from account > export data) and get all the conv uuid - and then download in bulk
import json
import os
import sys
def extract_attachments(data):
for conversation in data:
conversation_name = conversation['name']
conversation_dir = f"extracted_{conversation['uuid']}"
os.makedirs(conversation_dir, exist_ok=True)
for message in conversation['chat_messages']:
for attachment in message.get('attachments', []):
file_name = attachment['file_name']
content = attachment.get('extracted_content', '')
if content:
file_path = os.path.join(conversation_dir, file_name)
with open(file_path, 'w', encoding='utf-8') as f:
f.write(content)
print(f"Extracted: {file_path}")
def main():
json_file = 'conversations.json'
try:
with open(json_file, 'r', encoding='utf-8') as f:
data = json.load(f)
except json.JSONDecodeError:
print(f"Error: {json_file} is not a valid JSON file.")
sys.exit(1)
except FileNotFoundError:
print(f"Error: File {json_file} not found.")
sys.exit(1)
extract_attachments(data)
print("Extraction complete.")
if __name__ == "__main__":
main()