bit.ly auto shortener

Stalli0n

Junior Member
Joined
Nov 17, 2010
Messages
147
Reaction score
100
Hey, i wrote a simple php script that shortens URLs for me via bit.ly without API. But now they changed their site and it isn't working anymore. They added another field "key" which you have to send in the POST request. But i can't find this damn field anywhere.

Code:
http://bit.ly/data/shorten

POST /data/shorten HTTP/1.1
Host: bit.ly
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
X-XSRFToken: 053afca0c6924da7b036c16b7ab8886c
Referer: http://bit.ly/
Content-Length: 145
Cookie: anon_u=cHN1X18xYmY0MWNlNy01YzAwLTQzZGEtYTVkMS04MmY0NGY5Yzc1MWM=|1302631159|444c1a793a945727fcd57963488723d734fde7af; _b=MTMwMjYzMTE1OQ==|1302631159|aa20c74a3ab11253e7a4f75cd355b3af610c05a7; _xsrf=053afca0c6924da7b036c16b7ab8886c; __utma=126736798.1924418141.1302631226.1302631226.1302631226.1; __utmb=126736798.1.10.1302631226; __utmc=126736798; __utmz=126736798.1302631226.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _chartbeat2=59bvmc94riyktmiq
Pragma: no-cache
Cache-Control: no-cache
url=blackhatworld.com&basic_style=1&classic_mode=&rapid_shorten_mode=&_xsrf=053afca0c6924da7b036c16b7ab8886c&[COLOR=Red][U][B]key=3edf08fe05ae122fdeb9048eb7b31e7f[/B][/U][/COLOR]
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 12 Apr 2011 18:17:31 GMT
Content-Type: application/json; charset=UTF-8
Connection: keep-alive
Content-Length: 177
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Maybe it is in this file: http://bit.ly/s/v318/js/bitly_compressed.js

There's also some hex encoded javascript on the main site.

Code:
(function (c) 
{
    var d = ["classic_mode", "rapid_shorten_mode", "funnelcake"],
        b = ["galivant", "funnelcake", "exclusivedeal", "dGhlcmVvbmNld2FzJGFNYW4=", "c2FsbHlhdGV0aGVwaG9uZXk=", "ZnVubmVsY2FrZQ==", "cm9vdF9zZXJ2ZXI=", "cm9vdF9zZXJ2ZXI=", "Yml0bHkuYXdlc29tZQ==", "01100100101101000101010110101000100110101010", "21"],
        a = ["BITLY", "unauth_shorten", "validate_form", "#unAuthShortenForm", "submit", "bind", "slice", 1];

    c(a[3])[a[5]](a[4], function (e) 
    {
        $_xSCr[0][a[0]][a[1]][a[2]](e, b["0" * a[7]], d, b[a[6]](0, "5" * a[7]), b[a[6]]("3" * a[7]))
    })
}
)
(jQuery);
But i don't know what that does either...
 
Last edited:
Easiest way to use bit.ly is just create multiple accounts and then use their API :)

But if you really want to continue on with your script, there is a solution...
Once anything is submitted, the key value appears in the html.

In other words, you hit the shorten button with no data in it. Then parse the html source and you should find the key in a hidden input:

PHP:
<input type="hidden" name="key" value="***************">

Hope this helps.
 
Hm i just hit the shorten button with no data 2 times and looked at the Http Headers.
The key changes every time :/

So i guess i need to create one account for every url i shorten and use the API.
But i need to shorten easily over a hundred links per day...
 
Last edited:
Hm i just hit the shorten button with no data 2 times and looked at the Http Headers.
The key changes every time :/

So i guess i need to create one account for every url i shorten and use the API.
But i need to shorten easily over a hundred links per day...


Why can't you use the same account for multiple links???

It doesn't make sense to create so many accounts... As even if your worried about accounts being linked, they will still be linked via IP (unless your using a proxy for each).

For me bit.ly doesn't delete links as quickly as others.
 
Back
Top