Here's a script I wrote: http://www.hawkee.com/snippet/9960/
I'll start by saying that it's probably not what you're looking for. However, you could re-use many of the aliases I've written for it to detect links in your twitch chat. I'd suggest opening it in another tab and then using ctrl+f to find the aliases I'm about to reference.
For example:
on $*:text:$($catchURLex):#:{
This event would trigger when any URL was posted. However, it would also trigger for text like 'o.o'
To remove false matches, you would do the following:
var %urls $extractURL($1-)
if (!%urls) return
Inside $extractURL() I use an alias called $parseDomain(), which uses Mozilla's public suffix list to determine if the suffix used (such as .co.uk or .net) was valid or not. This means only valid domains are returned by $extractURL().
From there, you have the URLs posted inside %urls. You'd just need to loop through them and determine if the domain is whitelisted or not. For that, I have an alias called $trusted(). If $trusted(example.com) == $true, then the site is whitelisted.
It may be overkill for what you want, but if you're interested everything you'd need is in that script.