Twitter Email scraper Help

ihatecaptcha

BANNED
Joined
Jul 31, 2010
Messages
593
Reaction score
78
Anyone good in Php here?Can you guys modify it to grab recent tweet and also make it english language.I hope you guys will help me :)









Code:
<?
###################################
###################################
###                             ###
###   twitScrape 0.1b by arvo   ###
###  -------------------------  ###
###   twitter email harvester   ###
###                             ###
###################################
###     edit settings below     ###
###################################
// set refresh delay - in seconds
$spd = 3;

// storage file for harvested emails
$eFile = "emails.txt";

// set amount of pages to search - twitter max allowed is 15
$max = 15;

// set search terms - see http://search.twitter.com/operators
$e[0] = "gmail.com";
$e[1] = "hotmail.com";
$e[2] = "aol.com";
$e[3] = "yahoo.com";
$e[4] = "live.com";

###################################
###################################
###                             ###
### do not edit below this box! ###
###                             ###
###################################
###################################

// get & set session variables
if (is_numeric($_REQUEST['pQ']) && is_numeric($_REQUEST['eQ'])) {

    // temporarily set the variables
    $pQ = $_REQUEST['pQ'];
    $eQ = $_REQUEST['eQ'];

    // check if page limit reached
    if ($pQ > $max) {
        // page limit reached
        $pQ = 1;
        $eQ++;
        if ($eQ > 4) {
            $end = 1;
        } else {
            $end = 0;
        }
    }
    
} else {
    // variables not set, start fresh
    $pQ = 1;
    $eQ = 0;
    $end = 0;
}

// check if done scraping
if ($end > 0) { // done scraping

    // count total emails harvested
    $eCnt = count(file($eFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES));

    // display final results
    print '<center># Harvested: ' . $eCnt . '<br>(harvesting complete)<br></center>';
    print '<center><textarea cols="40" rows="25">';
    include($eFile);
    print '</textarea></center>';

} else { // keep scraping

    // set url to scrape
    $url = file_get_contents("http://search.twitter.com/search?page=".$pQ."&q=".$e[$eQ]."&rpp=100");

    // clean content
    $content = strip_tags($url);

    // extract emails
    preg_match_all("([a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|biz|info)\b)siU",$content,$emails);

    // create email object
    ob_start();
    for ($x = 0; $x < count($emails,1)-1; $x++) {
        print $emails[0][$x] . "\n";
    }
    $output = ob_get_clean();

    // write emails to a file
    file_put_contents( 'emails.txt', file_get_contents('emails.txt') . $output );

    // count total emails harvested
    $eCnt = count(file($eFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES));
    
    // display harvested emails
    print '<center># Harvested: ' . $eCnt . ' emails<br>(there may be quite a few dupes)<br></center>';
    print '<center><textarea cols="40" rows="25">';
    include($eFile);
    print '</textarea></center>';

    $pQ++;
    print '<meta http-equiv="Refresh" content="'.$spd.'; url='.$_SERVER['PHP_SELF'].'?eQ='.$eQ.'&pQ='.$pQ.'">';

}
?>
 
Back
Top