Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/clemsos/sina-url-decoder
- Owner: clemsos
- Created: 2013-11-08T10:33:05.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-08T10:34:37.000Z (about 11 years ago)
- Last Synced: 2024-10-14T01:23:18.602Z (2 months ago)
- Language: JavaScript
- Size: 97.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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);
}
});