1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Scrape Titles of Top100 Google Search Results for a keyword?

Discussion in 'Black Hat SEO' started by meinewelt, Jan 3, 2013.

  1. meinewelt

    meinewelt Junior Member

    Joined:
    Jan 11, 2012
    Messages:
    157
    Likes Received:
    60
    I now use copy+paste mostly but its a tedious job, is there any easier way to do it? Thanks!
     
  2. meinewelt

    meinewelt Junior Member

    Joined:
    Jan 11, 2012
    Messages:
    157
    Likes Received:
    60
    is there no bot that does it? like search for a keyword in google, use first 100 results and extract the titles?
     
  3. jacky2002r

    jacky2002r Junior Member

    Joined:
    Jan 6, 2009
    Messages:
    133
    Likes Received:
    77
    Download SEO4Firefox or SEOQuake Plugin in Firefox and then use it to scrape Google search results with Title & URL. Cheers
     
    • Thanks Thanks x 1
  4. regme

    regme Newbie

    Joined:
    Jun 16, 2012
    Messages:
    46
    Likes Received:
    10
    PHP fucntion preg_match with right regexp can do it in seconds. Can wright it for you tomorrow.
     
  5. regme

    regme Newbie

    Joined:
    Jun 16, 2012
    Messages:
    46
    Likes Received:
    10
    Ok, thats what you need. save it with <? .. ?> on hosting with PHP support and run with usage tag key. For example
    http://yoursite.com/get_titles.php?key=lolcats
    PHP:

    $keyword_p
    =urlencode($_GET['key']);
    $input=file_get_contents("http://www.google.com/search?q=".$keyword_p."&hl=en&tbs=qdr:m&lr=&sa=X&tbo=1&num=100");
    $regexp "<li class=\"g\"><h3(.*)<\/h3>";

    if(
    preg_match_all("/$regexp/siU"$input$matchesPREG_SET_ORDER)) {

        foreach(
    $matches as $match)     {

            
    $text=$match[0];

            
    $text=strip_tags($text);

            echo 
    $text.'<br>';    }

    }
     
    • Thanks Thanks x 4
  6. nanavlad

    nanavlad Jr. VIP Jr. VIP Premium Member

    Joined:
    Dec 2, 2009
    Messages:
    2,384
    Likes Received:
    875
    Gender:
    Male
    Occupation:
    SEO Consultant
    Location:
    Proxy Central
    theres a bot called blog commenting *****

    I think I saw it on the forum. but it scrapes the top 100 or so results from google
     
  7. elviswong

    elviswong Senior Member Premium Member

    Joined:
    Nov 8, 2011
    Messages:
    918
    Likes Received:
    239
    Yes i got one !

    EDITED:
    Do you need the urls of the top 100 search of a given keyword ?
     
    Last edited: Jan 10, 2013
  8. meinewelt

    meinewelt Junior Member

    Joined:
    Jan 11, 2012
    Messages:
    157
    Likes Received:
    60
    thankyou so much everyone!

    @regme very kind! you are my php hero now :)
     
    Last edited: Jan 11, 2013
  9. regme

    regme Newbie

    Joined:
    Jun 16, 2012
    Messages:
    46
    Likes Received:
    10
    It's ok, problem in IP.

    Try this code, if it will not work i'll give you link on script installed on my server.

    PHP:
    $keyword_p=urlencode($_GET['key']);$ch curl_init('http://www.google.com/search?q='.trim($keyword_p).'&hl=en&lr=&sa=X&tbo=1&num=100');curl_setopt($chCURLOPT_RETURNTRANSFERtrue);curl_setopt($chCURLOPT_COOKIESESSIONtrue);curl_setopt($chCURLOPT_COOKIEJARdirname (__FILE__)."/cookie.txt");curl_setopt($chCURLOPT_COOKIEFILEdirname (__FILE__)."/cookie.txt");$input curl_exec($ch);

    $regexp "<li class=\"g\"><h3(.*)<\/h3>";
    if(
    preg_match_all("/$regexp/siU"$input$matchesPREG_SET_ORDER)) {
        foreach(
    $matches as $match)     {
            
    $text=$match[0];
            
    $text=strip_tags($text);
            echo 
    $text.'<br>';    }
    }  
     
    • Thanks Thanks x 2
  10. iTalent

    iTalent Newbie

    Joined:
    Jul 15, 2013
    Messages:
    3
    Likes Received:
    0
    Hi, Regme your script worked wonderfully.

    Can u please change this to scrape titles of ezinearticles instead of google
     
  11. meinewelt

    meinewelt Junior Member

    Joined:
    Jan 11, 2012
    Messages:
    157
    Likes Received:
    60
    i now get error "Not Found" am probably doing something wrong :)

    I think there is a big need for a bot that will automatically create in spin format titles (sentences) for keywords from search, so you dont have to fill in manually in senuke and all the other tools :)))

    coders feel free to use my idea but i appreciate free license by PM can also beta test ;)
     
  12. vodkaa

    vodkaa Junior Member

    Joined:
    May 23, 2013
    Messages:
    119
    Likes Received:
    23
    You should be using a DOM parser for this sort of thing not regex. Try using this: hxxp://simplehtmldom.sourceforge.net/
     
  13. regme

    regme Newbie

    Joined:
    Jun 16, 2012
    Messages:
    46
    Likes Received:
    10
    Google sometimes change sourcecoe of search page. Try change string
    $regexp = "<li class=\"g\"><h3(.*)<\/h3>";
    to
    $regexp = "<li class=\"g\">(.*)<\/h3>";
     
    • Thanks Thanks x 1
  14. princebhalani143

    princebhalani143 Newbie

    Joined:
    Apr 26, 2013
    Messages:
    6
    Likes Received:
    0

    yes i was also searching for same, but now i forgot the name of that software which can also useful for some top 100 competitor backlink, if you remind the name of that software which scrape the top 100 from google source please inform me