Created
January 3, 2012 06:43
-
-
Save yukioc/1553822 to your computer and use it in GitHub Desktop.
get twitter user info and rss address.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<input type='text' id='screen_name'/> | |
<input type='submit' onclick='twit_rss_run();' /> | |
<div id='view'></div> | |
<script> | |
function twit_rss_run(){ | |
var name=document.getElementById('screen_name').value; | |
var v=document.getElementById('view'); | |
var s=document.createElement('script'); | |
var api='https://api.twitter.com/1/users/show.json?callback=twit_rss_cb&screen_name='+name; | |
s.setAttribute('type','text/javascript'); | |
s.setAttribute('charset','UTF-8'); | |
s.setAttribute('src',api); | |
v.appendChild(s); | |
} | |
function twit_rss_cb(json){ | |
var sname=json['screen_name']; | |
var img='https://api.twitter.com/1/users/profile_image?screen_name='+sname+'&size=bigger'; | |
var rss='https://api.twitter.com/1/statuses/user_timeline.rss?screen_name='+sname; | |
var a=function(url,txt){return '<a href='+url+'>'+txt+'</a>';} | |
var br='<br/>'; | |
var s=''; | |
s+='<table><tr><td>'; | |
s+='<img src="'+img+'"></img>'; | |
s+='</td><td>'; | |
s+=json['name']+' @'+sname+' id='+json['id']; | |
if(json['url']){s+=' '+a(json['url'],'url');} | |
s+=br+'Tweet='+json['statuses_count']; | |
s+=' / Favorites='+json['favourites_count']; | |
s+=' / Friends='+json['friends_count']; | |
s+=' / Followers='+json['followers_count']+br; | |
s+='rss:'+a(rss,rss)+br; | |
s+=json['description']+br; | |
s+='</td></tr></table>'; | |
document.getElementById('view').innerHTML=s; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment