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