posting_duo 0.0.71 → 0.2.3
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 +518 -373
- 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: cd7e0df5fa12b56ce1408bde9d167e9213724ac069346d7307a7f85cca3bcd73
|
4
|
+
data.tar.gz: 29813ff8a4cae0d5bbedb043d9ce49033981a1bb7542b1e8ec7eb267f9ac22b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27332d4ef436dec6fd8a38f6275f42d422b4acbb81e2137e7b7303d8cb2b9c25b1e8f23713cd15d2c48fe0481ca37598d213a29b1609d4007a9cfaaca066463d
|
7
|
+
data.tar.gz: 63cbb9cbc7b6c3b31a40914a63b78c206a7cfecb794aa073cc372525c3142b9cc0a0d2053979e2f909ff18e0df3ae44330a165c146f2c1aedbdaa515aecdfcca
|
data/lib/posting_duo.rb
CHANGED
@@ -20,6 +20,7 @@ require 'auto_click'
|
|
20
20
|
require 'rainbow/refinement'
|
21
21
|
require 'watir'
|
22
22
|
require 'timeout'
|
23
|
+
require 'win32ole'
|
23
24
|
include AutoClickMethods
|
24
25
|
using Rainbow
|
25
26
|
|
@@ -30,12 +31,10 @@ class Naver
|
|
30
31
|
def initialize
|
31
32
|
|
32
33
|
begin
|
33
|
-
|
34
|
-
|
35
|
-
# Webdrivers가 드라이버를 다운로드할 경로를 설정
|
34
|
+
puts "크롬을 최신 상태로 업데이트 해주세요"
|
35
|
+
puts "크롬 최신 상태가 아닐경우 오류가 발생될수있습니다."
|
36
36
|
Webdrivers.cache_time = 86_400 # 하루로 설정 (기본값: 86_400초)
|
37
37
|
Webdrivers.install_dir = "./" # 크롬드라이버를 수동으로 설치할 경로를 설정
|
38
|
-
# 크롬드라이버 자동 업데이트 시도
|
39
38
|
Webdrivers::Chromedriver.update
|
40
39
|
puts "chromedriver 자동 다운로드 성공"
|
41
40
|
rescue => e
|
@@ -50,16 +49,17 @@ class Naver
|
|
50
49
|
end
|
51
50
|
|
52
51
|
|
53
|
-
|
52
|
+
def chrome_setup(proxy, board_cookie_dir = "C:/board_cookie")
|
54
53
|
board_cookie_dir = "C:/board_cookie"
|
55
54
|
FileUtils.mkdir_p(board_cookie_dir) unless File.exist?(board_cookie_dir)
|
56
55
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
56
|
+
if proxy == ''
|
57
|
+
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})
|
58
|
+
else
|
59
|
+
system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" --window-position=0,0 --remote-debugging-port=9222 --user-data-dir=C:/board_cookie --proxy-server=#{proxy.to_s.force_encoding('utf-8').to_s} --no-first-run --no-default-browser-check --disable-sync https://chromewebstore.google.com/detail/captcha-solver-auto-recog/ifibfemgeogfhoebkmokieepdoobkbpo?hl=ko})
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
63
|
|
64
64
|
|
65
65
|
|
@@ -84,7 +84,13 @@ class Naver
|
|
84
84
|
|
85
85
|
options.add_argument('--disable-save-password-bubble') # 비밀번호 저장 팝업 비활성화
|
86
86
|
options.add_argument('--disable-password-manager') # 비밀번호 관리 비활성화
|
87
|
-
|
87
|
+
|
88
|
+
options.add_argument('--disable-web-security') # 웹 보안 비활성화
|
89
|
+
options.add_argument('--allow-running-insecure-content') # HTTPS 사이트에서 HTTP 컨텐츠 실행 허용
|
90
|
+
options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
|
91
|
+
options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
|
92
|
+
options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
|
93
|
+
options.add_argument('--disable-software-rasterizer') # 소프트웨어 렌더링 비활성화
|
88
94
|
|
89
95
|
# 'capabilities'과 'options' 배열로 설정
|
90
96
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
@@ -117,6 +123,16 @@ class Naver
|
|
117
123
|
options.add_argument('user-data-dir=C:/board_cookie')
|
118
124
|
|
119
125
|
|
126
|
+
options.add_argument('--disable-save-password-bubble') # 비밀번호 저장 팝업 비활성화
|
127
|
+
options.add_argument('--disable-password-manager') # 비밀번호 관리 비활성화
|
128
|
+
|
129
|
+
options.add_argument('--disable-web-security') # 웹 보안 비활성화
|
130
|
+
options.add_argument('--allow-running-insecure-content') # HTTPS 사이트에서 HTTP 컨텐츠 실행 허용
|
131
|
+
options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
|
132
|
+
options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
|
133
|
+
options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
|
134
|
+
options.add_argument('--disable-software-rasterizer') # 소프트웨어 렌더링 비활성화
|
135
|
+
|
120
136
|
# 'capabilities'과 'options' 배열로 설정
|
121
137
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
122
138
|
capabilities["goog:chromeOptions"] = options.as_json
|
@@ -144,7 +160,16 @@ class Naver
|
|
144
160
|
options.add_argument('--remote-debugging-port=9222')
|
145
161
|
options.add_argument('user-data-dir=C:/board_cookie')
|
146
162
|
|
147
|
-
|
163
|
+
options.add_argument('--disable-save-password-bubble') # 비밀번호 저장 팝업 비활성화
|
164
|
+
options.add_argument('--disable-password-manager') # 비밀번호 관리 비활성화
|
165
|
+
|
166
|
+
options.add_argument('--disable-web-security') # 웹 보안 비활성화
|
167
|
+
options.add_argument('--allow-running-insecure-content') # HTTPS 사이트에서 HTTP 컨텐츠 실행 허용
|
168
|
+
options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
|
169
|
+
options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
|
170
|
+
options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
|
171
|
+
options.add_argument('--disable-software-rasterizer') # 소프트웨어 렌더링 비활성화
|
172
|
+
|
148
173
|
|
149
174
|
# 'capabilities'과 'options' 배열로 설정
|
150
175
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
@@ -183,169 +208,268 @@ class Naver
|
|
183
208
|
|
184
209
|
chrome_start(proxy, board_cookie_dir)
|
185
210
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
# 원하는 URL이 아니면 탭을 닫기
|
200
|
-
if current_url != target_url
|
201
|
-
begin
|
202
|
-
@driver.close # 다른 탭을 닫기
|
203
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
204
|
-
#puts "탭을 닫는 데 오류 발생: #{e.message}"
|
205
|
-
end
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
# 남아 있는 탭으로 전환
|
210
|
-
all_windows = @driver.window_handles # 남은 탭 리스트 갱신
|
211
|
-
if all_windows.size > 0
|
212
|
-
@driver.switch_to.window(all_windows.first) # 남아 있는 첫 번째 탭으로 전환
|
213
|
-
else
|
214
|
-
#puts "남은 탭이 없습니다."
|
215
|
-
end
|
216
|
-
|
217
|
-
|
211
|
+
# 열린 모든 탭 핸들 확인
|
212
|
+
all_windows = @driver.window_handles
|
213
|
+
#puts "현재 열려 있는 탭 수: #{all_windows.size}" # 열린 탭 수 출력
|
214
|
+
|
215
|
+
# 원하는 URL
|
216
|
+
target_url = "https://chromewebstore.google.com/detail/captcha-solver-auto-recog/ifibfemgeogfhoebkmokieepdoobkbpo?hl=ko"
|
217
|
+
|
218
|
+
# 각 탭을 순회하면서
|
219
|
+
all_windows.each do |window|
|
220
|
+
@driver.switch_to.window(window)
|
221
|
+
current_url = @driver.current_url
|
222
|
+
#puts "탭 URL: #{current_url}" # 각 탭 URL 출력
|
218
223
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
229
|
-
wait.until { @driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="wQO0od"]') } #추가 안되어 있음
|
230
|
-
sleep(1.5)
|
231
|
-
@driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="wQO0od"]').click
|
232
|
-
puts'[Step.01] CAPTCHA 세션 연결 없음!! 브라우저 필요 설정 미 완료 상태!!.......'.yellow
|
233
|
-
puts'[Step.02] CAPTCHA 세션 연결 및 브라우저 필요 설정 진행 시작!!.......'.yellow
|
234
|
-
sleep(1.5)
|
235
|
-
mouse_move_percentage(0.3,0.02)
|
236
|
-
sleep(0.5)
|
237
|
-
left_click
|
238
|
-
sleep(1)
|
239
|
-
key_stroke('tab')
|
240
|
-
sleep(0.5)
|
241
|
-
key_stroke('enter')
|
242
|
-
check_cookie_login = 0
|
243
|
-
sleep(1)
|
244
|
-
rescue
|
245
|
-
@driver.quit
|
246
|
-
return 0
|
247
|
-
end
|
248
|
-
end
|
224
|
+
# 원하는 URL이 아니면 탭을 닫기
|
225
|
+
if current_url != target_url
|
226
|
+
begin
|
227
|
+
@driver.close # 다른 탭을 닫기
|
228
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
229
|
+
#puts "탭을 닫는 데 오류 발생: #{e.message}"
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
249
233
|
|
250
|
-
|
251
|
-
|
252
|
-
|
234
|
+
# 남아 있는 탭으로 전환
|
235
|
+
all_windows = @driver.window_handles # 남은 탭 리스트 갱신
|
236
|
+
if all_windows.size > 0
|
237
|
+
@driver.switch_to.window(all_windows.first) # 남아 있는 첫 번째 탭으로 전환
|
238
|
+
else
|
239
|
+
#puts "남은 탭이 없습니다."
|
240
|
+
end
|
253
241
|
|
254
|
-
begin
|
255
|
-
# 열린 모든 탭 핸들 확인
|
256
|
-
all_windows = @driver.window_handles
|
257
|
-
puts "현재 열려 있는 탭 수: #{all_windows.size}" # 열린 탭 수 출력
|
258
|
-
|
259
|
-
# 각 탭을 순회하면서
|
260
|
-
all_windows.each do |window|
|
261
|
-
@driver.switch_to.window(window)
|
262
|
-
current_url = @driver.current_url
|
263
|
-
puts "탭 URL: #{current_url}" # 각 탭 URL 출력
|
264
|
-
|
265
|
-
# 확장 프로그램 탭인지 확인
|
266
|
-
if current_url.include?('chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html')
|
267
|
-
begin
|
268
|
-
@driver.close # 확장 프로그램 탭을 닫기
|
269
|
-
|
270
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
271
|
-
end
|
272
|
-
else
|
273
|
-
end
|
274
|
-
end
|
275
|
-
|
276
|
-
# 남아 있는 탭으로 전환
|
277
|
-
all_windows = @driver.window_handles # 남은 탭 리스트 갱신
|
278
|
-
if all_windows.size > 0
|
279
|
-
@driver.switch_to.window(all_windows.first) # 남아 있는 첫 번째 탭으로 전환
|
280
|
-
else
|
281
|
-
end
|
282
|
-
|
283
|
-
sleep(1)
|
284
|
-
|
285
|
-
rescue => e
|
286
|
-
@driver.quit if @driver
|
287
|
-
end
|
288
|
-
|
289
242
|
|
243
|
+
|
244
|
+
|
245
|
+
sleep(1)
|
246
|
+
begin
|
247
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
248
|
+
wait.until { @driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="ajZLRd"]') } #추가 되어 있음
|
249
|
+
check_cookie_login = 1
|
250
|
+
puts'[Step.01] CAPTCHA 세션 및 브라우저 설정 완료 상태 확인!!.......'.yellow
|
251
|
+
rescue
|
252
|
+
begin
|
253
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
254
|
+
wait.until { @driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="wQO0od"]') } #추가 안되어 있음
|
255
|
+
sleep(1.5)
|
256
|
+
@driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="wQO0od"]').click
|
257
|
+
puts'[Step.01] CAPTCHA 세션 연결 없음!! 브라우저 필요 설정 미 완료 상태!!.......'.red
|
258
|
+
puts'[Step.02] CAPTCHA 세션 연결 및 브라우저 필요 설정 진행 시작!!.......'.red
|
259
|
+
sleep(1.5)
|
260
|
+
shell = WIN32OLE.new('WScript.Shell')
|
261
|
+
shell.AppActivate("Captcha Solver: Auto Recognition and Bypass")
|
262
|
+
shell.AppActivate("Captcha Solver: Auto Recognition and Bypass")
|
263
|
+
sleep(1)
|
264
|
+
shell.SendKeys("{TAB}")
|
265
|
+
sleep(0.5)
|
266
|
+
shell.SendKeys("{ENTER}")
|
267
|
+
|
268
|
+
check_cookie_login = 0
|
269
|
+
sleep(1)
|
270
|
+
rescue
|
271
|
+
@driver.quit
|
272
|
+
return 0
|
273
|
+
end
|
274
|
+
end
|
290
275
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
@driver.get('chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html')
|
295
|
-
sleep(1)
|
296
|
-
|
276
|
+
if check_cookie_login == 0
|
277
|
+
|
278
|
+
begin
|
297
279
|
|
298
|
-
|
280
|
+
begin
|
281
|
+
# 최대 20초 동안 확장 프로그램 탭이 열릴 때까지 대기
|
282
|
+
extension_url = 'chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html'
|
283
|
+
max_wait_time = 20
|
284
|
+
waited = 0
|
285
|
+
found = false
|
286
|
+
|
287
|
+
while waited < max_wait_time
|
288
|
+
all_windows = @driver.window_handles
|
289
|
+
all_windows.each do |window|
|
290
|
+
@driver.switch_to.window(window)
|
291
|
+
current_url = @driver.current_url
|
292
|
+
if current_url.include?(extension_url)
|
293
|
+
found = true
|
294
|
+
break
|
295
|
+
end
|
296
|
+
end
|
297
|
+
break if found
|
298
|
+
|
299
|
+
sleep(3)
|
300
|
+
waited += 1
|
301
|
+
end
|
302
|
+
|
303
|
+
if found
|
304
|
+
# 확장 프로그램 탭을 제외한 나머지 탭 닫기
|
305
|
+
all_windows = @driver.window_handles
|
306
|
+
all_windows.each do |window|
|
307
|
+
@driver.switch_to.window(window)
|
308
|
+
current_url = @driver.current_url
|
309
|
+
if !current_url.include?(extension_url)
|
310
|
+
sleep(2)
|
311
|
+
@driver.close
|
312
|
+
sleep(2)
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
# 확장 프로그램 탭으로 전환
|
317
|
+
remaining_windows = @driver.window_handles
|
318
|
+
if remaining_windows.size > 0
|
319
|
+
@driver.switch_to.window(remaining_windows.first)
|
320
|
+
end
|
321
|
+
else
|
322
|
+
puts "초기 작업 브라우저가 완벽하게 세팅 되지 않았습니다.".red
|
323
|
+
puts "C드라이브에서 scraping_cookie 폴더 삭제 후 다시 시작해주세요.".red
|
324
|
+
end
|
325
|
+
|
326
|
+
rescue => e
|
327
|
+
puts "초기 작업 브라우저가 완벽하게 세팅 되지 않았습니다.".red
|
328
|
+
puts "C드라이브에서 scraping_cookie 폴더 삭제 후 다시 시작해주세요.".red
|
329
|
+
@driver.quit if @driver
|
330
|
+
end
|
331
|
+
|
299
332
|
|
333
|
+
|
300
334
|
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
335
|
+
|
336
|
+
begin
|
337
|
+
# 요소 찾기 타임아웃을 10초로 설정
|
338
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
339
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
340
|
+
wait.until { @driver.find_element(:xpath, '/html/body/div/div[1]/table/tbody/tr[1]/td[2]/input') }
|
341
|
+
@driver.find_element(:xpath, '/html/body/div/div[1]/table/tbody/tr[1]/td[2]/input').click
|
342
|
+
sleep(1)
|
343
|
+
Clipboard.copy(captcha_key)
|
344
|
+
@driver.action.key_down(:control).send_keys('v').key_up(:control).perform
|
345
|
+
sleep(1)
|
346
|
+
@driver.find_element(:xpath, '//*[@id="connect"]').click
|
347
|
+
sleep(1)
|
348
|
+
|
349
|
+
begin
|
350
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
351
|
+
wait.until do
|
352
|
+
begin
|
353
|
+
alert = @driver.switch_to.alert
|
354
|
+
alert.accept
|
355
|
+
sleep(1)
|
356
|
+
true
|
357
|
+
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
358
|
+
false
|
359
|
+
end
|
360
|
+
end
|
361
|
+
rescue Selenium::WebDriver::Error::TimeoutError
|
362
|
+
@driver.find_element(:xpath, '//*[@id="connect"]').click
|
363
|
+
begin
|
364
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
365
|
+
wait.until do
|
366
|
+
begin
|
367
|
+
alert = @driver.switch_to.alert
|
368
|
+
alert.accept
|
369
|
+
sleep(1)
|
370
|
+
true
|
371
|
+
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
372
|
+
false
|
373
|
+
end
|
374
|
+
end
|
375
|
+
rescue Selenium::WebDriver::Error::TimeoutError
|
376
|
+
puts "초기 작업 브라우저가 완벽하게 세팅 되지 않았습니다.".red
|
377
|
+
puts "C드라이브에서 scraping_cookie 폴더 삭제 후 다시 시작해주세요.".red
|
378
|
+
system('taskkill /F /IM chrome.exe')
|
379
|
+
@driver.quit if @driver
|
380
|
+
end
|
381
|
+
end
|
382
|
+
puts '-[√] 브라우저 필요 설정 1차 시도.......'.green
|
383
|
+
@driver.get('chrome://settings/security')
|
384
|
+
sleep(2)
|
385
|
+
mouse_move_percentage(0.3,0.02)
|
386
|
+
sleep(0.5)
|
387
|
+
left_click
|
308
388
|
sleep(1)
|
309
|
-
|
310
|
-
|
389
|
+
# 루비에서 'tab' 키를 0.5초마다 7번 누르기
|
390
|
+
7.times do
|
391
|
+
key_stroke('tab') # 'tab' 키를 입력
|
392
|
+
sleep(0.5) # 0.5초 대기
|
393
|
+
end
|
394
|
+
key_stroke('enter')
|
311
395
|
sleep(1)
|
312
|
-
|
396
|
+
|
397
|
+
@driver.get('chrome://password-manager/settings')
|
398
|
+
sleep(2)
|
399
|
+
mouse_move_percentage(0.3,0.02)
|
400
|
+
sleep(0.5)
|
401
|
+
left_click
|
313
402
|
sleep(1)
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
begin
|
319
|
-
alert = @driver.switch_to.alert
|
320
|
-
alert.accept
|
321
|
-
sleep(1)
|
322
|
-
true
|
323
|
-
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
324
|
-
false
|
325
|
-
end
|
326
|
-
end
|
327
|
-
rescue Selenium::WebDriver::Error::TimeoutError
|
328
|
-
puts "alert이 없으므로 버튼 클릭"
|
329
|
-
@driver.find_element(:xpath, '//*[@id="connect"]').click
|
330
|
-
begin
|
331
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
332
|
-
wait.until do
|
333
|
-
begin
|
334
|
-
alert = @driver.switch_to.alert
|
335
|
-
alert.accept
|
336
|
-
sleep(1)
|
337
|
-
true
|
338
|
-
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
339
|
-
false
|
340
|
-
end
|
341
|
-
end
|
342
|
-
puts "두 번째 alert 처리 완료"
|
343
|
-
rescue Selenium::WebDriver::Error::TimeoutError
|
344
|
-
puts "두 번째 alert이 10초 내에 나타나지 않음. Chrome 종료."
|
345
|
-
system('taskkill /F /IM chrome.exe')
|
346
|
-
@driver.quit if @driver
|
347
|
-
end
|
403
|
+
# 루비에서 'tab' 키를 0.5초마다 7번 누르기
|
404
|
+
4.times do
|
405
|
+
key_stroke('tab') # 'tab' 키를 입력
|
406
|
+
sleep(0.5) # 0.5초 대기
|
348
407
|
end
|
408
|
+
key_stroke('enter')
|
409
|
+
sleep(1)
|
410
|
+
key_stroke('tab')
|
411
|
+
sleep(1)
|
412
|
+
key_stroke('enter')
|
413
|
+
sleep(1)
|
414
|
+
|
415
|
+
rescue
|
416
|
+
begin
|
417
|
+
sleep(1)
|
418
|
+
|
419
|
+
# 요소 찾기 타임아웃을 10초로 설정
|
420
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
421
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
422
|
+
wait.until { @driver.find_element(:xpath, '//*[@name="apiKey"]') }
|
423
|
+
@driver.find_element(:xpath, '//*[@name="apiKey"]').click
|
424
|
+
sleep(1)
|
425
|
+
begin
|
426
|
+
@driver.find_element(:xpath, '//*[@name="apiKey"]').click
|
427
|
+
rescue
|
428
|
+
end
|
429
|
+
|
430
|
+
Clipboard.copy(captcha_key)
|
431
|
+
@driver.action.key_down(:control).send_keys('v').key_up(:control).perform
|
432
|
+
sleep(1)
|
433
|
+
begin
|
434
|
+
@driver.find_element(:xpath, '//*[@class="default-btn"]').click
|
435
|
+
sleep(1)
|
436
|
+
|
437
|
+
begin
|
438
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
439
|
+
wait.until do
|
440
|
+
begin
|
441
|
+
alert = @driver.switch_to.alert
|
442
|
+
alert.accept
|
443
|
+
sleep(1)
|
444
|
+
true
|
445
|
+
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
446
|
+
false
|
447
|
+
end
|
448
|
+
end
|
449
|
+
rescue Selenium::WebDriver::Error::TimeoutError
|
450
|
+
|
451
|
+
@driver.find_element(:xpath, '//*[@class="default-btn"]').click
|
452
|
+
begin
|
453
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
454
|
+
wait.until do
|
455
|
+
begin
|
456
|
+
alert = @driver.switch_to.alert
|
457
|
+
alert.accept
|
458
|
+
sleep(1)
|
459
|
+
true
|
460
|
+
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
461
|
+
false
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
rescue Selenium::WebDriver::Error::TimeoutError
|
466
|
+
puts "초기 작업 브라우저가 완벽하게 세팅 되지 않았습니다.".red
|
467
|
+
puts "C드라이브에서 scraping_cookie 폴더 삭제 후 다시 시작해주세요.".red
|
468
|
+
system('taskkill /F /IM chrome.exe')
|
469
|
+
@driver.quit if @driver
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
349
473
|
puts '-[√] 브라우저 필요 설정 1차 시도.......'.green
|
350
474
|
@driver.get('chrome://settings/security')
|
351
475
|
sleep(2)
|
@@ -354,7 +478,7 @@ class Naver
|
|
354
478
|
left_click
|
355
479
|
sleep(1)
|
356
480
|
# 루비에서 'tab' 키를 0.5초마다 7번 누르기
|
357
|
-
|
481
|
+
7.times do
|
358
482
|
key_stroke('tab') # 'tab' 키를 입력
|
359
483
|
sleep(0.5) # 0.5초 대기
|
360
484
|
end
|
@@ -368,186 +492,100 @@ class Naver
|
|
368
492
|
left_click
|
369
493
|
sleep(1)
|
370
494
|
# 루비에서 'tab' 키를 0.5초마다 7번 누르기
|
371
|
-
|
495
|
+
4.times do
|
372
496
|
key_stroke('tab') # 'tab' 키를 입력
|
373
497
|
sleep(0.5) # 0.5초 대기
|
374
498
|
end
|
375
499
|
key_stroke('enter')
|
376
|
-
sleep(1)
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
sleep(1)
|
382
|
-
#@driver.switch_to.window(@driver.window_handles[0])
|
383
|
-
|
384
|
-
|
385
|
-
# 요소 찾기 타임아웃을 10초로 설정
|
386
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
387
|
-
#요소가 나타날 때까지 60초 동안 기다립니다.
|
388
|
-
wait.until { @driver.find_element(:xpath, '//*[@name="apiKey"]') }
|
389
|
-
@driver.find_element(:xpath, '//*[@name="apiKey"]').click
|
390
|
-
sleep(1)
|
391
|
-
begin
|
392
|
-
@driver.find_element(:xpath, '//*[@name="apiKey"]').click
|
393
|
-
rescue
|
394
|
-
|
395
|
-
puts '-[√] 로딩 및 코드인식 실패등 기타 이유로 다음 게시판 작업으로 이동합니다.......'.red
|
396
|
-
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
397
|
-
|
398
|
-
end
|
399
|
-
|
400
|
-
Clipboard.copy(captcha_key)
|
401
|
-
@driver.action.key_down(:control).send_keys('v').key_up(:control).perform
|
402
|
-
sleep(1)
|
403
|
-
begin
|
404
|
-
@driver.find_element(:xpath, '//*[@class="default-btn"]').click
|
405
|
-
sleep(1)
|
406
|
-
|
407
|
-
begin
|
408
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
409
|
-
wait.until do
|
410
|
-
begin
|
411
|
-
alert = @driver.switch_to.alert
|
412
|
-
alert.accept
|
413
|
-
sleep(1)
|
414
|
-
true
|
415
|
-
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
416
|
-
false
|
417
|
-
end
|
418
|
-
end
|
419
|
-
rescue Selenium::WebDriver::Error::TimeoutError
|
420
|
-
puts "alert이 없으므로 버튼 클릭"
|
421
|
-
@driver.find_element(:xpath, '//*[@class="default-btn"]').click
|
422
|
-
begin
|
423
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
424
|
-
wait.until do
|
425
|
-
begin
|
426
|
-
alert = @driver.switch_to.alert
|
427
|
-
alert.accept
|
428
|
-
sleep(1)
|
429
|
-
true
|
430
|
-
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
431
|
-
false
|
432
|
-
end
|
433
|
-
end
|
434
|
-
puts "두 번째 alert 처리 완료"
|
435
|
-
rescue Selenium::WebDriver::Error::TimeoutError
|
436
|
-
puts "두 번째 alert이 10초 내에 나타나지 않음. Chrome 종료."
|
437
|
-
system('taskkill /F /IM chrome.exe')
|
438
|
-
@driver.quit if @driver
|
439
|
-
end
|
440
|
-
end
|
441
|
-
|
442
|
-
rescue => e
|
443
|
-
@driver.window_handles.each do |handle|
|
444
|
-
@driver.switch_to.window(handle)
|
445
|
-
begin
|
446
|
-
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
447
|
-
@driver.close
|
448
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
449
|
-
puts "크롬 브라우저 종료: #{e.message}"
|
450
|
-
end
|
451
|
-
end
|
452
|
-
return 0
|
453
|
-
@driver.quit
|
454
|
-
end
|
455
|
-
puts '-[√] 브라우저 필요 설정 2차 시도.......'.green
|
456
|
-
@driver.get('chrome://settings/security')
|
457
|
-
sleep(2)
|
458
|
-
mouse_move_percentage(0.3,0.02)
|
459
|
-
sleep(0.5)
|
460
|
-
left_click
|
461
|
-
sleep(1)
|
462
|
-
# 루비에서 'tab' 키를 0.5초마다 7번 누르기
|
463
|
-
6.times do
|
464
|
-
key_stroke('tab') # 'tab' 키를 입력
|
465
|
-
sleep(0.5) # 0.5초 대기
|
466
|
-
end
|
467
|
-
key_stroke('enter')
|
468
|
-
sleep(1)
|
469
|
-
|
470
|
-
@driver.get('chrome://password-manager/settings')
|
471
|
-
sleep(2)
|
472
|
-
mouse_move_percentage(0.3,0.02)
|
473
|
-
sleep(0.5)
|
474
|
-
left_click
|
475
|
-
sleep(1)
|
476
|
-
# 루비에서 'tab' 키를 0.5초마다 7번 누르기
|
477
|
-
3.times do
|
478
|
-
key_stroke('tab') # 'tab' 키를 입력
|
479
|
-
sleep(0.5) # 0.5초 대기
|
480
|
-
end
|
481
|
-
key_stroke('enter')
|
482
|
-
sleep(1)
|
483
|
-
|
484
|
-
rescue => e
|
485
|
-
puts '-[√] 로딩 및 코드인식 실패등 기타 이유로 다음 게시판 작업으로 이동합니다.......'.red
|
486
|
-
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
487
|
-
@driver.window_handles.each do |handle|
|
488
|
-
@driver.switch_to.window(handle)
|
489
|
-
begin
|
490
|
-
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
491
|
-
@driver.close
|
492
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
493
|
-
puts "크롬 브라우저 종료: #{e.message}"
|
494
|
-
end
|
495
|
-
end
|
496
|
-
return 0
|
497
|
-
@driver.quit
|
498
|
-
end
|
499
|
-
|
500
|
-
end
|
501
|
-
|
502
|
-
rescue => e
|
503
|
-
puts '-[√] 로딩 지연 접속 실패.......'.red
|
504
|
-
@driver.window_handles.each do |handle|
|
505
|
-
@driver.switch_to.window(handle)
|
506
|
-
begin
|
507
|
-
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
508
|
-
@driver.close
|
509
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
510
|
-
puts "Failed to close tab: #{e.message}"
|
511
|
-
end
|
512
|
-
end
|
513
|
-
@driver.quit
|
514
|
-
return 0
|
515
|
-
end
|
516
|
-
|
517
|
-
else
|
518
|
-
# @driver.switch_to.default_content
|
519
|
-
end
|
500
|
+
sleep(1)
|
501
|
+
key_stroke('tab')
|
502
|
+
sleep(1)
|
503
|
+
key_stroke('enter')
|
504
|
+
sleep(1)
|
520
505
|
|
521
|
-
|
506
|
+
rescue => e
|
507
|
+
@driver.window_handles.each do |handle|
|
508
|
+
@driver.switch_to.window(handle)
|
509
|
+
begin
|
510
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
511
|
+
@driver.close
|
512
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
513
|
+
puts "초기 작업 브라우저가 완벽하게 세팅 되지 않았습니다.".red
|
514
|
+
puts "C드라이브에서 scraping_cookie 폴더 삭제 후 다시 시작해주세요.".red
|
515
|
+
end
|
516
|
+
end
|
517
|
+
return 0
|
518
|
+
@driver.quit
|
519
|
+
end
|
520
|
+
|
521
|
+
|
522
|
+
rescue => e
|
523
|
+
puts "초기 작업 브라우저가 완벽하게 세팅 되지 않았습니다.".red
|
524
|
+
puts "C드라이브에서 scraping_cookie 폴더 삭제 후 다시 시작해주세요.".red
|
525
|
+
@driver.window_handles.each do |handle|
|
526
|
+
@driver.switch_to.window(handle)
|
527
|
+
begin
|
528
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
529
|
+
@driver.close
|
530
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
531
|
+
puts "초기 작업 브라우저가 완벽하게 세팅 되지 않았습니다.".red
|
532
|
+
puts "C드라이브에서 scraping_cookie 폴더 삭제 후 다시 시작해주세요.".red
|
533
|
+
end
|
534
|
+
end
|
535
|
+
return 0
|
536
|
+
@driver.quit
|
537
|
+
end
|
538
|
+
|
539
|
+
end
|
522
540
|
|
541
|
+
rescue => e
|
542
|
+
puts "초기 작업 브라우저가 완벽하게 세팅 되지 않았습니다.".red
|
543
|
+
puts "C드라이브에서 scraping_cookie 폴더 삭제 후 다시 시작해주세요.".red
|
544
|
+
@driver.window_handles.each do |handle|
|
545
|
+
@driver.switch_to.window(handle)
|
546
|
+
begin
|
547
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
548
|
+
@driver.close
|
549
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
550
|
+
puts "Failed to close tab: #{e.message}"
|
551
|
+
end
|
552
|
+
end
|
553
|
+
@driver.quit
|
554
|
+
return 0
|
555
|
+
end
|
523
556
|
|
557
|
+
|
558
|
+
|
559
|
+
else
|
560
|
+
end
|
524
561
|
|
525
|
-
|
526
|
-
|
527
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
528
|
-
#요소가 나타날 때까지 3초 동안 기다립니다.
|
529
|
-
wait.until { @driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="ajZLRd"]') } #추가 되어 있음
|
562
|
+
begin
|
530
563
|
|
531
|
-
|
532
564
|
|
533
|
-
rescue => e
|
534
|
-
puts '-[√] 로그인 실패.......'.red
|
535
|
-
@driver.window_handles.each do |handle|
|
536
|
-
@driver.switch_to.window(handle)
|
537
|
-
begin
|
538
|
-
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
539
|
-
@driver.close
|
540
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
541
|
-
puts "Failed to close tab: #{e.message}"
|
542
|
-
end
|
543
|
-
end
|
544
|
-
@driver.quit
|
545
|
-
return 0
|
546
|
-
end
|
547
|
-
end
|
548
|
-
|
549
565
|
|
566
|
+
@driver.get('https://chromewebstore.google.com/detail/captcha-solver-auto-recog/ifibfemgeogfhoebkmokieepdoobkbpo?hl=ko')
|
567
|
+
sleep(1)
|
568
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
569
|
+
#요소가 나타날 때까지 3초 동안 기다립니다.
|
570
|
+
wait.until { @driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="ajZLRd"]') } #추가 되어 있음
|
571
|
+
sleep(1)
|
572
|
+
@driver.manage.window.maximize
|
550
573
|
|
574
|
+
rescue => e
|
575
|
+
puts '-[√] 연결 실패.......'.red
|
576
|
+
@driver.window_handles.each do |handle|
|
577
|
+
@driver.switch_to.window(handle)
|
578
|
+
begin
|
579
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
580
|
+
@driver.close
|
581
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
582
|
+
puts "Failed to close tab: #{e.message}"
|
583
|
+
end
|
584
|
+
end
|
585
|
+
@driver.quit
|
586
|
+
return 0
|
587
|
+
end
|
588
|
+
end
|
551
589
|
|
552
590
|
|
553
591
|
def update(user_id, user_pw, title, content, option, post_url, signup_url, login_url, cc_check_url, image_url_cheng, img_link2, category, more_txt1, more_txt2, more_txt3, more_txt4, captcha_key, keyword)
|
@@ -696,7 +734,7 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
|
|
696
734
|
wait.until { @driver.find_elements(:xpath, '//*[@id="amzn-captcha-verify-button"]').size == 0 }
|
697
735
|
puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
|
698
736
|
|
699
|
-
sleep(
|
737
|
+
sleep(5)
|
700
738
|
rescue => e
|
701
739
|
puts '-[√] 캡챠 해제 실패(캡챠는 사람이 풀기에 간혹 실수로 실패가 될수있습니다.).......'.red
|
702
740
|
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
@@ -743,7 +781,7 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
|
|
743
781
|
|
744
782
|
#@driver.find_element(:xpath, '//*[@data-state="solved"]').click
|
745
783
|
puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
|
746
|
-
sleep(
|
784
|
+
sleep(5)
|
747
785
|
rescue => e
|
748
786
|
puts '-[√] 캡챠 해제 실패(캡챠는 사람이 풀기에 간혹 실수로 실패가 될수있습니다.).......'.red
|
749
787
|
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
@@ -787,7 +825,7 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
|
|
787
825
|
@driver.find_element(:xpath, '//*[@data-state="solved"]').click
|
788
826
|
puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
|
789
827
|
|
790
|
-
sleep(
|
828
|
+
sleep(5)
|
791
829
|
rescue => e
|
792
830
|
puts '-[√] 캡챠 해제 실패(캡챠는 사람이 풀기에 간혹 실수로 실패가 될수있습니다.).......'.red
|
793
831
|
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
@@ -2813,13 +2851,8 @@ login_url = option['login_url'].to_s
|
|
2813
2851
|
wait.until { @driver.find_elements(:xpath, '//*[@id="amzn-captcha-verify-button"]').size == 0 }
|
2814
2852
|
puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
|
2815
2853
|
|
2816
|
-
sleep(
|
2817
|
-
rescue
|
2818
|
-
puts '-[√] 캡챠 해제 실패(캡챠는 사람이 풀기에 간혹 실수로 실패가 될수있습니다.).......'.red
|
2819
|
-
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
2820
|
-
puts e
|
2821
|
-
@driver.close
|
2822
|
-
return 0
|
2854
|
+
sleep(5)
|
2855
|
+
rescue
|
2823
2856
|
end
|
2824
2857
|
end
|
2825
2858
|
rescue
|
@@ -2860,13 +2893,8 @@ login_url = option['login_url'].to_s
|
|
2860
2893
|
|
2861
2894
|
#@driver.find_element(:xpath, '//*[@data-state="solved"]').click
|
2862
2895
|
puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
|
2863
|
-
sleep(
|
2864
|
-
rescue
|
2865
|
-
puts '-[√] 캡챠 해제 실패(캡챠는 사람이 풀기에 간혹 실수로 실패가 될수있습니다.).......'.red
|
2866
|
-
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
2867
|
-
puts e
|
2868
|
-
@driver.close
|
2869
|
-
return 0
|
2896
|
+
sleep(5)
|
2897
|
+
rescue
|
2870
2898
|
end
|
2871
2899
|
end
|
2872
2900
|
rescue
|
@@ -2904,13 +2932,8 @@ login_url = option['login_url'].to_s
|
|
2904
2932
|
@driver.find_element(:xpath, '//*[@data-state="solved"]').click
|
2905
2933
|
puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
|
2906
2934
|
|
2907
|
-
sleep(
|
2908
|
-
rescue
|
2909
|
-
puts '-[√] 캡챠 해제 실패(캡챠는 사람이 풀기에 간혹 실수로 실패가 될수있습니다.).......'.red
|
2910
|
-
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
2911
|
-
puts e
|
2912
|
-
@driver.close
|
2913
|
-
return 0
|
2935
|
+
sleep(5)
|
2936
|
+
rescue
|
2914
2937
|
end
|
2915
2938
|
end
|
2916
2939
|
rescue
|
@@ -3691,8 +3714,12 @@ login_url = option['login_url'].to_s
|
|
3691
3714
|
@driver.find_element(:xpath, '//*[@class="username"]').send_keys(user_id)
|
3692
3715
|
sleep(3)
|
3693
3716
|
rescue
|
3717
|
+
begin
|
3718
|
+
@driver.find_element(:xpath, '//*[@data-key="username"]').send_keys(user_id)
|
3719
|
+
sleep(3)
|
3720
|
+
rescue
|
3721
|
+
end
|
3694
3722
|
end
|
3695
|
-
|
3696
3723
|
end
|
3697
3724
|
end
|
3698
3725
|
end
|
@@ -3792,8 +3819,13 @@ login_url = option['login_url'].to_s
|
|
3792
3819
|
@driver.find_element(:xpath, '//*[@id="ol_pwlabel"]').send_keys(user_pw)
|
3793
3820
|
sleep(1)
|
3794
3821
|
rescue
|
3795
|
-
|
3796
|
-
|
3822
|
+
begin
|
3823
|
+
@driver.find_element(:xpath, '//*[@data-key="user_password"]').send_keys(user_pw)
|
3824
|
+
sleep(1)
|
3825
|
+
rescue
|
3826
|
+
|
3827
|
+
@driver.action.key_down(:tab).key_up(:tab).perform #x탭
|
3828
|
+
end
|
3797
3829
|
end
|
3798
3830
|
end
|
3799
3831
|
end
|
@@ -3894,8 +3926,15 @@ login_url = option['login_url'].to_s
|
|
3894
3926
|
puts '-[√] 로그인 버튼 코드 15 타겟.......'.cyan
|
3895
3927
|
sleep(3)
|
3896
3928
|
rescue
|
3897
|
-
|
3898
|
-
|
3929
|
+
begin
|
3930
|
+
@driver.find_element(:xpath, '//*[@id="um-submit-btn"]').click
|
3931
|
+
puts '-[√] 로그인 버튼 코드 15 타겟.......'.cyan
|
3932
|
+
sleep(3)
|
3933
|
+
rescue
|
3934
|
+
|
3935
|
+
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
3936
|
+
sleep(3)
|
3937
|
+
end
|
3899
3938
|
end
|
3900
3939
|
end
|
3901
3940
|
end
|
@@ -4361,7 +4400,7 @@ post_url = option['post_url'].to_s
|
|
4361
4400
|
wait.until { @driver.find_elements(:xpath, '//*[@id="amzn-captcha-verify-button"]').size == 0 }
|
4362
4401
|
puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
|
4363
4402
|
|
4364
|
-
sleep(
|
4403
|
+
sleep(5)
|
4365
4404
|
rescue => e
|
4366
4405
|
puts '-[√] 캡챠 해제 실패(캡챠는 사람이 풀기에 간혹 실수로 실패가 될수있습니다.).......'.red
|
4367
4406
|
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
@@ -4408,7 +4447,7 @@ post_url = option['post_url'].to_s
|
|
4408
4447
|
|
4409
4448
|
#@driver.find_element(:xpath, '//*[@data-state="solved"]').click
|
4410
4449
|
puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
|
4411
|
-
sleep(
|
4450
|
+
sleep(5)
|
4412
4451
|
rescue => e
|
4413
4452
|
puts '-[√] 캡챠 해제 실패(캡챠는 사람이 풀기에 간혹 실수로 실패가 될수있습니다.).......'.red
|
4414
4453
|
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
@@ -4452,7 +4491,7 @@ post_url = option['post_url'].to_s
|
|
4452
4491
|
@driver.find_element(:xpath, '//*[@data-state="solved"]').click
|
4453
4492
|
puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
|
4454
4493
|
|
4455
|
-
sleep(
|
4494
|
+
sleep(5)
|
4456
4495
|
rescue => e
|
4457
4496
|
puts '-[√] 캡챠 해제 실패(캡챠는 사람이 풀기에 간혹 실수로 실패가 될수있습니다.).......'.red
|
4458
4497
|
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
@@ -5930,7 +5969,17 @@ begin
|
|
5930
5969
|
@driver.find_element(:xpath, '//*[@for="boardPrivacyCheck"]').click
|
5931
5970
|
sleep(1)
|
5932
5971
|
rescue
|
5933
|
-
|
5972
|
+
begin
|
5973
|
+
@driver.find_element(:xpath, '//*[@for="checkbox-nonMember"]').click
|
5974
|
+
sleep(1)
|
5975
|
+
rescue
|
5976
|
+
begin
|
5977
|
+
@driver.find_element(:xpath, '//*[@name="agree_chk"]').click
|
5978
|
+
sleep(1)
|
5979
|
+
rescue
|
5980
|
+
|
5981
|
+
end
|
5982
|
+
end
|
5934
5983
|
end
|
5935
5984
|
end
|
5936
5985
|
end
|
@@ -5964,6 +6013,19 @@ begin
|
|
5964
6013
|
rescue
|
5965
6014
|
end
|
5966
6015
|
|
6016
|
+
begin
|
6017
|
+
#요소 자체 제거 하기 기능
|
6018
|
+
|
6019
|
+
chat_box = @driver.find_element(:xpath, '//*[@title="reCAPTCHA"]')
|
6020
|
+
@driver.execute_script("arguments[0].remove();", chat_box)
|
6021
|
+
puts '방해 code 제거 완료.......'.green
|
6022
|
+
sleep(1)
|
6023
|
+
rescue
|
6024
|
+
end
|
6025
|
+
|
6026
|
+
|
6027
|
+
|
6028
|
+
|
5967
6029
|
|
5968
6030
|
title = title.strip
|
5969
6031
|
##제목 입력 코드 부분─────────────────────────────────────────────────────────────────────>
|
@@ -6522,6 +6584,7 @@ begin
|
|
6522
6584
|
##내용 입력 필드 코드 부분─────────────────────────────────────────────────────────────────────>
|
6523
6585
|
#puts '-[√] 내용 입력 부분 탐색 시작.......'.yellow
|
6524
6586
|
#sleep(1)
|
6587
|
+
|
6525
6588
|
begin
|
6526
6589
|
@driver.find_element(:xpath, '//*[@name="content"]').click
|
6527
6590
|
sleep(1)
|
@@ -6575,6 +6638,11 @@ rescue
|
|
6575
6638
|
sleep(1)
|
6576
6639
|
puts '내용 항목 코드 타겟 9.......'.red
|
6577
6640
|
rescue
|
6641
|
+
begin
|
6642
|
+
@driver.find_element(:xpath, '//*[@class="kboard-content"]').click
|
6643
|
+
sleep(1)
|
6644
|
+
puts '내용 항목 코드 타겟 9-1.......'.red
|
6645
|
+
rescue
|
6578
6646
|
begin
|
6579
6647
|
#아이프레임에서 코드 선택
|
6580
6648
|
@driver.switch_to.frame(@driver.find_element(:xpath, '//*[@scrolling="no"]'))
|
@@ -6745,9 +6813,16 @@ rescue
|
|
6745
6813
|
sleep(1)
|
6746
6814
|
puts '내용 항목 코드 타겟 39.......'.red
|
6747
6815
|
rescue
|
6748
|
-
|
6816
|
+
begin
|
6817
|
+
@driver.find_element(:xpath, '//*[@class="kboard-attr-row kboard-attr-content required"]').click
|
6818
|
+
sleep(1)
|
6819
|
+
puts '내용 항목 코드 타겟 40.......'.red
|
6820
|
+
rescue
|
6821
|
+
|
6822
|
+
end
|
6749
6823
|
end
|
6750
6824
|
end
|
6825
|
+
end
|
6751
6826
|
end
|
6752
6827
|
end
|
6753
6828
|
end
|
@@ -7848,7 +7923,7 @@ if check_captcha == 1
|
|
7848
7923
|
sleep(1)
|
7849
7924
|
@driver.find_element(:xpath, '//*[@data-state="solved"]').click
|
7850
7925
|
puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
|
7851
|
-
sleep(
|
7926
|
+
sleep(5)
|
7852
7927
|
begin
|
7853
7928
|
@driver.find_element(:xpath, '//*[@name="user_captcha"]').click
|
7854
7929
|
sleep(1)
|
@@ -8153,7 +8228,28 @@ if check_captcha == 0
|
|
8153
8228
|
sleep(1)
|
8154
8229
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
8155
8230
|
rescue
|
8156
|
-
|
8231
|
+
begin
|
8232
|
+
@driver.switch_to.default_content()
|
8233
|
+
el = @driver.find_element(:xpath, '//*[@id="zsfImg"]')
|
8234
|
+
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
8235
|
+
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
8236
|
+
puts '-[√] 챕챠 코드 code 12.......'.red
|
8237
|
+
sleep(1)
|
8238
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
8239
|
+
sleep(1)
|
8240
|
+
mouse_move_percentage(0.3,0.02)
|
8241
|
+
sleep(0.5)
|
8242
|
+
left_click
|
8243
|
+
sleep(1)
|
8244
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
8245
|
+
@driver.action.context_click(el).perform #우 클릭
|
8246
|
+
sleep(1)
|
8247
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
8248
|
+
sleep(1)
|
8249
|
+
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
8250
|
+
rescue
|
8251
|
+
|
8252
|
+
end
|
8157
8253
|
end
|
8158
8254
|
end
|
8159
8255
|
end
|
@@ -8723,7 +8819,46 @@ if check_captcha == 0
|
|
8723
8819
|
puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
|
8724
8820
|
sleep(1)
|
8725
8821
|
rescue
|
8726
|
-
|
8822
|
+
begin
|
8823
|
+
@driver.switch_to.default_content()
|
8824
|
+
sleep(1)
|
8825
|
+
@driver.find_element(:xpath, '//*[@id="zsfCode"]').click
|
8826
|
+
|
8827
|
+
sleep(1)
|
8828
|
+
|
8829
|
+
el2 = @driver.find_element(:xpath, '//*[@id="zsfCode"]')
|
8830
|
+
@driver.action.context_click(el2).perform
|
8831
|
+
|
8832
|
+
sleep(1)
|
8833
|
+
@driver.action.key_stroke('up')
|
8834
|
+
sleep(1)
|
8835
|
+
@driver.action.key_stroke('up')
|
8836
|
+
sleep(1)
|
8837
|
+
@driver.action.key_stroke('enter')
|
8838
|
+
sleep(1)
|
8839
|
+
begin
|
8840
|
+
# 요소 찾기 타임아웃을 7초로 설정
|
8841
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
8842
|
+
#요소가 나타날 때까지 7초 동안 기다립니다.
|
8843
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
8844
|
+
rescue
|
8845
|
+
sleep(1)
|
8846
|
+
@driver.action.key_stroke('left')
|
8847
|
+
sleep(1)
|
8848
|
+
@driver.action.key_stroke('up')
|
8849
|
+
sleep(1)
|
8850
|
+
@driver.action.key_stroke('enter')
|
8851
|
+
sleep(1)
|
8852
|
+
# 요소 찾기 타임아웃을 7초로 설정
|
8853
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
8854
|
+
#요소가 나타날 때까지 7초 동안 기다립니다.
|
8855
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
8856
|
+
end
|
8857
|
+
puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
|
8858
|
+
sleep(1)
|
8859
|
+
rescue
|
8860
|
+
|
8861
|
+
end
|
8727
8862
|
end
|
8728
8863
|
end
|
8729
8864
|
end
|
@@ -8806,7 +8941,7 @@ sleep(10)
|
|
8806
8941
|
sleep(1)
|
8807
8942
|
@driver.find_element(:xpath, '//*[@data-state="solved"]').click
|
8808
8943
|
puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
|
8809
|
-
sleep(
|
8944
|
+
sleep(5)
|
8810
8945
|
begin
|
8811
8946
|
@driver.find_element(:xpath, '//*[@name="user_captcha"]').click
|
8812
8947
|
sleep(1)
|
@@ -9164,7 +9299,16 @@ rescue
|
|
9164
9299
|
sleep(5)
|
9165
9300
|
|
9166
9301
|
rescue
|
9167
|
-
|
9302
|
+
begin
|
9303
|
+
ss_button = @driver.find_element(:xpath, '//*[@class="btn btn_point"]')
|
9304
|
+
@driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
|
9305
|
+
sleep(1)
|
9306
|
+
|
9307
|
+
@driver.find_element(:xpath, '//*[@class="btn btn_point"]').click
|
9308
|
+
puts '-[√] 등록을 28번 코드로 시도하였습니다.......'.magenta
|
9309
|
+
sleep(5)
|
9310
|
+
|
9311
|
+
rescue
|
9168
9312
|
|
9169
9313
|
########─────────────────────────────▼▼▼▼▼▼▼ 등록버튼 2차 시도 ▼▼▼▼▼▼▼──────────────────────────────#######
|
9170
9314
|
begin
|
@@ -9362,7 +9506,7 @@ rescue
|
|
9362
9506
|
########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 2차 시도 ▲▲▲▲▲▲▲──────────────────────────────#######
|
9363
9507
|
|
9364
9508
|
|
9365
|
-
|
9509
|
+
end
|
9366
9510
|
end
|
9367
9511
|
end
|
9368
9512
|
end
|
@@ -9491,6 +9635,7 @@ end
|
|
9491
9635
|
|
9492
9636
|
|
9493
9637
|
|
9638
|
+
|
9494
9639
|
class Wordpress
|
9495
9640
|
include Glimmer
|
9496
9641
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: posting_duo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|