Export the messages of a Telegram chat by clicking the three dots (top right corner) and select "Export chat history". Next select as export format JSON (not HTML).
Open a console and change directory into the chat export directory containing the result.json file. Next open up a Python 3 interpreter: ipython3 and paste following code. Hit enter - et voila! All your messages have been converted into files in the directory messages which you can now import and explore with Digger Solo.
import json
import os
import re
defmerge_text(text):ifisinstance(text,list):
merged =""for part in text:ifisinstance(part,dict)and part.get("type")=="link":
merged += part.get("text","")elifisinstance(part,str):
merged += part
return merged
elifisinstance(text,str):return text
return""defsafe_filename(s, maxlen=100):# Remove/replace unsafe characters and trim to maxlen
s = re.sub(r'[\\/*?:"<>|]','_', s)# Replace filesystem-forbidden charsreturn s[:maxlen]or"empty_message"defsave_messages(messages):
os.makedirs("messages", exist_ok=True)for msg in messages:
content = merge_text(msg.get("text",""))
filename = safe_filename(content)
filepath = os.path.join("messages",f"{filename}.txt")withopen(filepath,"w", encoding="utf-8")as f:
f.write(content)if __name__ =="__main__":withopen('result.json','r', encoding='utf-8')as f:
data = json.load(f)
save_messages(data["messages"])