feedalizer 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ .DS_Store
12
+ .idea
13
+ ._*
14
+ .~*
15
+ *.swp
16
+ *.iml
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in feedalizer.gemspec
4
+ gemspec
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.
@@ -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 "hoe"
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
@@ -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
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -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__), "..", "lib")
5
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
6
6
 
7
- require "feedalizer"
8
- require "time"
7
+ require 'feedalizer'
8
+ require 'time'
9
9
 
10
- feedalize("http://pjvault.com/news.html") do
11
- feed.title = "Pearl Jam Vault"
12
- feed.description = "Pearl Jam News and Reviews"
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("li") do |rss_item, html_element|
15
- link = html_element.search("a").first
14
+ scrape_items('//LI') do |rss_item, html_element|
15
+ link = html_element.xpath('a').first
16
16
 
17
- rss_item.link = link.attributes["href"]
18
- rss_item.date = Time.parse(html_element.to_s)
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.inner_html
20
+ rss_item.description = html_element.inner_text
22
21
  end
23
22
 
24
23
  output!
@@ -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
@@ -1,65 +1,58 @@
1
- require "rss/maker"
2
- require "open-uri"
3
- require "hpricot"
1
+ require 'feedalizer/version'
2
+ require 'rss/maker'
3
+ require 'open-uri'
4
+ require 'oga'
4
5
 
5
- class Feedalizer
6
- VERSION = "0.1.2"
7
- IDENTIFIER = "Feedalizer/#{VERSION} (http://termos.vemod.net/feedalizer)"
8
-
9
- attr_reader :page
6
+ module Feedalizer
7
+ class Feed
8
+ IDENTIFIER = "Feedalizer/#{Feedalizer::VERSION} (https://github.com/michaelrigart/feedalizer)"
10
9
 
11
- def initialize(url, &block)
12
- @page = grab_page(url)
13
- @rss = RSS::Maker::RSS20.new
10
+ attr_reader :page
14
11
 
15
- feed.generator = IDENTIFIER
16
- feed.link = url
17
- feed.description = "Scraped from #{url}"
12
+ def initialize(url, &block)
13
+ @page = grab_page(url)
14
+ @rss = RSS::Maker::RSS20.new
18
15
 
19
- instance_eval(&block) if block
20
- end
16
+ feed.generator = IDENTIFIER
17
+ feed.link = url
18
+ feed.description = "Scraped from #{url}"
21
19
 
22
- def feed
23
- @rss.channel
24
- end
20
+ instance_eval(&block) if block
21
+ end
25
22
 
26
- def scrape_items(hpricot_query, limit = 15)
27
- elements = @page.search(hpricot_query)
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
- def grab_page(url)
36
- open(url) { |io| Hpricot(io) }
37
- end
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
- def output
40
- if @rss.respond_to?(:to_feed) # Ruby >= 1.8.7
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
- def output!(target = STDOUT)
48
- target << output
49
- end
44
+ def output!(target = STDOUT)
45
+ target << output
46
+ end
50
47
 
51
- def debug!
52
- @rss.items.each do |item|
53
- STDERR.puts [ item.title, item.date, item.link ].join("; ")
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
@@ -0,0 +1,3 @@
1
+ module Feedalizer
2
+ VERSION = '0.2.0'
3
+ end
@@ -2,25 +2,25 @@
2
2
 
3
3
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
4
 
5
- require "test/unit"
6
- require "feedalizer"
5
+ require 'minitest/autorun'
6
+ require 'feedalizer'
7
7
 
8
- class TestFeedalizer < Test::Unit::TestCase
9
- TEST_FILE = File.join(File.dirname(__FILE__), "test.html")
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 Hpricot::Doc, @feedalizer.page
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 } rescue nil
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 "Test", @feedalizer.page.search("html/head/title").text
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("div.item") do |item, element|
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 Hpricot::Elem, element
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("div.item", 1) do |item, element|
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 Hpricot::Doc, @feedalizer.grab_page(TEST_FILE)
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?("Feedalizer")
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?("<rss")
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.1.2
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: bin
10
+ bindir: exe
10
11
  cert_chain: []
11
-
12
- date: 2009-11-23 00:00:00 +01:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: hpricot
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
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: hoe
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
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.8.0
34
- version:
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 Hpricot with the
37
- standard RSS library in a way that makes it easy to transform web pages into
38
- RSS feeds. If you ask me, it makes it *too* easy.
39
- email:
40
- - christoffer.sawicki@gmail.com
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
- extra_rdoc_files:
46
- - CHANGELOG.txt
47
- - COPYING.txt
48
- - Manifest.txt
49
- - README.txt
50
- - TODO.txt
51
- files:
52
- - bin/feedalizer
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
- - examples/sydsvenskan-nemi.rb
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
- - TODO.txt
65
- has_rdoc: true
66
- homepage: http://termos.vemod.net/feedalizer
67
- licenses: []
68
-
80
+ homepage: https://github.com/michaelrigart/feedalizer
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
69
84
  post_install_message:
70
- rdoc_options:
71
- - --main
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: "0"
80
- version:
81
- required_rubygems_version: !ruby/object:Gem::Requirement
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: "0"
86
- version:
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
87
98
  requirements: []
88
-
89
- rubyforge_project: feedalizer
90
- rubygems_version: 1.3.5
99
+ rubyforge_project:
100
+ rubygems_version: 2.4.5
91
101
  signing_key:
92
- specification_version: 3
93
- summary: Transforms web pages into RSS feeds
102
+ specification_version: 4
103
+ summary: Ruby library to transform web pages into RSS feeds.
94
104
  test_files: []
95
-
@@ -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.
@@ -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.
@@ -1,13 +0,0 @@
1
- bin/feedalizer
2
- CHANGELOG.txt
3
- COPYING.txt
4
- examples/pjvault.rb
5
- examples/sydsvenskan-nemi.rb
6
- lib/feedalizer.rb
7
- logo.svg
8
- Manifest.txt
9
- Rakefile
10
- README.txt
11
- tests/test.html
12
- tests/test_feedalizer.rb
13
- TODO.txt
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
@@ -1,7 +0,0 @@
1
- * Add more examples
2
- * Write some documentation (tutorial?)
3
- * Add note about CGI
4
- * Cache the retrieved HTML during script development?
5
- * Write unit test(s) for debug mode.
6
- * Add timeout control (a bit tricky to do nicely)
7
- * Restructure CHANGELOG.txt
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "feedalizer"
4
-
5
- eval(ARGF.read)
@@ -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