posting_zon 3.110.999 → 3.111.002
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/posting_zon.rb +228 -155
- 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: 29d51c8c55e05d4fd727d91977476c2bece429e8f234aef51cea3ea7e62e60fd
|
4
|
+
data.tar.gz: 5e4e4a834c3fcac779f2b8f0235caafc5f53cc6dceff2c9a55a3b1286884bd93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47bc9917572ea9f8fcae3615fe1e727566edc4fa0c10add28d0ae744844466db2a8bb530b7e78ae84deaee6a3eecf87e75d28dedfa9158e033396ae29b3e9b01
|
7
|
+
data.tar.gz: 8a696eca4063eb9b3e24197f756160ed55bd9b8b7eab9d4537d9f844f7b755e9e9937d6fb73584fe8b20713546a8b9860b9e3d77c2934246654165a525f9e651
|
data/lib/posting_zon.rb
CHANGED
@@ -25,44 +25,18 @@ include AutoClickMethods
|
|
25
25
|
using Rainbow
|
26
26
|
|
27
27
|
|
28
|
-
class ChromeKiller
|
29
|
-
def self.kill_selenium_chrome
|
30
|
-
begin
|
31
|
-
wmi = WIN32OLE.connect("winmgmts://")
|
32
|
-
chrome_procs = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chrome.exe'")
|
33
|
-
chrome_procs.each do |proc|
|
34
|
-
begin
|
35
|
-
cmd = proc.CommandLine rescue nil
|
36
|
-
next unless cmd && cmd.include?("user-data-dir=C:/board_cookie")
|
37
28
|
|
38
|
-
puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
|
39
|
-
proc.Terminate rescue nil
|
40
|
-
rescue => inner_e
|
41
|
-
puts "프로세스 처리 중 오류: #{inner_e.message}"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
sleep(1)
|
45
|
-
rescue => e
|
46
|
-
puts "Chrome 종료 시도 중 오류 발생: #{e.message}"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
29
|
|
51
30
|
class Naver
|
52
31
|
def initialize
|
53
|
-
|
54
|
-
ChromeKiller.kill_selenium_chrome
|
55
|
-
sleep(1)
|
56
|
-
rescue => e
|
57
|
-
puts "크롬 창 초기화 시도 중 오류 발생: #{e.message} (무시하고 진행)"
|
58
|
-
end
|
32
|
+
|
59
33
|
end
|
60
34
|
|
61
35
|
|
62
36
|
def chrome_setup(proxy, board_cookie_dir = "C:/board_cookie")
|
63
37
|
board_cookie_dir = "C:/board_cookie"
|
64
38
|
FileUtils.mkdir_p(board_cookie_dir) unless File.exist?(board_cookie_dir)
|
65
|
-
|
39
|
+
|
66
40
|
if proxy == ''
|
67
41
|
system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" --window-position=0,0 --remote-debugging-port=9222 --user-data-dir=C:/board_cookie --no-first-run --no-default-browser-check --disable-sync https://chromewebstore.google.com/detail/captcha-solver-auto-recog/ifibfemgeogfhoebkmokieepdoobkbpo?hl=ko})
|
68
42
|
else
|
@@ -228,6 +202,25 @@ class Naver
|
|
228
202
|
end
|
229
203
|
end
|
230
204
|
end
|
205
|
+
|
206
|
+
class ChromeKiller
|
207
|
+
def self.kill_selenium_chrome
|
208
|
+
begin
|
209
|
+
wmi = WIN32OLE.connect("winmgmts://")
|
210
|
+
chrome_procs = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chrome.exe'")
|
211
|
+
chrome_procs.each do |proc|
|
212
|
+
begin
|
213
|
+
cmd = proc.CommandLine rescue nil
|
214
|
+
next unless cmd && cmd.include?("user-data-dir=C:/board_cookie")
|
215
|
+
proc.Terminate rescue nil
|
216
|
+
rescue
|
217
|
+
end
|
218
|
+
end
|
219
|
+
sleep(1)
|
220
|
+
rescue
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
231
224
|
|
232
225
|
def login(proxy, captcha_key, board_cookie_dir = "C:/board_cookie")
|
233
226
|
@captcha_key = captcha_key
|
@@ -243,12 +236,21 @@ class Naver
|
|
243
236
|
end
|
244
237
|
end
|
245
238
|
|
239
|
+
|
240
|
+
begin
|
241
|
+
ChromeKiller.kill_selenium_chrome
|
242
|
+
sleep(2)
|
243
|
+
rescue
|
244
|
+
end
|
245
|
+
|
246
246
|
# 새로운 스레드 생성 및 실행
|
247
|
-
Thread.new { chrome_setup(proxy, board_cookie_dir)
|
247
|
+
Thread.new { chrome_setup(proxy, board_cookie_dir)}
|
248
248
|
|
249
249
|
# 충분한 대기 시간을 두고 실행
|
250
250
|
sleep(1)
|
251
251
|
|
252
|
+
|
253
|
+
|
252
254
|
chrome_start(proxy, board_cookie_dir)
|
253
255
|
|
254
256
|
|
@@ -691,12 +693,22 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
|
|
691
693
|
|
692
694
|
#오른쪽 마우스 해제 코드
|
693
695
|
begin
|
694
|
-
# 우 클릭 해제
|
696
|
+
# 우 클릭 해제
|
695
697
|
@driver.execute_script <<~JS
|
696
|
-
|
698
|
+
// 모든 요소 순회하면서 oncontextmenu 제거
|
699
|
+
document.querySelectorAll('*').forEach(el => {
|
700
|
+
el.oncontextmenu = null;
|
701
|
+
});
|
702
|
+
|
703
|
+
// 이벤트 리스너로 막는 것도 제거
|
697
704
|
document.addEventListener('contextmenu', event => event.stopPropagation(), true);
|
698
705
|
document.oncontextmenu = null;
|
699
|
-
document.
|
706
|
+
if (document.documentElement) {
|
707
|
+
document.documentElement.oncontextmenu = null; // <html> 태그
|
708
|
+
}
|
709
|
+
if (document.body) {
|
710
|
+
document.body.oncontextmenu = null; // <body> 태그
|
711
|
+
}
|
700
712
|
JS
|
701
713
|
rescue
|
702
714
|
end
|
@@ -1177,7 +1189,9 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
|
|
1177
1189
|
##<────────────────────────────────────────────────────────────────────────────────────────────────────────────────캡챠 체크
|
1178
1190
|
##<────────────────────────────────────────────────────────────────────────────────────────────────────────────────캡챠 체크
|
1179
1191
|
##<────────────────────────────────────────────────────────────────────────────────────────────────────────────────캡챠 체크
|
1180
|
-
|
1192
|
+
|
1193
|
+
|
1194
|
+
|
1181
1195
|
begin
|
1182
1196
|
@driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]')
|
1183
1197
|
check_captcha = 1
|
@@ -2002,12 +2016,25 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
|
|
2002
2016
|
sleep(1)
|
2003
2017
|
##캡챠 이미지,2캡챠,,등등 코드 부분─────────────────────────────────────────────────────────────────────>
|
2004
2018
|
begin
|
2005
|
-
# 우 클릭 해제
|
2019
|
+
# 우 클릭 해제 alert 팝업 활성화
|
2006
2020
|
@driver.execute_script <<~JS
|
2021
|
+
// 기존 alert 저장하고 비활성화
|
2022
|
+
window._originalAlert = window.alert;
|
2007
2023
|
window.alert = function() {};
|
2024
|
+
|
2025
|
+
// 전체 DOM 요소에서 우클릭 차단 해제
|
2026
|
+
document.querySelectorAll('*').forEach(el => {
|
2027
|
+
el.oncontextmenu = null;
|
2028
|
+
});
|
2029
|
+
|
2008
2030
|
document.addEventListener('contextmenu', event => event.stopPropagation(), true);
|
2009
2031
|
document.oncontextmenu = null;
|
2010
|
-
document.
|
2032
|
+
if (document.documentElement) {
|
2033
|
+
document.documentElement.oncontextmenu = null;
|
2034
|
+
}
|
2035
|
+
if (document.body) {
|
2036
|
+
document.body.oncontextmenu = null;
|
2037
|
+
}
|
2011
2038
|
JS
|
2012
2039
|
rescue
|
2013
2040
|
end
|
@@ -3546,15 +3573,19 @@ end
|
|
3546
3573
|
|
3547
3574
|
|
3548
3575
|
|
3549
|
-
|
3550
|
-
|
3551
|
-
|
3552
|
-
|
3553
|
-
|
3554
|
-
|
3555
3576
|
else
|
3556
3577
|
end
|
3557
3578
|
|
3579
|
+
begin
|
3580
|
+
# 우 클릭 해제 alert 금지 비활성
|
3581
|
+
@driver.execute_script <<~JS
|
3582
|
+
if (window._originalAlert) {
|
3583
|
+
window.alert = window._originalAlert;
|
3584
|
+
delete window._originalAlert;
|
3585
|
+
}
|
3586
|
+
JS
|
3587
|
+
rescue
|
3588
|
+
end
|
3558
3589
|
|
3559
3590
|
##<─────────────────────────────────────────────────────────────────────캡챠 해제 입력 코드 부분
|
3560
3591
|
|
@@ -3712,12 +3743,22 @@ login_url = option['login_url'].to_s
|
|
3712
3743
|
|
3713
3744
|
##캡챠 해제 입력 코드 부분─────────────────────────────────────────────────────────────────────>
|
3714
3745
|
begin
|
3715
|
-
# 우 클릭 해제
|
3746
|
+
# 우 클릭 해제
|
3716
3747
|
@driver.execute_script <<~JS
|
3717
|
-
|
3748
|
+
// 모든 요소 순회하면서 oncontextmenu 제거
|
3749
|
+
document.querySelectorAll('*').forEach(el => {
|
3750
|
+
el.oncontextmenu = null;
|
3751
|
+
});
|
3752
|
+
|
3753
|
+
// 이벤트 리스너로 막는 것도 제거
|
3718
3754
|
document.addEventListener('contextmenu', event => event.stopPropagation(), true);
|
3719
3755
|
document.oncontextmenu = null;
|
3720
|
-
document.
|
3756
|
+
if (document.documentElement) {
|
3757
|
+
document.documentElement.oncontextmenu = null; // <html> 태그
|
3758
|
+
}
|
3759
|
+
if (document.body) {
|
3760
|
+
document.body.oncontextmenu = null; // <body> 태그
|
3761
|
+
}
|
3721
3762
|
JS
|
3722
3763
|
rescue
|
3723
3764
|
end
|
@@ -5156,12 +5197,22 @@ begin
|
|
5156
5197
|
|
5157
5198
|
sleep(1)
|
5158
5199
|
begin
|
5159
|
-
# 우 클릭 해제
|
5200
|
+
# 우 클릭 해제
|
5160
5201
|
@driver.execute_script <<~JS
|
5161
|
-
|
5202
|
+
// 모든 요소 순회하면서 oncontextmenu 제거
|
5203
|
+
document.querySelectorAll('*').forEach(el => {
|
5204
|
+
el.oncontextmenu = null;
|
5205
|
+
});
|
5206
|
+
|
5207
|
+
// 이벤트 리스너로 막는 것도 제거
|
5162
5208
|
document.addEventListener('contextmenu', event => event.stopPropagation(), true);
|
5163
5209
|
document.oncontextmenu = null;
|
5164
|
-
document.
|
5210
|
+
if (document.documentElement) {
|
5211
|
+
document.documentElement.oncontextmenu = null; // <html> 태그
|
5212
|
+
}
|
5213
|
+
if (document.body) {
|
5214
|
+
document.body.oncontextmenu = null; // <body> 태그
|
5215
|
+
}
|
5165
5216
|
JS
|
5166
5217
|
rescue
|
5167
5218
|
end
|
@@ -5539,12 +5590,22 @@ post_url = option['post_url'].to_s
|
|
5539
5590
|
|
5540
5591
|
sleep(1)
|
5541
5592
|
begin
|
5542
|
-
# 우 클릭 해제
|
5593
|
+
# 우 클릭 해제
|
5543
5594
|
@driver.execute_script <<~JS
|
5544
|
-
|
5595
|
+
// 모든 요소 순회하면서 oncontextmenu 제거
|
5596
|
+
document.querySelectorAll('*').forEach(el => {
|
5597
|
+
el.oncontextmenu = null;
|
5598
|
+
});
|
5599
|
+
|
5600
|
+
// 이벤트 리스너로 막는 것도 제거
|
5545
5601
|
document.addEventListener('contextmenu', event => event.stopPropagation(), true);
|
5546
5602
|
document.oncontextmenu = null;
|
5547
|
-
document.
|
5603
|
+
if (document.documentElement) {
|
5604
|
+
document.documentElement.oncontextmenu = null; // <html> 태그
|
5605
|
+
}
|
5606
|
+
if (document.body) {
|
5607
|
+
document.body.oncontextmenu = null; // <body> 태그
|
5608
|
+
}
|
5548
5609
|
JS
|
5549
5610
|
rescue
|
5550
5611
|
end
|
@@ -7877,17 +7938,6 @@ rescue
|
|
7877
7938
|
puts '-[√] 제목 입력 항목 코드 탐색 실패!!.......'.red
|
7878
7939
|
puts '-[√] 다음 작업 준비 중으로 1~60 초 정도 기다려주세요.......'.red
|
7879
7940
|
|
7880
|
-
@driver.window_handles.each do |handle|
|
7881
|
-
@driver.switch_to.window(handle)
|
7882
|
-
begin
|
7883
|
-
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
7884
|
-
@driver.close
|
7885
|
-
|
7886
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
7887
|
-
puts "크롬 브라우저 종료: #{e.message}"
|
7888
|
-
end
|
7889
|
-
end
|
7890
|
-
#return 0
|
7891
7941
|
@driver.quit
|
7892
7942
|
sleep(1)
|
7893
7943
|
return 0
|
@@ -9733,12 +9783,25 @@ rescue
|
|
9733
9783
|
end
|
9734
9784
|
|
9735
9785
|
begin
|
9736
|
-
# 우 클릭 해제
|
9786
|
+
# 우 클릭 해제 alert 팝업 활성화
|
9737
9787
|
@driver.execute_script <<~JS
|
9788
|
+
// 기존 alert 저장하고 비활성화
|
9789
|
+
window._originalAlert = window.alert;
|
9738
9790
|
window.alert = function() {};
|
9791
|
+
|
9792
|
+
// 전체 DOM 요소에서 우클릭 차단 해제
|
9793
|
+
document.querySelectorAll('*').forEach(el => {
|
9794
|
+
el.oncontextmenu = null;
|
9795
|
+
});
|
9796
|
+
|
9739
9797
|
document.addEventListener('contextmenu', event => event.stopPropagation(), true);
|
9740
9798
|
document.oncontextmenu = null;
|
9741
|
-
document.
|
9799
|
+
if (document.documentElement) {
|
9800
|
+
document.documentElement.oncontextmenu = null;
|
9801
|
+
}
|
9802
|
+
if (document.body) {
|
9803
|
+
document.body.oncontextmenu = null;
|
9804
|
+
}
|
9742
9805
|
JS
|
9743
9806
|
rescue
|
9744
9807
|
end
|
@@ -11635,9 +11698,16 @@ end
|
|
11635
11698
|
|
11636
11699
|
|
11637
11700
|
|
11638
|
-
|
11639
|
-
|
11640
|
-
|
11701
|
+
begin
|
11702
|
+
# 우 클릭 해제 alert 금지 비활성
|
11703
|
+
@driver.execute_script <<~JS
|
11704
|
+
if (window._originalAlert) {
|
11705
|
+
window.alert = window._originalAlert;
|
11706
|
+
delete window._originalAlert;
|
11707
|
+
}
|
11708
|
+
JS
|
11709
|
+
rescue
|
11710
|
+
end
|
11641
11711
|
##<─────────────────────────────────────────────────────────────────────캡챠 해제 입력 코드 부분
|
11642
11712
|
|
11643
11713
|
|
@@ -12434,87 +12504,7 @@ end
|
|
12434
12504
|
end
|
12435
12505
|
|
12436
12506
|
|
12437
|
-
begin
|
12438
|
-
# 타임아웃을 3초로 설정
|
12439
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
12440
|
-
# 요소가 나타날 때까지 30초 동안 기다립니다.
|
12441
|
-
wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
|
12442
|
-
sleep(1)
|
12443
|
-
el_ready = @driver.find_element(:xpath, '//*[@data-state="ready"]')
|
12444
|
-
@driver.action.move_to(el_ready).perform
|
12445
|
-
sleep(1)
|
12446
|
-
begin
|
12447
|
-
@driver.execute_script(<<~JS)
|
12448
|
-
document.querySelectorAll('.captcha-solver[data-state="solved"]').forEach(el => el.remove());
|
12449
|
-
JS
|
12450
12507
|
|
12451
|
-
puts "방해 캡차 관련 요소 제거 완료".green
|
12452
|
-
rescue
|
12453
|
-
end
|
12454
|
-
puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
|
12455
|
-
begin
|
12456
|
-
@driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
|
12457
|
-
rescue
|
12458
|
-
begin
|
12459
|
-
@driver.find_element(:xpath, '//*[@class="captcha-solver-image"]').click #캡챠우회버튼
|
12460
|
-
rescue
|
12461
|
-
begin
|
12462
|
-
@driver.find_element(:xpath, '//*[@class="captcha-solver-info"]').click #캡챠우회버튼
|
12463
|
-
rescue
|
12464
|
-
begin
|
12465
|
-
@driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]').click #캡챠우회버튼
|
12466
|
-
rescue
|
12467
|
-
end
|
12468
|
-
end
|
12469
|
-
end
|
12470
|
-
end
|
12471
|
-
|
12472
|
-
sleep(10)
|
12473
|
-
begin
|
12474
|
-
@driver.find_element(:xpath, '//*[@data-state="error"]').click
|
12475
|
-
puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
|
12476
|
-
puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
|
12477
|
-
@driver.window_handles.each do |handle|
|
12478
|
-
@driver.switch_to.window(handle)
|
12479
|
-
begin
|
12480
|
-
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
12481
|
-
@driver.close
|
12482
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
12483
|
-
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
12484
|
-
end
|
12485
|
-
end
|
12486
|
-
#return 0
|
12487
|
-
@driver.quit
|
12488
|
-
sleep(1)
|
12489
|
-
return 0
|
12490
|
-
sleep(1)
|
12491
|
-
rescue
|
12492
|
-
wait = Selenium::WebDriver::Wait.new(timeout: 150)
|
12493
|
-
|
12494
|
-
begin
|
12495
|
-
wait.until do
|
12496
|
-
begin
|
12497
|
-
# data-state="solved" 요소가 있으면 true (대기 종료)
|
12498
|
-
@driver.find_element(:xpath, '//*[@data-state="solved"]')
|
12499
|
-
true
|
12500
|
-
rescue Selenium::WebDriver::Error::StaleElementReferenceError
|
12501
|
-
# 페이지가 바뀌면 true (대기 종료)
|
12502
|
-
true
|
12503
|
-
rescue Selenium::WebDriver::Error::NoSuchElementError
|
12504
|
-
# 요소가 아직 없으면 false (계속 대기)
|
12505
|
-
false
|
12506
|
-
end
|
12507
|
-
end
|
12508
|
-
rescue Selenium::WebDriver::Error::TimeoutError
|
12509
|
-
# 150초 지나도 못 찾으면 여기로 넘어감
|
12510
|
-
end
|
12511
|
-
|
12512
|
-
puts '-[√] 캡챠 해제 완료 또는 페이지 변경 감지 → 이어서 진행 합니다.......'.green
|
12513
|
-
sleep(5)
|
12514
|
-
|
12515
|
-
end
|
12516
|
-
rescue
|
12517
|
-
end
|
12518
12508
|
|
12519
12509
|
########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 ▲▲▲▲▲▲▲──────────────────────────────#######
|
12520
12510
|
########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 ▲▲▲▲▲▲▲──────────────────────────────#######
|
@@ -12538,11 +12528,9 @@ rescue => e
|
|
12538
12528
|
sleep(1)
|
12539
12529
|
end
|
12540
12530
|
|
12541
|
-
|
12531
|
+
|
12542
12532
|
begin
|
12543
|
-
|
12544
12533
|
banned_word = nil
|
12545
|
-
|
12546
12534
|
begin
|
12547
12535
|
wait = Selenium::WebDriver::Wait.new(timeout: 2)
|
12548
12536
|
alert = wait.until { @driver.switch_to.alert }
|
@@ -12604,16 +12592,101 @@ end
|
|
12604
12592
|
|
12605
12593
|
end #반복루프
|
12606
12594
|
|
12607
|
-
|
12608
|
-
|
12609
|
-
|
12610
|
-
|
12611
|
-
|
12612
|
-
|
12595
|
+
begin
|
12596
|
+
wait = Selenium::WebDriver::Wait.new(timeout: 2)
|
12597
|
+
alert = wait.until { @driver.switch_to.alert }
|
12598
|
+
alert_text = alert.text # alert 메시지 저장
|
12599
|
+
alert.accept
|
12600
|
+
rescue
|
12601
|
+
end
|
12602
|
+
|
12603
|
+
begin
|
12604
|
+
# 타임아웃을 3초로 설정
|
12605
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
12606
|
+
# 요소가 나타날 때까지 30초 동안 기다립니다.
|
12607
|
+
wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
|
12608
|
+
sleep(1)
|
12609
|
+
el_ready = @driver.find_element(:xpath, '//*[@data-state="ready"]')
|
12610
|
+
@driver.action.move_to(el_ready).perform
|
12611
|
+
sleep(1)
|
12612
|
+
begin
|
12613
|
+
@driver.execute_script(<<~JS)
|
12614
|
+
document.querySelectorAll('.captcha-solver[data-state="solved"]').forEach(el => el.remove());
|
12615
|
+
JS
|
12616
|
+
|
12617
|
+
puts "방해 캡차 관련 요소 제거 완료".green
|
12618
|
+
rescue
|
12613
12619
|
end
|
12620
|
+
puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
|
12621
|
+
begin
|
12622
|
+
@driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
|
12623
|
+
rescue
|
12624
|
+
begin
|
12625
|
+
@driver.find_element(:xpath, '//*[@class="captcha-solver-image"]').click #캡챠우회버튼
|
12626
|
+
rescue
|
12627
|
+
begin
|
12628
|
+
@driver.find_element(:xpath, '//*[@class="captcha-solver-info"]').click #캡챠우회버튼
|
12629
|
+
rescue
|
12630
|
+
begin
|
12631
|
+
@driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]').click #캡챠우회버튼
|
12632
|
+
rescue
|
12633
|
+
end
|
12634
|
+
end
|
12635
|
+
end
|
12636
|
+
end
|
12637
|
+
|
12638
|
+
sleep(10)
|
12639
|
+
begin
|
12640
|
+
@driver.find_element(:xpath, '//*[@data-state="error"]').click
|
12641
|
+
puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
|
12642
|
+
puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
|
12643
|
+
@driver.window_handles.each do |handle|
|
12644
|
+
@driver.switch_to.window(handle)
|
12645
|
+
begin
|
12646
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
12647
|
+
@driver.close
|
12648
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
12649
|
+
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
12650
|
+
end
|
12651
|
+
end
|
12652
|
+
#return 0
|
12653
|
+
@driver.quit
|
12654
|
+
sleep(1)
|
12655
|
+
return 0
|
12656
|
+
sleep(1)
|
12657
|
+
rescue
|
12658
|
+
wait = Selenium::WebDriver::Wait.new(timeout: 150)
|
12659
|
+
|
12660
|
+
begin
|
12661
|
+
wait.until do
|
12662
|
+
begin
|
12663
|
+
# data-state="solved" 요소가 있으면 true (대기 종료)
|
12664
|
+
@driver.find_element(:xpath, '//*[@data-state="solved"]')
|
12665
|
+
true
|
12666
|
+
rescue Selenium::WebDriver::Error::StaleElementReferenceError
|
12667
|
+
# 페이지가 바뀌면 true (대기 종료)
|
12668
|
+
true
|
12669
|
+
rescue Selenium::WebDriver::Error::NoSuchElementError
|
12670
|
+
# 요소가 아직 없으면 false (계속 대기)
|
12671
|
+
false
|
12672
|
+
end
|
12673
|
+
end
|
12674
|
+
rescue Selenium::WebDriver::Error::TimeoutError
|
12675
|
+
# 150초 지나도 못 찾으면 여기로 넘어감
|
12676
|
+
end
|
12677
|
+
|
12678
|
+
puts '-[√] 캡챠 해제 완료 또는 페이지 변경 감지 → 이어서 진행 합니다.......'.green
|
12679
|
+
sleep(5)
|
12680
|
+
|
12681
|
+
end
|
12682
|
+
rescue
|
12683
|
+
end
|
12684
|
+
|
12685
|
+
|
12614
12686
|
sleep(2)
|
12615
12687
|
|
12616
12688
|
|
12689
|
+
|
12617
12690
|
begin
|
12618
12691
|
# log 디렉토리가 없다면 생성
|
12619
12692
|
Dir.mkdir('./log') unless Dir.exist?('./log')
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: posting_zon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.111.002
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-06-
|
10
|
+
date: 2025-06-25 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: posting app
|
13
13
|
email: mymin26@naver.com
|