Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/clemsos/sina-url-decoder

Decode Sina Weibo shortened url (t.cn) using Javascript/jQuery
https://github.com/clemsos/sina-url-decoder

Last synced: about 1 month ago
JSON representation

Decode Sina Weibo shortened url (t.cn) using Javascript/jQuery

Awesome Lists containing this project

README

        

# Decode Sina URLs

Decode Sina url t.cn to complete url using Javascript/jQuery

ex :

// deal with links
links=$("td a"); // get all links
urls=[];

// loop through links
for (var i = 0; i < links.length; i++) {

// collect all urls
urls.push($(links[i]).attr("href"));
}

// call Sina API to get complete links
decode_sina_urls(urls,function(long_urls){

// parse & replace link
for (var i = 0; i < links.length; i++) {
$(links[i]).text(long_urls[i].url_long);
$(links[i]).attr("href",long_urls[i].url_long);
}

});