Adapt ARP's url fix

Co-authored-by: Cheng Hann Gan <chenghanngan.us@gmail.com>
This commit is contained in:
Hans5958 2022-04-07 14:10:08 +07:00
parent 3a86822175
commit b5aa228962

View file

@ -88,6 +88,15 @@ def fix_r_caps(entry: dict):
return entry
def fix_no_protocol_urls(entry: dict):
if not "website" in entry:
return entry
if entry["website"].startswith("http"):
entry["website"] = "https://" + entry["website"]
return entry
def per_line_entries(entries: list):
out = "[\n"
for entry in entries:
@ -103,6 +112,8 @@ def print_(*args, **kwargs):
entry = remove_extras(entry)
print_("Fixing r/ capitalization...")
entry = fix_r_caps(entry)
print_("Fixing links without protocol...")
entry = fix_no_protocol_urls(entry)
print_("Collapsing Markdown links...")
entry = collapse_links(entry)
print_("Fix formatting of subreddit...")