tblog_duopack 0.0.5 → 0.0.9

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/tblog_duopack.rb +566 -384
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67aca1228ea382eedfe5cd4311bba5bac0f58c7086bab65742981b1fd94df259
4
- data.tar.gz: 4d9399e4ca2201f9124d730528fad53e94d6ea74e140202e8510a70eb51dcd9e
3
+ metadata.gz: 1c2492b0fa5a0d65287cd0b9ac27017363f1e9df73282bfffc3e7d9666253e52
4
+ data.tar.gz: e0346713a5ae4c02b4dacb6dc0c0cbc098879e59a63d97f3a7eee83288c56884
5
5
  SHA512:
6
- metadata.gz: a5bfde0b177e7c1ec89d2651af06931fd4e54ff71e7f4ee5de1486fcaddea5f90c51945b7ed2c61c80a3d31d253de780a9381e34414c4e0bd3c11717ca01f9f0
7
- data.tar.gz: 04b37e0db153e7973c7b480e0affd256418358187bf51f02cfe105a280724d0e2352dc4ab900a053d945e0d829e70ffc906575cf70cb11e07acb45f3125acae2
6
+ metadata.gz: 2ea90b379b8f5068fab36f4cf363321e470c8e27b4adc6b053683bad6bf43c01f7d46cec75e1e01ec2b4376c4d7106ae6b342981b8e92f7e930e9c669ffdb9bb
7
+ data.tar.gz: df57c47410e2a80e30c4be8abd271d69554356f63537bc247b68d0aaea3cf7b4570a6cb9f98d594a562bf854f1a6965d484d785a79a25a9797fb0f29e57ea896
data/lib/tblog_duopack.rb CHANGED
@@ -1,7 +1,6 @@
1
-
2
1
  require 'glimmer-dsl-libui'
3
2
  require 'selenium-webdriver'
4
- # require 'webdrivers'
3
+ require 'webdrivers'
5
4
  require 'iconv'
6
5
  require 'nokogiri'
7
6
  require 'http'
@@ -18,8 +17,6 @@ require 'cgi'
18
17
  require 'digest'
19
18
  require 'auto_click'
20
19
  require 'rainbow/refinement'
21
- require 'net/http'
22
- require 'httparty'
23
20
  include AutoClickMethods
24
21
  using Rainbow
25
22
  include Glimmer
@@ -209,133 +206,114 @@ end
209
206
 
210
207
  class Naver
211
208
  def initialize
212
- @seed = 1
213
- @cookie = ''
209
+ @seed = 1
210
+ @cookie = ''
214
211
  end
215
-
212
+
216
213
  def chrome_start(proxy)
217
- # 공통 옵션 설정
218
- Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
219
- options = Selenium::WebDriver::Chrome::Options.new
220
-
221
- options.add_argument('--disable-blink-features=AutomationControlled')
222
- options.add_argument('--disable-popup-blocking')
223
- options.add_argument('--dns-prefetch-disable')
224
- options.add_argument('--disable-dev-shm-usage')
225
- options.add_argument('--disable-software-rasterizer')
226
- options.add_argument('--ignore-certificate-errors')
227
- options.add_argument('--disable-gpu') # GPU 가속 끄기
228
- options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36') # user-agent 위조
229
- options.add_argument('--disable-web-security')
230
- options.add_argument('--allow-running-insecure-content')
231
- options.add_argument('--allow-insecure-localhost')
232
- options.add_argument('--no-sandbox')
233
- options.add_argument('--disable-translate')
234
- options.add_argument('--disable-extensions-file-access-check')
235
- options.add_argument('--disable-impl-side-painting')
236
-
237
- # 자동화된 테스트 제거
238
- options.exclude_switches = ['enable-automation'] # 'excludeSwitches'를 'exclude_switches'로 수정
239
-
240
- prefs = {
241
- "profile.password_manager_enabled" => false, # 비밀번호 관리자 비활성화
242
- "credentials_enable_service" => false, # 비밀번호 저장 관련 기능 비활성화
243
- "password_manager.enabled" => false, # 비밀번호 관리자 비활성화 (추가적인 설정)
244
- "profile.managed_default_content_settings.cookies" => 2, # 쿠키 관련 팝업 차단
245
- "profile.default_content_setting_values.notifications" => 2 # 알림 관련 팝업 차단
246
- }
247
- options.add_preference('prefs', prefs)
248
-
249
- # Proxy가 설정되었으면 proxy 서버 설정
250
- if proxy != ''
251
- options.add_argument('--proxy-server=' + proxy.to_s.force_encoding('utf-8'))
252
- end
253
-
254
- # 브라우저 실행
255
- begin
256
- @driver = Selenium::WebDriver.for(:chrome, options: options)
257
- @driver.get("https://www.tistory.com/auth/login")
258
- rescue => e
259
- puts "Error: #{e.message}"
260
- puts 'Using default Chrome driver without proxy'
261
- @driver = Selenium::WebDriver.for(:chrome, options: options)
262
- @driver.get("https://www.tistory.com/auth/login")
263
- end
214
+ # 공통 옵션 설정
215
+ #Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
216
+ options = Selenium::WebDriver::Chrome::Options.new
217
+
218
+ options.add_extension('./crx/app.crx') # 확장 프로그램을 첫 번째 탭에 추가
219
+ options.add_argument('--disable-blink-features=AutomationControlled')
220
+ options.add_argument('--disable-popup-blocking')
221
+ options.add_argument('--dns-prefetch-disable')
222
+ options.add_argument('--disable-dev-shm-usage')
223
+ options.add_argument('--disable-software-rasterizer')
224
+ options.add_argument('--ignore-certificate-errors')
225
+ options.add_argument('--disable-gpu') # GPU 가속 끄기
226
+ options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36') # user-agent 위조
227
+ options.add_argument('--disable-web-security')
228
+ options.add_argument('--allow-running-insecure-content')
229
+ options.add_argument('--allow-insecure-localhost')
230
+ options.add_argument('--no-sandbox')
231
+ options.add_argument('--disable-translate')
232
+ options.add_argument('--disable-extensions-file-access-check')
233
+ options.add_argument('--disable-impl-side-painting')
234
+
235
+ # 자동화된 테스트 제거
236
+ options.exclude_switches = ['enable-automation']
237
+
238
+ options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
239
+ options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
240
+ #options.add_preference("profile.managed_default_content_settings.cookies", 2) # 쿠키 관련 팝업 차단
241
+ options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
242
+ options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
243
+
244
+
245
+ # Proxy 설정
246
+ if proxy != ''
247
+ options.add_argument('--proxy-server=' + proxy.to_s.force_encoding('utf-8'))
264
248
  end
265
-
266
- def solve_captcha(captcha_api_key)
267
- page_url = @driver.current_url
268
- iframe_element = @driver.find_element(:css, "iframe[title='reCAPTCHA']")
269
- iframe_src = iframe_element.attribute("src")
249
+
250
+ # 브라우저 실행
251
+ begin
252
+ # :capabilities에 options를 배열로 전달
253
+ capabilities = [options]
254
+
255
+ # Selenium WebDriver에서 options를 capabilities로 전달
256
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
257
+
270
258
 
271
- google_key = URI.parse(iframe_src).query.split("&").map { |param| param.split("=") }.to_h["k"]
259
+ sleep(1)
260
+ # 두 번째 탭에서 로그인 페이지 열기
261
+ @driver.get('https://www.tistory.com/auth/login')
262
+ sleep(1)
263
+
264
+ rescue => e
272
265
 
273
- raise "reCAPTCHA site key를 iframe에서 찾을 수 없습니다." if google_key.nil?
274
-
275
- response = HTTParty.post("http://2captcha.com/in.php", body: {
276
- method: 'userrecaptcha',
277
- googlekey: google_key,
278
- pageurl: page_url,
279
- key: captcha_api_key,
280
- json: 1
281
- })
282
-
283
- if response.code != 200 || JSON.parse(response.body)["status"] != 1
284
- raise "2Captcha 요청에 실패했습니다. 응답: #{response.body}"
285
- end
286
-
287
- captcha_id = JSON.parse(response.body)["request"]
266
+ puts "Error: #{e.message}"
267
+ puts 'Using default Chrome driver without proxy'
268
+ # :capabilities에 options를 배열로 전달
269
+ capabilities = [options]
288
270
 
289
- # CAPTCHA 해결을 기다립니다.
290
- wait = Selenium::WebDriver::Wait.new(:timeout => 30)
291
- result = nil
271
+ # Selenium WebDriver에서 options를 capabilities로 전달
272
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
292
273
 
293
- loop do
294
- result = HTTParty.get("http://2captcha.com/res.php?key=#{captcha_api_key}&action=get&id=#{captcha_id}&json=1")
295
- parsed_result = JSON.parse(result.body)
296
-
297
- if parsed_result["status"] == 1
298
- return parsed_result["request"]
299
- elsif parsed_result["request"] != "CAPCHA_NOT_READY"
300
- raise "2Captcha 에러 발생: #{parsed_result['request']}"
301
- end
302
- sleep(5) # 5초 간격으로 재시도
303
- end
274
+ # 첫 번째 탭에서 확장 프로그램을 로드
275
+ #@driver.get("chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html")
276
+ sleep(1)
277
+ # 두 번째 탭에서 로그인 페이지 열기
278
+ @driver.get('https://www.tistory.com/auth/login')
279
+ sleep(1)
304
280
  end
305
-
306
-
307
-
281
+ end
282
+
308
283
  def login(user_id, user_pw, proxy, captcha_api_key)
309
- chrome_start(proxy)
310
- @captcha_api_key = captcha_api_key
311
- @user_id = user_id
312
-
313
- user_cookie_file = []
314
- begin
315
- Dir.entries('./cookie').each do |i|
316
- if i != '.' && i != '..'
317
- user_cookie_file << i
318
- end
319
- end
320
- rescue
321
- end
322
-
323
- @cookie4 = {}
324
- if user_cookie_file.include?(user_id+'.txt')
325
- f = File.open('./cookie/'+user_id+'.txt', 'r')
326
- @cookie4 = JSON.parse(f.read)
327
- f.close
284
+ chrome_start(proxy)
285
+ @captcha_api_key = captcha_api_key
286
+ @user_id = user_id
287
+
288
+ user_cookie_file = []
289
+ begin
290
+ Dir.entries('./cookie').each do |i|
291
+ if i != '.' && i != '..'
292
+ user_cookie_file << i
293
+ end
328
294
  end
329
-
330
- # 기존 쿠키가 있으면 쿠키를 추가
331
- begin
332
- @cookie4.each do |i|
333
- @driver.manage.add_cookie(name: i['name'], value: i['value'], same_site: i['same_site'], domain: i['domain'], path: i['path'])
334
- end
335
- rescue
295
+ rescue
296
+ end
297
+
298
+ @cookie4 = {}
299
+ if user_cookie_file.include?(user_id+'.txt')
300
+ f = File.open('./cookie/'+user_id+'.txt', 'r')
301
+ @cookie4 = JSON.parse(f.read)
302
+ f.close
303
+ end
304
+
305
+ # 기존 쿠키가 있으면 쿠키를 추가
306
+ begin
307
+ @cookie4.each do |i|
308
+ @driver.manage.add_cookie(name: i['name'], value: i['value'], same_site: i['same_site'], domain: i['domain'], path: i['path'])
336
309
  end
337
-
338
- @driver.get('https://www.tistory.com/auth/login')
310
+ rescue
311
+ end
312
+
313
+ @driver.switch_to.window(@driver.window_handles.last)
314
+ sleep(1.5)
315
+ @driver.get('https://www.tistory.com/auth/login')
316
+
339
317
  sleep(1)
340
318
  begin
341
319
  wait = Selenium::WebDriver::Wait.new(:timeout => 3)
@@ -364,72 +342,75 @@ class Naver
364
342
  puts '-[√] 2 비밀번호 입력.......'.yellow
365
343
 
366
344
  wait = Selenium::WebDriver::Wait.new(:timeout => 3)
367
- wait.until { @driver.find_element(:xpath, '//*[@type="submit"]') }
345
+ wait.until { @driver.find_element(:xpath, '//*[@class="btn_g highlight submit"]') }
368
346
  @driver.find_element(:xpath, '//*[@type="submit"]').click
369
347
  puts '-[√] 3 로그인 버튼 클릭.......'.yellow
370
-
371
- #예외 변수
348
+
349
+ #캡챠 해제시
372
350
  begin
373
- # CAPTCHA iframe 찾기
374
- captcha_iframe = wait.until {
375
- @driver.find_elements(:tag_name, "iframe").find do |iframe|
376
- iframe.attribute("title") == "reCAPTCHA" || (iframe.attribute("src")&.include?("google.com/recaptcha"))
377
- end
378
- }
351
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
352
+ wait.until { @driver.find_element(:xpath, '//*[@id="captchaContainer"]') }
353
+ puts '-[√] 로그인 중 캡챠 요구 발생 처리 진행.......'.yellow
379
354
  sleep(1)
380
-
381
- # CAPTCHA iframe이 없다면 예외 처리
382
- if captcha_iframe.nil?
383
- puts 'CAPTCHA 없음, 로그인 진행 중...'.cyan
384
- else
385
- # CAPTCHA iframe으로 전환
386
- @driver.switch_to.frame(captcha_iframe)
387
- puts 'CAPTCHA iframe 전환 성공'.cyan
388
- sleep(2)
389
-
390
- # CAPTCHA 클릭
391
- recaptcha_element = wait.until { @driver.find_element(:id, "recaptcha-anchor") }
392
- recaptcha_element.click
393
- puts 'CAPTCHA 클릭 완료'.cyan
394
- sleep(3)
395
-
396
- # CAPTCHA 해결
397
- @captcha_api_key = captcha_api_key
398
- captcha_answer = solve_captcha(@captcha_api_key)
399
- puts "CAPTCHA 해결된 답: #{captcha_answer}".cyan
400
- sleep(5)
401
-
402
- # CAPTCHA 답 입력
403
- begin
404
- # 다시 `wait`을 사용하여 `g-recaptcha-response` 필드를 기다립니다
405
- captcha_input = wait.until { @driver.find_element(:id, "g-recaptcha-response") }
406
- @driver.execute_script("arguments[0].style.display = 'block';", captcha_input) # 숨겨진 CAPTCHA 입력 필드를 표시
407
- captcha_input.send_keys(captcha_answer)
408
- puts 'CAPTCHA 답 입력 완료'.cyan
409
- rescue Selenium::WebDriver::Error::NoSuchElementError => e
410
- puts "g-recaptcha-response 필드를 찾을 수 없습니다. 다시 시도해주세요.".red
411
- raise e
412
- end
413
-
414
- # 로그인 버튼 다시 클릭
415
- wait.until { @driver.find_element(:xpath, '//*[@class="btn_g highlight submit"]') }
416
- @driver.find_element(:xpath, '//*[@class="btn_g highlight submit"]').click
417
- puts '-[√] 3-3 로그인 버튼 다시 클릭.......'.cyan
355
+ @driver.switch_to.window(@driver.window_handles[0])
356
+ sleep(1)
357
+ @driver.find_element(:xpath, '//*[@name="apiKey"]').click
358
+ Clipboard.copy(captcha_api_key)
359
+ sleep(0.5)
360
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
361
+ sleep(0.5)
362
+ @driver.find_element(:xpath, '//*[@data-lang="login"]').click
363
+
364
+ begin
365
+ sleep(2)
366
+ @driver.switch_to.alert.dismiss
367
+ sleep(1)
368
+ rescue
369
+
418
370
  end
419
-
420
- rescue Selenium::WebDriver::Error::NoSuchElementError => e
421
- puts 'CAPTCHA 없음, 로그인 진행 중...'.cyan
422
- rescue => e
423
- puts "로그인 처리 중 오류 발생: #{e.message}".red
424
- end
425
371
 
372
+ # 두 번째 탭으로 전환
373
+ @driver.switch_to.window(@driver.window_handles[1])
374
+
375
+ begin
376
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
377
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
378
+ @driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
379
+ puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
380
+ sleep(10)
381
+
382
+ begin
383
+ @driver.find_element(:xpath, '//*[@data-state="error"]').click
384
+ puts '-[√] 1 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
385
+ puts '-[√] 2 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
386
+ sleep(1)
387
+ @driver.quit
388
+ rescue
389
+ # 타임아웃을 77초로 설정
390
+ wait = Selenium::WebDriver::Wait.new(:timeout => 100)
391
+ # 요소가 나타날 때까지 100초 동안 기다립니다.
392
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="solved"]') }
393
+ sleep(1)
394
+ @driver.find_element(:xpath, '//*[@data-state="solved"]').click
395
+ puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
396
+ sleep(3)
397
+ @driver.find_element(:xpath, '//*[@id="password--2"]').click #비번 클릭
398
+ sleep(1)
399
+ @driver.action.send_keys(:enter).perform #엔터키 주기
400
+ end
401
+
402
+ rescue
403
+ end
404
+
405
+ rescue
406
+ end
426
407
 
427
408
 
428
409
  # 아이디/비밀번호 오류 처리 부분
429
410
  begin
430
411
  @driver.find_element(:xpath, '//*[@class="desc_error"]')
431
412
  sleep(1)
432
- @driver.close
413
+ @driver.quit
433
414
  puts 'error = 아이디/비밀번호 오류'.yellow
434
415
  rescue
435
416
  end
@@ -459,10 +440,19 @@ class Naver
459
440
  begin
460
441
  @driver.find_element(:xpath, '//*[@class="inner_error inner_error_type2"]')
461
442
  puts 'error = 평소와 다른 로그인이 감지되어 추가 인증이 필요합니다.'.yellow
462
- sleep(1)
463
- @driver.close
443
+ @driver.quit
464
444
  rescue
465
445
  end
446
+
447
+ #최종 로그인 실패시
448
+ begin
449
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5)
450
+ wait.until { @driver.find_element(:xpath, '//*[@class="my_tistory border_box"]') }
451
+ rescue => e
452
+ puts '-[√] 로그인 실패.......'.red
453
+ @driver.quit
454
+ return 0
455
+ end
466
456
 
467
457
  end
468
458
 
@@ -486,23 +476,28 @@ class Naver
486
476
 
487
477
 
488
478
 
489
- def update(title, content, option, dd_time, url, keyword, captcha_api_key)
479
+ def update(title, content, option, url, keyword, captcha_api_key)#dd_time
490
480
  puts 'start...'.yellow
491
481
  puts(url)
492
482
  sleep(1)
493
483
  @driver.get(url)
494
- sleep(5)
495
-
484
+ sleep(2)
485
+
496
486
 
497
487
 
498
488
  begin
489
+ # alert이 뜨기를 기다리기
490
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5) # 10초 대기
491
+ alert = wait.until { @driver.switch_to.alert }
499
492
 
500
- @driver.switch_to.alert.dismiss
501
- rescue
502
-
493
+ # alert 처리 (예: dismiss나 accept)
494
+ alert.dismiss # 또는 alert.accept
495
+ sleep(2)
496
+ rescue
497
+ sleep(1)
503
498
  end
504
499
 
505
- sleep(1)
500
+
506
501
 
507
502
 
508
503
 
@@ -536,7 +531,7 @@ class Naver
536
531
  rescue => e
537
532
  puts '-[√] 카테고리 ERROR 발생.......'.red
538
533
  puts '-[√] 다음 작업이 준비중이니 1~60 초 정도 기다려주세요.......'.green
539
- @driver.close
534
+ @driver.quit
540
535
  return 0
541
536
  end
542
537
 
@@ -552,7 +547,7 @@ class Naver
552
547
  begin
553
548
  @driver.find_element(:xpath, '//*[@id="post-title-inp"]').send_keys(title)
554
549
  rescue => e
555
- @driver.close
550
+ @driver.quit
556
551
  return 0
557
552
  puts '-[√] 페이지 로드(로딩)시간 초과 및 알수없는 오류로 종료.......'.red
558
553
  puts '-[√] 다음 작업이 준비중이니 1~60 초 정도 기다려주세요.......'.green
@@ -571,7 +566,7 @@ class Naver
571
566
  @driver.find_element(:xpath, '//*[@id="mceu_9-button"]').click()
572
567
  @driver.find_element(:xpath, '//*[@id="mceu_9-button"]').click()
573
568
  rescue => e
574
- @driver.close
569
+ @driver.quit
575
570
  return 0
576
571
  puts '-[√] 페이지 로드(로딩)시간 초과 및 알수없는 오류로 종료.......'.red
577
572
  puts '-[√] 다음 작업이 준비중이니 1~60 초 정도 기다려주세요.......'.green
@@ -1072,31 +1067,7 @@ class Naver
1072
1067
  end
1073
1068
 
1074
1069
 
1075
-
1076
-
1077
-
1078
-
1079
-
1080
-
1081
-
1082
-
1083
-
1084
-
1085
-
1086
-
1087
-
1088
-
1089
-
1090
-
1091
-
1092
-
1093
-
1094
-
1095
-
1096
-
1097
-
1098
-
1099
- if option['중앙정렬'] == 'false'
1070
+ if option['중앙정렬'] == 'true'
1100
1071
  puts '-[√] 중앙정렬 선택.......'.yellow
1101
1072
  begin
1102
1073
 
@@ -1110,7 +1081,7 @@ class Naver
1110
1081
  sleep(1.5)
1111
1082
 
1112
1083
 
1113
- if option['좌측정렬'] == 'false'
1084
+ if option['좌측정렬'] == 'true'
1114
1085
  puts '-[√] 좌측정렬 선택.......'.yellow
1115
1086
  begin
1116
1087
  @driver.action.key_down(:control).key_down('a').key_up('a').key_up(:control).perform
@@ -1122,7 +1093,7 @@ class Naver
1122
1093
  sleep(1.5)
1123
1094
 
1124
1095
 
1125
- if option['우측정렬'] == 'false'
1096
+ if option['우측정렬'] == 'true'
1126
1097
  puts '-[√] 우측정렬 선택.......'.yellow
1127
1098
  begin
1128
1099
  @driver.action.key_down(:control).key_down('a').key_up('a').key_up(:control).perform
@@ -1149,104 +1120,284 @@ class Naver
1149
1120
  #태그 입력 항목
1150
1121
 
1151
1122
  sleep(1.5)
1123
+
1124
+ ##################글 발행##################
1152
1125
 
1153
- @driver.find_element(:xpath, '/html/body/div[1]/div/div[2]/div[3]/button').click
1154
- #1차 완료버튼
1155
- sleep(1.5)
1126
+ if option['글발생하기'] == 'true'
1127
+ puts '-[√] 글 발행 선택.......'.yellow
1128
+ begin
1129
+
1130
+
1131
+ @driver.find_element(:xpath, '/html/body/div[1]/div/div[2]/div[3]/button').click
1132
+ #1차 완료버튼
1133
+ sleep(1.5)
1156
1134
 
1157
- # 타임아웃을 10초로 설정
1158
- wait = Selenium::WebDriver::Wait.new(:timeout => 60)
1159
- #요소가 나타날 때까지 60초 동안 기다립니다.
1160
- wait.until { @driver.find_element(:xpath, '//*[@id="open20"]') }
1135
+ # 타임아웃을 10초로 설정
1136
+ wait = Selenium::WebDriver::Wait.new(:timeout => 60)
1137
+ #요소가 나타날 때까지 60초 동안 기다립니다.
1138
+ wait.until { @driver.find_element(:xpath, '//*[@id="open20"]') }
1161
1139
 
1162
1140
 
1163
- if option['전체공개'] == 'false'
1164
- puts '-[√] 전체공개 선택.......'.yellow
1165
- begin
1166
-
1167
- @driver.find_element(:xpath, '//*[@id="open20"]').click
1168
- sleep(2)
1169
- rescue
1170
- end
1171
- end
1141
+ if option['전체공개'] == 'true'
1142
+ puts '-[√] 전체공개 선택.......'.yellow
1143
+ begin
1144
+
1145
+ @driver.find_element(:xpath, '//*[@id="open20"]').click
1146
+ sleep(1)
1147
+ rescue
1148
+ end
1149
+ end
1150
+
1151
+
1152
+ if option['비공개'] == 'true'
1153
+ puts '-[√] 비공개 선택.......'.yellow
1154
+ begin
1155
+ @driver.find_element(:xpath, '//*[@id="open0"]').click
1156
+ sleep(1)
1157
+ rescue
1158
+ end
1159
+ end
1172
1160
 
1173
1161
 
1174
- if option['비공개'] == 'false'
1175
- puts '-[√] 비공개 선택.......'.yellow
1176
- begin
1177
- @driver.find_element(:xpath, '//*[@id="open0"]').click
1178
- sleep(2)
1179
- rescue
1180
- end
1181
- end
1182
-
1162
+ if option['댓글허용'] == 'true'
1163
+ puts '-[√] 댓글허용 선택.......'.yellow
1164
+ begin
1165
+
1166
+ @driver.find_element(:xpath, '//*[@class="mce-btn-type1"]').click
1167
+ sleep(2)
1168
+ @driver.find_element(:partial_link_text, '댓글 허용').click
1169
+ sleep(1)
1170
+ rescue
1171
+ end
1172
+ end
1173
+ sleep(2)
1174
+
1175
+ if option['댓글 비 허용'] == 'true'
1176
+ puts '-[√] 댓글 비 허용 선택.......'.yellow
1177
+ begin
1178
+ @driver.find_element(:xpath, '//*[@class="mce-btn-type1"]').click
1179
+ sleep(2)
1180
+ @driver.find_element(:partial_link_text, '댓글 비허용').click
1181
+ sleep(1)
1182
+ rescue
1183
+ end
1184
+ end
1183
1185
 
1184
- if option['댓글허용'] == 'false'
1185
- puts '-[√] 댓글허용 선택.......'.yellow
1186
- begin
1187
-
1188
- @driver.find_element(:xpath, '//*[@class="mce-btn-type1"]').click
1189
- sleep(2)
1190
- @driver.find_element(:partial_link_text, '댓글 허용').click
1191
- sleep(2)
1186
+
1187
+
1188
+
1189
+
1190
+
1191
+
1192
+
1193
+
1194
+ #캡챠 해제시######################################################################
1195
+ begin
1196
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3.7)
1197
+ wait.until { @driver.find_element(:xpath, '//*[@id="captchaContainer"]') }
1198
+ puts '-[√] 로그인 중 캡챠 요구 발생 처리 진행.......'.yellow
1199
+ sleep(1)
1200
+ @driver.switch_to.window(@driver.window_handles[0])
1201
+ sleep(1)
1202
+ @driver.find_element(:xpath, '//*[@name="apiKey"]').click
1203
+ sleep(0.5)
1204
+ @driver.find_element(:xpath, '//*[@name="apiKey"]').clear
1205
+ sleep(0.5)
1206
+ Clipboard.copy(captcha_api_key)
1207
+ sleep(0.5)
1208
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
1209
+ sleep(0.5)
1210
+ @driver.find_element(:xpath, '//*[@data-lang="login"]').click
1211
+
1212
+ begin
1213
+ sleep(2)
1214
+ @driver.switch_to.alert.dismiss
1215
+ sleep(1)
1216
+ rescue
1217
+
1218
+ end
1219
+
1220
+ # 두 번째 탭으로 전환
1221
+ @driver.switch_to.window(@driver.window_handles[1])
1222
+
1223
+ begin
1224
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
1225
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
1226
+ @driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
1227
+ puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
1228
+ sleep(10)
1229
+
1230
+ begin
1231
+ @driver.find_element(:xpath, '//*[@data-state="error"]').click
1232
+ puts '-[√] 1 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
1233
+ puts '-[√] 2 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
1234
+
1235
+ @driver.quit
1236
+ puts '-[√] 다음 작업을 진행합니다. 약 10~60초 소요 될 수 있습니다.......'.red
1237
+ rescue
1238
+ # 타임아웃을 77초로 설정
1239
+ wait = Selenium::WebDriver::Wait.new(:timeout => 100)
1240
+ # 요소가 나타날 때까지 100초 동안 기다립니다.
1241
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="solved"]') }
1242
+ sleep(1)
1243
+ @driver.find_element(:xpath, '//*[@data-state="solved"]').click
1244
+ puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
1245
+ sleep(1)
1246
+
1247
+ end
1248
+
1249
+ rescue
1250
+ end
1251
+
1252
+ rescue
1253
+ end
1254
+ #캡챠 해제시######################################################################
1255
+
1256
+
1257
+
1258
+
1259
+
1260
+
1261
+ #sleep(dd_time.to_i) # 등록버튼 누르기 전 딜레이
1262
+ # 등록 버튼 클릭
1263
+ @driver.find_element(:xpath, '//*[@id="publish-btn"]').click
1264
+ puts '-[√] 포스트 등록 성공 여부 확인 중.......'.yellow
1265
+ sleep(2)
1266
+ ###########포스트 캡챠해제 팝업 시 재시도 작업 시작▼▼▼▼▼▼▼▼▼▼▼▼
1267
+ begin
1268
+ sleep(1)
1269
+ @driver.switch_to.alert.accept
1270
+ puts '-[√] 캡챠 체크 시간 초과!! 재 등록 시도.......'.green
1271
+ sleep(2)
1272
+ @driver.get(url)
1273
+ puts '-[√] 등록 내용 불러오기 시도.......'.yellow
1274
+ sleep(2)
1275
+ @driver.switch_to.alert.accept
1276
+ sleep(2)
1277
+ puts '-[√] 재 등록 시도 시작.......'.yellow
1278
+ @driver.find_element(:xpath, '//*[@id="publish-layer-btn"]').click
1279
+ sleep(2)
1280
+
1281
+ # 타임아웃을 10초로 설정
1282
+ wait = Selenium::WebDriver::Wait.new(:timeout => 60)
1283
+ #요소가 나타날 때까지 60초 동안 기다립니다.
1284
+ wait.until { @driver.find_element(:xpath, '//*[@id="open20"]') }
1285
+
1286
+ if option['전체공개'] == 'true'
1287
+ puts '-[√] 전체공개 선택.......'.yellow
1288
+ begin
1289
+
1290
+ @driver.find_element(:xpath, '//*[@id="open20"]').click
1291
+ sleep(2)
1292
+ rescue
1293
+ end
1294
+ end
1295
+
1296
+
1297
+ if option['비공개'] == 'true'
1298
+ puts '-[√] 비공개 선택.......'.yellow
1299
+ begin
1300
+ @driver.find_element(:xpath, '//*[@id="open0"]').click
1301
+ sleep(2)
1302
+ rescue
1303
+ end
1304
+ end
1305
+
1306
+
1307
+ if option['댓글허용'] == 'true'
1308
+ puts '-[√] 댓글허용 선택.......'.yellow
1309
+ begin
1310
+
1311
+ @driver.find_element(:xpath, '//*[@class="mce-btn-type1"]').click
1312
+ sleep(2)
1313
+ @driver.find_element(:partial_link_text, '댓글 허용').click
1314
+ sleep(2)
1315
+ rescue
1316
+ end
1317
+ end
1318
+ sleep(2)
1319
+
1320
+ if option['댓글 비 허용'] == 'true'
1321
+ puts '-[√] 댓글 비 허용 선택.......'.yellow
1322
+ begin
1323
+ @driver.find_element(:xpath, '//*[@class="mce-btn-type1"]').click
1324
+ sleep(2)
1325
+ @driver.find_element(:partial_link_text, '댓글 비허용').click
1326
+ sleep(2)
1327
+ rescue
1328
+ end
1329
+ end
1330
+
1331
+ begin
1332
+ sleep(1)
1333
+ puts '-[√] 캡챠 발생 유무 확인.......'.green
1334
+ @driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼 (xpath값에서 data-state="ready를 지목하고자 한다면 //*[@data-state="ready"] 입력)
1335
+ puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
1336
+ sleep(10)
1337
+ begin
1338
+ sleep(1)
1339
+ @driver.find_element(:xpath, '//*[@data-state="error"]').click #캡챠 해제 오류 버튼
1340
+ puts '-[√] 캡챠 해제 에러 발생 !! API번호 및 포인트를 체크해주세요.......'.red
1341
+ sleep(1)
1342
+ puts '-[√] 캡챠 해제 에러 발생 !! API번호 및 포인트를 체크해주세요.......'.red
1343
+ sleep(1)
1344
+ @driver.close
1345
+ puts '-[√] 작업 종료 중........다음 포스팅 작업을 준비 합니다........'.red
1346
+ sleep(1)
1347
+ sleep(dd_time.to_i) #등록버튼 누르기전 딜레이
1348
+ @driver.find_element(:xpath, '//*[@id="publish-btn"]').click #등록완료버튼
1349
+ rescue
1350
+ # 타임아웃을 100초로 설정
1351
+ wait = Selenium::WebDriver::Wait.new(:timeout => 100)
1352
+ # 요소가 나타날 때까지 100초 동안 기다립니다.
1353
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="solved"]') }
1354
+ sleep(2)
1355
+ @driver.find_element(:xpath, '//*[@data-state="solved"]').click #캡챠 해제 완료 버튼
1356
+ puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
1357
+ sleep(3.7)
1358
+ end
1359
+ rescue
1360
+ end
1361
+
1362
+ @driver.find_element(:xpath, '//*[@id="publish-btn"]').click #등록완료버튼
1363
+ puts '-[√] 포스트 등록 성공 여부 확인 중.......'.yellow
1364
+ rescue
1365
+ end
1366
+
1367
+
1368
+
1369
+ # 포스트 등록 완료 확인
1370
+ begin
1371
+ # 포스트 등록 완료를 확인할 수 있는 요소(예: 등록 후 확인 페이지로 이동)
1372
+ wait.until { @driver.find_element(:xpath, '//*[@class="post_cont"]') }
1373
+ puts '-[√] 포스트 등록 완료.......'.yellow
1374
+ sleep(1.5)
1375
+ @driver.quit
1376
+ rescue => e
1377
+ puts '-[×] 포스트 등록 실패!'.red
1378
+ @driver.quit
1379
+ return 0
1380
+ end
1381
+
1192
1382
  rescue
1193
1383
  end
1194
1384
  end
1195
- sleep(2)
1196
-
1197
- if option['댓글 비 허용'] == 'false'
1198
- puts '-[√] 댓글 허용 선택.......'.yellow
1199
- begin
1200
- @driver.find_element(:xpath, '//*[@class="mce-btn-type1"]').click
1201
- sleep(2)
1202
- @driver.find_element(:partial_link_text, '댓글 비허용').click
1203
- sleep(2)
1385
+
1386
+
1387
+ if option['글임시저장'] == 'true'
1388
+ puts '-[√] 임시 저장 선택.......'.yellow
1389
+ begin
1390
+
1391
+ @driver.find_element(:xpath, '//*[@class="btn btn-draft"]').click
1392
+ sleep(1.5)
1393
+ @driver.quit
1204
1394
  rescue
1205
1395
  end
1206
1396
  end
1207
1397
 
1208
1398
 
1209
- sleep(dd_time.to_i) # 등록버튼 누르기 전 딜레이
1210
- # 등록 버튼 클릭
1211
- @driver.find_element(:xpath, '//*[@id="publish-btn"]').click
1212
- puts '-[√] 포스트 등록 성공 여부 확인 중.......'.yellow
1213
- sleep(2)
1214
- # 리캡챡 발생 여부 확인
1215
- begin
1216
- # 리캡챡 요소 확인 (예: 구글 reCAPTCHA의 iframe을 찾는 방법)
1217
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1218
- wait.until { @driver.find_element(:xpath, '//*[@id="recaptcha-anchor"]') }
1219
-
1220
- puts '-[√] 리캡챡 감지됨! 자동 해결 시도...'.yellow
1221
1399
 
1222
- # 리캡챡 해결 함수 호출
1223
- @captcha_api_key = captcha_api_key
1224
- sleep(1)
1225
- captcha_solution = solve_captcha(captcha_api_key)
1226
-
1227
- # 리캡챡 응답 필드에 해결된 값을 입력
1228
- @driver.execute_script("document.getElementById('g-recaptcha-response').innerHTML='#{captcha_solution}'")
1229
- sleep(3) # 잠시 대기 후
1230
- @driver.find_element(:xpath, '//*[@id="publish-btn"]').click # 등록 버튼 다시 클릭
1231
- puts '-[√] 리캡챡 해결 후 등록 시도.......'.yellow
1232
- sleep(2)
1233
- rescue
1234
- # 리캡챡이 없다면 바로 진행
1235
- puts '-[√] 리캡챡 없음, 바로 등록 진행.......'.yellow
1236
- end
1237
-
1238
- # 포스트 등록 완료 확인
1239
- begin
1240
- # 포스트 등록 완료를 확인할 수 있는 요소(예: 등록 후 확인 페이지로 이동)
1241
- wait.until { @driver.find_element(:xpath, '//*[@class="post_cont"]') }
1242
- puts '-[√] 포스트 등록 완료.......'.yellow
1243
- rescue
1244
- puts '-[×] 포스트 등록 실패!'.red
1245
- end
1246
1400
 
1247
-
1248
- # 브라우저 종료
1249
- @driver.close
1250
1401
 
1251
1402
 
1252
1403
 
@@ -1352,45 +1503,23 @@ class Wordpress
1352
1503
  end
1353
1504
  end
1354
1505
 
1355
- # def get_naver_text(q)
1356
- # begin
1357
- # Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1358
- # @driver = Selenium::WebDriver.for :chrome
1359
- # rescue
1360
- # @driver = Selenium::WebDriver.for :chrome
1361
- # end
1362
- # @driver.get('https://search.naver.com/search.naver?display=15&f=&filetype=0&page=3&query='+q.to_s+'&research_url=&sm=tab_pge&start=16&where=web')
1363
- # noko = Nokogiri::HTML(@driver.page_source)
1364
- # tt = noko.xpath('//*[@id="main_pack"]/section/div/ul').text
1365
- # aa33 = '하였습니다,하였어요,하게됬어요,했답니다,했었는데요,하게되었어요,했어요,그랬답니다,그랬어요,합니다,그랬어요,그랬답니다,그랬답니다,그러합니다,좋아요,좋습니다,됬어요,되었어요,되었답니다,되었구요,되었어요,되네요,하네요,해요,할거예요,할수었이요,입니다,인데요,이예요,이랍니다,이였어요,그랬어요,그랬거든요,그랬습니다,었어요,었습니다,있었어요'.split(',')
1366
- # for page in 3..8
1367
- # @driver.get('https://www.google.com/search?q='+q.to_s+'&start='+(page*10).to_s)
1368
- # noko = Nokogiri::HTML(@driver.page_source)
1369
- # for n in 1..15
1370
- # tt2 = noko.xpath('//*[@id="rso"]/div['+n.to_s+']/div/div/div[2]/div').text
1371
- # if tt2.length < 5
1372
-
1373
- # else
1374
- # tt2 = tt2.split('...').join('')+aa3.sample
1375
- # tt += tt2
1376
- # end
1377
- # end
1378
- # end
1379
- # @driver.close
1380
- # tt = tt.split(' ').shuffle.join(' ')[0..1000]
1381
- # m = Array.new
1382
- # for n in 0..19
1383
- # m << tt[(n*100)..(n*100+100)]
1384
- # end
1385
- # return m.join("\n")
1386
- # end
1506
+
1387
1507
 
1388
1508
  def get_naver_text(q)
1389
1509
  begin
1390
- Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1391
- @driver = Selenium::WebDriver.for :chrome
1510
+ options = Selenium::WebDriver::Chrome::Options.new
1511
+ # :capabilities에 options를 배열로 전달
1512
+ capabilities = [options]
1513
+
1514
+ # Selenium WebDriver에서 options를 capabilities로 전달
1515
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
1392
1516
  rescue
1393
- @driver = Selenium::WebDriver.for :chrome
1517
+ options = Selenium::WebDriver::Chrome::Options.new
1518
+ # :capabilities에 options를 배열로 전달
1519
+ capabilities = [options]
1520
+
1521
+ # Selenium WebDriver에서 options를 capabilities로 전달
1522
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
1394
1523
  end
1395
1524
  @driver.get('https://search.naver.com/search.naver?display=15&f=&filetype=0&page=3&query='+q.to_s+'&research_url=&sm=tab_pge&start=16&where=web')
1396
1525
  noko = Nokogiri::HTML(@driver.page_source)
@@ -1420,10 +1549,19 @@ class Wordpress
1420
1549
 
1421
1550
  def get_naver_text2(keyword)
1422
1551
  begin
1423
- Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1424
- @driver = Selenium::WebDriver.for :chrome
1552
+ options = Selenium::WebDriver::Chrome::Options.new
1553
+ # :capabilities에 options를 배열로 전달
1554
+ capabilities = [options]
1555
+
1556
+ # Selenium WebDriver에서 options를 capabilities로 전달
1557
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
1425
1558
  rescue
1426
- @driver = Selenium::WebDriver.for :chrome
1559
+ options = Selenium::WebDriver::Chrome::Options.new
1560
+ # :capabilities에 options를 배열로 전달
1561
+ capabilities = [options]
1562
+
1563
+ # Selenium WebDriver에서 options를 capabilities로 전달
1564
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
1427
1565
  end
1428
1566
  @driver.get('https://search.naver.com/search.naver?ssc=tab.blog.all&sm=tab_jum&query='+keyword.to_s)
1429
1567
  for n3 in 1..10
@@ -1466,10 +1604,18 @@ class Wordpress
1466
1604
  @user_pw = user_pw
1467
1605
  @captcha_api_key = captcha_api_key
1468
1606
  begin
1469
- Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1470
- @driver = Selenium::WebDriver.for :chrome
1607
+ options = Selenium::WebDriver::Chrome::Options.new
1608
+ # :capabilities에 options를 배열로 전달
1609
+ capabilities = [options]
1610
+
1611
+ # Selenium WebDriver에서 options를 capabilities로 전달
1612
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
1471
1613
  rescue
1472
- @driver = Selenium::WebDriver.for :chrome
1614
+ # :capabilities에 options를 배열로 전달
1615
+ capabilities = [options]
1616
+
1617
+ # Selenium WebDriver에서 options를 capabilities로 전달
1618
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
1473
1619
  end
1474
1620
  end
1475
1621
 
@@ -1706,7 +1852,7 @@ class Wordpress
1706
1852
 
1707
1853
  while true
1708
1854
  for n in 0..@data['table'].length-1
1709
- @data['table'][n][10] = 0
1855
+ @data['table'][n][8] = 0
1710
1856
  end
1711
1857
 
1712
1858
  while true
@@ -1740,10 +1886,10 @@ class Wordpress
1740
1886
 
1741
1887
  option['proxy'] = ''
1742
1888
  if @data['포스트설정']['프록시'].checked?
1743
- if table[6].to_s.include?('ex)') or table[6].to_i == 0
1889
+ if table[5].to_s.include?('ex)') or table[5].to_i == 0
1744
1890
  option['proxy'] = @data['포스트설정']['프록시리스트'].sample.to_s
1745
1891
  else
1746
- option['proxy'] = table[6].to_s.force_encoding('utf-8').to_s
1892
+ option['proxy'] = table[5].to_s.force_encoding('utf-8').to_s
1747
1893
  end
1748
1894
  end
1749
1895
 
@@ -1751,10 +1897,10 @@ class Wordpress
1751
1897
 
1752
1898
 
1753
1899
 
1754
- puts table[7]
1755
- puts table[10]
1900
+ puts table[6]
1901
+ puts table[8]
1756
1902
 
1757
- if table[7].to_i > table[10].to_i
1903
+ if table[6].to_i > table[8].to_i
1758
1904
  if @data['포스트설정']['테더링'].checked?
1759
1905
  puts 'tedering ip change...'
1760
1906
  stdout, stderr, status = Open3.capture3('./adb devices')
@@ -2317,7 +2463,6 @@ class Wordpress
2317
2463
  end
2318
2464
  end
2319
2465
 
2320
-
2321
2466
  @data['table'][index][-1] = 70
2322
2467
  @data['table'] << []
2323
2468
  @data['table'].pop
@@ -2534,27 +2679,27 @@ class Wordpress
2534
2679
 
2535
2680
 
2536
2681
  if @data['포스트설정']['전체공개'].checked?
2537
- option['전체공개'] = 'false'
2538
- else
2539
2682
  option['전체공개'] = 'true'
2683
+ else
2684
+ option['전체공개'] = 'false'
2540
2685
  end
2541
2686
 
2542
2687
  if @data['포스트설정']['비공개'].checked?
2543
- option['비공개'] = 'false'
2544
- else
2545
2688
  option['비공개'] = 'true'
2689
+ else
2690
+ option['비공개'] = 'false'
2546
2691
  end
2547
2692
 
2548
2693
  if @data['포스트설정']['댓글허용'].checked?
2549
- option['댓글허용'] = 'false'
2550
- else
2551
2694
  option['댓글허용'] = 'true'
2695
+ else
2696
+ option['댓글허용'] = 'false'
2552
2697
  end
2553
2698
 
2554
2699
  if @data['포스트설정']['댓글 비 허용'].checked?
2555
- option['댓글 비 허용'] = 'false'
2556
- else
2557
2700
  option['댓글 비 허용'] = 'true'
2701
+ else
2702
+ option['댓글 비 허용'] = 'false'
2558
2703
  end
2559
2704
 
2560
2705
 
@@ -2563,42 +2708,55 @@ class Wordpress
2563
2708
  end
2564
2709
 
2565
2710
  if @data['포스트설정']['중앙정렬'].checked?
2566
- option['중앙정렬'] = 'false'
2567
- else
2568
2711
  option['중앙정렬'] = 'true'
2712
+ else
2713
+ option['중앙정렬'] = 'false'
2569
2714
  end
2570
2715
 
2571
2716
  if @data['포스트설정']['우측정렬'].checked?
2572
- option['우측정렬'] = 'false'
2573
- else
2574
2717
  option['우측정렬'] = 'true'
2718
+ else
2719
+ option['우측정렬'] = 'false'
2575
2720
  end
2576
2721
 
2577
2722
  if @data['포스트설정']['좌측정렬'].checked?
2723
+ option['좌측정렬'] = 'true'
2724
+ else
2578
2725
  option['좌측정렬'] = 'false'
2726
+ end
2727
+
2728
+ if @data['포스트설정']['글발생하기'].checked?
2729
+ option['글발생하기'] = 'true'
2579
2730
  else
2580
- option['좌측정렬'] = 'true'
2731
+ option['글발생하기'] = 'false'
2732
+ end
2733
+
2734
+ if @data['포스트설정']['글임시저장'].checked?
2735
+ option['글임시저장'] = 'true'
2736
+ else
2737
+ option['글임시저장'] = 'false'
2581
2738
  end
2582
2739
 
2740
+
2583
2741
  @data['table'][index][-1] = 90
2584
2742
  @data['table'] << []
2585
2743
  @data['table'].pop
2586
2744
 
2587
2745
  p option
2588
2746
 
2589
- dd_time = @data['table'][index][9].to_s.force_encoding('utf-8').to_i
2747
+ #dd_time = @data['table'][index][8].to_s.force_encoding('utf-8').to_i
2590
2748
  url = @data['table'][index][3].to_s.force_encoding('utf-8')
2591
2749
  captcha_api_key = @data['포스트설정']['captcha_api_key'].text.to_s.force_encoding('utf-8')
2592
2750
 
2593
2751
 
2594
2752
  puts 'start...'
2595
- naver.update(title,content,option, dd_time, url, keyword, captcha_api_key)
2753
+ naver.update(title,content,option, url, keyword, captcha_api_key)#dd_time
2596
2754
 
2597
- @data['table'][index][10] = @data['table'][index][10].to_i + 1
2755
+ @data['table'][index][8] = @data['table'][index][8].to_i + 1
2598
2756
  @data['table'][index][-1] = 100
2599
2757
  @data['table'] << []
2600
2758
  @data['table'].pop
2601
- sleep(@data['table'][index][8].to_i)
2759
+ sleep(@data['table'][index][7].to_i)
2602
2760
  end
2603
2761
  rescue => e
2604
2762
  puts e
@@ -2951,8 +3109,8 @@ class Wordpress
2951
3109
 
2952
3110
  button('등록'){
2953
3111
  on_clicked {
2954
- @data['table'] << [false, @data['site_id_input'].text, @data['site_pw_input'].text,@data['게시판url'].text,@data['category'].text, @data['proxy'].text, 1, 1, 1, 0,0]
2955
- @data['table'] << [false, @data['site_id_input'].text, @data['site_pw_input'].text,@data['게시판url'].text,@data['category'].text, @data['proxy'].text, 1, 1, 1, 0,0]
3112
+ @data['table'] << [false, @data['site_id_input'].text, @data['site_pw_input'].text,@data['게시판url'].text,@data['category'].text, @data['proxy'].text, 1, 1, 0,0]
3113
+ @data['table'] << [false, @data['site_id_input'].text, @data['site_pw_input'].text,@data['게시판url'].text,@data['category'].text, @data['proxy'].text, 1, 1, 0,0]
2956
3114
  @data['table'].pop
2957
3115
  }
2958
3116
  }
@@ -2964,8 +3122,8 @@ class Wordpress
2964
3122
  file_data.split("\n").each do |i|
2965
3123
  i3 = i.to_s.force_encoding('utf-8').to_s
2966
3124
  i2 = i3.split(',')
2967
- @data['table'] << [false, i2[0].to_s, i2[1].to_s,i2[2].to_s,i2[3].to_s,i2[4].to_s,1,1,1,0,0]
2968
- @data['table'] << [false, i2[0].to_s, i2[1].to_s,1,1,1,0,0]
3125
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s,i2[2].to_s,i2[3].to_s,i2[4].to_s,1,1,0,0]
3126
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s,1,1,0,0]
2969
3127
  @data['table'].pop
2970
3128
  end
2971
3129
  end
@@ -3027,9 +3185,9 @@ class Wordpress
3027
3185
  text_column('다음 작업 딜레이'){
3028
3186
  editable true
3029
3187
  }
3030
- text_column('등록 버튼 딜레이'){
3031
- editable true
3032
- }
3188
+ # text_column('등록 버튼 딜레이'){
3189
+ # editable true
3190
+ # }
3033
3191
  text_column('시도 횟수'){
3034
3192
 
3035
3193
  }
@@ -3041,6 +3199,7 @@ class Wordpress
3041
3199
 
3042
3200
  horizontal_box{
3043
3201
  stretchy false
3202
+
3044
3203
  @data['포스트설정']['captcha_api_key'] = entry(){
3045
3204
  text 'captcha_api_key 입력'
3046
3205
  }
@@ -3051,9 +3210,9 @@ class Wordpress
3051
3210
  @data['table_delay_input'] = entry{
3052
3211
  text '딜레이 ex) 3'
3053
3212
  }
3054
- @data['table_delay_input2'] = entry{
3055
- text '등록전딜레이'
3056
- }
3213
+ #@data['table_delay_input2'] = entry{
3214
+ # text '등록전딜레이'
3215
+ #}
3057
3216
 
3058
3217
  button('전체설정'){
3059
3218
  on_clicked{
@@ -3061,7 +3220,7 @@ class Wordpress
3061
3220
 
3062
3221
  @data['table'][n][6] = @data['table_counter_input'].text.to_i
3063
3222
  @data['table'][n][7] = @data['table_delay_input'].text.to_i
3064
- @data['table'][n][8] = @data['table_delay_input2'].text.to_i
3223
+ #@data['table'][n][8] = @data['table_delay_input2'].text.to_i
3065
3224
  @data['table'] << []
3066
3225
  @data['table'].pop
3067
3226
  end
@@ -3931,13 +4090,13 @@ class Wordpress
3931
4090
  @data['포스트설정']['내용을자동생성'] = checkbox('키워드기반 생성으로만 등록(GPT 미 사용시 자체 생성)'){
3932
4091
  top 9
3933
4092
  left 0
3934
- on_toggled{
3935
- if @data['포스트설정']['내용을자동생성'].checked?
3936
- @data['포스트설정']['내용과자동생성'].checked = false
3937
- @data['포스트설정']['내용투명'].checked = false
3938
- @data['포스트설정']['자동글 수식에 입력'].checked = false
3939
-
3940
- end
4093
+ on_toggled {
4094
+ if @data['포스트설정']['내용을자동생성'].checked?
4095
+ @data['포스트설정']['내용과자동생성'].checked = false
4096
+ @data['포스트설정']['내용투명'].checked = false
4097
+ @data['포스트설정']['내용투명'].enabled = false # 비활성화
4098
+
4099
+ end
3941
4100
  }
3942
4101
  }
3943
4102
 
@@ -3950,13 +4109,12 @@ class Wordpress
3950
4109
  if @data['포스트설정']['내용과자동생성'].checked?
3951
4110
  @data['포스트설정']['내용을자동생성'].checked = false
3952
4111
  @data['포스트설정']['내용투명'].enabled = true # '내용투명' 활성화
3953
- @data['포스트설정']['자동글 수식에 입력'].enabled = true # '내용투명' 활성화
4112
+
3954
4113
  else
3955
4114
  @data['포스트설정']['내용투명'].checked = false # 체크 해제
3956
4115
  @data['포스트설정']['내용투명'].enabled = false # 비활성화
3957
- @data['포스트설정']['자동글 수식에 입력'].checked = false # 체크 해제
3958
- @data['포스트설정']['자동글 수식에 입력'].enabled = false # 비활성화
3959
- end
4116
+
4117
+ end
3960
4118
  }
3961
4119
  }
3962
4120
 
@@ -3967,7 +4125,7 @@ class Wordpress
3967
4125
  on_toggled {
3968
4126
  if @data['포스트설정']['내용투명'].checked?
3969
4127
  @data['포스트설정']['내용을자동생성'].checked = false
3970
- @data['포스트설정']['자동글 수식에 입력'].checked = false
4128
+
3971
4129
  end
3972
4130
  }
3973
4131
  }
@@ -4432,7 +4590,6 @@ class Wordpress
4432
4590
  }
4433
4591
  }
4434
4592
 
4435
-
4436
4593
 
4437
4594
 
4438
4595
  horizontal_box{
@@ -4440,6 +4597,31 @@ class Wordpress
4440
4597
  @data['무한반복'] = checkbox('무한반복'){
4441
4598
  stretchy false
4442
4599
  }
4600
+
4601
+
4602
+
4603
+ @data['포스트설정']['글발생하기'] = checkbox('글 발행하기'){
4604
+ stretchy false
4605
+ on_toggled{
4606
+ if @data['포스트설정']['글발생하기'].checked? == true
4607
+ if @data['포스트설정']['글임시저장'].checked?
4608
+ @data['포스트설정']['글임시저장'].checked = false
4609
+ end
4610
+ end
4611
+ }
4612
+ }
4613
+ @data['포스트설정']['글임시저장'] = checkbox('글 임시저장'){
4614
+ stretchy false
4615
+ on_toggled{
4616
+ if @data['포스트설정']['글임시저장'].checked? == true
4617
+ if @data['포스트설정']['글발생하기'].checked?
4618
+ @data['포스트설정']['글발생하기'].checked = false
4619
+ end
4620
+ end
4621
+ }
4622
+ }
4623
+
4624
+
4443
4625
  button('작업시작'){
4444
4626
  on_clicked{
4445
4627
  if @user_login_ok == 1
@@ -4480,7 +4662,7 @@ class Wordpress
4480
4662
  @data['포스트설정']['중앙정렬'].checked = true
4481
4663
  @data['포스트설정']['전체공개'].checked = true
4482
4664
  @data['포스트설정']['댓글허용'].checked = true
4483
-
4665
+ @data['포스트설정']['글발생하기'].checked = true
4484
4666
 
4485
4667
  }.show
4486
4668
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tblog_duopack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-20 00:00:00.000000000 Z
11
+ date: 2025-01-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com