Skip to content

Instantly share code, notes, and snippets.

@makotom
Created February 4, 2012 15:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makotom/1738537 to your computer and use it in GitHub Desktop.
Save makotom/1738537 to your computer and use it in GitHub Desktop.
ももんがコレクター
#!/usr/bin/php
<?php
$c = array();
for($i = 1; $i <= 30; $i += 1){
if($i !== 1) sleep(2);
$tmp = json_decode(file_get_contents("http://search.twitter.com/search.json?q=%E3%82%82%E3%82%82%E3%82%93%E3%81%8C&rpp=100&result_type=recent&page={$i}"));
$c = (isset($tmp->results) && is_array($tmp->results)) ? array_merge($c, $tmp->results) : $c;
echo "{$i}: Collected " . count($c) . " statuses.\n";
}
$users = array();
foreach($c as $e){
$users[$e->from_user] = 0;
}
file_put_contents("momonga.dat", serialize(array_keys($users)));
echo count($users) . " ももんが were collected.\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment