google / safebrowsing

Safe Browsing API Go Client
Apache License 2.0
470 stars 129 forks source link

Exposes a function to check if a string is a URL. #75

Closed colonelxc closed 7 years ago

colonelxc commented 7 years ago

This makes it possible to check if a string will pass URL parsing before calling LookupURLs. This can help identify if one string in a batch will cause an error that will abort the LookupURLs call.

A pitfall of this method is that any series of words without punctuation is considered a valid URL, as the code will turn spaces into '%20's and consider the whole string as a long hostname.

Fixes #72

dsnet commented 7 years ago

Alternatively, you could call it ValidURL.

dsnet commented 7 years ago

Still LGTM.