diff options
| author | Dennis Fink | 2026-11-13 21:20:40 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-13 21:20:40 +0100 |
| commit | a285fdf29e59c3b957247ea9241943c7202e9a28 (patch) | |
| tree | 17ceeb703de23af1e67081d99a8864bbe353fb46 /webmentions_ssg/tasks/source_parser.py | |
| parent | 78ecd8bc227bdcbbd0e45eea025f7223252ed0da (diff) | |
| download | webmentions-ssg-a285fdf29e59c3b957247ea9241943c7202e9a28.tar.gz webmentions-ssg-a285fdf29e59c3b957247ea9241943c7202e9a28.zip | |
refactor(core): consolidate repeated helper logic
Centralize SQL row counts, hostname parsing, and content-type
normalization so tasks, forms, and scanners share consistent
implementations.
Simplify periodic task registration and admin lookups with table-driven
setup and Flask-SQLAlchemy's built-in 404 helper.
Diffstat (limited to 'webmentions_ssg/tasks/source_parser.py')
| -rw-r--r-- | webmentions_ssg/tasks/source_parser.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/webmentions_ssg/tasks/source_parser.py b/webmentions_ssg/tasks/source_parser.py index 9cbe071..294402c 100644 --- a/webmentions_ssg/tasks/source_parser.py +++ b/webmentions_ssg/tasks/source_parser.py @@ -11,14 +11,14 @@ from fnmatch import fnmatchcase from itertools import chain from pathlib import Path from typing import Any -from urllib.parse import quote, urldefrag, urljoin, urlsplit +from urllib.parse import quote, urldefrag, urljoin import mf2py import xxhash from bs4 import BeautifulSoup, Tag from bs4.element import NavigableString, PageElement -from ..net import is_http_url +from ..net import hostname_of, is_http_url REACTION_PROPERTIES = ("in-reply-to", "like-of", "repost-of", "bookmark-of") @@ -283,7 +283,7 @@ def iter_targets( for value in chain(hrefs, reactions): target = normalize_target(value, base_url=base_url, source_url=source_url) if target is not None: - hostname = (urlsplit(target).hostname or "").rstrip(".") + hostname = hostname_of(target) or "" if not any(fnmatchcase(hostname, pattern) for pattern in ignored_hostnames): yield target |
