Today, the Internet is flooded with shortened URL. All links shared on Twitter are shortened (start with t.co). There is nothing wrong with it. I just don’t feel comfortable clicking a shortened URL without knowing where it will bring me to. How paranoid I am!

There are several reason I don’t trust shortened URL:

  1. They might contain tracking or referral code. SlickDeals heavily uses it (to make money, of course). Again, there is nothing wrong with it. They provide you a service and they deserve to get some money out of it.
  2. They might hide malicious URL, like XSS
  3. I hate them!

There are several expand URL services out there, however they just support a very limited set of URL shorten service. What I want is something more. I want to be able to track the final URL after a bunch of redirections. So I wrote this API:

http://api.codepie.org/expand_url/<your_url_here_no_escape_needed>

For example:

http://api.codepie.org/expand_url/http://slickdeals.net/?pno=128958&lno=1&afsrc=1&trd=Newegg+com

Here is the API result. You will be amazed how many hops it take to the final destination:

http://slickdeals.net/?pno=128958&lno=1&afsrc=1&trd=Newegg+com

http://www.jdoqocy.com/click-1225267-10440897?sid=1fea0918ac5e454fa2fc89be4e70d43b&url=http%3A%2F%2Fwww.newegg.com%2FProduct%2FProduct.aspx%3Fsdtid%3D7164970%26SID%3D1fea0918ac5e454fa2fc89be4e70d43b%26AID%3D10440897%26PID%3D1225267%26nm_mc%3DAFC-C8Junction%26cm_mmc%3DAFC-C8Junction-_-cables-_-na-_-na%26Item%3D03V-003G-00433

http://cj.dotomi.com/a6106ar-zH/ry2/GFJJFNOM/GHHKHLM/F/F/F?c=v5vq%3DEsrnDMELnpIrHIHsnFspLMorHrKDqHGo%2674y%3Du662%25GN%25FS%25FS999.0r9rtt.p1z%25FSc41q7p6%25FSc41q7p6.n52A%25GS5q6vq%25GQKEJHMKD%25FJfVQ%25GQEsrnDMELnpIrHIHsnFspLMorHrKDqHGo%25FJNVQ%25GQEDHHDLMK%25FJcVQ%25GQEFFIFJK%25FJ0z_zp%25GQNSP-PLW70p6v10%25FJpz_zzp%25GQNSP-PLW70p6v10-_-pnoyr5-_-0n-_-0n%25FJV6rz%25GQDGi-DDGT-DDHGG%3C%3Cu662%3A%2F%2F999.wq131pB.p1z%3ALD%2Fpyvpx-EFFIFJK-EDHHDLMK%3C%3CT%3Cu6625%3A%2F%2F999.t11tyr.p1z%2F%3C

http://www.emjcd.com/h4102tenm6/elq/32662AB9/3447489/2/39292468268596B574/87Ad4g9d4ggd33g6A24f3A25952f57g5?c=zC2x%3DLzyuKTLSuwPyOPOzuMzwSTvyOyRKxONv%26EB5%3D1DD9%25NU%25MZ%25MZGGG.7yGy00.w86%25MZjB8xEwD%25MZjB8xEwD.uC9H%25NZCxD2x%25NXRLQOTRK%25MQmcX%25NXLzyuKTLSuwPyOPOzuMzwSTvyOyRKxONv%25MQUcX%25NXLKOOKSTR%25MQjcX%25NXLMMPMQR%25MQ76_6w%25NXUZW-WSdE7wD287%25MQw6_66w%25NXUZW-WSdE7wD287-_-wuv5yC-_-7u-_-7u%25MQcDy6%25NXKNp-KKNa-KKONN%3Cw38!GQ96-PAKTEzy%3C1DD9%3A%2F%2FGGG.3x8A8wI.w86%3ASK%2Fw52w4-LMMPMQR-LKOOKSTR%3C%3Ca%3C1DD9C%3A%2F%2FGGG.08805y.w86%2F%3C

http://www.newegg.com/Common/AdvancedLinkLanding.aspx?nm_mc=AFC-C8Junction&cm_mmc=AFC-C8Junction-_-na-_-na-_-na&AID=10440897&PID=1225267&SID=1fea0918ac5e454fa2fc89be4e70d43b&URL=http%3A%2F%2Fwww.newegg.com%2FProduct%2FProduct.aspx%3Fsdtid%3D7164970%26SID%3D1fea0918ac5e454fa2fc89be4e70d43b%26AID%3D10440897%26PID%3D1225267%26nm_mc%3DAFC-C8Junction%26cm_mmc%3DAFC-C8Junction-_-cables-_-na-_-na%26Item%3D03V-003G-00433

http://www.newegg.com/Product/Product.aspx?sdtid=7164970&SID=1fea0918ac5e454fa2fc89be4e70d43b&AID=10440897&PID=1225267&nm_mc=AFC-C8Junction&cm_mmc=AFC-C8Junction-_-cables-_-na-_-na&Item=03V-003G-00433&cm_sp=

Suggestions welcome!

New API: Expand URL
Tagged on:         

One thought on “New API: Expand URL

  • May 20, 2016 at 9:08 AM
    Permalink

    Hi,

    Thanks for your job on this api. I have a few question because, for my job, i need to expand url, and it’s hard to find a reliable api to do that. I wanted to call every url and check the response header to know the real url, but with the proxy in my company prevented me to use that solution.
    I wish to know how you expand the url, and how many call/hour can i do without problems with your api. (i have to expand url from lots of tweets and facebook posts).
    Is it a problem that i use your api for professional use ?

    Thanks in advance for your response

    Reply

Leave a Reply