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
Leave a Comment
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
1.
Fragger | May 29, 2009 at 12:07 pm
Nice script, I’m using it now thanks.
2.
twigleaf | May 29, 2009 at 12:12 pm
lol