How to copy this link from text window to the clipboard?

The issue is, I think, is that the URL is buried in the RTF. I can’t find the post we had on this a couple of months. I want to give attribution.

Some kind soul provided me with this AppleScript, which when run pulls the URL out of the RTF and returns the results to the script editor.

-- adapted from https://www.macscripter.net/viewtopic.php?pid=182034, https://macscripter.net/viewtopic.php?id=46657

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions

-- get any rich texts off the clipboard
set pb to current application's NSPasteboard's generalPasteboard()
set theRichTexts to (pb's readObjectsForClasses:{current application's NSAttributedString} options:(missing value)) as list

if (count of theRichTexts) = 0 then
	display dialog "No rich text found on the clipboard" buttons {"OK"} default button 1
	error number -128
end if

set theRichText to (item 1 of theRichTexts)

-- get length so we can start from the end
set start to (theRichText's |length|()) - 1

-- make plain string copy to work on
set theString to theRichText's |string|()'s mutableCopy()

set output to return

repeat while start ≥ 0
	set {aURL, theRange} to theRichText's attribute:(current application's NSLinkAttributeName) atIndex:start effectiveRange:(reference)
	if aURL is not missing value then
		-- get linked text
		set anchorText to theString's substringWithRange:theRange
		if aURL's |scheme|()'s isEqualToString:"mailto" then -- email address
			set newLink to aURL's resourceSpecifier()
		else if anchorText's containsString:"This Site" then -- resource specifier, remove //
			set newLink to aURL's resourceSpecifier()'s substringFromIndex:2
		else -- full URL
			set newLink to aURL's absoluteString()
		end if
		set output to ((output & anchorText as text) & "::" & newLink as text) & return
	end if
	set start to (location of theRange) - 2
end repeat

return output -- to view in Script Editor Result pane

Update: Found it, it was @sumnerg (Extract Anchor and URL from pasted HTML - #9 by sumnerg).