5

最後のプロジェクトとして、Twitter で現在最もホットなトピックを見つけて表示する Web サイトを構築しています。過去 1 週間または 1 日の膨大な量のツイートからトピックを抽出する方法を知っている人はいますか? http://tweet3d.com/でタグクラウドのようにトピックを表示したり、 http://trendistic.indextank.com/ のように各トピックのトレンドを表示したりする方法も考えてます。

この最終プロジェクトの会費が今月末に締め切られるので、本当にあなたの助けが必要です。パートナーから Flash Builder を使うように言われました。私もその使い方を学んでいます。みんなありがとう。


追加情報 (2011 年 11 月 20 日): Google で検索した後、この論文にたどり着きました: Topic Modelを使用して Twitter と従来のメディアを比較します。関連する背景がありません。

4

2 に答える 2

2

私はTwitterAPIにあまり詳しくありませんが、おそらくこれが役立つ可能性があります: https ://dev.twitter.com/docs/api/1/get/trends/current

于 2011-11-20T18:58:35.327 に答える
2

Twitter APIを扱う際に、すべての質問に答えるはずの素敵なJSフィドルをまとめました。Webアプリはトレンドのロケールを取得し、トレンドのトピックにドリルダウンして、その中のツイートを表示できるようにします。

標準のTwitter検索送信ボックスも含めたので、奇妙なことに、これはあなたが調べるための最低限のTweetdeckクライアントです。また、新しいJqueryライブラリの適応を推進するために、新しいlive.bindクリックイベント構文を利用する1.91を使用しました。

楽しみ

http://jsfiddle.net/jdrefahl/5M3Gn/

function searchTwitter(query) {
$.ajax({
    url: 'http://search.twitter.com/search.json?' + jQuery.param(query),
    dataType: 'jsonp',
    success: function (data) {
        var tweets = $('#tweets');
        tweets.html('');
        for (res in data['results']) {
            tweets.append('<div>' + data['results'][res]['from_user'] + ' wrote: <p>' + data['results'][res]['text'] + '</p></div><br />');
        }
    }
});
}

$(document).ready(function () {

function getTrendsByID(id) {
    $.ajax({
        url: 'http://api.twitter.com/1/trends/' + id + '.json',
        dataType: 'jsonp',
        success: function (data) {
            $.each(data[0].trends, function (i) {
            });
        }
    });
};

function getLocales() {
    $.ajax({
        url: 'https://api.twitter.com/1/trends/available.json',
        dataType: 'jsonp',
        success: function (data) {
            var locales = $('ul#locales');
            locales.html('');
            $.each(data, function (i) {
                localeID[i] = data[i].woeid;
                $('ul#locales').append('<li>' + data[i].name + '</li>');
            });
        }
    });

};

function getTrends(id) {
    $.ajax({
        url: 'https://api.twitter.com/1/trends/' + id + '.json',
        dataType: 'jsonp',
        success: function (data) {
            var trends = $('ul#currentTrends');
            trends.html('');
            $.each(data[0].trends, function (i) {
                $('ul#currentTrends').append('<li>' + data[0].trends[i].name + '</li>');
            });
        }
    });
};

// Event Handlers
$(document).on("click", "#locales li", function () {
    var $this = $(this);
    var localesHdr = $('#currentTrendsCont h3');
    var tweets = $('#tweets');
    var trendsHdr = $('#tweetsCont h3');
    trendsHdr.html('');
    tweets.html('');
    localesHdr.html('');
    $('#currentTrendsCont h3').html($this.text());
    getTrends(localeID[$this.index()]);
});

$(document).on("click", "#currentTrends li", function () {
    var $this = $(this);
    var trendsHdr = $('#tweetsCont h3');
    trendsHdr.html('');
    $('#tweetsCont h3').html($this.text());
    var params = {
        q: $this.text(),
        rpp: 10
    };
    searchTwitter(params);
});

$('#submit').click(function () {
    var trendsHdr = $('#tweetsCont h3');
    var trends = $('#currentTrends');
    var local = $('#currentTrendsCont h3');
    local.html('');
    trendsHdr.html('');
    trends.html('');
    $('#tweetsCont h3').html('search query: '+$('#query').val());
    var params = {
        q: $('#query').val(),
        rpp: 10
    };
    searchTwitter(params);
});

// Globals
var localeID = new Array();

// Init!
getLocales();

});
于 2013-03-06T08:10:43.870 に答える