Created
January 9, 2019 00:16
-
-
Save Steffo99/9d5643f964449a6e2e6eb196269ce660 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import os | |
| import re | |
| DATA_FOLDER = "T:\\Data Takeout" | |
| REGEX = r"" | |
| def search_inside(loaded_chat): | |
| for msg in loaded_chat["messages"]: | |
| match = re.search(REGEX, msg.get("content", ""), re.IGNORECASE) | |
| if match is not None: | |
| return match.group(0) | |
| return None | |
| for category in ["archived_threads", "filtered_threads", "inbox"]: | |
| for folder in [x[0] for x in os.walk(f"{DATA_FOLDER}\\messages\\{category}\\")]: | |
| try: | |
| with open(f"{folder}\\message.json", "r") as file: | |
| j = json.load(file) | |
| except Exception: | |
| continue | |
| results = search_inside(j) | |
| if results is not None: | |
| print(f"{folder} | {results}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment