Convert URL from relative to absolute


Please advice pointers, sample code to convert all relative urls to absolute urls in an html document, using Rust.

Best Regards,

You'll need and the crate. Check out — it already filters HTML and URLs in them.

This is great! It narrowed my searching scope.

I have figured following code, but looks like I got more than I wished. I only need rel2abs conversion nothing else. Is there way to disable all other functions of ammonia.clean?

pub fn _rel2abs(base_url: &str, input: &str) -> String {

The codes seems working for a small html fragment, not a complete document.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.