Created
May 16, 2012 02:30
-
-
Save jdeloach/2706816 to your computer and use it in GitHub Desktop.
Twitter Archiver Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple, not the prettiest method to get your latest 3200 tweets (Twitter imposed limit). Thrown together in 20 minutes, not expected to be the greatest. | |
* Author: Jordan DeLoach (Twitter: @jtmcgee Github: @jdeloach Web: jordandeloach.com) | |
* | |
* Step One (insert your username): | |
* curl -s --user-agent 'Mozilla' --insecure 'https://twitter.com/statuses/user_timeline/YOUR_USERNAME_HERE.xml?count=100&page=[1-32]' >> tweets.txt | |
* | |
* Step Two: | |
* Run "php twitterParser.php >> tweetsParsed.txt" | |
* | |
* Step Three: | |
* See your awesome tweets in tweetsParsed.txt. Simple enough. Ugly enough. | |
*/ | |
$lines = file_get_contents("tweets.txt"); | |
$lines = explode("\n", $lines); | |
foreach($lines as $line) { | |
$line = trim($line); | |
if(substr($line, 0, 6) == "<text>") { | |
print substr($line, 6, (strlen($line)-13)) . "\n\n"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment