posting_duo 3.100.999 → 3.102.999

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/posting_duo.rb +214 -117
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 336579baba0c55bf8e58db2c9999ab8812c4b1daf0a20f79ea4fb0fb3980d843
4
- data.tar.gz: 49b903dfc37151042cee2fd74942bcaf58f607d0604265db8bf5eff9e2c52729
3
+ metadata.gz: 2c19292517569a61f84a094753f72e65933388db458972fa027ffc4938fd1bc5
4
+ data.tar.gz: bfcb7d95f6a9fbc858305ecb4f4b56bbdd4229a75c1273d669cc8f88f0caa8da
5
5
  SHA512:
6
- metadata.gz: 3b1fde3f6c9717903699212629df83906bb418beaea716ffb79539ae23fa3f14ceeebb23fa917b8397433dbbd723dec86dbd6e12949bc3445c8803a81fa4e2af
7
- data.tar.gz: f792f454435a941c076fe8066e02be7e3bf058500b691ec16de7a2d55199f1c2259c57ee9d6172772bb96ad9da51b0e20af159173912e9879db6bd6c6c8a3d86
6
+ metadata.gz: 2b1cfd80c03d0d343da034916329ea91aceed2f43e9c483f32bcbe59f9679b30d612e336bf5c42e6f2bc1581754973fd9f9ad74623ada2bf8004af072f16fd7e
7
+ data.tar.gz: 2362dc80236f4f7f0e729e9513718add293c80b53ed902b2ad3bc8dad988f5c7095aac1691bfb6b37b648e51c41720c4bc4d96144842c4ab9efe340186ede5d1
data/lib/posting_duo.rb CHANGED
@@ -32,6 +32,7 @@ class Naver
32
32
  kill_selenium_chrome #기존 창 모두 닫는 명령
33
33
  sleep(1)
34
34
  end
35
+
35
36
 
36
37
  def kill_selenium_chrome #기존 창 모두 닫는 코드
37
38
  wmi = WIN32OLE.connect("winmgmts://")
@@ -48,19 +49,12 @@ class Naver
48
49
  end
49
50
  end
50
51
  end
51
-
52
- # chromedriver도 같이 종료
53
- chromedrivers = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chromedriver.exe'")
54
- chromedrivers.each do |proc|
55
- puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
56
- begin
57
- proc.Terminate
58
- rescue
59
- #puts "→ 이미 종료된 chromedriver: #{proc.ProcessId}"
60
- end
61
- end
52
+ sleep(1)
53
+
62
54
  end
63
-
55
+
56
+
57
+
64
58
  def chrome_setup(proxy, board_cookie_dir = "C:/board_cookie")
65
59
  board_cookie_dir = "C:/board_cookie"
66
60
  FileUtils.mkdir_p(board_cookie_dir) unless File.exist?(board_cookie_dir)
@@ -75,7 +69,7 @@ class Naver
75
69
 
76
70
 
77
71
 
78
- def chrome_start(proxy, board_cookie_dir = "C:/board_cookie")
72
+ def chrome_start(proxy, board_cookie_dir = "C:/board_cookie")
79
73
  board_cookie_dir = "C:/board_cookie"
80
74
  FileUtils.mkdir_p(board_cookie_dir) unless File.exist?(board_cookie_dir)
81
75
  if proxy == ''
@@ -252,47 +246,49 @@ class Naver
252
246
  sleep(1)
253
247
 
254
248
  chrome_start(proxy, board_cookie_dir)
249
+
255
250
 
256
- # 열린 모든 탭 핸들 확인
251
+ target_url = "https://chromewebstore.google.com/detail/captcha-solver-auto-recog/ifibfemgeogfhoebkmokieepdoobkbpo?hl=ko"
252
+
257
253
  all_windows = @driver.window_handles
258
- #puts "현재 열려 있는 탭 수: #{all_windows.size}" # 열린 탭 수 출력
259
254
 
260
- # 원하는 URL
261
- target_url = "https://chromewebstore.google.com/detail/captcha-solver-auto-recog/ifibfemgeogfhoebkmokieepdoobkbpo?hl=ko"
255
+ # target_url로 열린 탭들만 필터링
256
+ target_tabs = all_windows.select do |win|
257
+ @driver.switch_to.window(win)
258
+ @driver.current_url == target_url
259
+ end
262
260
 
263
- # 탭을 순회하면서
264
- all_windows.each do |window|
265
- @driver.switch_to.window(window)
266
- current_url = @driver.current_url
267
- #puts "탭 URL: #{current_url}" # 각 탭 URL 출력
268
-
269
- # 원하는 URL이 아니면 탭을 닫기
270
- if current_url != target_url
271
- begin
272
- @driver.close # 다른 탭을 닫기
273
- rescue Selenium::WebDriver::Error::WebDriverError => e
274
- #puts "탭을 닫는 데 오류 발생: #{e.message}"
275
- end
261
+ # 남길 탭: target_url 탭 중 가장 마지막 (없으면 빈 배열)
262
+ tabs_to_keep = target_tabs.empty? ? [] : [target_tabs.last]
263
+
264
+ # 닫을 탭 = 전체에서 남길 탭 제외
265
+ tabs_to_close = all_windows - tabs_to_keep
266
+
267
+ tabs_to_close.each do |win|
268
+ begin
269
+ @driver.switch_to.window(win)
270
+ @driver.close
271
+ rescue Selenium::WebDriver::Error::WebDriverError => e
272
+ # 닫기 실패해도 무시
276
273
  end
277
274
  end
278
275
 
279
- # 남아 있는 탭으로 전환
280
- all_windows = @driver.window_handles # 남은 탭 리스트 갱신
281
- if all_windows.size > 0
282
- @driver.switch_to.window(all_windows.first) # 남아 있는 첫 번째 탭으로 전환
283
- else
284
- #puts "남은 탭이 없습니다."
285
- end
276
+ # 남아있는 탭으로 포커스 이동 (남은 게 있으면)
277
+ remaining_windows = @driver.window_handles
278
+ @driver.switch_to.window(remaining_windows.first) if remaining_windows.any?
286
279
 
287
280
 
288
281
 
289
282
 
290
283
  sleep(1)
291
284
  begin
292
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
293
- wait.until { @driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="ajZLRd"]') } #추가 되어 있음
294
- check_cookie_login = 1
295
- puts'[Step.01] CAPTCHA 세션 및 브라우저 설정 완료 상태 확인!!.......'.yellow
285
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
286
+ wait.until { @driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="ajZLRd"]') } #추가 되어 있음
287
+ puts'[Step.01] CAPTCHA 세션 및 브라우저 설정 완료 상태 확인!!.......'.yellow
288
+ sleep(1)
289
+ @driver.manage.window.maximize
290
+ sleep(1)
291
+ check_cookie_login = 0
296
292
  rescue
297
293
  begin
298
294
  wait = Selenium::WebDriver::Wait.new(:timeout => 3)
@@ -309,9 +305,7 @@ class Naver
309
305
  shell.SendKeys("{TAB}")
310
306
  sleep(0.5)
311
307
  shell.SendKeys("{ENTER}")
312
-
313
- check_cookie_login = 2
314
- sleep(1)
308
+ check_cookie_login = 1
315
309
  rescue
316
310
  @driver.quit
317
311
  sleep(1)
@@ -321,39 +315,11 @@ class Naver
321
315
  end
322
316
  end
323
317
 
324
- if check_cookie_login == 1
325
- begin
326
- @driver.get('https://chromewebstore.google.com/detail/captcha-solver-auto-recog/ifibfemgeogfhoebkmokieepdoobkbpo?hl=ko')
327
- sleep(2)
328
- wait = Selenium::WebDriver::Wait.new(:timeout => 5)
329
- #요소가 나타날 때까지 3초 동안 기다립니다.
330
- wait.until { @driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="ajZLRd"]') } #추가 되어 있음
331
- sleep(1)
332
- @driver.manage.window.maximize
333
- sleep(1)
334
- rescue => e
335
- puts '-[√] 연결 실패.......'.red
336
- @driver.window_handles.each do |handle|
337
- @driver.switch_to.window(handle)
338
- begin
339
- # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
340
- @driver.close
341
- rescue Selenium::WebDriver::Error::WebDriverError => e
342
- puts "Failed to close tab: #{e.message}"
343
- end
344
- end
345
- @driver.quit
346
- sleep(1)
347
- @driver.close
348
- return 0
349
- sleep(1)
350
- end
351
-
352
318
 
353
- elsif check_cookie_login == 2
354
-
319
+ if check_cookie_login == 1
320
+
355
321
  begin
356
-
322
+ sleep(1)
357
323
  @driver.get('chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html')
358
324
  sleep(5)
359
325
 
@@ -831,22 +797,65 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
831
797
  sleep(1)
832
798
  rescue
833
799
  begin
834
- # 타임아웃을 77초로 설정
835
- wait = Selenium::WebDriver::Wait.new(:timeout => 150)
836
- # 요소가 나타날 때까지 100초 동안 기다립니다.
837
- wait.until { @driver.find_elements(:xpath, '//*[@class="spacer"]').size == 0 }
838
- sleep(1)
839
-
840
- #@driver.find_element(:xpath, '//*[@data-state="solved"]').click
841
- puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
842
- sleep(5)
843
- rescue => e
844
- puts '-[√] 캡챠 해제 실패(캡챠는 사람이 풀기에 간혹 실수로 실패가 될수있습니다.).......'.red
845
- puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
846
- puts e
847
- @driver.close
848
- return 0
849
- end
800
+ # 타임아웃을 77초로 설정
801
+ wait = Selenium::WebDriver::Wait.new(:timeout => 150)
802
+ # 요소가 나타날 때까지 100초 동안 기다립니다.
803
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="solved"]') }
804
+ sleep(1)
805
+
806
+ #@driver.find_element(:xpath, '//*[@data-state="solved"]').click
807
+ puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
808
+ sleep(7)
809
+ begin
810
+ wait = Selenium::WebDriver::Wait.new(timeout: 10)
811
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
812
+
813
+ original_tab = @driver.window_handle
814
+
815
+ @driver.switch_to.new_window(:tab)
816
+ new_tab = @driver.window_handle # 새 탭 핸들 저장
817
+
818
+ @driver.get('chrome://extensions/')
819
+ sleep(3)
820
+
821
+ # 마우스 및 키보드 입력 시도
822
+ mouse_move_percentage(0.35, 0.02)
823
+ sleep(0.5)
824
+ left_click
825
+ sleep(1)
826
+ key_stroke('enter')
827
+ sleep(1)
828
+ 6.times do
829
+ key_stroke('tab')
830
+ sleep(0.5)
831
+ end
832
+ key_stroke('enter')
833
+ sleep(1)
834
+
835
+
836
+
837
+ # 원래 탭으로 전환
838
+ @driver.switch_to.window(original_tab)
839
+ @driver.navigate.refresh
840
+ sleep(10)
841
+ @driver.switch_to.window(new_tab)
842
+ sleep(1)
843
+ # 마우스 및 키보드 입력 시도
844
+ mouse_move_percentage(0.35, 0.02)
845
+ sleep(0.5)
846
+ left_click
847
+ sleep(1)
848
+ key_stroke('enter')
849
+ sleep(1)
850
+ @driver.close
851
+ sleep(1)
852
+ @driver.switch_to.window(original_tab)
853
+ sleep(1)
854
+ rescue
855
+ end
856
+
857
+ rescue
858
+ end
850
859
  end
851
860
  rescue
852
861
  begin
@@ -3808,12 +3817,60 @@ login_url = option['login_url'].to_s
3808
3817
  # 타임아웃을 77초로 설정
3809
3818
  wait = Selenium::WebDriver::Wait.new(:timeout => 150)
3810
3819
  # 요소가 나타날 때까지 100초 동안 기다립니다.
3811
- wait.until { @driver.find_elements(:xpath, '//*[@class="spacer"]').size == 0 }
3820
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="solved"]') }
3812
3821
  sleep(1)
3813
3822
 
3814
3823
  #@driver.find_element(:xpath, '//*[@data-state="solved"]').click
3815
3824
  puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
3816
- sleep(5)
3825
+ sleep(7)
3826
+ begin
3827
+ wait = Selenium::WebDriver::Wait.new(timeout: 10)
3828
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
3829
+
3830
+ original_tab = @driver.window_handle
3831
+
3832
+ @driver.switch_to.new_window(:tab)
3833
+ new_tab = @driver.window_handle # 새 탭 핸들 저장
3834
+
3835
+ @driver.get('chrome://extensions/')
3836
+ sleep(3)
3837
+
3838
+ # 마우스 및 키보드 입력 시도
3839
+ mouse_move_percentage(0.35, 0.02)
3840
+ sleep(0.5)
3841
+ left_click
3842
+ sleep(1)
3843
+ key_stroke('enter')
3844
+ sleep(1)
3845
+ 6.times do
3846
+ key_stroke('tab')
3847
+ sleep(0.5)
3848
+ end
3849
+ key_stroke('enter')
3850
+ sleep(1)
3851
+
3852
+
3853
+
3854
+ # 원래 탭으로 전환
3855
+ @driver.switch_to.window(original_tab)
3856
+ @driver.navigate.refresh
3857
+ sleep(10)
3858
+ @driver.switch_to.window(new_tab)
3859
+ sleep(1)
3860
+ # 마우스 및 키보드 입력 시도
3861
+ mouse_move_percentage(0.35, 0.02)
3862
+ sleep(0.5)
3863
+ left_click
3864
+ sleep(1)
3865
+ key_stroke('enter')
3866
+ sleep(1)
3867
+ @driver.close
3868
+ sleep(1)
3869
+ @driver.switch_to.window(original_tab)
3870
+ sleep(1)
3871
+ rescue
3872
+ end
3873
+
3817
3874
  rescue
3818
3875
  end
3819
3876
  end
@@ -3905,6 +3962,8 @@ login_url = option['login_url'].to_s
3905
3962
  end
3906
3963
  ##<─────────────────────────────────────────────────────────────────────캡챠 해제 입력 코드 부분
3907
3964
 
3965
+
3966
+
3908
3967
 
3909
3968
  begin
3910
3969
  # 요소 찾기 타임아웃을 10초로 설정
@@ -5046,10 +5105,11 @@ login_url = option['login_url'].to_s
5046
5105
 
5047
5106
 
5048
5107
 
5049
-
5050
5108
  rescue => e
5051
5109
  #puts '-[√] 로그인 PASS.......'.cyan
5110
+
5052
5111
  puts e
5112
+
5053
5113
  end
5054
5114
 
5055
5115
 
@@ -5611,34 +5671,71 @@ post_url = option['post_url'].to_s
5611
5671
  sleep(1)
5612
5672
  rescue
5613
5673
  begin
5614
- # 타임아웃을 77초로 설정
5615
- wait = Selenium::WebDriver::Wait.new(:timeout => 150)
5616
- # 요소가 나타날 때까지 100초 동안 기다립니다.
5617
- wait.until { @driver.find_elements(:xpath, '//*[@class="spacer"]').size == 0 }
5618
- sleep(1)
5619
-
5620
- #@driver.find_element(:xpath, '//*[@data-state="solved"]').click
5621
- puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
5622
- sleep(5)
5623
- rescue => e
5624
- puts '-[√] 캡챠 해제 실패(캡챠는 사람이 풀기에 간혹 실수로 실패가 될수있습니다.).......'.red
5625
- puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
5626
- puts e
5627
- @driver.close
5628
- return 0
5629
- end
5630
- end
5631
- rescue
5632
-
5633
- end
5634
- end
5635
- ##<─────────────────────────────────────────────────────────────────────캡챠 해제 입력 코드 부분
5674
+ # 타임아웃을 77초로 설정
5675
+ wait = Selenium::WebDriver::Wait.new(:timeout => 150)
5676
+ # 요소가 나타날 때까지 100초 동안 기다립니다.
5677
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="solved"]') }
5678
+ sleep(1)
5679
+
5680
+ #@driver.find_element(:xpath, '//*[@data-state="solved"]').click
5681
+ puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
5682
+ sleep(7)
5683
+ begin
5684
+ wait = Selenium::WebDriver::Wait.new(timeout: 10)
5685
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
5636
5686
 
5687
+ original_tab = @driver.window_handle
5637
5688
 
5689
+ @driver.switch_to.new_window(:tab)
5690
+ new_tab = @driver.window_handle # 새 탭 핸들 저장
5638
5691
 
5692
+ @driver.get('chrome://extensions/')
5693
+ sleep(3)
5694
+
5695
+ # 마우스 및 키보드 입력 시도
5696
+ mouse_move_percentage(0.35, 0.02)
5697
+ sleep(0.5)
5698
+ left_click
5699
+ sleep(1)
5700
+ key_stroke('enter')
5701
+ sleep(1)
5702
+ 6.times do
5703
+ key_stroke('tab')
5704
+ sleep(0.5)
5705
+ end
5706
+ key_stroke('enter')
5707
+ sleep(1)
5639
5708
 
5709
+
5640
5710
 
5711
+ # 원래 탭으로 전환
5712
+ @driver.switch_to.window(original_tab)
5713
+ @driver.navigate.refresh
5714
+ sleep(10)
5715
+ @driver.switch_to.window(new_tab)
5716
+ sleep(1)
5717
+ # 마우스 및 키보드 입력 시도
5718
+ mouse_move_percentage(0.35, 0.02)
5719
+ sleep(0.5)
5720
+ left_click
5721
+ sleep(1)
5722
+ key_stroke('enter')
5723
+ sleep(1)
5724
+ @driver.close
5725
+ sleep(1)
5726
+ @driver.switch_to.window(original_tab)
5727
+ sleep(1)
5728
+ rescue
5729
+ end
5641
5730
 
5731
+ rescue
5732
+ end
5733
+ end
5734
+ rescue
5735
+
5736
+ end
5737
+ end
5738
+ ##<─────────────────────────────────────────────────────────────────────캡챠 해제 입력 코드 부분
5642
5739
 
5643
5740
 
5644
5741
 
@@ -12163,7 +12260,7 @@ end
12163
12260
 
12164
12261
  end
12165
12262
 
12166
- #end #반복루프
12263
+ #end #반복루프
12167
12264
  class Wordpress
12168
12265
  include Glimmer
12169
12266
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posting_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.100.999
4
+ version: 3.102.999
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-06-04 00:00:00.000000000 Z
10
+ date: 2025-06-13 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: File to Clipboard gem
13
13
  email: mymin26@naver.com