permalink

15

Java tool to download search query data

As Python is not really my mother tongue I decided to create a Java 6 version of the download tool for the search data in Google’s Webmaster Tools.

To run it follow these steps:

  1. Unzip the archive into a directory of your choice
  2. Modify config/wmt.properties to match your needs
  3. Run either run.sh (you’ll need to make it executable) or run.bat

Using the -m or –lastmonth command line option the tool will only export the data for the last calendar month. I use this switch in my cronjob which is scheduled to run every month on the 5th day of the month.

The files will be downloaded to the directory you defined in the properties file. By default it will download all types of search query data. If you want to reduce the amount of files being downloaded, change the list of download types in DownloadFiles.java and recompile.

I tested it on Ubuntu 11.10 and Windows 7.

Download

15 Comments

  1. Pingback: Descarga las consultas de búsqueda de Google Webmaster Tools | Marketing en Internet, Posicionamiento web y mucho más

  2. Pingback: Keyword not provided | FrankOli.de

  3. Thanks for uploading this sample code, is very good.

    I have a question for you, is there any way to modify a little the proyect code to get a cvs with “crawl-errors”?

    Thanks,
    Marcello

  4. Hey, Thanks a ton for this !

    I was looking for java version of the download tool. Is there a way to modify the date range for which we can download this data? Is there a documentation available for this from Google?

  5. I just found out how to give custom date range for which you want to download data:

    Place where you append “prop” parameter to the query URL add the parameters “db” and “de” with values in “yyyymmdd” format and you would get the data for that date range.

    i.e. Modify path += “&prop=” + prop;

    to path += “&prop=” + prop + “&db=” + startDate + “&de=”
    + endDate;

    e.g. To get the data for 1 day (7th June 2012) modify the line to :
    path += “&prop=” + “ALL” + “&db=” + “20120607” + “&de=” + “20120607”;

    I hope it helps.

    • Hi Namit. Thanks for your comment.
      If you look closely, you’ve seen that I am using the command line switches ‘d’ and ‘m’ to control either the number of days to export or simply export the last month. I wasn’t interested in more ranges, but if you’ve written the code for that including the required range checking I am happy to include it in the source.

  6. Hi, I am trying to run the application but I get the following error. I am kind of new to Java, so this is probably my fault, but any help would be greatly appreciated.

    Thanks!

    Exception in thread “main” java.lang.NoClassDefFoundError: com/webkruscht/wmt/Op
    tions
    at com.webkruscht.wmt.DownloadFiles.getOptions(DownloadFiles.java:76)
    at com.webkruscht.wmt.DownloadFiles.main(DownloadFiles.java:122)
    Caused by: java.lang.ClassNotFoundException: com.webkruscht.wmt.Options
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    … 2 more

    • Hi Tom,

      sorry for the much too late reply. Looks like some files were missing in the latest version of the ZIP file. No idea why.
      Please try to download it again.

  7. This is exactly what I was looking for and am having problems running this thing.
    I’ve already made changes to wmt.properties and tried to run the ‘run.sh’ it gives me the error of ClassNotFoundException: com.webkruscht.wmt.Options

    Maybe I need to add another library?

Leave a Reply

Required fields are marked *.