This commit is contained in:
neoarz 2025-04-14 22:49:17 -04:00
parent 3336bbf1a4
commit 702a10795b
2 changed files with 40 additions and 0 deletions

18
update_json.py Normal file
View file

@ -0,0 +1,18 @@
import json
import re
import requests
import os
import sys
from datetime import datetime
def prepare_description(text):
text = re.sub('<[^<]+?>', '', text) # Remove HTML tags
text = re.sub(r'#{1,6}\s?', '', text) # Remove markdown header tags
text = re.sub(r'\*{2}', '', text) # Remove all occurrences of two consecutive asterisks
text = re.sub(r'(?<=\r|\n)-', '•', text) # Only replace - with • if it is preceded by \r or \n
text = re.sub(r'`', '"', text) # Replace ` with "
text = re.sub(r'\r\n\r\n', '\r \n', text) # Replace \r\n\r\n with \r \n (avoid incorrect display of the description regarding paragraphs)
return text