reddit_bot 1.5.4 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a923835e5dce5295e1f05fd79ae40ed2f9541bc9
4
- data.tar.gz: 72bbf9aec3c05fe6ccd222e35ebf5bb725206385
3
+ metadata.gz: a756bbcad28e9879156bae2d179a1a0ffbfd23cb
4
+ data.tar.gz: 445b9143887ba23365e3d63bfeb588da2ecc2e89
5
5
  SHA512:
6
- metadata.gz: ee1e05ae9fe6f118cef51d12477fe212199414f9d1583868a75cc3890912d4370f2a8764d119c40fbd0e5a2fdbe8c6cc45e6eb98ea895e9143f64845e45c9a89
7
- data.tar.gz: c7146ba14d38b31565ba1dbe2884f0ffc336592962753fb38370a59a3420762d0dfeb620562b16f3c552e1f36b7bbdae23915293e23cd2bf580b63fd27afb0ff
6
+ metadata.gz: 44c2a8ab8d5e4efe84903868750211add7aa7d7375b27d152792d5d360d68df5532fa03d03a1b9e65ab9c56a83c464f854c15bfa2a9d71849f09d97b5a524418
7
+ data.tar.gz: 9b8d687724b41b0ba8c8a400afd9c66fcc6961bb00660e4891032487190d9f6b935dfbfb51c582016455cb8d23847b695312a5942310dbbdef75a3423d119797
@@ -1,4 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "reddit_bot", "~>1.3.0"
4
- gem "nethttputils", git: "git@github.com:Nakilon/nethttputils.git", tag: "v0.0.3.1"
3
+ gem "reddit_bot", "~>1.5.4"
4
+ gem "nethttputils", git: "git@github.com:Nakilon/nethttputils.git", tag: "v0.1.0.4"
@@ -1,15 +1,15 @@
1
1
  GIT
2
2
  remote: git@github.com:Nakilon/nethttputils.git
3
- revision: 856f3a44f48c314ed3fdcf4532f7a7dd85ec31ef
4
- tag: v0.0.3.1
3
+ revision: 6cb2b6a2422d82e266e08b16da4fa29e809fd260
4
+ tag: v0.1.0.4
5
5
  specs:
6
- nethttputils (0.0.3.1)
6
+ nethttputils (0.1.0.4)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  json (2.1.0)
12
- reddit_bot (1.3.0)
12
+ reddit_bot (1.5.4)
13
13
  json
14
14
 
15
15
  PLATFORMS
@@ -17,7 +17,7 @@ PLATFORMS
17
17
 
18
18
  DEPENDENCIES
19
19
  nethttputils!
20
- reddit_bot (~> 1.3.0)
20
+ reddit_bot (~> 1.5.4)
21
21
 
22
22
  BUNDLED WITH
23
- 1.16.0
23
+ 1.16.1
@@ -3,7 +3,6 @@
3
3
  BOT = RedditBot::Bot.new YAML.load File.read "secrets.yaml"
4
4
 
5
5
  loop do
6
- Hearthbeat.beat "u_DevFlairBot_r_ion_r_survivetheculling", 130 unless Gem::Platform.local.os == "darwin"
7
6
  puts "LOOP #{Time.now}"
8
7
 
9
8
  [
@@ -15,7 +14,8 @@ loop do
15
14
  JSON.parse( begin
16
15
  NetHTTPUtils.request_data "https://www.reddit.com/r/#{subreddit}/comments.json", header: ["User-Agent", "ajsdjasdasd"]
17
16
  rescue NetHTTPUtils::Error => e
18
- raise unless e.code == 503
17
+ raise unless [503, 504].include? e.code
18
+ sleep 60
19
19
  retry
20
20
  end )["data"]["children"].each do |comment|
21
21
  id = comment["data"]["link_id"][3..-1]
@@ -2,14 +2,14 @@
2
2
 
3
3
  gem "json"
4
4
 
5
- gem "nethttputils", git: "git@github.com:Nakilon/nethttputils.git", tag: "v0.1.0.1"
5
+ gem "nethttputils", git: "git@github.com:Nakilon/nethttputils.git", tag: "v0.1.2.0"
6
6
 
7
7
  gem "reddit_bot", "~>1.5.2"
8
8
  gem "nokogiri"
9
9
 
10
10
  gem "imgur2array", git: "git@github.com:Nakilon/imgur2array.git", tag: "v0.0.2.9"
11
11
  gem "fastimage", "~>1.7.0"
12
- gem "url2dimensions", git: "git@github.com:Nakilon/url2dimensions.git", tag: "v0.0.0.4"
12
+ gem "url2dimensions", git: "git@github.com:Nakilon/url2dimensions.git", tag: "v0.0.0.6"
13
13
 
14
14
  gem "gcplogger", git: "git@github.com:Nakilon/gcplogger.git", tag: "v0.0.2.0"
15
15
  gem "google-cloud-error_reporting"
@@ -15,17 +15,17 @@ GIT
15
15
 
16
16
  GIT
17
17
  remote: git@github.com:Nakilon/nethttputils.git
18
- revision: 9e357649157955d0fc476b88966aa9a4435ff57a
19
- tag: v0.1.0.1
18
+ revision: 620051619245a3b0b00447817831c6fb676d3df7
19
+ tag: v0.1.2.0
20
20
  specs:
21
- nethttputils (0.1.0.1)
21
+ nethttputils (0.1.2.0)
22
22
 
23
23
  GIT
24
24
  remote: git@github.com:Nakilon/url2dimensions.git
25
- revision: 7364b82617bcdb7fafd5dd2bee268fedefe24074
26
- tag: v0.0.0.4
25
+ revision: 2aae1c5a8a8f8d06c38ae3ab370ed4ed4c5d7a4b
26
+ tag: v0.0.0.6
27
27
  specs:
28
- url2dimensions (0.0.0.4)
28
+ url2dimensions (0.0.0.6)
29
29
 
30
30
  GEM
31
31
  remote: https://rubygems.org/
@@ -112,4 +112,4 @@ DEPENDENCIES
112
112
  url2dimensions!
113
113
 
114
114
  BUNDLED WITH
115
- 1.16.0
115
+ 1.16.1
@@ -44,7 +44,7 @@ fail unless 1 == search_url["https://i.imgur.com/9JTxtjW.jpg"].size
44
44
 
45
45
  loop do
46
46
  begin
47
- logger.warn "LOOP #{Time.now}"
47
+ logger.info "LOOP #{Time.now}"
48
48
  rescue => e
49
49
  puts "oops"
50
50
  Google::Cloud::ErrorReporting.report e
@@ -84,7 +84,8 @@ loop do
84
84
  checked << id
85
85
  # next if Gem::Platform.local.os == "darwin" # prevent concurrent posting
86
86
  logger.debug "image url for #{id}: #{url}"
87
- next logger.warn "skipped a post by /u/sjhill" if author == "sjhill"
87
+ next logger.warn "skipped a post by /u/sjhill" if author == "sjhill" # opt-out
88
+ next logger.warn "skipped a post by /u/bekalaki" if author == "bekalaki" # 9 ways to divide karmawhore
88
89
 
89
90
  next logger.warn "skipped (URL2Dimensions :skipped) #{url} from http://redd.it/#{id}" if :skipped == _ = begin
90
91
  URL2Dimensions::get_dimensions CGI.unescape_html url
@@ -97,7 +98,7 @@ loop do
97
98
  width, height, best_direct_url, *all_direct_urls = _
98
99
  logger.info "URL2Dimensions: %p" % [[width, height, best_direct_url, all_direct_urls.size]]
99
100
  unless min_resolution <= width * height
100
- next logger.info "skipped low resolution #{source}"
101
+ next logger.debug "skipped low resolution #{source}"
101
102
  end
102
103
  # next if Gem::Platform.local.os == "darwin" # prevent concurrent posting
103
104
  # puts "https://www.reddit.com/r/LargeImages/search.json?q=url%3A#{CGI.escape url}&restrict_sr=on"
@@ -155,6 +156,6 @@ loop do
155
156
  end
156
157
  end
157
158
 
158
- logger.warn "END LOOP #{Time.now}"
159
+ logger.info "END LOOP #{Time.now}"
159
160
  sleep 300
160
161
  end
@@ -0,0 +1 @@
1
+ echo "TEST=_ bundle exec ruby main.rb"
@@ -1,4 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gem "reddit_bot", "~>1.5.3"
4
- gem "nethttputils", git: "git@github.com:Nakilon/nethttputils.git", tag: "v0.1.0.1"
4
+ gem "nethttputils", git: "git@github.com:Nakilon/nethttputils.git", tag: "v0.1.0.4"
@@ -1,9 +1,9 @@
1
1
  GIT
2
2
  remote: git@github.com:Nakilon/nethttputils.git
3
- revision: 9e357649157955d0fc476b88966aa9a4435ff57a
4
- tag: v0.1.0.1
3
+ revision: 6cb2b6a2422d82e266e08b16da4fa29e809fd260
4
+ tag: v0.1.0.4
5
5
  specs:
6
- nethttputils (0.1.0.1)
6
+ nethttputils (0.1.0.4)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -20,4 +20,4 @@ DEPENDENCIES
20
20
  reddit_bot (~> 1.5.3)
21
21
 
22
22
  BUNDLED WITH
23
- 1.16.0
23
+ 1.16.1
@@ -201,44 +201,8 @@ module RedditBot
201
201
  end
202
202
 
203
203
  def reddit_resp *args
204
- response = nil
205
- tap do
206
- response = _resp *args
207
- case response.code
208
- when "502", "503", "520", "500", "521", "504", "400", "522", "504"
209
- puts "LOL #{response.code} at #{Time.now}?"
210
- p args
211
- sleep 60
212
- redo
213
- when "409"
214
- puts "Conflict (409)? at #{Time.now}?"
215
- p args
216
- sleep 5
217
- redo
218
- when "401"
219
- puts "probably token is expired (401): #{response.body}"
220
- sleep 5
221
- # init *@secrets
222
- @token_cached = nil # maybe just update_captcha?
223
- throw :"401"
224
- when "403"
225
- puts "access denied: #{response.body} when requesting: #{args}"
226
- sleep 300
227
- redo
228
- # throw :"403"
229
- when "200"
230
- "ok"
231
- else
232
- # puts response.body if response.code == "400"
233
- # fail "#{response.code} at '#{args[1]}'"
234
- fail "#{response.code} for '#{args}'"
235
- end
236
- end
237
- response.body
238
- end
239
-
240
- def _resp mtd, url, form, headers, base_auth = nil
241
- NetHTTPUtils.get_response(url, mtd, form: form, header: headers, auth: base_auth).tap do |response|
204
+ mtd, url, form, headers, base_auth = *args
205
+ NetHTTPUtils.request_data(url, mtd, form: form, header: headers, auth: base_auth) do |response|
242
206
  next unless remaining = response.to_hash["x-ratelimit-remaining"]
243
207
  if Gem::Platform.local.os == "darwin"
244
208
  puts %w{
@@ -1,3 +1,3 @@
1
1
  module RedditBot
2
- VERSION = "1.5.4" # :nodoc:
2
+ VERSION = "1.6.0" # :nodoc:
3
3
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reddit_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Maslov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-28 00:00:00.000000000 Z
11
+ date: 2018-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  description: better than PRAW
@@ -77,6 +77,7 @@ files:
77
77
  - examples/oneplus/Gemfile
78
78
  - examples/oneplus/Gemfile.lock
79
79
  - examples/oneplus/main.rb
80
+ - examples/realtimeww2/.bashrc
80
81
  - examples/realtimeww2/Gemfile
81
82
  - examples/realtimeww2/Gemfile.lock
82
83
  - examples/realtimeww2/main.rb
@@ -102,17 +103,17 @@ require_paths:
102
103
  - lib
103
104
  required_ruby_version: !ruby/object:Gem::Requirement
104
105
  requirements:
105
- - - '>='
106
+ - - ">="
106
107
  - !ruby/object:Gem::Version
107
108
  version: 2.0.0
108
109
  required_rubygems_version: !ruby/object:Gem::Requirement
109
110
  requirements:
110
- - - '>='
111
+ - - ">="
111
112
  - !ruby/object:Gem::Version
112
113
  version: '0'
113
114
  requirements: []
114
115
  rubyforge_project:
115
- rubygems_version: 2.0.14.1
116
+ rubygems_version: 2.5.2
116
117
  signing_key:
117
118
  specification_version: 4
118
119
  summary: Library for Reddit bots