Hacking a filter for Twitter

February 22, 2009

The following php script fetches a Twitter RSS feed and filters out all the irrelevant comments you made.

<?
// replace url with your twitter rss feed
$lines = file( "http://twitter.com/statuses/user_timeline/1234567890.rss" );

$skip = false;
$c = count( $lines );
for ( $i = 0; $i < $c; $i++ ) {
    $line = $lines[$i];

    $p = strpos( $line, "<item>" );
    if ( $p !== false ) {
        // Replace YourName with your twitter account name
        $p2 = strpos( $lines[$i+1], "YourName: @" );
        if ( $p2 !== false ) {
            $skip = true;
        }
    }

    if ( $skip ) {
        if ( strpos( $line, "</item>" ) !== false ) {
            $skip = false;
        }
    } else {
        echo $line;
    }
}
?>

Entry Filed under: /roll. .

2 Comments Add your own

  • 1. Fragger  |  May 29, 2009 at 12:07 pm

    Nice script, I’m using it now thanks.

    Reply
  • 2. twigleaf  |  May 29, 2009 at 12:12 pm

    lol :)

    Reply

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


RSS Twitter

 

February 2009
S M T W T F S
« Dec   Mar »
1234567
891011121314
15161718192021
22232425262728

Categories

Blogroll

Meta