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
806 stars 109 forks source link

Added possibility to pass cookies as options #36

Closed spk closed 10 years ago

spk commented 10 years ago

This can be useful for example when you want to crawl a website logged in.

postmodern commented 10 years ago

It might be more useful to initialize the full CookieJar via an option.

spk commented 10 years ago

Yes I can watch this if you are not working in it ?

spk commented 10 years ago

@postmodern is this implementation ok for you ?

postmodern commented 10 years ago

It just occurred to me you can simply populate the cookie_jar within the setup block:

Spidr.host(...) do |agent|
  agent.cookie_jar['host'] = {...}

  agent.every_url do |url|
    ...
  end
end
spk commented 10 years ago

@postmodern yes it work with agent.cookies['host'] = {...} thank you.