iMacros Google keyword scraping help

Discussion in 'Other Scripting Languages' started by biks, Apr 1, 2010.

  1. biks

    biks Power Member

    Joined:
    Oct 28, 2008
    Messages:
    713
    Likes Received:
    378
    Occupation:
    Video editor, graphics guy
    So I'm just trying to make an iMacro which goes to Google's keyword tool and scrape the top results. I sorta can do it, but I suspect it'll take some VB and that's where my head starts to implode. This is what I've got. I wanna start here:

    https://adwords.google.com/select/KeywordToolExternal

    Let's assume I'm already logged in and have already entered a keyword, done the captcha and have finished the search. Let's say I did a search for "fat loss" I run this imacro:

    Code:
    VERSION BUILD=6600525     
    TAB T=1     
    TAB CLOSEALLOTHERS   
    SET !ERRORIGNORE YES
    SET !EXTRACT_TEST_POPUP NO
    SET !DATASOURCE_COLUMNS 2
    SET !LOOP 1
    'Increase the current position in the file with each loop 
    SET !DATASOURCE_LINE {{!LOOP}}
    '      
    TAG POS=1 TYPE=TD ATTR=CLASS:c0&&TXT:* EXTRACT=TXT  
    TAG POS=2 TYPE=TD ATTR=CLASS:data&&TXT:* EXTRACT=TXT  
    TAG POS=2 TYPE=TD ATTR=CLASS:c0&&TXT:* EXTRACT=TXT  
    TAG POS=4 TYPE=TD ATTR=CLASS:data&&TXT:* EXTRACT=TXT  
    TAG POS=3 TYPE=TD ATTR=CLASS:c0&&TXT:* EXTRACT=TXT  
    TAG POS=6 TYPE=TD ATTR=CLASS:data&&TXT:* EXTRACT=TXT  
    TAG POS=4 TYPE=TD ATTR=CLASS:c0&&TXT:* EXTRACT=TXT  
    TAG POS=8 TYPE=TD ATTR=CLASS:data&&TXT:* EXTRACT=TXT  
    SAVEAS TYPE=EXTRACT FOLDER=* FILE=keywordTEST.csv
    I end up with this:

    [​IMG]

    But what I really want is this:

    [​IMG]

    How hard is it to extract to the first two, then go to the next cell? I suspect it requires VB stuff.

    Does anyone know of any other keyword tool scrapers that I can just use?
     
  2. aworford1

    aworford1 Newbie

    Joined:
    Mar 26, 2010
    Messages:
    6
    Likes Received:
    0
    biks,
    You need to do your SAVEAS every time that you want to make a new row (in Excel) in iMacros. That will dump everything you have EXTRACT'ed up to that point in 1 row, then clear the !EXTRACT variable. No VB needed (THANK GOODNESS!).

    Code:
    VERSION BUILD=6600525     
    TAB T=1     
    TAB CLOSEALLOTHERS   
    SET !ERRORIGNORE YES
    SET !EXTRACT_TEST_POPUP NO
    SET !DATASOURCE_COLUMNS 2
    SET !LOOP 1
    'Increase the current position in the file with each loop 
    SET !DATASOURCE_LINE {{!LOOP}}
    '      
    TAG POS=1 TYPE=TD ATTR=CLASS:c0&&TXT:* EXTRACT=TXT  
    TAG POS=2 TYPE=TD ATTR=CLASS:data&&TXT:* EXTRACT=TXT
    SAVEAS TYPE=EXTRACT FOLDER=* FILE=keywordTEST.csv 
    TAG POS=2 TYPE=TD ATTR=CLASS:c0&&TXT:* EXTRACT=TXT  
    TAG POS=4 TYPE=TD ATTR=CLASS:data&&TXT:* EXTRACT=TXT  
    SAVEAS TYPE=EXTRACT FOLDER=* FILE=keywordTEST.csv
    TAG POS=3 TYPE=TD ATTR=CLASS:c0&&TXT:* EXTRACT=TXT  
    TAG POS=6 TYPE=TD ATTR=CLASS:data&&TXT:* EXTRACT=TXT  
    SAVEAS TYPE=EXTRACT FOLDER=* FILE=keywordTEST.csv
    TAG POS=4 TYPE=TD ATTR=CLASS:c0&&TXT:* EXTRACT=TXT  
    TAG POS=8 TYPE=TD ATTR=CLASS:data&&TXT:* EXTRACT=TXT  
    SAVEAS TYPE=EXTRACT FOLDER=* FILE=keywordTEST.csv