feedium 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/parse.rb +1 -1
- data/lib/feedium.rb +20 -6
- data/lib/feedium/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c30edaee350209df22641b98d9a71c5304052d65
|
4
|
+
data.tar.gz: 283e0d3c69211aa2bda023102b49cd16be590407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64ed566cf25077d6956c79b7dfcea583014dddfb02763da53e021d5c56a2e86e645a4ddf48a304ac962a51926fc2609570454fb10bb8fdb046219535f8e2fb67
|
7
|
+
data.tar.gz: d6df389edbe20371e837080700105eab42ae75ed6e9a90d672db027b1081c91eeb2ca606bcaf2a0495d4b96ec116a4c3b8531eb71af0111c16beed851a70d58b
|
data/examples/parse.rb
CHANGED
data/lib/feedium.rb
CHANGED
@@ -22,7 +22,8 @@ module Feedium
|
|
22
22
|
def self.find(url)
|
23
23
|
return @request.url if self.feed?(url)
|
24
24
|
|
25
|
-
|
25
|
+
@body = @body || @request.io.read
|
26
|
+
doc = Nokogiri::HTML(@body)
|
26
27
|
|
27
28
|
if doc.at('base') && doc.at('base')['href']
|
28
29
|
@base_uri = doc.at('base')['href']
|
@@ -64,13 +65,26 @@ module Feedium
|
|
64
65
|
content_type = @request.io.content_type.downcase
|
65
66
|
content_type = @request.io.meta['content-type'].gsub(/;.*$/, '') if content_type == 'application/octet-stream'
|
66
67
|
|
67
|
-
CONTENT_TYPES.include?(content_type) ? true : false
|
68
|
+
is_feed = CONTENT_TYPES.include?(content_type) ? true : false
|
69
|
+
|
70
|
+
if !is_feed
|
71
|
+
begin
|
72
|
+
@body = @request.io.read
|
73
|
+
is_feed = !self.parse(url, @body).class.name.index('Feedjira::Parser').nil?
|
74
|
+
rescue
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
is_feed
|
68
79
|
end
|
69
80
|
|
70
|
-
def self.parse(url)
|
71
|
-
|
72
|
-
|
81
|
+
def self.parse(url, content = nil)
|
82
|
+
if content.nil?
|
83
|
+
request = Request.new(url)
|
84
|
+
request.send
|
85
|
+
content = request.io.read
|
86
|
+
end
|
73
87
|
|
74
|
-
Feedjira::Feed.parse(
|
88
|
+
Feedjira::Feed.parse(content)
|
75
89
|
end
|
76
90
|
end
|
data/lib/feedium/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feedium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|