[ANN] RedNails Released

Z

Zev Blut

RedNails is template driven data scraping API.

http://rednails.rubyforge.org

RedNails uses a template to create a regular expression that catches
user marked variables. When a string of data is passed to RedNails it
will use the regular expression to extract the matches and return them
to the user.

If the scraped data is regular enough then RedNails is a simple way to =

extract
data as all one needs to do is copy a live data feed and mark the points=
to
extract and make this the template.

Usage:
1) Create a template.
2) Load and initialize an instance of a RedNails object with the templat=
e.
3) Pass this instance your data feed from which you wish to extract =

information.
4) Use the results.

Template Format:
A RedNails template is simply a text file that has the points to scrape =
=

marked
with what looks like a ruby string substitution. You give each =

substitution a
unique variable name which can then be referenced when using the =

parse_hash method.

An example template is:

"Hello my name is #{name}. How are you?"

If the data string to scrape is:

"Hello my name is Mr.Bill. How are you?"

Then the following code fragement will produce "Mr.Bill":

require 'rednails'
rednails =3D RedNails.new("template.txt")
results =3D rednails.parse_hash("livedata.txt")
puts results["name"] # =3D> Mr.Bill


For more details see the RedNails URL listed at the top.

RedNails has been in production use for a number of years, although
this is the first public release of the API. If you have any
problems, comments, or recommendations please feel free to mail me.

Thanks,
Zev
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,813
Messages
2,569,696
Members
45,479
Latest member
QFZErin313

Latest Threads

Top