feedalizer 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/Gemfile +4 -0
- data/LICENSE +19 -0
- data/README.md +40 -0
- data/Rakefile +1 -13
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/examples/pjvault.rb +11 -12
- data/feedalizer.gemspec +30 -0
- data/lib/feedalizer.rb +39 -46
- data/lib/feedalizer/version.rb +3 -0
- data/tests/test_feedalizer.rb +21 -26
- metadata +83 -74
- data/CHANGELOG.txt +0 -7
- data/COPYING.txt +0 -18
- data/Manifest.txt +0 -13
- data/README.txt +0 -24
- data/TODO.txt +0 -7
- data/bin/feedalizer +0 -5
- data/examples/sydsvenskan-nemi.rb +0 -28
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0f9d3ffbc7dc6296bf18bc94cd999592f788e813
|
4
|
+
data.tar.gz: 65edab2aeb654ae667f8383bce810683cace8273
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cc579dec7cb4956b79724e0905694288fbba120dd5b0998b6822492fcda349f42a373570f501d80c5e78598ab91d3e9a5db40a4b4848441c8e615b957ba33148
|
7
|
+
data.tar.gz: f4b56bb1bf76eabc9604efb852b191a90ae69c3bb1462c9c0994f20672f383628bf8de49397a85c11157f4782f3d344867b797a629221932fc2a025a5670e7fe
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) <2015> Michaël Rigart <michael@netronix.be>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
[![Code Climate](https://codeclimate.com/github/michaelrigart/feedalizer/badges/gpa.svg)](https://codeclimate.com/github/michaelrigart/feedalizer)
|
2
|
+
|
3
|
+
# Feedalizer
|
4
|
+
|
5
|
+
Feedalizer is a *small* Ruby library that glues together Oga with the standard RSS library in a way that makes it easy to transform web pages into RSS feeds. If you ask me, it makes it *too* easy.
|
6
|
+
|
7
|
+
This gem was originally created by [Christoffer Sawicki](http://qerub.se/feedalizer) who made the last version 0.1.2. During my search for a way to convert web pages to RSS feeds, I came upon this Gem and decided to revive it again. It originally used [Hpricot](https://github.com/hpricot/hpricot) which isn't supported anymore. So I just yanked it out and replaced it with [Oga](https://github.com/YorickPeterse/oga).
|
8
|
+
|
9
|
+
In the process, I made some minor adjustments to the Gem layout.
|
10
|
+
|
11
|
+
Christoffer has been so kind to grant me author approval on RubyGems.org so I could make the necessary changes to update this gem.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'feedalizer'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install feedalizer
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
First of all, see the included examples and take a quick look at the code.
|
32
|
+
|
33
|
+
## Development
|
34
|
+
|
35
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/michaelrigart/feedalizer.
|
40
|
+
|
data/Rakefile
CHANGED
@@ -1,14 +1,2 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
2
|
|
3
|
-
$LOAD_PATH.unshift("lib")
|
4
|
-
|
5
|
-
require "feedalizer"
|
6
|
-
|
7
|
-
Hoe.new("feedalizer", Feedalizer::VERSION) do |p|
|
8
|
-
p.summary = "Transforms web pages into RSS feeds"
|
9
|
-
p.developer "Christoffer Sawicki", "christoffer.sawicki@gmail.com"
|
10
|
-
p.extra_deps = %<hpricot>
|
11
|
-
p.changes = "" # See CHANGELOG.txt
|
12
|
-
|
13
|
-
# All other necessary information is collected from README.txt
|
14
|
-
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'feedalizer'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/examples/pjvault.rb
CHANGED
@@ -2,23 +2,22 @@
|
|
2
2
|
|
3
3
|
# This script was contributed by Christian Neukirchen, thanks!
|
4
4
|
|
5
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),
|
5
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
6
6
|
|
7
|
-
require
|
8
|
-
require
|
7
|
+
require 'feedalizer'
|
8
|
+
require 'time'
|
9
9
|
|
10
|
-
feedalize(
|
11
|
-
feed.title =
|
12
|
-
feed.description =
|
10
|
+
feedalize('http://pjvault.com/news77.html') do
|
11
|
+
feed.title = 'Pearl Jam Vault'
|
12
|
+
feed.description = 'Pearl Jam News and Reviews'
|
13
13
|
|
14
|
-
scrape_items(
|
15
|
-
link = html_element.
|
14
|
+
scrape_items('//LI') do |rss_item, html_element|
|
15
|
+
link = html_element.xpath('a').first
|
16
16
|
|
17
|
-
rss_item.link = link.
|
18
|
-
rss_item.
|
19
|
-
rss_item.title = link.children.last.to_s
|
17
|
+
rss_item.link = link.get('href')
|
18
|
+
rss_item.title = link.inner_text
|
20
19
|
|
21
|
-
rss_item.description = html_element.
|
20
|
+
rss_item.description = html_element.inner_text
|
22
21
|
end
|
23
22
|
|
24
23
|
output!
|
data/feedalizer.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'feedalizer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'feedalizer'
|
8
|
+
spec.version = Feedalizer::VERSION
|
9
|
+
spec.authors = ['Michaël Rigart', 'Christoffer Sawicki']
|
10
|
+
spec.email = ['michael@netronix.be']
|
11
|
+
|
12
|
+
spec.summary = 'Ruby library to transform web pages into RSS feeds.'
|
13
|
+
spec.description = 'Feedalizer is a *small* Ruby library that glues together
|
14
|
+
Hpricot with the standard RSS library in a way that makes it easy to transform
|
15
|
+
web pages into RSS feeds. If you ask me, it makes it *too* easy.'
|
16
|
+
|
17
|
+
spec.homepage = 'https://github.com/michaelrigart/feedalizer'
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
spec.license = 'MIT'
|
25
|
+
|
26
|
+
spec.add_dependency 'oga', '~> 1.2'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
29
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
30
|
+
end
|
data/lib/feedalizer.rb
CHANGED
@@ -1,65 +1,58 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'feedalizer/version'
|
2
|
+
require 'rss/maker'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'oga'
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
attr_reader :page
|
6
|
+
module Feedalizer
|
7
|
+
class Feed
|
8
|
+
IDENTIFIER = "Feedalizer/#{Feedalizer::VERSION} (https://github.com/michaelrigart/feedalizer)"
|
10
9
|
|
11
|
-
|
12
|
-
@page = grab_page(url)
|
13
|
-
@rss = RSS::Maker::RSS20.new
|
10
|
+
attr_reader :page
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
def initialize(url, &block)
|
13
|
+
@page = grab_page(url)
|
14
|
+
@rss = RSS::Maker::RSS20.new
|
18
15
|
|
19
|
-
|
20
|
-
|
16
|
+
feed.generator = IDENTIFIER
|
17
|
+
feed.link = url
|
18
|
+
feed.description = "Scraped from #{url}"
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
end
|
20
|
+
instance_eval(&block) if block
|
21
|
+
end
|
25
22
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
elements.first(limit).each do |html_element|
|
30
|
-
rss_item = @rss.items.new_item
|
31
|
-
yield rss_item, html_element
|
23
|
+
def feed
|
24
|
+
@rss.channel
|
32
25
|
end
|
33
|
-
end
|
34
26
|
|
35
|
-
|
36
|
-
|
37
|
-
|
27
|
+
def scrape_items(query, limit = 15)
|
28
|
+
elements = @page.xpath(query)
|
29
|
+
|
30
|
+
elements.first(limit).each do |html_element|
|
31
|
+
rss_item = @rss.items.new_item
|
32
|
+
yield rss_item, html_element
|
33
|
+
end
|
34
|
+
end
|
38
35
|
|
39
|
-
|
40
|
-
|
36
|
+
def grab_page(url)
|
37
|
+
open(url) { |io| Oga.parse_html(io) }
|
38
|
+
end
|
39
|
+
|
40
|
+
def output
|
41
41
|
@rss.to_feed.to_s
|
42
|
-
else
|
43
|
-
@rss.to_rss.to_s
|
44
42
|
end
|
45
|
-
end
|
46
43
|
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
def output!(target = STDOUT)
|
45
|
+
target << output
|
46
|
+
end
|
50
47
|
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
def debug!
|
49
|
+
@rss.items.each do |item|
|
50
|
+
STDERR.puts [item.title, item.date, item.link].join('; ')
|
51
|
+
end
|
54
52
|
end
|
55
53
|
end
|
56
|
-
|
57
|
-
# Backwards-compatibility
|
58
|
-
alias_method :parse_source, :grab_page
|
59
|
-
alias_method :source, :page
|
60
54
|
end
|
61
|
-
|
62
55
|
# A handy wrapper for Feedalizer.new :-)
|
63
56
|
def feedalize(*args, &block)
|
64
|
-
Feedalizer.new(*args, &block)
|
57
|
+
Feedalizer::Feed.new(*args, &block)
|
65
58
|
end
|
data/tests/test_feedalizer.rb
CHANGED
@@ -2,25 +2,25 @@
|
|
2
2
|
|
3
3
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require 'minitest/autorun'
|
6
|
+
require 'feedalizer'
|
7
7
|
|
8
|
-
class TestFeedalizer < Test
|
9
|
-
TEST_FILE = File.join(File.dirname(__FILE__),
|
8
|
+
class TestFeedalizer < Minitest::Test
|
9
|
+
TEST_FILE = File.join(File.dirname(__FILE__), 'test.html')
|
10
10
|
|
11
11
|
def setup
|
12
|
-
@feedalizer = Feedalizer.new(TEST_FILE)
|
12
|
+
@feedalizer = Feedalizer::Feed.new(TEST_FILE)
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_construction
|
16
16
|
assert_kind_of RSS::Maker::RSS20::Channel, @feedalizer.feed
|
17
|
-
assert_kind_of
|
17
|
+
assert_kind_of Oga::XML::Document, @feedalizer.page
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_block
|
21
21
|
inside = nil
|
22
|
-
Feedalizer.new(TEST_FILE) { inside = self }
|
23
|
-
assert_kind_of Feedalizer, inside
|
22
|
+
Feedalizer::Feed.new(TEST_FILE) { inside = self }
|
23
|
+
assert_kind_of Feedalizer::Feed, inside
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_defaults
|
@@ -29,17 +29,17 @@ class TestFeedalizer < Test::Unit::TestCase
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_page
|
32
|
-
assert_equal
|
32
|
+
assert_equal 'Test', @feedalizer.page.xpath('/html/head/title').text
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_scrape_items
|
36
36
|
elements = []
|
37
37
|
|
38
|
-
@feedalizer.scrape_items("
|
38
|
+
@feedalizer.scrape_items('//div[@class="item"]') do |item, element|
|
39
39
|
elements << element
|
40
40
|
|
41
41
|
assert_kind_of RSS::Maker::RSS20::Items::Item, item
|
42
|
-
assert_kind_of
|
42
|
+
assert_kind_of Oga::XML::Element, element
|
43
43
|
end
|
44
44
|
|
45
45
|
assert_equal 2, elements.size
|
@@ -48,7 +48,7 @@ class TestFeedalizer < Test::Unit::TestCase
|
|
48
48
|
def test_scrape_items_limit
|
49
49
|
elements = []
|
50
50
|
|
51
|
-
@feedalizer.scrape_items("
|
51
|
+
@feedalizer.scrape_items('//div[@class="item"]', 1) do |_item, element|
|
52
52
|
elements << element
|
53
53
|
end
|
54
54
|
|
@@ -56,30 +56,25 @@ class TestFeedalizer < Test::Unit::TestCase
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def test_grab_page
|
59
|
-
assert_kind_of
|
59
|
+
assert_kind_of Oga::XML::Document, @feedalizer.grab_page(TEST_FILE)
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
def test_existance_of_generator
|
63
63
|
f = @feedalizer.feed
|
64
|
-
|
65
|
-
f.about = f.title = f.description =
|
66
|
-
|
67
|
-
assert @feedalizer.output.include?(
|
64
|
+
|
65
|
+
f.about = f.title = f.description = '...'
|
66
|
+
|
67
|
+
assert @feedalizer.output.include?('Feedalizer')
|
68
68
|
end
|
69
69
|
|
70
70
|
def test_output
|
71
71
|
f = @feedalizer.feed
|
72
|
-
|
73
|
-
f.about = f.title = f.description =
|
72
|
+
|
73
|
+
f.about = f.title = f.description = '...'
|
74
74
|
|
75
75
|
output = @feedalizer.output
|
76
76
|
|
77
|
-
assert output.include?(
|
77
|
+
assert output.include?('<rss')
|
78
78
|
assert output.size > 320
|
79
79
|
end
|
80
|
-
|
81
|
-
def test_backwards_compatibility
|
82
|
-
assert @feedalizer.respond_to?(:page)
|
83
|
-
assert @feedalizer.respond_to?(:parse_source)
|
84
|
-
end
|
85
80
|
end
|
metadata
CHANGED
@@ -1,95 +1,104 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: feedalizer
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
|
+
- Michaël Rigart
|
7
8
|
- Christoffer Sawicki
|
8
9
|
autorequire:
|
9
|
-
bindir:
|
10
|
+
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
date: 2015-08-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: oga
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.2'
|
17
21
|
type: :runtime
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - "
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.2'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.10'
|
27
35
|
type: :development
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
34
|
-
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.10'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '10.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '10.0'
|
35
56
|
description: |-
|
36
|
-
Feedalizer is a *small* Ruby library that glues together
|
37
|
-
standard RSS library in a way that makes it easy to transform
|
38
|
-
RSS feeds. If you ask me, it makes it *too* easy.
|
39
|
-
email:
|
40
|
-
-
|
41
|
-
executables:
|
42
|
-
- feedalizer
|
57
|
+
Feedalizer is a *small* Ruby library that glues together
|
58
|
+
Hpricot with the standard RSS library in a way that makes it easy to transform
|
59
|
+
web pages into RSS feeds. If you ask me, it makes it *too* easy.
|
60
|
+
email:
|
61
|
+
- michael@netronix.be
|
62
|
+
executables: []
|
43
63
|
extensions: []
|
44
|
-
|
45
|
-
|
46
|
-
-
|
47
|
-
-
|
48
|
-
-
|
49
|
-
- README.
|
50
|
-
-
|
51
|
-
|
52
|
-
- bin/
|
53
|
-
- CHANGELOG.txt
|
54
|
-
- COPYING.txt
|
64
|
+
extra_rdoc_files: []
|
65
|
+
files:
|
66
|
+
- ".gitignore"
|
67
|
+
- Gemfile
|
68
|
+
- LICENSE
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- bin/console
|
72
|
+
- bin/setup
|
55
73
|
- examples/pjvault.rb
|
56
|
-
-
|
74
|
+
- feedalizer.gemspec
|
57
75
|
- lib/feedalizer.rb
|
76
|
+
- lib/feedalizer/version.rb
|
58
77
|
- logo.svg
|
59
|
-
- Manifest.txt
|
60
|
-
- Rakefile
|
61
|
-
- README.txt
|
62
78
|
- tests/test.html
|
63
79
|
- tests/test_feedalizer.rb
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
80
|
+
homepage: https://github.com/michaelrigart/feedalizer
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
69
84
|
post_install_message:
|
70
|
-
rdoc_options:
|
71
|
-
|
72
|
-
- README.txt
|
73
|
-
require_paths:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
74
87
|
- lib
|
75
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
-
requirements:
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
77
90
|
- - ">="
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version:
|
80
|
-
|
81
|
-
|
82
|
-
requirements:
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
83
95
|
- - ">="
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version:
|
86
|
-
version:
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
87
98
|
requirements: []
|
88
|
-
|
89
|
-
|
90
|
-
rubygems_version: 1.3.5
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.4.5
|
91
101
|
signing_key:
|
92
|
-
specification_version:
|
93
|
-
summary:
|
102
|
+
specification_version: 4
|
103
|
+
summary: Ruby library to transform web pages into RSS feeds.
|
94
104
|
test_files: []
|
95
|
-
|
data/CHANGELOG.txt
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
Noteworthy changes:
|
2
|
-
|
3
|
-
2006-08-23: Added optional limit parameter to scrape_items. (Thanks to Thanh Vinh Tang for the hint that it is needed.)
|
4
|
-
2006-10-11: Release of version 0.1.0.
|
5
|
-
2007-07-09: Feedalizer now uses RSS 2.0 instead of RSS 1.0.
|
6
|
-
2008-03-27: Improved examples/sydsvenskan-nemi.rb.
|
7
|
-
2008-03-27: Release of version 0.1.1.
|
data/COPYING.txt
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
Copyright (c) 2006-2008 Christoffer Sawicki <christoffer.sawicki@gmail.com>
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to
|
5
|
-
deal in the Software without restriction, including without limitation the
|
6
|
-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
-
sell copies of the Software, and to permit persons to whom the Software is
|
8
|
-
furnished to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
11
|
-
all copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
16
|
-
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
DELETED
data/README.txt
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
= Feedalizer
|
2
|
-
|
3
|
-
http://termos.vemod.net/feedalizer
|
4
|
-
|
5
|
-
== Description
|
6
|
-
|
7
|
-
Feedalizer is a *small* Ruby library that glues together Hpricot with the
|
8
|
-
standard RSS library in a way that makes it easy to transform web pages into
|
9
|
-
RSS feeds. If you ask me, it makes it *too* easy.
|
10
|
-
|
11
|
-
== Documentation
|
12
|
-
|
13
|
-
First of all, see the included examples and take a quick look at the code.
|
14
|
-
|
15
|
-
Then read some documentation for the two libraries that are used:
|
16
|
-
|
17
|
-
* Hpricot:
|
18
|
-
http://code.whytheluckystiff.net/hpricot/
|
19
|
-
* RSS::Maker:
|
20
|
-
http://www.cozmixng.org/~rwiki/?cmd=view;name=RSS+Parser%3A%3AReference.en
|
21
|
-
|
22
|
-
== License
|
23
|
-
|
24
|
-
See link:COPYING.txt.
|
data/TODO.txt
DELETED
data/bin/feedalizer
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
4
|
-
|
5
|
-
require "feedalizer"
|
6
|
-
require "time"
|
7
|
-
|
8
|
-
feedalize("http://sydsvenskan.se/serier/nemi/index.jsp?context=serie") do
|
9
|
-
feed.title = "Nemi"
|
10
|
-
feed.description = "Daily Nemi strip scraped from Sydsvenskan"
|
11
|
-
|
12
|
-
scrape_items("option") do |rss_item, html_element|
|
13
|
-
link = html_element.attributes["value"]
|
14
|
-
date = Time.parse(html_element.inner_html)
|
15
|
-
|
16
|
-
rss_item.title = [feed.title, date.strftime("%Y-%m-%d")].join(", ")
|
17
|
-
rss_item.description = grab_page(link).search("//img[@width=600]")
|
18
|
-
rss_item.date = date
|
19
|
-
rss_item.link = link
|
20
|
-
|
21
|
-
rss_item.guid.isPermaLink = true
|
22
|
-
rss_item.guid.content = link
|
23
|
-
end
|
24
|
-
|
25
|
-
if __FILE__ == $0
|
26
|
-
output!(ARGV[0] ? File.open(ARGV[0], "w") : STDOUT)
|
27
|
-
end
|
28
|
-
end
|