>>102240750
fuck yeah we can do that we have god on our side
import toml
import glob
import re
def search_content_in_toml_files(pattern):
search_pattern = re.compile(r'== *\n*') # Compile the regex pattern
# Find all files matching the pattern
for file_path in glob.glob(pattern):
try:
# Load the TOML file
data = toml.load(file_path)
# Loop through each element in the parsed data
for key, value in data.items():
if isinstance(value, dict) and 'content' in value:
content = value['content']
if isinstance(content, str):
# Check if content matches the search pattern
if search_pattern.search(content):
print(f"Match found in {file_path} for key '{key}':\n{content}\n")
except FileNotFoundError:
print(f"Error: The file '{file_path}' was not found.")
except toml.TomlDecodeError as e:
print(f"Error decoding TOML in '{file_path}': {e}")
if __name__ == "__main__":
# Specify the pattern to match TOML files
toml_file_pattern = '*/posts.toml'
# Search for the content in the specified TOML files
search_content_in_toml_files(toml_file_pattern)