Automatically remove non-primary Discord invites, X, Telegram and .onion links

These links are not really needed considering they are always not
recognizably named and the URI itself is usually just random letters so
not at all useful for autocompletion. The filter removes them by
matching the link title, so no primary Discord links are removed but all
complementary are.
This commit is contained in:
5Litt 2025-10-19 10:08:02 +02:00
parent 4264db5dc4
commit 044c670b30

View file

@ -273,6 +273,12 @@ def parse_bookmark_line(line: str) -> Tuple[str, str, str, BookmarkLine | None]:
level1, level2, level3 = hierarchy_match.groups()
matches = url_pattern.findall(line)
# Remove non-primary Discord invites, X, Telegram and .onion links
filters = {"Discord", "X", "Telegram", ".onion"}
for matched_link in matches.copy():
if matched_link[0] in filters:
matches.remove(matched_link)
# Check if line contains starred content
is_starred = "" in line or "🌟" in line