Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/algonauti/yasf
Yet Another Scraper Framework
https://github.com/algonauti/yasf
Last synced: about 1 month ago
JSON representation
Yet Another Scraper Framework
- Host: GitHub
- URL: https://github.com/algonauti/yasf
- Owner: algonauti
- License: mit
- Created: 2012-09-26T17:55:49.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-05-15T15:02:17.000Z (over 9 years ago)
- Last Synced: 2024-10-31T14:40:04.972Z (about 2 months ago)
- Language: Ruby
- Size: 917 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Yasf
[![Build Status](https://travis-ci.org/algonauti/yasf.svg?branch=master)](https://travis-ci.org/algonauti/yasf)Web scraper
## Usage:
``gem install yasf``
## Scraping a page:
The simplest way to use yasf is by calling ``Yasf.crawl`` and passing it a block:
```ruby
require 'yasf'
result = Yasf.crawl do
base_url "http://www.wowebook.com"property :page_title, xpath: '/html/head/title'
collection :books, xpath: '//*[@id="content"]/div/article' do
property :title, xpath: 'header/h2/a/@title'do |data|
data.to_s.upcase
endproperty :description, xpath: 'div/p'
property :download, xpath: 'div/p/a' do
field :href
field :title
end
end
endputs result.page_title
result.books.each do |book|
puts "Book: #{book.title} -> #{book.description}"
end```
### [Wiki](http://github.com/algonauti/yasf/wiki)
## Copyright
Copyright (c) 2014 Algonauti