Peter Alcock 51a1ff4c00 extensions | 8 months ago | |
---|---|---|
.. | ||
lib | 8 months ago | |
spec | 8 months ago | |
.gitignore | 8 months ago | |
.rubocop.yml | 8 months ago | |
Gemfile | 8 months ago | |
LICENSE.txt | 8 months ago | |
README.md | 8 months ago | |
Rakefile | 8 months ago | |
polipus-storage-mysql.gemspec | 8 months ago |
MySQL Storage driver for Polipus::Crawler
Add this line to your application's Gemfile:
gem 'polipus-storage-mysql'
And then execute:
$ bundle
Or install it yourself as:
$ gem install polipus-storage-mysql
require 'polipus'
require 'polipus/storage/mysql_store'
mysql_storage = Polipus::Storage::mysql_store(mysql_options, table_name)
Polipus.crawler('rubygems','http://rubygems.org/', storage: mysql_store) do |crawler|
# In-place page processing
crawler.on_page_downloaded do |page|
# A nokogiri object
puts "Page title: '#{page.doc.css('title').text}' Page url: #{page.url}"
end
end
MySQL options are passed directly to the mysql2 driver: (https://github.com/brianmario/mysql2)
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)