Make a quick html data extractor with REBOL (code)

July 21st, 2008

This is the REBOL code from video in previous post. A nicer version can be seen here

page: read http://www.avto.net/2004/motornaKolesa/zadetki_zadnjih100.asp
ads: make block! 110
parse adspart [ some [ to <tr> copy ad to </tr> ( if find ad {<a HREF="oglas.asp?} [ append ads ad ] ) ] ]

ads-rule: [ thru </td> thru {<a href="} copy _link to {"} thru ">" copy _title to </a> thru <small> copy _descr to </small> ]
clean-html: func [ a ] [ replace/all a "&nbsp;" " " ]
foreach ad ads [
    parse ad ads-rule
    print clean-html _title
]

2 Responses to “Make a quick html data extractor with REBOL (code)”

  1. BarryO Says:

    Hey,
    Rebol is a brilliant language, nice to see it being used.

    You could use “replace/all” and that would take care of any multiple encoded spaces. I guess you knew that anyway.

  2. janko Says:

    Hi, yes I agree! I hope the new version 3 will progress out of the alpha at least slowly as it has some very very nice features and I would love to use it.

    Yes, it would be much smarter to use replace/all, I wasn’t thinking a lot and I am a little rusty in Rebol :) , I will fix the post. thanx,

Leave a Reply