���ܸ��tweet�������ˡ�Ϥ�����������Ȥ��⤦������ɡ�
����ϥե��������API�ǥ桼���κǿ��Υ��ơ����������뤳�Ȥ��顢
�����Í̾�ͤΥե������tweet�ò½¸¤ï¿½ï¿½Ê¿ï¿½ï¿½ï¿½Í¤ï¿½Ð¤ï¿½ï¿½Æ¤ß¤è¤¦ï¿½ï¿½ï¿½È¡ï¿½
���֤����׳�Ū�ˤɤΤ��餤��tweet��ʿ���ͤ�Ȥ�����פȤ��ƿ��ѤǤ����ͤȤ��äƤ���Ϥ���͡���
���ä��褦�ʽ���ʤ��ä��褦�ʵ������뤱�ɡ��Ȥꤢ����Ŭ���ʿ��ȤäƤߤޤ�����
�������åȤȤ���Í̾�ͤϾ��֤���
���֤���Υե������API�Ǽ�������ʿ���ͤ�����ޤ�����
����äȸŤ�API�λ��͸��Ƥ���page=1�Ȥ��ǥڡ��������ꤹ��äƽ񤤤Ƥ�������ɡ������Υɥ�����ȸ�����cursor�ˤʤäƤ���
̵�̤˥ϥޤä���
����ͤ�cursor=-1�����ꤷ�ơ��쥹�ݥ󥹤�next_cursor���֤äƤ���ΤǼ��Υڡ����򸫤�Ȥ��Ϥ����ͤ����ꤹ�롣
���פ����cursor=1,2,3�Ȥ�����ʤ��ߤ�������
���˽񤤤Ƥ����ñ�ʥХå���äƤߤ��Ȥ�����
�о�Tweet | 6587tweet |
�ȡ�����ʸ���� | 234153ʸ�� |
ʿ��Tweetʸ���� | 35.5ʸ�� |
*)RT�ǻϤޤäƤ�tweet�Ͻ����ޤ�����
���٤���äƤߤƤ��������30ʸ������ä��Τǡ�
���ܿͤ�30��40ʸ���ǤĤ֤䤤�Ƥ����Ǥ��礦�����֤�
tweetLength.php
<?php $username = "USERNAME"; $password = "PASSWORD"; $target = 'kazuyo_k'; $tweet=0; $length=0; $cursor = -1; for ($i=0;$i<150;$i++) { if ($cursor == 0) break 1; $url = sprintf("http://twitter.com/statuses/followers.json?cursor=%d&screen_name=%s",$cursor,$target); $json = request($url,$username,$password); if (!is_array($json->users)) continue 1; foreach ($json->users as $key => $val) { if(isset($val->status)) { //RT�ǻϤޤ�tweet�����Ф� if(preg_match("/^RT(.+)/",$val->status->text)) continue 1; if (mb_detect_encoding($val->status->text) != 'UTF-8') continue 1; $tweet++; $length+=mb_strlen($val->status->text, 'utf-8'); } } $cursor = $json->next_cursor; } echo "tweet : " . $tweet . "\n"; echo "length : " . $length . "\n"; echo "avg : " . $length / $tweet . "\n"; function request($host='',$username='',$password=''){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $host); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); $result = curl_exec($ch); curl_close($ch); return json_decode($result); } ?>