Scraping Twitscoop

What’s hot on Twitter right now? You can scrap twitter trending topics to answer the question. But there is something hotter – Twitscoop. So what we are waiting for? Let’s scrap Twitscoop tag cloud.

Simple Twitscoop tag cloud scraper

General idea:

  • Get a homepage
  • Extract tags
  • Remove duplicate tags

Example

<?php
$file = file_get_contents("http://www.twitscoop.com");
preg_match_all("(<em class='blue'>(.*)</em>)siU",
    $file, $matches);
 
$matches = array_values(array_unique($matches[1]));
 
for ($i = 0; $i < count($matches); $i++) {
    $matches[$i] = strtolower($matches[$i]);
}
 
$matches = array_values(array_unique($matches));
 
// Job's done! $matches stores everything you need.
?>

Widget

BTW, there is a nice looking Twitscoop widget which displays hot trends and buzzing tag cloud. You can grab the code here.

What’s hot on Twitter right now? Now you know.

Leave a Reply

Your email address will not be published. Required fields are marked *