commit - 6aae7a73f0c90bb618878e3119a181faa4303229
commit + 4b13045172da61f343703da08f5a86bc74de2b64
blob - 0052b54b059288a6e4d1d27fe7fcee49d7430ef5
blob + d2323f0f665bcc0bbdce2d037cafcc38dc807bf9
--- capsule/vostok/atom2gemfeed.py
+++ capsule/vostok/atom2gemfeed.py
uses_netloc.append("gemini")
+def _is_gemini_link(value):
+ return value and value.lower().startswith("gemini://")
+
+
def _main(raw_url):
splitted_url = urlsplit(raw_url)
if splitted_url.scheme != "gemini":
print(f"# {title[0].text if title else raw_url}\r")
print("\r")
for entry in root.get("entry") or []:
+ gemini_link = None
entry_dict = {}
for child in entry:
_, _, tag = child.tag.rpartition('}')
entry_dict[tag] = child.text
+ if tag == "link" and child.attrib.get("rel") == "alternate":
+ gemini_link = child.attrib.get("href")
- gemini_link = entry_dict.get("id")
- if not gemini_link:
+
+ if not _is_gemini_link(gemini_link):
+ gemini_link = entry_dict.get("id")
+ if not _is_gemini_link(gemini_link):
continue
entry_date = ""
except ValueError:
pass
- title = entry_dict.get("title") or ""
print(f"=> {gemini_link} {entry_date}{entry_dict.get('title') or ''}\r")
return