Expand URL_IGNORE_LIST (#409)

Co-authored-by: UltralyticsAssistant <[email protected]>
This commit is contained in:
Glenn Jocher
2025-04-13 03:21:35 +02:00
committed by GitHub
co-authored by UltralyticsAssistant
parent 85e888dd17
commit f3047e398b
3 changed files with 41 additions and 40 deletions
+1 -1
View File
@@ -22,4 +22,4 @@
# ├── test_summarize_pr.py
# └── ...
__version__ = "0.0.64"
__version__ = "0.0.65"
+39 -38
View File
@@ -56,45 +56,46 @@ URL_IGNORE_LIST = { # use a set (not frozenset) to update with possible private
"storage.googleapis.com", # private GCS buckets
"{", # possible Python fstring
"(", # breaks pattern matches
"api", # ignore api endpoints
}
REDIRECT_IGNORE_LIST = {
"{", # possible f-string
"}", # possible f-string
"/es/",
"/us/",
"en-us",
"es-es",
"/latest/",
"/2022/",
"/2023/",
"/2024/",
"/2025/",
"/2026/",
"/2027/",
"/2028/",
"/2029/",
"/2030/",
"credential",
"login",
"consent",
"verify",
"badge",
"shields.io",
"bit.ly",
"ow.ly",
"https://youtu.be/",
"latex.codecogs.com",
"svg.image",
"?view=azureml",
"ultralytics.com/actions",
"ultralytics.com/bilibili",
"ultralytics.com/images",
"app.gong.io/call?",
"https://code.visualstudio.com/", # errors
"?rdt=", # problems with reddit redirecting to https://www.reddit.com/r/ultralytics/?rdt=48616
"objects.githubusercontent.com", # Prevent replacement with temporary signed GitHub asset URLs
"api.", # ignore api endpoints
}
REDIRECT_IGNORE_LIST = frozenset(
{
"{", # possible f-string
"}", # possible f-string
"/es/",
"/us/",
"en-us",
"es-es",
"/latest/",
":text", # ignore text-selection links due to parsing complications
":443", # https://getcruise.com/ -> https://www.gm.com:443/innovation/path-to-autonomous
"404",
"notfound",
"unsupported", # https://labs.google/fx/tools/video-fx/unsupported-country
"authorize", # nature articles like https://idp.nature.com/authorize?response_type=cookie&client...
"credential",
"login",
"consent",
"verify",
"badge",
"shields.io",
"bit.ly",
"ow.ly",
"https://youtu.be/",
"latex.codecogs.com",
"svg.image",
"?view=azureml",
"?utm_",
"redirect",
"ultralytics.com/actions",
"ultralytics.com/bilibili",
"ultralytics.com/images",
"app.gong.io/call?",
"https://code.visualstudio.com/", # errors
"?rdt=", # problems with reddit redirecting to https://www.reddit.com/r/ultralytics/?rdt=48616
"objects.githubusercontent.com", # Prevent replacement with temporary signed GitHub asset URLs
}
)
URL_PATTERN = re.compile(
r"\[([^]]+)]\(([^)]+)\)" # Matches Markdown links [text](url)
r"|"
+1 -1
View File
@@ -78,7 +78,7 @@ def test_markdown_links(verbose):
def test_mixed_formats(verbose):
"""Tests URL detection in mixed text formats (HTML, Markdown, plain text) using check_links_in_string."""
text = "A <a href='https://1.com'>link</a> and [markdown](https://2.org/) and https://3.net"
result, urls = check_links_in_string(text, return_bad=True)
result, urls = check_links_in_string(text, verbose, return_bad=True)
assert result is False
assert set(urls) == {"https://1.com", "https://3.net"}