README.md in maxwell-0.3.0 vs README.md in maxwell-0.4.0
- old
+ new
@@ -2,42 +2,40 @@
Maxwell makes web scraping more simpler and faster with Ruby.
## Installation
-Add this line to your application's Gemfile:
-
```ruby
-gem 'maxwell'
+echo "gem 'maxwell'" >> Gemfile && bundle
```
-And then execute:
-
- $ bundle
-
Or install it yourself as:
$ gem install maxwell
## Usage
```ruby
class YahooScraper < Maxwell::Base
- attr_scrape :title, :url, :address
+ attr_accessor :title, :url, :address
- regist_strategy("h3.slcHead.cFix a") do
- @title = @html.title
- @url = @html.css("td.sdhk jdj").text
- @address = @html.css("table tr.ddad").text
+ javascript true
+
+ concurrency 4
+
+ def parser html
+ @title = html.title
+ @url = html.css("td.sdhk jdj").text
+ @address = html.css("table tr.ddad").text
end
- regist_handler do |result|
+ def handler result
p result
+ #=> { title: "...", url: "...", address: "..." }
end
-
end
-YahooScraper.new.execute("https://www.yahoo.com/")
+YahooScraper.execute ["https://www.yahoo.com/"]
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec maxwell` to use the gem in this directory, ignoring other installed copies of this gem.