Skip to content

Commit

Permalink
Added a script that figures out what tweets are "public," vs at-replies.
Browse files Browse the repository at this point in the history
It counts retweets and normal tweets: things to be seen by anyone following
you. Things that are replies (that aren't retweets of other people's replies)
aren't counted.
  • Loading branch information
icculus committed Apr 6, 2016
1 parent 079eb5e commit 6643574
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions publictweetcount.php
@@ -0,0 +1,38 @@
<?php

/* Load required lib files. */
session_start();
require_once('twitteroauth/twitteroauth.php');
require_once('config.php');

$cachedir = './cache';
$cachefnames = scandir($cachedir);
if ($cachefnames !== false)
{
while (($cachefnames[0] == '.') || ($cachefnames[0] == '..'))
array_shift($cachefnames);
if (count($cachefnames) == 0)
$cachefnames = false;
else
rsort($cachefnames, SORT_NUMERIC);
}

$total = 0;
if ($cachefnames !== false)
{
foreach ($cachefnames as $fname)
{
$obj = unserialize(file_get_contents("$cachedir/$fname"));
if ($obj !== false)
{
if ($obj->text[0] != '@')
{
$total++;
print("{$obj->text}\n");
}
}
}
}

print("$total tweets\n");

0 comments on commit 6643574

Please sign in to comment.