Home javascript API to reduce links vk.cc

API to reduce links vk.cc

Author

Date

Category

Someone will tell, is there an API to reduce links in VK?
Searched the whole Internet can not find
Thanks in advance


Answer 1, Authority 100%

API seems to, no, but as they write in office. Live group, there is extension under Chrome , disassembly which is likely to understand how to make Something your own.

UPD. Looks like everything is simple. See how the VK.CC page works – from the form a post queuing, and it turns out a short link back! In the mentioned extension under Chrome it is so implemented:

FUNCTION LoadShort (Q, Done) {
 Q = Trim (Q);
 var cache_url = q.replace (/ http: \ / // gi, ""). replace (// // Gi, "");
 if (s.get ("res _" + cache_url)! = NULL) {
  if (Done) Done ("9654 & lt;! & gt; profile.css, page.js & lt;! & gt; 3 & lt;! & gt; 3326 & lt;! & gt; 0 & lt;! & gt;" + s. get ("res _" + cache_url));
  Return;
 }
 Xhr.ONReadyStateChange = Function () {
  if (xhr.ReadyState == 4) {
   if (xhr.status & gt; = 200 & amp; & amp; xhr.status & lt; 300) {
    if (done) done (xhr.responsetext);
   }
  }
 };
 xhr.open ("POST", "http://vk.com/cc", true);
 xhr.setRequestheader ("Content-Type", "Application / X-WWW-FORM-URLENCODED");
 xhr.setrequestheader ("X-Requested-with", "xmlhttprequest");
 xhr.send ("Act = Shorten & amp; al = 1 & amp; link =" + enc (q));
}

Implement this in the framework of the usual web page on JS will not be possible due to the fact that they are located on another domain than your page. But through the server, it is quite simple.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions