$5 to your Paypal

ihatecaptcha

BANNED
Joined
Jul 31, 2010
Messages
593
Reaction score
78
I need help to modify this script,the problem is it collects duplicate emails.All you need to do is add a code to get unique emails.

Here is the script


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

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

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

// 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?ands=&from=&lang=en&near=&nots=&ors=gmail.com+hotmail.com&phrase=&q=&ref=&result_type=recent&rpp=10&since=&tag=&to=&units=mi&until=&within=15");













    // 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.'">';

}
?>

Pm me your Paypal.Thanks :)
 
Me!

Insert array_unique() function call just after the preg_match_all() call:
Code:
$emails[0] = array_unique($emails[0]);
 
It's everytime the same, I can't PM or even reply to sent PMs because I'm a newbie here...

The code I've given you only filter duplicates in what's being collected, you were unclear on what you expect.
Maybe you would like it filters duplicates too in the emails.txt file ?
 
Back
Top