In a Service, how to get a URL from rich text?
You can do it using the app TextSoap. The cleaners "Extract URLs by Replacing" and "Extract URLs by Appending" work with rich text format.

You can also use the following AppleScript:

tell application "textsoap7"
    cleanClipboard with "Extract URLs by Replacing"
end tell