feedcellar 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +9 -0
- data/feedcellar.gemspec +1 -0
- data/lib/feedcellar/command.rb +7 -2
- data/lib/feedcellar/feed.rb +8 -22
- data/lib/feedcellar/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f55161aaf90f993ee60dc7a2b2a44b18de903a3
|
4
|
+
data.tar.gz: 467d81d5bcace2ea719ad534f639cee93b5cf884
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 621a9cab01fcec48aafb331cf1535e15510c457caee852ebb440a2b6ffd24ff78d54c15f32e44908ee64eaa3d065e4972e5c29b9c48f1f99a214cdc785f93b5e
|
7
|
+
data.tar.gz: a0c7bc298bcce0f6a209db8faf4595f4263cf05ed2aa8f139b5c15251c59a9bf1063bad332ea647533e4223bc1d8e87cf62b96c376bedf8324dbdd477b6ae62d
|
data/NEWS.md
CHANGED
data/feedcellar.gemspec
CHANGED
@@ -40,6 +40,7 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_runtime_dependency("rroonga", ">= 5.0.0")
|
41
41
|
spec.add_runtime_dependency("thor")
|
42
42
|
spec.add_runtime_dependency("parallel")
|
43
|
+
spec.add_runtime_dependency("feedjira")
|
43
44
|
|
44
45
|
spec.add_development_dependency("test-unit")
|
45
46
|
spec.add_development_dependency("test-unit-notify")
|
data/lib/feedcellar/command.rb
CHANGED
@@ -89,14 +89,19 @@ module Feedcellar
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
desc "collect", "Collect feeds from WWW."
|
92
|
+
desc "collect [FILTER_PATTERN]", "Collect feeds from WWW."
|
93
93
|
option :parallel, :type => :boolean, :desc => "run on multiple processes"
|
94
|
-
def collect
|
94
|
+
def collect(filter_pattern=nil)
|
95
95
|
GroongaDatabase.new.open(@database_dir) do |database|
|
96
96
|
resources = database.resources
|
97
97
|
collect_proc = lambda do |record|
|
98
98
|
feed_url = record.xmlUrl
|
99
|
+
|
99
100
|
next unless feed_url
|
101
|
+
if filter_pattern
|
102
|
+
regexp = Regexp.new(filter_pattern)
|
103
|
+
next unless regexp =~ feed_url
|
104
|
+
end
|
100
105
|
|
101
106
|
items = Feed.parse(feed_url)
|
102
107
|
next unless items
|
data/lib/feedcellar/feed.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# class Feedcellar::Feed
|
2
2
|
#
|
3
|
-
# Copyright (C) 2013-
|
3
|
+
# Copyright (C) 2013-2016 Masafumi Yokoyama <myokoym@gmail.com>
|
4
4
|
#
|
5
5
|
# This library is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# License along with this library; if not, write to the Free Software
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
|
-
require "
|
19
|
+
require "feedjira"
|
20
20
|
|
21
21
|
module Feedcellar
|
22
22
|
class Feed
|
@@ -32,32 +32,18 @@ module Feedcellar
|
|
32
32
|
feeds = []
|
33
33
|
|
34
34
|
begin
|
35
|
-
rss =
|
36
|
-
rescue RSS::InvalidRSSError
|
37
|
-
begin
|
38
|
-
rss = RSS::Parser.parse(feed_url, false)
|
39
|
-
rescue
|
40
|
-
$stderr.puts "WARNING: #{$!} (#{feed_url})"
|
41
|
-
return nil
|
42
|
-
end
|
35
|
+
rss = Feedjira::Feed.fetch_and_parse(feed_url)
|
43
36
|
rescue
|
44
37
|
$stderr.puts "WARNING: #{$!} (#{feed_url})"
|
45
38
|
return nil
|
46
39
|
end
|
47
40
|
return nil unless rss
|
48
41
|
|
49
|
-
rss.
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
date = item.updated.content if item.updated
|
55
|
-
else
|
56
|
-
title = item.title
|
57
|
-
link = item.link
|
58
|
-
description = item.description
|
59
|
-
date = item.date
|
60
|
-
end
|
42
|
+
rss.entries.each do |entry|
|
43
|
+
title = entry.title
|
44
|
+
link = entry.url
|
45
|
+
description = entry.summary || entry.content
|
46
|
+
date = entry.published || entry.updated
|
61
47
|
|
62
48
|
next unless link
|
63
49
|
|
data/lib/feedcellar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feedcellar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masafumi Yokoyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rroonga
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: feedjira
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: test-unit
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|