I have been tasked with performing realtime and historical analysis of shortened links that users include in their messaging, comparing them against databases of known-malicious URLs (e.g. Google Safe Browsing, OpenPhish).
However, a core use-case for link shortening done by our user-base is the collection of "hit" data, reflecting whether their link was clicked, who clicked it, when, etc. This presents the problem that I need to "unshorten" URLs without actually accessing them directly.
Some providers, such as bit.ly, provide an API method to retrieve information about their shortened links. But, each API seems to be different, and often requires provider-specific API credentials.
Are there any popular libraries, services, or standardized approaches for dealing with this problem?
In which language do you want? Here is one for bitly v4 in php:
https://github.com/phplicengine/bitly