Assistance Needed

I am having issues trying to get this program to extract data from a directory site (i.e. yellowpages.com) and inserting the results into a file for importing to sql database.

I have read the tutorial, but for some reason I am still having issues.

What I would like to do is:
Extract Data (I believe I somewhat have this down, although I get some errors)

Create a file and insert the extractors into a preset syntax for integration into sql database.

Also, do I have to manually browse each page for the results (since they normally only show 45 or so listings per page) or can screen scraper do this for me?

Thanks in advance.

Assistance Needed

Nevermind, I figured it out.

Assistance Needed

I was wondering if you could give me an example as to how to write the script to accomodate the output changes I would like.

First of all, my basic script looks like this:

FileWriter out = null;

try
{
  session.log( "Writing data to a file." );

  // Open up the file to be appended to.
  out = new FileWriter( "dvds.txt", true );

  // Write out the data to the file.
  out.write( dataRecord.get( "NAME" ) + "\t" );
  out.write( dataRecord.get( "ADDRESS" ) + "\t" );
  out.write( dataRecord.get( "CITY" ) + "\t" );
  out.write( dataRecord.get( "STATE" ) + "\t" );
  out.write( dataRecord.get( "ZIP" ) );
  out.write( "\n" );

  // Close up the file.
  out.close();
}
catch( Exception e )
{
  session.log( "An error occurred while writing the data to a file: " + e.getMessage() );
}

How can I adjust this to print the output to the text file like I want it?

Thanks in advance!

Assistance Needed

Todd, thank you for your response.

I believe I have it working well now, getting things running like I want them.

I have a couple issues though that I need some help with.

One, I created sub extractor patterns for a main extractor pattern. Whenever I run each one individually, they respond back correctly. However, when I run the main extractor pattern, it just returns the ~@DATARECORD@~ variable. Is this normal?

Two, I understand how to get the program to output to a text file somewhat. However, I would like to know how to format the file it outputs to.

For example:
Instead of outputting: ~@NAME@~ ~@NUMBER@~ ~@ADDRESS@~

I would rather: INSERT INTO `user_info` (`~@NAME@~`, `~@NUMBER@~`, `~@ADDRESS@~`)

See where I am getting at? I would just like to modify the output to a text file to plug the information for each token into its corresponding spot.

Thank you very much for your time!

Assistance Needed

Hi,

I believe tutorials 3, 4, and 5 pretty well cover this. Unfortunately, we don't have much sample code to send beyond what's in those tutorials. Did you already go through those ones?

If you still run into trouble, you might consider having us do a site or two for you. If you'd like a free quote on your project, you can send us a services inquiry at this page:

[url]http://www.screen-scraper.com/services/services.php[/url]

Kind regards,

Todd Wilson

Assistance Needed

Also, I am a fairly novice programmer. So any sample scripts would greatly help!

Thanks in advance.