nblog_zon 0.0.56 → 0.0.59

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/nblog_zon.rb +108 -34
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82f0ca96aef64506089aeb9a8a0e1f517ed20bbd3d6269f65a890573ed9204be
4
- data.tar.gz: e29cc54df5ef3834ea0ba774c535665913b318e8bc9e827a4ae3eb8726ae7eea
3
+ metadata.gz: 97a284727453d2d0f0b3616025ec32116ebb3cf931265f4a5511ffaf8f1b27e4
4
+ data.tar.gz: 20b32196db249730309ed18f02c7dc0fdf45ed4bcb4227f92f2e55230a00d45b
5
5
  SHA512:
6
- metadata.gz: e2979183a39f05b5665220e8e93ed200f1e8e170c63787069107e8aa64387ed44611b3b1506748acef45144f5b0e9a7fcd657eb5b9fcc877e792852de041b89e
7
- data.tar.gz: f191c84f0b8e82e933948a5a7d1c1d2dd200a833cd07bbdebfeca89f48cae9df82064c439c1589ff1b70d2021eb33d2e9f7920c9b08c9c0b34667176a03c2a76
6
+ metadata.gz: 6eb2a9f89292260bd27fbade7aa5911107b3fd9770297fb65b8fef09a7b12b3c16f434497886e6d2be4f3a3bdd45cc18c15042848231bfcf7aae728d14c84458
7
+ data.tar.gz: bbcc23d13a060dfd5ad0c43275b0cf994448f089a2721ff8fd065a7bb63a5da69dd0de6a1b3ef2bb9636cb6b947f1ed25ed07a5f6543f668a35c42a61aa8ed5e
data/lib/nblog_zon.rb CHANGED
@@ -228,9 +228,9 @@ class Naver
228
228
  options.add_argument('--disable-gpu')
229
229
  options.add_argument('--remote-debugging-port=9222')
230
230
  options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
231
- @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
231
+ @driver = Selenium::WebDriver.for(:chrome, options: options)
232
232
  rescue
233
- @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
233
+ @driver = Selenium::WebDriver.for(:chrome, options: options)
234
234
  end
235
235
  else
236
236
  begin
@@ -251,7 +251,7 @@ class Naver
251
251
  options.add_argument('--disable-gpu')
252
252
  options.add_argument('--remote-debugging-port=9222')
253
253
  options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
254
- @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
254
+ @driver = Selenium::WebDriver.for(:chrome, options: options)
255
255
  rescue => e
256
256
  puts e
257
257
  puts 'proxy error...'
@@ -265,9 +265,9 @@ class Naver
265
265
  options.add_argument('--disable-gpu')
266
266
  options.add_argument('--remote-debugging-port=9222')
267
267
  options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
268
- @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
268
+ @driver = Selenium::WebDriver.for(:chrome, options: options)
269
269
  rescue
270
- @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
270
+ @driver = Selenium::WebDriver.for(:chrome, options: options)
271
271
  end
272
272
  end
273
273
  end
@@ -306,55 +306,80 @@ class Naver
306
306
  sleep(1)
307
307
 
308
308
  begin
309
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
309
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
310
+ #요소가 나타날 때까지 3초 동안 기다립니다.
311
+ wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
312
+ sleep(1.5)
313
+ check_cookie_login = 1
314
+ puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
315
+ sleep(2.5)
316
+ rescue
317
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
310
318
  #요소가 나타날 때까지 3초 동안 기다립니다.
311
319
  wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]') }
312
320
  sleep(1.5)
313
321
  @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]').click
314
322
  check_cookie_login = 0
315
323
  sleep(1)
316
- rescue
317
- check_cookie_login = 1
318
- puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
319
- sleep(2.5)
320
324
  end
321
325
 
322
326
  if check_cookie_login == 0
323
327
  puts'[Step.02] 계정 세션이 없거나 기간 만료로 인해 로그인 시도.......'.yellow
324
328
  # @driver.find_element(:xpath, '//*[@id="right-content-area"]/div[1]/div[1]/div/a').click
325
329
  sleep(3)
326
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
327
- #요소가 나타날 때까지 3초 동안 기다립니다.
328
- wait.until { @driver.find_element(:xpath, '//*[@for="switch"]') }
329
- sleep(1.5)
330
- @driver.find_element(:xpath, '//*[@id="login_keep_wrap"]/div[1]/label').click
331
- sleep(1.5)
332
- @driver.find_element(:xpath, '//*[@id="id"]').click
333
- Clipboard.copy(user_id)
334
- @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
335
- sleep(1.5)
336
- @driver.find_element(:xpath, '//*[@id="pw"]').click
337
- Clipboard.copy(user_pw)
338
- @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
339
- sleep(1.5)
340
- @driver.find_element(:xpath, '//*[@id="log.login"]').click
341
- sleep(2.5)
330
+ begin
331
+ wait = Selenium::WebDriver::Wait.new(:timeout => 10)
332
+ #요소가 나타날 때까지 3초 동안 기다립니다.
333
+ wait.until { @driver.find_element(:xpath, '//*[@for="switch"]') }
334
+ sleep(1.5)
335
+ @driver.find_element(:xpath, '//*[@id="login_keep_wrap"]/div[1]/label').click
336
+ sleep(1.5)
337
+ @driver.find_element(:xpath, '//*[@id="id"]').click
338
+ Clipboard.copy(user_id)
339
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
340
+ sleep(1.5)
341
+ @driver.find_element(:xpath, '//*[@id="pw"]').click
342
+ Clipboard.copy(user_pw)
343
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
344
+ sleep(1.5)
345
+ @driver.find_element(:xpath, '//*[@id="log.login"]').click
346
+ sleep(2.5)
347
+ rescue => e
348
+ puts '-[√] 로딩 지연 접속 실패.......'.red
349
+ @driver.window_handles.each do |handle|
350
+ @driver.switch_to.window(handle)
351
+ begin
352
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
353
+ @driver.close
354
+ rescue Selenium::WebDriver::Error::WebDriverError => e
355
+ puts "Failed to close tab: #{e.message}"
356
+ end
357
+ end
358
+ return 0
359
+ end
342
360
 
343
361
  else
344
362
  # @driver.switch_to.default_content
345
363
  end
346
364
 
347
365
  begin
348
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
366
+ wait = Selenium::WebDriver::Wait.new(:timeout => 10)
349
367
  #요소가 나타날 때까지 3초 동안 기다립니다.
350
368
  wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
351
369
 
352
370
  rescue => e
353
- puts '-[√] 로그인 실패!!.......'.red
354
- puts e
355
- @driver.close
371
+ puts '-[√] 로그인 실패.......'.red
372
+ @driver.window_handles.each do |handle|
373
+ @driver.switch_to.window(handle)
374
+ begin
375
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
376
+ @driver.close
377
+ rescue Selenium::WebDriver::Error::WebDriverError => e
378
+ puts "Failed to close tab: #{e.message}"
379
+ end
380
+ end
356
381
  return 0
357
- end
382
+ end
358
383
  end
359
384
 
360
385
  def create_id
@@ -654,7 +679,25 @@ class Naver
654
679
  end
655
680
 
656
681
 
682
+ begin
657
683
  #제목 입력
684
+ wait = Selenium::WebDriver::Wait.new(:timeout => 10)
685
+ #요소가 나타날 때까지 60초 동안 기다립니다.
686
+ wait.until { @driver.find_element(:xpath, '//*[@draggable="false"]') }
687
+ rescue => e
688
+ puts '-[√] 글 입력 필드 로딩 지연 접속 실패.......'.red
689
+ @driver.window_handles.each do |handle|
690
+ @driver.switch_to.window(handle)
691
+ begin
692
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
693
+ @driver.close
694
+ rescue Selenium::WebDriver::Error::WebDriverError => e
695
+ puts "Failed to close tab: #{e.message}"
696
+ end
697
+ end
698
+ return 0
699
+ end
700
+
658
701
  ele = @driver.find_element(:xpath, '//*[@draggable="false"]')
659
702
  @driver.action.click(ele).perform
660
703
  sleep(0.5)
@@ -1539,8 +1582,30 @@ class Naver
1539
1582
  end
1540
1583
 
1541
1584
 
1542
- @driver.find_element(:xpath, '//*[@data-focus-lock="publishLayer"]').click #1차 등록버튼
1543
- sleep(3)
1585
+ begin
1586
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
1587
+ #요소가 나타날 때까지 3초 동안 기다립니다.
1588
+ wait.until { @driver.find_element(:xpath, '//*[@data-focus-lock="publishLayer"]') }
1589
+ sleep(1.5)
1590
+ @driver.find_element(:xpath, '//*[@data-focus-lock="publishLayer"]').click #1차 등록버튼
1591
+ sleep(3)
1592
+ rescue => e
1593
+ puts '-[√] 로딩 지연 접속 실패.......'.red
1594
+ @driver.window_handles.each do |handle|
1595
+ @driver.switch_to.window(handle)
1596
+ begin
1597
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
1598
+ @driver.close
1599
+ rescue Selenium::WebDriver::Error::WebDriverError => e
1600
+ puts "Failed to close tab: #{e.message}"
1601
+ end
1602
+ end
1603
+ return 0
1604
+ end
1605
+
1606
+
1607
+
1608
+
1544
1609
  category = option['category']
1545
1610
  begin
1546
1611
  p category
@@ -1689,11 +1754,20 @@ class Naver
1689
1754
  end
1690
1755
 
1691
1756
  begin
1692
- @driver.close
1757
+ @driver.window_handles.each do |handle|
1758
+ @driver.switch_to.window(handle)
1759
+ begin
1760
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
1761
+ @driver.close
1762
+ rescue Selenium::WebDriver::Error::WebDriverError => e
1763
+ puts "Failed to close tab: #{e.message}"
1764
+ end
1765
+ end
1693
1766
  rescue
1694
1767
 
1695
1768
  end
1696
1769
 
1770
+
1697
1771
 
1698
1772
  end
1699
1773
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nblog_zon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.56
4
+ version: 0.0.59
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-05 00:00:00.000000000 Z
11
+ date: 2025-02-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: rnjstnswp123@naver.com