【发布时间】:2014-12-11 01:32:54
【问题描述】:
有没有什么方法可以统计包含特定主题标签或单词的推文?例如,统计所有包含主题标签、#apple 的推文或所有包含“iphone”的推文?
【问题讨论】:
标签: twitter
有没有什么方法可以统计包含特定主题标签或单词的推文?例如,统计所有包含主题标签、#apple 的推文或所有包含“iphone”的推文?
【问题讨论】:
标签: twitter
这个获取计数标签(#)twitter的php源代码
<?php
global $total, $hashtag;
//$hashtag = '#supportvisitbogor2011';
$hashtag = '#australialovesjustin';
$total = 0;
function getTweets($hash_tag, $page) {
global $total, $hashtag;
$url = 'http://search.twitter.com/search.json?q='.urlencode($hash_tag).'&';
$url .= 'page='.$page;
$ch = curl_init($url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);
$json = curl_exec ($ch);
curl_close ($ch);
//echo "<pre>";
//$json_decode = json_decode($json);
//print_r($json_decode->results);
$json_decode = json_decode($json);
$total += count($json_decode->results);
if($json_decode->next_page){
$temp = explode("&",$json_decode->next_page);
$p = explode("=",$temp[0]);
getTweets($hashtag,$p[1]);
}
}
getTweets($hashtag,1);
echo $total;
?>
谢谢..
【讨论】:
您可以使用DataSift 之类的服务来实时跟踪包含特定主题标签或关键字的推文。他们还将在今年夏天发布Historics service,让您可以追溯到 2010 年 1 月
【讨论】: