postmodern / spidr

A versatile Ruby web spidering library that can spider a site, multiple domains, certain links or infinitely. Spidr is designed to be fast and easy to use.
MIT License
800 stars 109 forks source link

Is it possible to display only part of a spidered URL? #41

Closed DHarls17 closed 8 years ago

DHarls17 commented 8 years ago

I only want to display part of a spidered URL, but is this possible?

I've spidered the website www.parkers.co.uk and got the correct URLs, but I don't want to displayed the www.parkers.co.uk part of the URL.

For example, instead of; http://www.parkers.co.uk/cars/prices/ http://www.parkers.co.uk/cars/leasing/ http://www.parkers.co.uk/vans/for-sale/

I just want to display; /cars/prices/ /cars/leasing/ /vans/for-sale/

thanks!

robfuller commented 8 years ago

page.url is a URI object, so you can just call .path on it to get what you are looking for.

postmodern commented 8 years ago

Please see the URI::HTTP API docs. I'm almost certain what you're looking for is the request_uri method, which returns path + ?query.

postmodern commented 8 years ago

You can find all documentation for ruby's stdlib in http://rubydoc.info/stdlib/ and all gem documentation at http://rubydoc.info/gem/name_goes_here. Cheers