diff options
| -rw-r--r-- | converters/links_to_gemini.py | 10 | ||||
| -rw-r--r-- | main.py | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/converters/links_to_gemini.py b/converters/links_to_gemini.py index 9b3749d..8e401da 100644 --- a/converters/links_to_gemini.py +++ b/converters/links_to_gemini.py @@ -3,15 +3,18 @@ from os import walk import os.path def convert_links_to_gemini(domain): - for file in os.listdir("output/gemini"): + convert_file_links(file) + return("links are converted to gemini (3/3)") + +def convert_file_links(file): processed = "" f = open("output/gemini/" + file, "r") for line in f.readlines(): - if ".html" in line and "http" not in line or domain in line: + if ".html" in line and "http" not in line: # or domain in line: line = line.replace("html", "gmi") url = line.split(" ")[1] - + link = url.split("/")[-1] line = line.replace(str(url), str(link)) @@ -25,4 +28,3 @@ def convert_links_to_gemini(domain): f.write(processed) f.close() - return("links are converted to gemini (3/3)") @@ -3,7 +3,8 @@ from os import walk import os.path from converters.html_to_md import convert_html_to_md from converters.md_to_gemini import convert_md_to_gemini -from converters.links_to_gemini import convert_links_to_gemini +from converters.links_to_gemini import convert_links_to_gemini, convert_file_links +import shutil dir = "input" |
