birdsong 0.2.3 → 0.2.4

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
  SHA256:
3
- metadata.gz: e225de345219a482d98dc634601169cb2ab42c78cc9105574fb426f34d334980
4
- data.tar.gz: 39f26a882f4e5939012fef4f64b30dabe5b28983a8d21fee6723b75a7342f889
3
+ metadata.gz: 91cec2f940312e308a14a0f84049908d0a38cc9ef53548c0ef9907c5c46bffeb
4
+ data.tar.gz: a7871d2629fa2eec4bb9ee73b635bf974f1ec5f7c0606070e446b6937c60fe9d
5
5
  SHA512:
6
- metadata.gz: cac7812476ce19901ac91d1701bf8d01772156d1cf1e9e64d4cd17e9a47d1e8cf60e5f8c05b97c387576f0a910a89aeba1aaca9753764107b4cda6f11de97efe
7
- data.tar.gz: c50a4320302b0f87ae09be8b445faa52b7935e4177ffa3804de1ade10faad1c4377590750ef3c369d57d977f0e45022db6898dd7a3901426f0cadcfd0007a4e4
6
+ metadata.gz: 72b073c5546b6a4b22184809d4b1e8381bdd18b07f577f49d6c096ecded7e8b08ff546730a913cb8f41945036f9372bfb503b655eda24bdcff9ba924f9e7b81a
7
+ data.tar.gz: fa6f487b45dc2b284773d4dbccefefeacb74200b2b0f14341a187d899bc82e2048a65e50524e9577e05e0cd9f1a4f0d7f0b8bbdc37d3075a643e143aa7dc9064
@@ -108,6 +108,7 @@ module Birdsong
108
108
  end
109
109
 
110
110
  page.driver.execute_script("window.stop();")
111
+
111
112
  raise Birdsong::NoTweetFoundError if response_body.nil?
112
113
  Oj.load(response_body)
113
114
  end
@@ -140,49 +141,49 @@ module Birdsong
140
141
  Capybara.current_driver = :selenium
141
142
  end
142
143
 
143
- def login
144
- # Reset the sessions so that there's nothing laying around
145
- page.quit
146
-
147
- # Check if we're on a Instagram page already, if not visit it.
148
- unless page.driver.browser.current_url.include? "instagram.com"
149
- # There seems to be a bug in the Linux ARM64 version of chromedriver where this will properly
150
- # navigate but then timeout, crashing it all up. So instead we check and raise the error when
151
- # that then fails again.
152
- page.driver.browser.navigate.to("https://instagram.com")
153
- end
154
-
155
- # We don't have to login if we already are
156
- begin
157
- return if find_field("Search", wait: 10).present?
158
- rescue Capybara::ElementNotFound; end
159
-
160
- # Check if we're redirected to a login page, if we aren't we're already logged in
161
- return unless page.has_xpath?('//*[@id="loginForm"]/div/div[3]/button')
162
-
163
- # Try to log in
164
- loop_count = 0
165
- while loop_count < 5 do
166
- fill_in("username", with: ENV["INSTAGRAM_USER_NAME"])
167
- fill_in("password", with: ENV["INSTAGRAM_PASSWORD"])
168
-
169
- begin
170
- click_button("Log in", exact_text: true) # Note: "Log in" (lowercase `in`) instead redirects to Facebook's login page
171
- rescue Capybara::ElementNotFound; end # If we can't find it don't break horribly, just keep waiting
172
-
173
- break unless has_css?('p[data-testid="login-error-message"', wait: 10)
174
- loop_count += 1
175
- sleep(rand * 10.3)
176
- end
177
-
178
- # Sometimes Instagram just... doesn't let you log in
179
- raise "Instagram not accessible" if loop_count == 5
180
-
181
- # No we don't want to save our login credentials
182
- begin
183
- click_on("Save Info")
184
- rescue Capybara::ElementNotFound; end
185
- end
144
+ # def login
145
+ # # Reset the sessions so that there's nothing laying around
146
+ # page.quit
147
+
148
+ # # Check if we're on a Instagram page already, if not visit it.
149
+ # unless page.driver.browser.current_url.include? "twitter.com"
150
+ # # There seems to be a bug in the Linux ARM64 version of chromedriver where this will properly
151
+ # # navigate but then timeout, crashing it all up. So instead we check and raise the error when
152
+ # # that then fails again.
153
+ # page.driver.browser.navigate.to("https://twitter.com")
154
+ # end
155
+
156
+ # # We don't have to login if we already are
157
+ # begin
158
+ # return if find_field("Search", wait: 10).present?
159
+ # rescue Capybara::ElementNotFound; end
160
+
161
+ # # Check if we're redirected to a login page, if we aren't we're already logged in
162
+ # return unless page.has_xpath?('//*[@id="loginForm"]/div/div[3]/button')
163
+
164
+ # # Try to log in
165
+ # loop_count = 0
166
+ # while loop_count < 5 do
167
+ # fill_in("username", with: ENV["TWITTER_USER_NAME"])
168
+ # fill_in("password", with: ENV["TWITTER_PASSWORD"])
169
+
170
+ # begin
171
+ # click_button("Log in", exact_text: true) # Note: "Log in" (lowercase `in`) instead redirects to Facebook's login page
172
+ # rescue Capybara::ElementNotFound; end # If we can't find it don't break horribly, just keep waiting
173
+
174
+ # break unless has_css?('p[data-testid="login-error-message"', wait: 10)
175
+ # loop_count += 1
176
+ # sleep(rand * 10.3)
177
+ # end
178
+
179
+ # # Sometimes Instagram just... doesn't let you log in
180
+ # raise "Instagram not accessible" if loop_count == 5
181
+
182
+ # # No we don't want to save our login credentials
183
+ # begin
184
+ # click_on("Save Info")
185
+ # rescue Capybara::ElementNotFound; end
186
+ # end
186
187
 
187
188
  def fetch_image(url)
188
189
  request = Typhoeus::Request.new(url, followlocation: true)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Birdsong
4
- VERSION = "0.2.3"
4
+ VERSION = "0.2.4"
5
5
  end
data/lib/birdsong.rb CHANGED
@@ -23,6 +23,7 @@ module Birdsong
23
23
  class InvalidIdError < Error; end
24
24
  class InvalidMediaTypeError < Error; end
25
25
  class NoTweetFoundError < Error; end
26
+ class WebDriverError < Error; end
26
27
  class RateLimitExceeded < Error
27
28
  attr_reader :rate_limit
28
29
  attr_reader :rate_remaining
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: birdsong
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Guess
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-10 00:00:00.000000000 Z
11
+ date: 2024-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
200
  - !ruby/object:Gem::Version
201
201
  version: '0'
202
202
  requirements: []
203
- rubygems_version: 3.4.19
203
+ rubygems_version: 3.4.20
204
204
  signing_key:
205
205
  specification_version: 4
206
206
  summary: A gem to interface with Twitter's API V2