如何以编程方式查找从 html 引用的所有文件?

How to programmatically find all files referenced from html?

是否可以找到所有 "href" 和 "src" 属性并检查它们的值是否包含类似 "*/*.*" 的内容? “/”应该是唯一的(不是“//”,因为它可以在协议之后的开始时使用)。

我想查询会更复杂,但我在考虑朝着正确的方向前进吗?我需要用 C++ 编写它,我可能会使用 libcurl,但我想这些事实并不重要。

最后,我解析 HTML5 并遍历所有可能包含 URL 的属性,如下所示:

for (const string& attribute : { "action", "cite", "data", "formaction", "href", "manifest", "poster", "src" })
  iterate_attribute_occurrences_and_possibly_start_downloading(downloader, attribute, with_possible_URL);
iterate_attribute_occurrences_and_possibly_start_downloading(downloader, "srcset", with_possible_comma_separated_URLs);
iterate_attribute_occurrences_and_possibly_start_downloading(downloader, "style", with_CSS_possibly_containing_URLs_in_url_data_type);