Created
December 26, 2012 03:53
-
-
Save mia-0032/4377708 to your computer and use it in GitHub Desktop.
Twitterを特定の単語で検索して、表示するスクリプト。
文中のリンクとハッシュタグ、リプライにはリンクを貼る。
jQuery必要。 今はもうTwitterAPIのバージョン変わってるから動かないかも。
This file contains 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
window.onload = function() { | |
$.getJSON("http://search.twitter.com/search.json?q='hoge'+OR+'foo'&rpp=5&callback=?", | |
{}, function (data) { | |
$.each(data.results, function (i,v) { | |
var tweet = v.text; | |
tweet = tweet.replace(/(http:\/\/[\x21-\x7e]+)/gi, "<a href='$1'>$1</a>"); | |
tweet = tweet.replace(/#([\x21-\x7e]+)/gi, "<a href=http://twitter.com/#!/search?q=%23$1 target='_blank'>#$1</a>"); | |
tweet = tweet.replace(/@([\x21-\x39\x3b-\x7e]+)/gi, "<a href=http://twitter.com/#!/$1 target='_blank'>@$1</a>:"); | |
$("#tweetList").append(tweet + "<br>"); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment