Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
[ANN] RedNails Released
Zev Blut
12/13/2006 1:00:00 PM
RedNails is template driven data scraping API.
http://rednails.rub...
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
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
[ANN] RedNails Released
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password