diff options
| author | uvok | 2025-06-22 15:57:44 +0200 |
|---|---|---|
| committer | uvok | 2025-06-22 15:57:44 +0200 |
| commit | 8ea1433a287289d3e3d81e1b60ebd215279c7002 (patch) | |
| tree | 68abc117b74ba20f1d496d5aabec1a3771deab65 /converters/links_to_gemini.py | |
| parent | 7eeeb7d3c86b1e6269f81f9bc13de8874a140bc8 (diff) | |
Extract function to do link conversion
Diffstat (limited to 'converters/links_to_gemini.py')
| -rw-r--r-- | converters/links_to_gemini.py | 10 |
1 files changed, 6 insertions, 4 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)") |
