posting_duo 3.110.999 → 3.111.001
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_duo.rb +197 -115
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9c815887c83839b749cb8341a93eb37c31e2a4f5f07cb628785638665e17f6a
|
4
|
+
data.tar.gz: 4379e26d86d58242b773287432b16bdd62ead1c59e778ec82a4716d1fee0cec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03dadb3df19ca18a2f338c512f4a965a710f0474ac36353f40776838891008c42c2c8a883ee1660493134250af6d95c2654d9edf4f3228396db1de56e984d9e2
|
7
|
+
data.tar.gz: 053e818d75cd0efd2f0b7e87d2c22f042a149fae0959515b7b7ce55f635a1070fb286435924b9897f5249afc7b59fbbaa6342fb8ea56dc8ba43aefe12f58cfa9
|
data/lib/posting_duo.rb
CHANGED
@@ -691,12 +691,22 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
|
|
691
691
|
|
692
692
|
#오른쪽 마우스 해제 코드
|
693
693
|
begin
|
694
|
-
# 우 클릭 해제
|
694
|
+
# 우 클릭 해제
|
695
695
|
@driver.execute_script <<~JS
|
696
|
-
|
696
|
+
// 모든 요소 순회하면서 oncontextmenu 제거
|
697
|
+
document.querySelectorAll('*').forEach(el => {
|
698
|
+
el.oncontextmenu = null;
|
699
|
+
});
|
700
|
+
|
701
|
+
// 이벤트 리스너로 막는 것도 제거
|
697
702
|
document.addEventListener('contextmenu', event => event.stopPropagation(), true);
|
698
703
|
document.oncontextmenu = null;
|
699
|
-
document.
|
704
|
+
if (document.documentElement) {
|
705
|
+
document.documentElement.oncontextmenu = null; // <html> 태그
|
706
|
+
}
|
707
|
+
if (document.body) {
|
708
|
+
document.body.oncontextmenu = null; // <body> 태그
|
709
|
+
}
|
700
710
|
JS
|
701
711
|
rescue
|
702
712
|
end
|
@@ -1177,7 +1187,9 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
|
|
1177
1187
|
##<────────────────────────────────────────────────────────────────────────────────────────────────────────────────캡챠 체크
|
1178
1188
|
##<────────────────────────────────────────────────────────────────────────────────────────────────────────────────캡챠 체크
|
1179
1189
|
##<────────────────────────────────────────────────────────────────────────────────────────────────────────────────캡챠 체크
|
1180
|
-
|
1190
|
+
|
1191
|
+
|
1192
|
+
|
1181
1193
|
begin
|
1182
1194
|
@driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]')
|
1183
1195
|
check_captcha = 1
|
@@ -2002,12 +2014,25 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
|
|
2002
2014
|
sleep(1)
|
2003
2015
|
##캡챠 이미지,2캡챠,,등등 코드 부분─────────────────────────────────────────────────────────────────────>
|
2004
2016
|
begin
|
2005
|
-
# 우 클릭 해제
|
2017
|
+
# 우 클릭 해제 alert 팝업 활성화
|
2006
2018
|
@driver.execute_script <<~JS
|
2019
|
+
// 기존 alert 저장하고 비활성화
|
2020
|
+
window._originalAlert = window.alert;
|
2007
2021
|
window.alert = function() {};
|
2022
|
+
|
2023
|
+
// 전체 DOM 요소에서 우클릭 차단 해제
|
2024
|
+
document.querySelectorAll('*').forEach(el => {
|
2025
|
+
el.oncontextmenu = null;
|
2026
|
+
});
|
2027
|
+
|
2008
2028
|
document.addEventListener('contextmenu', event => event.stopPropagation(), true);
|
2009
2029
|
document.oncontextmenu = null;
|
2010
|
-
document.
|
2030
|
+
if (document.documentElement) {
|
2031
|
+
document.documentElement.oncontextmenu = null;
|
2032
|
+
}
|
2033
|
+
if (document.body) {
|
2034
|
+
document.body.oncontextmenu = null;
|
2035
|
+
}
|
2011
2036
|
JS
|
2012
2037
|
rescue
|
2013
2038
|
end
|
@@ -3546,15 +3571,19 @@ end
|
|
3546
3571
|
|
3547
3572
|
|
3548
3573
|
|
3549
|
-
|
3550
|
-
|
3551
|
-
|
3552
|
-
|
3553
|
-
|
3554
|
-
|
3555
3574
|
else
|
3556
3575
|
end
|
3557
3576
|
|
3577
|
+
begin
|
3578
|
+
# 우 클릭 해제 alert 금지 비활성
|
3579
|
+
@driver.execute_script <<~JS
|
3580
|
+
if (window._originalAlert) {
|
3581
|
+
window.alert = window._originalAlert;
|
3582
|
+
delete window._originalAlert;
|
3583
|
+
}
|
3584
|
+
JS
|
3585
|
+
rescue
|
3586
|
+
end
|
3558
3587
|
|
3559
3588
|
##<─────────────────────────────────────────────────────────────────────캡챠 해제 입력 코드 부분
|
3560
3589
|
|
@@ -3712,12 +3741,22 @@ login_url = option['login_url'].to_s
|
|
3712
3741
|
|
3713
3742
|
##캡챠 해제 입력 코드 부분─────────────────────────────────────────────────────────────────────>
|
3714
3743
|
begin
|
3715
|
-
# 우 클릭 해제
|
3744
|
+
# 우 클릭 해제
|
3716
3745
|
@driver.execute_script <<~JS
|
3717
|
-
|
3746
|
+
// 모든 요소 순회하면서 oncontextmenu 제거
|
3747
|
+
document.querySelectorAll('*').forEach(el => {
|
3748
|
+
el.oncontextmenu = null;
|
3749
|
+
});
|
3750
|
+
|
3751
|
+
// 이벤트 리스너로 막는 것도 제거
|
3718
3752
|
document.addEventListener('contextmenu', event => event.stopPropagation(), true);
|
3719
3753
|
document.oncontextmenu = null;
|
3720
|
-
document.
|
3754
|
+
if (document.documentElement) {
|
3755
|
+
document.documentElement.oncontextmenu = null; // <html> 태그
|
3756
|
+
}
|
3757
|
+
if (document.body) {
|
3758
|
+
document.body.oncontextmenu = null; // <body> 태그
|
3759
|
+
}
|
3721
3760
|
JS
|
3722
3761
|
rescue
|
3723
3762
|
end
|
@@ -5156,12 +5195,22 @@ begin
|
|
5156
5195
|
|
5157
5196
|
sleep(1)
|
5158
5197
|
begin
|
5159
|
-
# 우 클릭 해제
|
5198
|
+
# 우 클릭 해제
|
5160
5199
|
@driver.execute_script <<~JS
|
5161
|
-
|
5200
|
+
// 모든 요소 순회하면서 oncontextmenu 제거
|
5201
|
+
document.querySelectorAll('*').forEach(el => {
|
5202
|
+
el.oncontextmenu = null;
|
5203
|
+
});
|
5204
|
+
|
5205
|
+
// 이벤트 리스너로 막는 것도 제거
|
5162
5206
|
document.addEventListener('contextmenu', event => event.stopPropagation(), true);
|
5163
5207
|
document.oncontextmenu = null;
|
5164
|
-
document.
|
5208
|
+
if (document.documentElement) {
|
5209
|
+
document.documentElement.oncontextmenu = null; // <html> 태그
|
5210
|
+
}
|
5211
|
+
if (document.body) {
|
5212
|
+
document.body.oncontextmenu = null; // <body> 태그
|
5213
|
+
}
|
5165
5214
|
JS
|
5166
5215
|
rescue
|
5167
5216
|
end
|
@@ -5539,12 +5588,22 @@ post_url = option['post_url'].to_s
|
|
5539
5588
|
|
5540
5589
|
sleep(1)
|
5541
5590
|
begin
|
5542
|
-
# 우 클릭 해제
|
5591
|
+
# 우 클릭 해제
|
5543
5592
|
@driver.execute_script <<~JS
|
5544
|
-
|
5593
|
+
// 모든 요소 순회하면서 oncontextmenu 제거
|
5594
|
+
document.querySelectorAll('*').forEach(el => {
|
5595
|
+
el.oncontextmenu = null;
|
5596
|
+
});
|
5597
|
+
|
5598
|
+
// 이벤트 리스너로 막는 것도 제거
|
5545
5599
|
document.addEventListener('contextmenu', event => event.stopPropagation(), true);
|
5546
5600
|
document.oncontextmenu = null;
|
5547
|
-
document.
|
5601
|
+
if (document.documentElement) {
|
5602
|
+
document.documentElement.oncontextmenu = null; // <html> 태그
|
5603
|
+
}
|
5604
|
+
if (document.body) {
|
5605
|
+
document.body.oncontextmenu = null; // <body> 태그
|
5606
|
+
}
|
5548
5607
|
JS
|
5549
5608
|
rescue
|
5550
5609
|
end
|
@@ -9733,12 +9792,25 @@ rescue
|
|
9733
9792
|
end
|
9734
9793
|
|
9735
9794
|
begin
|
9736
|
-
# 우 클릭 해제
|
9795
|
+
# 우 클릭 해제 alert 팝업 활성화
|
9737
9796
|
@driver.execute_script <<~JS
|
9797
|
+
// 기존 alert 저장하고 비활성화
|
9798
|
+
window._originalAlert = window.alert;
|
9738
9799
|
window.alert = function() {};
|
9800
|
+
|
9801
|
+
// 전체 DOM 요소에서 우클릭 차단 해제
|
9802
|
+
document.querySelectorAll('*').forEach(el => {
|
9803
|
+
el.oncontextmenu = null;
|
9804
|
+
});
|
9805
|
+
|
9739
9806
|
document.addEventListener('contextmenu', event => event.stopPropagation(), true);
|
9740
9807
|
document.oncontextmenu = null;
|
9741
|
-
document.
|
9808
|
+
if (document.documentElement) {
|
9809
|
+
document.documentElement.oncontextmenu = null;
|
9810
|
+
}
|
9811
|
+
if (document.body) {
|
9812
|
+
document.body.oncontextmenu = null;
|
9813
|
+
}
|
9742
9814
|
JS
|
9743
9815
|
rescue
|
9744
9816
|
end
|
@@ -11635,9 +11707,16 @@ end
|
|
11635
11707
|
|
11636
11708
|
|
11637
11709
|
|
11638
|
-
|
11639
|
-
|
11640
|
-
|
11710
|
+
begin
|
11711
|
+
# 우 클릭 해제 alert 금지 비활성
|
11712
|
+
@driver.execute_script <<~JS
|
11713
|
+
if (window._originalAlert) {
|
11714
|
+
window.alert = window._originalAlert;
|
11715
|
+
delete window._originalAlert;
|
11716
|
+
}
|
11717
|
+
JS
|
11718
|
+
rescue
|
11719
|
+
end
|
11641
11720
|
##<─────────────────────────────────────────────────────────────────────캡챠 해제 입력 코드 부분
|
11642
11721
|
|
11643
11722
|
|
@@ -12434,87 +12513,7 @@ end
|
|
12434
12513
|
end
|
12435
12514
|
|
12436
12515
|
|
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
|
-
|
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
12516
|
|
12515
|
-
end
|
12516
|
-
rescue
|
12517
|
-
end
|
12518
12517
|
|
12519
12518
|
########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 ▲▲▲▲▲▲▲──────────────────────────────#######
|
12520
12519
|
########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 ▲▲▲▲▲▲▲──────────────────────────────#######
|
@@ -12538,11 +12537,9 @@ rescue => e
|
|
12538
12537
|
sleep(1)
|
12539
12538
|
end
|
12540
12539
|
|
12541
|
-
|
12540
|
+
|
12542
12541
|
begin
|
12543
|
-
|
12544
12542
|
banned_word = nil
|
12545
|
-
|
12546
12543
|
begin
|
12547
12544
|
wait = Selenium::WebDriver::Wait.new(timeout: 2)
|
12548
12545
|
alert = wait.until { @driver.switch_to.alert }
|
@@ -12604,16 +12601,101 @@ end
|
|
12604
12601
|
|
12605
12602
|
end #반복루프
|
12606
12603
|
|
12607
|
-
|
12608
|
-
|
12609
|
-
|
12610
|
-
|
12611
|
-
|
12612
|
-
|
12604
|
+
begin
|
12605
|
+
wait = Selenium::WebDriver::Wait.new(timeout: 2)
|
12606
|
+
alert = wait.until { @driver.switch_to.alert }
|
12607
|
+
alert_text = alert.text # alert 메시지 저장
|
12608
|
+
alert.accept
|
12609
|
+
rescue
|
12610
|
+
end
|
12611
|
+
|
12612
|
+
begin
|
12613
|
+
# 타임아웃을 3초로 설정
|
12614
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
12615
|
+
# 요소가 나타날 때까지 30초 동안 기다립니다.
|
12616
|
+
wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
|
12617
|
+
sleep(1)
|
12618
|
+
el_ready = @driver.find_element(:xpath, '//*[@data-state="ready"]')
|
12619
|
+
@driver.action.move_to(el_ready).perform
|
12620
|
+
sleep(1)
|
12621
|
+
begin
|
12622
|
+
@driver.execute_script(<<~JS)
|
12623
|
+
document.querySelectorAll('.captcha-solver[data-state="solved"]').forEach(el => el.remove());
|
12624
|
+
JS
|
12625
|
+
|
12626
|
+
puts "방해 캡차 관련 요소 제거 완료".green
|
12627
|
+
rescue
|
12628
|
+
end
|
12629
|
+
puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
|
12630
|
+
begin
|
12631
|
+
@driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
|
12632
|
+
rescue
|
12633
|
+
begin
|
12634
|
+
@driver.find_element(:xpath, '//*[@class="captcha-solver-image"]').click #캡챠우회버튼
|
12635
|
+
rescue
|
12636
|
+
begin
|
12637
|
+
@driver.find_element(:xpath, '//*[@class="captcha-solver-info"]').click #캡챠우회버튼
|
12638
|
+
rescue
|
12639
|
+
begin
|
12640
|
+
@driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]').click #캡챠우회버튼
|
12641
|
+
rescue
|
12642
|
+
end
|
12643
|
+
end
|
12644
|
+
end
|
12613
12645
|
end
|
12646
|
+
|
12647
|
+
sleep(10)
|
12648
|
+
begin
|
12649
|
+
@driver.find_element(:xpath, '//*[@data-state="error"]').click
|
12650
|
+
puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
|
12651
|
+
puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
|
12652
|
+
@driver.window_handles.each do |handle|
|
12653
|
+
@driver.switch_to.window(handle)
|
12654
|
+
begin
|
12655
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
12656
|
+
@driver.close
|
12657
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
12658
|
+
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
12659
|
+
end
|
12660
|
+
end
|
12661
|
+
#return 0
|
12662
|
+
@driver.quit
|
12663
|
+
sleep(1)
|
12664
|
+
return 0
|
12665
|
+
sleep(1)
|
12666
|
+
rescue
|
12667
|
+
wait = Selenium::WebDriver::Wait.new(timeout: 150)
|
12668
|
+
|
12669
|
+
begin
|
12670
|
+
wait.until do
|
12671
|
+
begin
|
12672
|
+
# data-state="solved" 요소가 있으면 true (대기 종료)
|
12673
|
+
@driver.find_element(:xpath, '//*[@data-state="solved"]')
|
12674
|
+
true
|
12675
|
+
rescue Selenium::WebDriver::Error::StaleElementReferenceError
|
12676
|
+
# 페이지가 바뀌면 true (대기 종료)
|
12677
|
+
true
|
12678
|
+
rescue Selenium::WebDriver::Error::NoSuchElementError
|
12679
|
+
# 요소가 아직 없으면 false (계속 대기)
|
12680
|
+
false
|
12681
|
+
end
|
12682
|
+
end
|
12683
|
+
rescue Selenium::WebDriver::Error::TimeoutError
|
12684
|
+
# 150초 지나도 못 찾으면 여기로 넘어감
|
12685
|
+
end
|
12686
|
+
|
12687
|
+
puts '-[√] 캡챠 해제 완료 또는 페이지 변경 감지 → 이어서 진행 합니다.......'.green
|
12688
|
+
sleep(5)
|
12689
|
+
|
12690
|
+
end
|
12691
|
+
rescue
|
12692
|
+
end
|
12693
|
+
|
12694
|
+
|
12614
12695
|
sleep(2)
|
12615
12696
|
|
12616
12697
|
|
12698
|
+
|
12617
12699
|
begin
|
12618
12700
|
# log 디렉토리가 없다면 생성
|
12619
12701
|
Dir.mkdir('./log') unless Dir.exist?('./log')
|