url extract node remove duplicates content

This commit is contained in:
AhBumm
2026-04-22 10:59:47 +08:00
parent ef4aab5778
commit cb82855f0f
2 changed files with 15 additions and 14 deletions
+14 -13
View File
@@ -525,13 +525,16 @@ class RegTuziChatResponse:
)
all_urls.extend(base64_urls)
# 3. Deduplicate URLs while preserving order
unique_urls = []
seen = set()
# 3. Deduplicate by filename, keeping the last occurrence
filename_to_url = {}
for url in all_urls:
if url not in seen:
unique_urls.append(url)
seen.add(url)
if url.startswith('data:'):
# base64 data URIs: use the full string as key
filename_to_url[url] = url
else:
fname = urlparse(url).path.rsplit('/', 1)[-1]
filename_to_url[fname] = url
unique_urls = list(dict.fromkeys(filename_to_url.values()))
out_str = ",".join(unique_urls)
@@ -557,15 +560,13 @@ class RegTuziChatResponse:
)
video_urls.extend(regex_video_urls)
# 2. Deduplicate and get the last URL
unique_urls = []
seen = set()
# 2. Deduplicate by filename, keeping the last occurrence
filename_to_url = {}
for url in video_urls:
if url not in seen:
unique_urls.append(url)
seen.add(url)
fname = urlparse(url).path.rsplit('/', 1)[-1]
filename_to_url[fname] = url
unique_urls = list(dict.fromkeys(filename_to_url.values()))
out_str = unique_urls[-1] if unique_urls else ""
return (out_str,)
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui_billbum_api_nodes"
description = "New Support Seedance2.0 api Now!!! API call node for Third-party platforms both official and local. Support VLMs LLMs Dalle3 Flux-Pro(Support kontext, banana etc... now!! and new Support gpt-image-1!!). And some little tools: img to b64 url, b64 url to img, b64 url to b64 data, reg text to word and ',' only, etc."
version = "1.2.3"
version = "1.2.4"
license = {file = "LICENSE"}
dependencies = ["tenacity", "openai", "pillow", "requests", "numpy", "tiktoken", "urlextract"]