njongto_duo 0.0.71 → 0.0.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/njongto_duo.rb +20 -43
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86eb590b9841cf1ead72e5927889f9f155c04a3ed912a800c3a1dd67f1ee8174
4
- data.tar.gz: 4f083fc712305b1631fd7521242d3b57ecffb95f86fea38c0a4fba87ff52aef7
3
+ metadata.gz: 1c1a360bbb6958d1cdf7abcf979f845d150295fdcabd585e3bb1bc0decdb2c2e
4
+ data.tar.gz: 3de2e9ca7c53a064d9e44e799e9b11441c9f18eb4834d97c7745f0006cba0b67
5
5
  SHA512:
6
- metadata.gz: 3c5d5a8f2cf0f2b4dae5a94474ef659eefe36f52c839bf7c052a727d397204c385c635818305194fbaa2509e4f69c3f633e1ad62fd354d59662610afd144f88d
7
- data.tar.gz: '09758992e1cf88fba42962cb594d18d47d675731dfd349693bb12ae02f41a02257635d7cc470c2bf7e07ef10387c3605ea6ece845b9bd64c9c4e919e13945f2f'
6
+ metadata.gz: 1aed359a0e435be1a41c1d114d60a88f79aedba98235e9629e863a2bbad19b490cdb2daf1afbb42c94805490b49b13f09847e2b3afc5fff4d5f25a659eb26e3f
7
+ data.tar.gz: 1d1158da493d4bfcd69a6ad75a7f4c90a81f8b8428221367d60a15d88681fc147653b8e55fb235e08822c55bebbd07afc939a891c38b68c0240e03c6d9b14962
data/lib/njongto_duo.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'glimmer-dsl-libui'
2
2
  require 'selenium-webdriver'
3
- #require 'webdrivers'
4
3
  require 'iconv'
5
4
  require 'nokogiri'
6
5
  require 'http'
@@ -16,7 +15,6 @@ require 'uri'
16
15
  require 'cgi'
17
16
  require 'auto_click'
18
17
  require 'rainbow/refinement'
19
- require 'win32ole'
20
18
  include AutoClickMethods
21
19
  using Rainbow
22
20
  include Glimmer
@@ -24,40 +22,9 @@ include Glimmer
24
22
 
25
23
  class Naver
26
24
  def initialize
27
- kill_selenium_chrome #기존 창 모두 닫는 명령
28
- sleep(1)
29
25
  @seed = 1
30
26
  end
31
27
 
32
- def kill_selenium_chrome #기존 창 모두 닫는 코드
33
- wmi = WIN32OLE.connect("winmgmts://")
34
- chrome_procs = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chrome.exe'")
35
-
36
- chrome_procs.each do |proc|
37
- cmd = proc.CommandLine
38
- if cmd && cmd.include?("user-data-dir=C:/naver_cookie")
39
- puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
40
- begin
41
- proc.Terminate
42
- rescue
43
- #puts "→ 이미 종료된 프로세스: #{proc.ProcessId}"
44
- end
45
- end
46
- end
47
-
48
- # chromedriver도 같이 종료
49
- chromedrivers = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chromedriver.exe'")
50
- chromedrivers.each do |proc|
51
- puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
52
- begin
53
- proc.Terminate
54
- rescue
55
- #puts "→ 이미 종료된 chromedriver: #{proc.ProcessId}"
56
- end
57
- end
58
- end
59
-
60
-
61
28
  def chrome_setup(user_id, proxy)
62
29
  naver_cookie_dir = "C:/naver_cookie"
63
30
  FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
@@ -250,19 +217,29 @@ class Naver
250
217
  begin
251
218
  wait = Selenium::WebDriver::Wait.new(:timeout => 7)
252
219
  #요소가 나타날 때까지 3초 동안 기다립니다.
253
- wait.until { @driver.find_element(:xpath, '//*[@for="switch"]') }
254
- sleep(1.5)
255
- @driver.find_element(:xpath, '//*[@id="login_keep_wrap"]/div[1]/label').click
256
- sleep(1.5)
257
- @driver.find_element(:xpath, '//*[@id="id"]').click
220
+ wait.until { @driver.find_element(:xpath, '//*[@id="id" and @name="id"]') }
221
+ @driver.find_element(:xpath, '//*[@id="id" and @name="id"]').click
258
222
  Clipboard.copy(user_id)
259
223
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
260
224
  sleep(1.5)
261
- @driver.find_element(:xpath, '//*[@id="pw"]').click
225
+ @driver.find_element(:xpath, '//*[@id="pw" and @name="pw"]').click
262
226
  Clipboard.copy(user_pw)
263
227
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
264
228
  sleep(1.5)
265
- @driver.find_element(:xpath, '//*[@id="log.login"]').click
229
+
230
+ begin
231
+ smart_level_value = @driver.find_element(id: 'smart_LEVEL').attribute('value')
232
+ if smart_level_value == '1'
233
+ @driver.find_element(xpath: '//label[@for="switch" and @class="switch_btn"]').click
234
+ sleep(1.5)
235
+ end
236
+ rescue
237
+ end
238
+
239
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
240
+ #요소가 나타날 때까지 3초 동안 기다립니다.
241
+ wait.until { @driver.find_element(xpath: '//button[@type="submit" and @id="log.login"]') }
242
+ @driver.find_element(xpath: '//button[@type="submit" and @id="log.login"]').click
266
243
  sleep(2.5)
267
244
  rescue => e
268
245
  puts '-[√] 로딩 지연 접속 실패.......'.red
@@ -284,9 +261,9 @@ class Naver
284
261
  end
285
262
 
286
263
  begin
287
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
264
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5)
288
265
  #요소가 나타날 때까지 3초 동안 기다립니다.
289
- wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
266
+ wait.until { @driver.find_element(:xpath, '//*[@type="button" and @class="MyView-module__btn_logout___bsTOJ"]') }
290
267
 
291
268
  rescue => e
292
269
  puts '-[√] 로그인 실패.......'.red
@@ -301,7 +278,7 @@ class Naver
301
278
  end
302
279
  return 0
303
280
  @driver.quit
304
- end
281
+ end
305
282
  end
306
283
 
307
284
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: njongto_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.71
4
+ version: 0.0.73
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-29 00:00:00.000000000 Z
10
+ date: 2025-07-08 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: File to Clipboard gem
13
13
  email: mymin26@naver.com