wreddit 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wreddit.rb +18 -3
- data/lib/wreddit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21c56dbe3a3be68cad2ad9ba317b49c04203acfc
|
4
|
+
data.tar.gz: 95a3377b29f22b2948099e9700ab08d52b2bc7b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3207ab3ed372fdc6949faa027cf020f8635aa7a5151c1c3c12ca6a61d413e306b4deb63bc8de8a53bfe7b7d747ad7912b81a9a833f89a0cf39ecd8ff334c4d17
|
7
|
+
data.tar.gz: d56b2447ee25646cc4d9e5f87e14a0042cf8c3f81d96a52d057700a805fb73f1dbc3e697e8ca6c3745eb645269e1d665026ea3e5bf84e26f50fe73ff42ecf5ed
|
data/lib/wreddit.rb
CHANGED
@@ -44,7 +44,12 @@ class Wreddit
|
|
44
44
|
# unique parsing (currently only works in JSON)
|
45
45
|
def links
|
46
46
|
links = []
|
47
|
-
|
47
|
+
begin
|
48
|
+
response = JSON.parse(self.json)
|
49
|
+
begin
|
50
|
+
rescue JSON::ParserError, TypeError => e
|
51
|
+
puts e
|
52
|
+
end
|
48
53
|
unless response['data']['children'].nil?
|
49
54
|
response['data']['children'].each do |child|
|
50
55
|
links.push(child['data']['url'])
|
@@ -57,7 +62,12 @@ class Wreddit
|
|
57
62
|
|
58
63
|
def titles
|
59
64
|
titles = []
|
60
|
-
|
65
|
+
begin
|
66
|
+
response = JSON.parse(self.json)
|
67
|
+
begin
|
68
|
+
rescue JSON::ParserError, TypeError => e
|
69
|
+
puts e
|
70
|
+
end
|
61
71
|
unless response['data']['children'].nil?
|
62
72
|
response['data']['children'].each do |child|
|
63
73
|
titles.push(child['data']['title'])
|
@@ -70,7 +80,12 @@ class Wreddit
|
|
70
80
|
|
71
81
|
def descriptions
|
72
82
|
descriptions = []
|
73
|
-
|
83
|
+
begin
|
84
|
+
response = JSON.parse(self.json)
|
85
|
+
begin
|
86
|
+
rescue JSON::ParserError, TypeError => e
|
87
|
+
puts e
|
88
|
+
end
|
74
89
|
unless response['data']['children'].nil?
|
75
90
|
response['data']['children'].each do |child|
|
76
91
|
descriptions.push(child['data']['selftext'])
|
data/lib/wreddit/version.rb
CHANGED