tblog_duopack 0.0.3 → 0.0.7

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 +554 -432
  3. metadata +2 -2
data/lib/tblog_duopack.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  require 'glimmer-dsl-libui'
3
2
  require 'selenium-webdriver'
4
3
  # require 'webdrivers'
@@ -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,109 @@ 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
+ # 드라이버 실행
253
+ @driver = Selenium::WebDriver.for(:chrome, options: options)
254
+
255
+ # 첫 번째 탭에서 확장 프로그램을 로드
256
+ #@driver.get("chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html")
270
257
 
271
- google_key = URI.parse(iframe_src).query.split("&").map { |param| param.split("=") }.to_h["k"]
258
+ sleep(1)
259
+ # 두 번째 탭에서 로그인 페이지 열기
260
+ @driver.get('https://www.tistory.com/auth/login')
261
+ sleep(1)
262
+
263
+ rescue => e
272
264
 
273
- raise "reCAPTCHA site key를 iframe에서 찾을 수 없습니다." if google_key.nil?
265
+ puts "Error: #{e.message}"
266
+ puts 'Using default Chrome driver without proxy'
267
+ @driver = Selenium::WebDriver.for(:chrome, options: options)
274
268
 
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"]
288
-
289
- # CAPTCHA 해결을 기다립니다.
290
- wait = Selenium::WebDriver::Wait.new(:timeout => 30)
291
- result = nil
292
-
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
269
+ # 번째 탭에서 확장 프로그램을 로드
270
+ #@driver.get("chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html")
271
+ sleep(1)
272
+ # 두 번째 탭에서 로그인 페이지 열기
273
+ @driver.get('https://www.tistory.com/auth/login')
274
+ sleep(1)
304
275
  end
305
-
306
-
307
-
276
+ end
277
+
308
278
  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
279
+ chrome_start(proxy)
280
+ @captcha_api_key = captcha_api_key
281
+ @user_id = user_id
282
+
283
+ user_cookie_file = []
284
+ begin
285
+ Dir.entries('./cookie').each do |i|
286
+ if i != '.' && i != '..'
287
+ user_cookie_file << i
288
+ end
328
289
  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
290
+ rescue
291
+ end
292
+
293
+ @cookie4 = {}
294
+ if user_cookie_file.include?(user_id+'.txt')
295
+ f = File.open('./cookie/'+user_id+'.txt', 'r')
296
+ @cookie4 = JSON.parse(f.read)
297
+ f.close
298
+ end
299
+
300
+ # 기존 쿠키가 있으면 쿠키를 추가
301
+ begin
302
+ @cookie4.each do |i|
303
+ @driver.manage.add_cookie(name: i['name'], value: i['value'], same_site: i['same_site'], domain: i['domain'], path: i['path'])
336
304
  end
337
-
338
- @driver.get('https://www.tistory.com/auth/login')
305
+ rescue
306
+ end
307
+
308
+ @driver.switch_to.window(@driver.window_handles.last)
309
+ sleep(1.5)
310
+ @driver.get('https://www.tistory.com/auth/login')
311
+
339
312
  sleep(1)
340
313
  begin
341
314
  wait = Selenium::WebDriver::Wait.new(:timeout => 3)
@@ -364,72 +337,75 @@ class Naver
364
337
  puts '-[√] 2 비밀번호 입력.......'.yellow
365
338
 
366
339
  wait = Selenium::WebDriver::Wait.new(:timeout => 3)
367
- wait.until { @driver.find_element(:xpath, '//*[@type="submit"]') }
340
+ wait.until { @driver.find_element(:xpath, '//*[@class="btn_g highlight submit"]') }
368
341
  @driver.find_element(:xpath, '//*[@type="submit"]').click
369
342
  puts '-[√] 3 로그인 버튼 클릭.......'.yellow
370
-
371
- #예외 변수
343
+
344
+ #캡챠 해제시
372
345
  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
- }
346
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
347
+ wait.until { @driver.find_element(:xpath, '//*[@id="captchaContainer"]') }
348
+ puts '-[√] 로그인 중 캡챠 요구 발생 처리 진행.......'.yellow
379
349
  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
350
+ @driver.switch_to.window(@driver.window_handles[0])
351
+ sleep(1)
352
+ @driver.find_element(:xpath, '//*[@name="apiKey"]').click
353
+ Clipboard.copy(captcha_api_key)
354
+ sleep(0.5)
355
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
356
+ sleep(0.5)
357
+ @driver.find_element(:xpath, '//*[@data-lang="login"]').click
358
+
359
+ begin
360
+ sleep(2)
361
+ @driver.switch_to.alert.dismiss
362
+ sleep(1)
363
+ rescue
364
+
418
365
  end
419
-
420
- rescue Selenium::WebDriver::Error::NoSuchElementError => e
421
- puts 'CAPTCHA 없음, 로그인 진행 중...'.cyan
422
- rescue => e
423
- puts "로그인 처리 중 오류 발생: #{e.message}".red
424
- end
425
366
 
367
+ # 두 번째 탭으로 전환
368
+ @driver.switch_to.window(@driver.window_handles[1])
369
+
370
+ begin
371
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
372
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
373
+ @driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
374
+ puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
375
+ sleep(10)
376
+
377
+ begin
378
+ @driver.find_element(:xpath, '//*[@data-state="error"]').click
379
+ puts '-[√] 1 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
380
+ puts '-[√] 2 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
381
+ sleep(1)
382
+ @driver.quit
383
+ rescue
384
+ # 타임아웃을 77초로 설정
385
+ wait = Selenium::WebDriver::Wait.new(:timeout => 100)
386
+ # 요소가 나타날 때까지 100초 동안 기다립니다.
387
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="solved"]') }
388
+ sleep(1)
389
+ @driver.find_element(:xpath, '//*[@data-state="solved"]').click
390
+ puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
391
+ sleep(3)
392
+ @driver.find_element(:xpath, '//*[@id="password--2"]').click #비번 클릭
393
+ sleep(1)
394
+ @driver.action.send_keys(:enter).perform #엔터키 주기
395
+ end
396
+
397
+ rescue
398
+ end
399
+
400
+ rescue
401
+ end
426
402
 
427
403
 
428
404
  # 아이디/비밀번호 오류 처리 부분
429
405
  begin
430
406
  @driver.find_element(:xpath, '//*[@class="desc_error"]')
431
407
  sleep(1)
432
- @driver.close
408
+ @driver.quit
433
409
  puts 'error = 아이디/비밀번호 오류'.yellow
434
410
  rescue
435
411
  end
@@ -459,10 +435,19 @@ class Naver
459
435
  begin
460
436
  @driver.find_element(:xpath, '//*[@class="inner_error inner_error_type2"]')
461
437
  puts 'error = 평소와 다른 로그인이 감지되어 추가 인증이 필요합니다.'.yellow
462
- sleep(1)
463
- @driver.close
438
+ @driver.quit
464
439
  rescue
465
440
  end
441
+
442
+ #최종 로그인 실패시
443
+ begin
444
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5)
445
+ wait.until { @driver.find_element(:xpath, '//*[@class="my_tistory border_box"]') }
446
+ rescue => e
447
+ puts '-[√] 로그인 실패.......'.red
448
+ @driver.quit
449
+ return 0
450
+ end
466
451
 
467
452
  end
468
453
 
@@ -486,23 +471,28 @@ class Naver
486
471
 
487
472
 
488
473
 
489
- def update(title, content, option, dd_time, url, keyword, captcha_api_key)
474
+ def update(title, content, option, url, keyword, captcha_api_key)#dd_time
490
475
  puts 'start...'.yellow
491
476
  puts(url)
492
477
  sleep(1)
493
478
  @driver.get(url)
494
- sleep(5)
495
-
479
+ sleep(2)
480
+
496
481
 
497
482
 
498
483
  begin
484
+ # alert이 뜨기를 기다리기
485
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5) # 10초 대기
486
+ alert = wait.until { @driver.switch_to.alert }
499
487
 
500
- @driver.switch_to.alert.dismiss
501
- rescue
502
-
488
+ # alert 처리 (예: dismiss나 accept)
489
+ alert.dismiss # 또는 alert.accept
490
+ sleep(2)
491
+ rescue
492
+ sleep(1)
503
493
  end
504
494
 
505
- sleep(1)
495
+
506
496
 
507
497
 
508
498
 
@@ -536,7 +526,7 @@ class Naver
536
526
  rescue => e
537
527
  puts '-[√] 카테고리 ERROR 발생.......'.red
538
528
  puts '-[√] 다음 작업이 준비중이니 1~60 초 정도 기다려주세요.......'.green
539
- @driver.close
529
+ @driver.quit
540
530
  return 0
541
531
  end
542
532
 
@@ -552,7 +542,7 @@ class Naver
552
542
  begin
553
543
  @driver.find_element(:xpath, '//*[@id="post-title-inp"]').send_keys(title)
554
544
  rescue => e
555
- @driver.close
545
+ @driver.quit
556
546
  return 0
557
547
  puts '-[√] 페이지 로드(로딩)시간 초과 및 알수없는 오류로 종료.......'.red
558
548
  puts '-[√] 다음 작업이 준비중이니 1~60 초 정도 기다려주세요.......'.green
@@ -571,7 +561,7 @@ class Naver
571
561
  @driver.find_element(:xpath, '//*[@id="mceu_9-button"]').click()
572
562
  @driver.find_element(:xpath, '//*[@id="mceu_9-button"]').click()
573
563
  rescue => e
574
- @driver.close
564
+ @driver.quit
575
565
  return 0
576
566
  puts '-[√] 페이지 로드(로딩)시간 초과 및 알수없는 오류로 종료.......'.red
577
567
  puts '-[√] 다음 작업이 준비중이니 1~60 초 정도 기다려주세요.......'.green
@@ -1072,31 +1062,7 @@ class Naver
1072
1062
  end
1073
1063
 
1074
1064
 
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'
1065
+ if option['중앙정렬'] == 'true'
1100
1066
  puts '-[√] 중앙정렬 선택.......'.yellow
1101
1067
  begin
1102
1068
 
@@ -1110,7 +1076,7 @@ class Naver
1110
1076
  sleep(1.5)
1111
1077
 
1112
1078
 
1113
- if option['좌측정렬'] == 'false'
1079
+ if option['좌측정렬'] == 'true'
1114
1080
  puts '-[√] 좌측정렬 선택.......'.yellow
1115
1081
  begin
1116
1082
  @driver.action.key_down(:control).key_down('a').key_up('a').key_up(:control).perform
@@ -1122,7 +1088,7 @@ class Naver
1122
1088
  sleep(1.5)
1123
1089
 
1124
1090
 
1125
- if option['우측정렬'] == 'false'
1091
+ if option['우측정렬'] == 'true'
1126
1092
  puts '-[√] 우측정렬 선택.......'.yellow
1127
1093
  begin
1128
1094
  @driver.action.key_down(:control).key_down('a').key_up('a').key_up(:control).perform
@@ -1149,104 +1115,284 @@ class Naver
1149
1115
  #태그 입력 항목
1150
1116
 
1151
1117
  sleep(1.5)
1118
+
1119
+ ##################글 발행##################
1152
1120
 
1153
- @driver.find_element(:xpath, '/html/body/div[1]/div/div[2]/div[3]/button').click
1154
- #1차 완료버튼
1155
- sleep(1.5)
1121
+ if option['글발생하기'] == 'true'
1122
+ puts '-[√] 글 발행 선택.......'.yellow
1123
+ begin
1124
+
1125
+
1126
+ @driver.find_element(:xpath, '/html/body/div[1]/div/div[2]/div[3]/button').click
1127
+ #1차 완료버튼
1128
+ sleep(1.5)
1156
1129
 
1157
- # 타임아웃을 10초로 설정
1158
- wait = Selenium::WebDriver::Wait.new(:timeout => 60)
1159
- #요소가 나타날 때까지 60초 동안 기다립니다.
1160
- wait.until { @driver.find_element(:xpath, '//*[@id="open20"]') }
1130
+ # 타임아웃을 10초로 설정
1131
+ wait = Selenium::WebDriver::Wait.new(:timeout => 60)
1132
+ #요소가 나타날 때까지 60초 동안 기다립니다.
1133
+ wait.until { @driver.find_element(:xpath, '//*[@id="open20"]') }
1161
1134
 
1162
1135
 
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
1136
+ if option['전체공개'] == 'true'
1137
+ puts '-[√] 전체공개 선택.......'.yellow
1138
+ begin
1139
+
1140
+ @driver.find_element(:xpath, '//*[@id="open20"]').click
1141
+ sleep(1)
1142
+ rescue
1143
+ end
1144
+ end
1145
+
1146
+
1147
+ if option['비공개'] == 'true'
1148
+ puts '-[√] 비공개 선택.......'.yellow
1149
+ begin
1150
+ @driver.find_element(:xpath, '//*[@id="open0"]').click
1151
+ sleep(1)
1152
+ rescue
1153
+ end
1154
+ end
1172
1155
 
1173
1156
 
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
-
1157
+ if option['댓글허용'] == 'true'
1158
+ puts '-[√] 댓글허용 선택.......'.yellow
1159
+ begin
1160
+
1161
+ @driver.find_element(:xpath, '//*[@class="mce-btn-type1"]').click
1162
+ sleep(2)
1163
+ @driver.find_element(:partial_link_text, '댓글 허용').click
1164
+ sleep(1)
1165
+ rescue
1166
+ end
1167
+ end
1168
+ sleep(2)
1169
+
1170
+ if option['댓글 비 허용'] == 'true'
1171
+ puts '-[√] 댓글 비 허용 선택.......'.yellow
1172
+ begin
1173
+ @driver.find_element(:xpath, '//*[@class="mce-btn-type1"]').click
1174
+ sleep(2)
1175
+ @driver.find_element(:partial_link_text, '댓글 비허용').click
1176
+ sleep(1)
1177
+ rescue
1178
+ end
1179
+ end
1183
1180
 
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)
1181
+
1182
+
1183
+
1184
+
1185
+
1186
+
1187
+
1188
+
1189
+ #캡챠 해제시######################################################################
1190
+ begin
1191
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3.7)
1192
+ wait.until { @driver.find_element(:xpath, '//*[@id="captchaContainer"]') }
1193
+ puts '-[√] 로그인 중 캡챠 요구 발생 처리 진행.......'.yellow
1194
+ sleep(1)
1195
+ @driver.switch_to.window(@driver.window_handles[0])
1196
+ sleep(1)
1197
+ @driver.find_element(:xpath, '//*[@name="apiKey"]').click
1198
+ sleep(0.5)
1199
+ @driver.find_element(:xpath, '//*[@name="apiKey"]').clear
1200
+ sleep(0.5)
1201
+ Clipboard.copy(captcha_api_key)
1202
+ sleep(0.5)
1203
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
1204
+ sleep(0.5)
1205
+ @driver.find_element(:xpath, '//*[@data-lang="login"]').click
1206
+
1207
+ begin
1208
+ sleep(2)
1209
+ @driver.switch_to.alert.dismiss
1210
+ sleep(1)
1211
+ rescue
1212
+
1213
+ end
1214
+
1215
+ # 두 번째 탭으로 전환
1216
+ @driver.switch_to.window(@driver.window_handles[1])
1217
+
1218
+ begin
1219
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
1220
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
1221
+ @driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
1222
+ puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
1223
+ sleep(10)
1224
+
1225
+ begin
1226
+ @driver.find_element(:xpath, '//*[@data-state="error"]').click
1227
+ puts '-[√] 1 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
1228
+ puts '-[√] 2 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
1229
+
1230
+ @driver.quit
1231
+ puts '-[√] 다음 작업을 진행합니다. 약 10~60초 소요 될 수 있습니다.......'.red
1232
+ rescue
1233
+ # 타임아웃을 77초로 설정
1234
+ wait = Selenium::WebDriver::Wait.new(:timeout => 100)
1235
+ # 요소가 나타날 때까지 100초 동안 기다립니다.
1236
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="solved"]') }
1237
+ sleep(1)
1238
+ @driver.find_element(:xpath, '//*[@data-state="solved"]').click
1239
+ puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
1240
+ sleep(1)
1241
+
1242
+ end
1243
+
1244
+ rescue
1245
+ end
1246
+
1247
+ rescue
1248
+ end
1249
+ #캡챠 해제시######################################################################
1250
+
1251
+
1252
+
1253
+
1254
+
1255
+
1256
+ #sleep(dd_time.to_i) # 등록버튼 누르기 전 딜레이
1257
+ # 등록 버튼 클릭
1258
+ @driver.find_element(:xpath, '//*[@id="publish-btn"]').click
1259
+ puts '-[√] 포스트 등록 성공 여부 확인 중.......'.yellow
1260
+ sleep(2)
1261
+ ###########포스트 캡챠해제 팝업 시 재시도 작업 시작▼▼▼▼▼▼▼▼▼▼▼▼
1262
+ begin
1263
+ sleep(1)
1264
+ @driver.switch_to.alert.accept
1265
+ puts '-[√] 캡챠 체크 시간 초과!! 재 등록 시도.......'.green
1266
+ sleep(2)
1267
+ @driver.get(url)
1268
+ puts '-[√] 등록 내용 불러오기 시도.......'.yellow
1269
+ sleep(2)
1270
+ @driver.switch_to.alert.accept
1271
+ sleep(2)
1272
+ puts '-[√] 재 등록 시도 시작.......'.yellow
1273
+ @driver.find_element(:xpath, '//*[@id="publish-layer-btn"]').click
1274
+ sleep(2)
1275
+
1276
+ # 타임아웃을 10초로 설정
1277
+ wait = Selenium::WebDriver::Wait.new(:timeout => 60)
1278
+ #요소가 나타날 때까지 60초 동안 기다립니다.
1279
+ wait.until { @driver.find_element(:xpath, '//*[@id="open20"]') }
1280
+
1281
+ if option['전체공개'] == 'true'
1282
+ puts '-[√] 전체공개 선택.......'.yellow
1283
+ begin
1284
+
1285
+ @driver.find_element(:xpath, '//*[@id="open20"]').click
1286
+ sleep(2)
1287
+ rescue
1288
+ end
1289
+ end
1290
+
1291
+
1292
+ if option['비공개'] == 'true'
1293
+ puts '-[√] 비공개 선택.......'.yellow
1294
+ begin
1295
+ @driver.find_element(:xpath, '//*[@id="open0"]').click
1296
+ sleep(2)
1297
+ rescue
1298
+ end
1299
+ end
1300
+
1301
+
1302
+ if option['댓글허용'] == 'true'
1303
+ puts '-[√] 댓글허용 선택.......'.yellow
1304
+ begin
1305
+
1306
+ @driver.find_element(:xpath, '//*[@class="mce-btn-type1"]').click
1307
+ sleep(2)
1308
+ @driver.find_element(:partial_link_text, '댓글 허용').click
1309
+ sleep(2)
1310
+ rescue
1311
+ end
1312
+ end
1313
+ sleep(2)
1314
+
1315
+ if option['댓글 비 허용'] == 'true'
1316
+ puts '-[√] 댓글 비 허용 선택.......'.yellow
1317
+ begin
1318
+ @driver.find_element(:xpath, '//*[@class="mce-btn-type1"]').click
1319
+ sleep(2)
1320
+ @driver.find_element(:partial_link_text, '댓글 비허용').click
1321
+ sleep(2)
1322
+ rescue
1323
+ end
1324
+ end
1325
+
1326
+ begin
1327
+ sleep(1)
1328
+ puts '-[√] 캡챠 발생 유무 확인.......'.green
1329
+ @driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼 (xpath값에서 data-state="ready를 지목하고자 한다면 //*[@data-state="ready"] 입력)
1330
+ puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
1331
+ sleep(10)
1332
+ begin
1333
+ sleep(1)
1334
+ @driver.find_element(:xpath, '//*[@data-state="error"]').click #캡챠 해제 오류 버튼
1335
+ puts '-[√] 캡챠 해제 에러 발생 !! API번호 및 포인트를 체크해주세요.......'.red
1336
+ sleep(1)
1337
+ puts '-[√] 캡챠 해제 에러 발생 !! API번호 및 포인트를 체크해주세요.......'.red
1338
+ sleep(1)
1339
+ @driver.close
1340
+ puts '-[√] 작업 종료 중........다음 포스팅 작업을 준비 합니다........'.red
1341
+ sleep(1)
1342
+ sleep(dd_time.to_i) #등록버튼 누르기전 딜레이
1343
+ @driver.find_element(:xpath, '//*[@id="publish-btn"]').click #등록완료버튼
1344
+ rescue
1345
+ # 타임아웃을 100초로 설정
1346
+ wait = Selenium::WebDriver::Wait.new(:timeout => 100)
1347
+ # 요소가 나타날 때까지 100초 동안 기다립니다.
1348
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="solved"]') }
1349
+ sleep(2)
1350
+ @driver.find_element(:xpath, '//*[@data-state="solved"]').click #캡챠 해제 완료 버튼
1351
+ puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
1352
+ sleep(3.7)
1353
+ end
1354
+ rescue
1355
+ end
1356
+
1357
+ @driver.find_element(:xpath, '//*[@id="publish-btn"]').click #등록완료버튼
1358
+ puts '-[√] 포스트 등록 성공 여부 확인 중.......'.yellow
1359
+ rescue
1360
+ end
1361
+
1362
+
1363
+
1364
+ # 포스트 등록 완료 확인
1365
+ begin
1366
+ # 포스트 등록 완료를 확인할 수 있는 요소(예: 등록 후 확인 페이지로 이동)
1367
+ wait.until { @driver.find_element(:xpath, '//*[@class="post_cont"]') }
1368
+ puts '-[√] 포스트 등록 완료.......'.yellow
1369
+ sleep(1.5)
1370
+ @driver.quit
1371
+ rescue => e
1372
+ puts '-[×] 포스트 등록 실패!'.red
1373
+ @driver.quit
1374
+ return 0
1375
+ end
1376
+
1192
1377
  rescue
1193
1378
  end
1194
1379
  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)
1380
+
1381
+
1382
+ if option['글임시저장'] == 'true'
1383
+ puts '-[√] 임시 저장 선택.......'.yellow
1384
+ begin
1385
+
1386
+ @driver.find_element(:xpath, '//*[@class="btn btn-draft"]').click
1387
+ sleep(1.5)
1388
+ @driver.quit
1204
1389
  rescue
1205
1390
  end
1206
1391
  end
1207
1392
 
1208
1393
 
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
1394
 
1220
- puts '-[√] 리캡챡 감지됨! 자동 해결 시도...'.yellow
1221
-
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
1395
 
1247
-
1248
- # 브라우저 종료
1249
- @driver.close
1250
1396
 
1251
1397
 
1252
1398
 
@@ -1352,38 +1498,7 @@ class Wordpress
1352
1498
  end
1353
1499
  end
1354
1500
 
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
1501
+
1387
1502
 
1388
1503
  def get_naver_text(q)
1389
1504
  begin
@@ -1706,7 +1821,7 @@ class Wordpress
1706
1821
 
1707
1822
  while true
1708
1823
  for n in 0..@data['table'].length-1
1709
- @data['table'][n][10] = 0
1824
+ @data['table'][n][8] = 0
1710
1825
  end
1711
1826
 
1712
1827
  while true
@@ -1740,10 +1855,10 @@ class Wordpress
1740
1855
 
1741
1856
  option['proxy'] = ''
1742
1857
  if @data['포스트설정']['프록시'].checked?
1743
- if table[6].to_s.include?('ex)') or table[6].to_i == 0
1858
+ if table[5].to_s.include?('ex)') or table[5].to_i == 0
1744
1859
  option['proxy'] = @data['포스트설정']['프록시리스트'].sample.to_s
1745
1860
  else
1746
- option['proxy'] = table[6].to_s.force_encoding('utf-8').to_s
1861
+ option['proxy'] = table[5].to_s.force_encoding('utf-8').to_s
1747
1862
  end
1748
1863
  end
1749
1864
 
@@ -1751,10 +1866,10 @@ class Wordpress
1751
1866
 
1752
1867
 
1753
1868
 
1754
- puts table[7]
1755
- puts table[10]
1869
+ puts table[6]
1870
+ puts table[8]
1756
1871
 
1757
- if table[7].to_i > table[10].to_i
1872
+ if table[6].to_i > table[8].to_i
1758
1873
  if @data['포스트설정']['테더링'].checked?
1759
1874
  puts 'tedering ip change...'
1760
1875
  stdout, stderr, status = Open3.capture3('./adb devices')
@@ -2250,101 +2365,70 @@ class Wordpress
2250
2365
  end
2251
2366
 
2252
2367
  image_thum_ids = Array.new
2253
-
2254
2368
  image_memory = Array.new
2255
-
2369
+
2256
2370
  if @data['포스트설정']['내용사진자동삽입'].checked?
2257
2371
  puts '내용사진자동삽입...'
2372
+
2258
2373
  sn = @data['포스트설정']['내용사진자동삽입시작숫자'].text.to_s.force_encoding('utf-8').to_i
2259
2374
  en = @data['포스트설정']['내용사진자동삽입끝숫자'].text.to_s.force_encoding('utf-8').to_i
2375
+
2260
2376
  begin
2261
2377
  cn = rand(sn..en)
2262
2378
  rescue
2263
2379
  cn = 0
2264
2380
  puts 'cn = rand(sn..en) error cn = 1'
2265
2381
  end
2266
-
2382
+
2267
2383
  if cn != 0
2268
- position = Array.new
2269
- if @data['포스트설정']['내용과자동생성'].checked?
2270
- for n in 1..cn
2271
- position << rand(0..(content.split("(자동생성글)")[1].split("\n").length-1))
2272
- sleep(2)
2273
- end
2274
- position.pop
2275
- else
2276
- for n in 1..cn
2277
- position << rand(0..(content.split("\n").length-2))
2278
- sleep(2)
2279
- end
2280
- end
2281
-
2282
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2283
- content5 = content.split("(자동생성글)")[0].to_s.split("\n")
2284
- content55 = content.split("(자동생성글)")[1].to_s
2285
-
2286
- else
2287
- content55 = ''
2288
- content5 = content.split("(자동생성글)")[0].to_s.split("\n")
2289
- end
2290
-
2291
- p content5
2292
- puts content55
2293
- p position
2294
-
2295
- while true
2296
- check11 = 0
2297
- for nn in 0..position.length-1
2298
- if content5[position[nn]].to_s.include?('style') or content5[position[nn]].to_s.include?('<') or content5[position[nn]].to_s.include?('>')
2299
- check11 = 1
2300
- position[nn] += 4
2301
- end
2302
- end
2303
- if check11 == 0
2304
- break
2384
+ # 내용 분할 (자동 생성 글과 텍스트)
2385
+ content5 = content.split("(자동생성글)")[0].to_s.split("\n")
2386
+ content55 = content.split("(자동생성글)")[1].to_s if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
2387
+
2388
+ # 빈 줄 찾기
2389
+ empty_positions = content5.each_with_index.select { |line, index| line.strip.empty? }.map { |line, index| index }
2390
+
2391
+ # 빈 줄이 부족하면 텍스트 끝에 빈 줄 추가
2392
+ if empty_positions.length < cn
2393
+ # 부족한 빈 줄의 수
2394
+ missing_empty_lines = cn - empty_positions.length
2395
+ missing_empty_lines.times do
2396
+ content5 << "" # 텍스트 마지막에 빈 줄 추가
2305
2397
  end
2398
+ empty_positions = content5.each_with_index.select { |line, index| line.strip.empty? }.map { |line, index| index } # 다시 빈 줄 위치 계산
2306
2399
  end
2307
-
2308
- position = position.sort
2309
-
2310
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2400
+
2401
+ # 이미지 삽입할 위치를 지정 (빈 줄 위치에 삽입)
2402
+ position = empty_positions[0..cn-1]
2403
+
2404
+ # 이미지 URL 가져오기
2405
+ if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
2311
2406
  image_url22 = get_image_file().force_encoding('utf-8')
2312
2407
  end
2313
-
2408
+
2409
+ # 각 위치에 이미지를 하나씩만 삽입
2314
2410
  position.each do |i|
2315
2411
  image_url = get_image_file().force_encoding('utf-8')
2316
- puts image_url
2317
-
2318
- puts '사진넣는위치 => '+i.to_s
2412
+ puts '사진넣는위치 => ' + i.to_s
2413
+
2414
+ # 링크가 있을 경우 링크 포함
2319
2415
  if @data['포스트설정']['내용사진링크'].checked?
2320
- image_memory << ""+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')+'"><img src="'+image_url+'" alt="'+keyword.force_encoding('utf-8')+'"></a>'+""
2321
- content5.insert(i, '**image**')
2416
+ image_memory << "<a href='" + @data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8') + "'><img src='" + image_url + "' alt='" + keyword.force_encoding('utf-8') + "'></a>"
2417
+ content5[i] = '**image**' # 빈 줄에 이미지를 삽입
2322
2418
  else
2323
- image_memory << ""+'<img src="'+image_url+'" alt="'+keyword+'" class="aligncenter size-full">'+""
2324
- content5.insert(i, '**image**')
2419
+ image_memory << "<img src='" + image_url + "' alt='" + keyword + "' class='aligncenter size-full'>"
2420
+ content5[i] = '**image**' # 빈 줄에 이미지를 삽입
2325
2421
  end
2326
2422
  end
2327
-
2328
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2329
- content = content5.join("\n")+'(자동생성글)'+content55
2330
- # iconv = Iconv.new('UTF-8', 'ASCII-8BIT')
2331
- # content = iconv.iconv(content)
2332
- # content = content.encode('UTF-8', 'binary', invalid: :replace, replace: '')
2333
- puts content
2334
- image_url = image_url22
2335
-
2336
- # if @data['포스트설정']['자동글 수식에 입력'].checked?
2337
-
2338
- # else
2339
- # if @data['포스트설정']['내용사진링크'].checked?
2340
- # content = content.split('(자동생성글)')[0]+""+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8')+'"><img src="'+image_url+'" alt="'+keyword+'"></a>'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
2341
- # else
2342
- # content = content.split('(자동생성글)')[0]+""+'<img src="'+image_url+'" alt="'+keyword+'" >'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
2343
- # end
2344
- # end
2423
+
2424
+ # 자동 생성된 내용과 합치기
2425
+ if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
2426
+ content = content5.join("\n") + '(자동생성글)' + content55
2345
2427
  else
2346
2428
  content = content5.join("\n")
2347
2429
  end
2430
+
2431
+ puts content
2348
2432
  end
2349
2433
  end
2350
2434
 
@@ -2564,27 +2648,27 @@ class Wordpress
2564
2648
 
2565
2649
 
2566
2650
  if @data['포스트설정']['전체공개'].checked?
2567
- option['전체공개'] = 'false'
2568
- else
2569
2651
  option['전체공개'] = 'true'
2652
+ else
2653
+ option['전체공개'] = 'false'
2570
2654
  end
2571
2655
 
2572
2656
  if @data['포스트설정']['비공개'].checked?
2573
- option['비공개'] = 'false'
2574
- else
2575
2657
  option['비공개'] = 'true'
2658
+ else
2659
+ option['비공개'] = 'false'
2576
2660
  end
2577
2661
 
2578
2662
  if @data['포스트설정']['댓글허용'].checked?
2579
- option['댓글허용'] = 'false'
2580
- else
2581
2663
  option['댓글허용'] = 'true'
2664
+ else
2665
+ option['댓글허용'] = 'false'
2582
2666
  end
2583
2667
 
2584
2668
  if @data['포스트설정']['댓글 비 허용'].checked?
2585
- option['댓글 비 허용'] = 'false'
2586
- else
2587
2669
  option['댓글 비 허용'] = 'true'
2670
+ else
2671
+ option['댓글 비 허용'] = 'false'
2588
2672
  end
2589
2673
 
2590
2674
 
@@ -2593,42 +2677,55 @@ class Wordpress
2593
2677
  end
2594
2678
 
2595
2679
  if @data['포스트설정']['중앙정렬'].checked?
2596
- option['중앙정렬'] = 'false'
2597
- else
2598
2680
  option['중앙정렬'] = 'true'
2681
+ else
2682
+ option['중앙정렬'] = 'false'
2599
2683
  end
2600
2684
 
2601
2685
  if @data['포스트설정']['우측정렬'].checked?
2602
- option['우측정렬'] = 'false'
2603
- else
2604
2686
  option['우측정렬'] = 'true'
2687
+ else
2688
+ option['우측정렬'] = 'false'
2605
2689
  end
2606
2690
 
2607
2691
  if @data['포스트설정']['좌측정렬'].checked?
2692
+ option['좌측정렬'] = 'true'
2693
+ else
2608
2694
  option['좌측정렬'] = 'false'
2695
+ end
2696
+
2697
+ if @data['포스트설정']['글발생하기'].checked?
2698
+ option['글발생하기'] = 'true'
2609
2699
  else
2610
- option['좌측정렬'] = 'true'
2700
+ option['글발생하기'] = 'false'
2701
+ end
2702
+
2703
+ if @data['포스트설정']['글임시저장'].checked?
2704
+ option['글임시저장'] = 'true'
2705
+ else
2706
+ option['글임시저장'] = 'false'
2611
2707
  end
2612
2708
 
2709
+
2613
2710
  @data['table'][index][-1] = 90
2614
2711
  @data['table'] << []
2615
2712
  @data['table'].pop
2616
2713
 
2617
2714
  p option
2618
2715
 
2619
- dd_time = @data['table'][index][9].to_s.force_encoding('utf-8').to_i
2716
+ #dd_time = @data['table'][index][8].to_s.force_encoding('utf-8').to_i
2620
2717
  url = @data['table'][index][3].to_s.force_encoding('utf-8')
2621
2718
  captcha_api_key = @data['포스트설정']['captcha_api_key'].text.to_s.force_encoding('utf-8')
2622
2719
 
2623
2720
 
2624
2721
  puts 'start...'
2625
- naver.update(title,content,option, dd_time, url, keyword, captcha_api_key)
2722
+ naver.update(title,content,option, url, keyword, captcha_api_key)#dd_time
2626
2723
 
2627
- @data['table'][index][10] = @data['table'][index][10].to_i + 1
2724
+ @data['table'][index][8] = @data['table'][index][8].to_i + 1
2628
2725
  @data['table'][index][-1] = 100
2629
2726
  @data['table'] << []
2630
2727
  @data['table'].pop
2631
- sleep(@data['table'][index][8].to_i)
2728
+ sleep(@data['table'][index][7].to_i)
2632
2729
  end
2633
2730
  rescue => e
2634
2731
  puts e
@@ -2981,8 +3078,8 @@ class Wordpress
2981
3078
 
2982
3079
  button('등록'){
2983
3080
  on_clicked {
2984
- @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]
2985
- @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]
3081
+ @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]
3082
+ @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]
2986
3083
  @data['table'].pop
2987
3084
  }
2988
3085
  }
@@ -2994,8 +3091,8 @@ class Wordpress
2994
3091
  file_data.split("\n").each do |i|
2995
3092
  i3 = i.to_s.force_encoding('utf-8').to_s
2996
3093
  i2 = i3.split(',')
2997
- @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]
2998
- @data['table'] << [false, i2[0].to_s, i2[1].to_s,1,1,1,0,0]
3094
+ @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]
3095
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s,1,1,0,0]
2999
3096
  @data['table'].pop
3000
3097
  end
3001
3098
  end
@@ -3057,9 +3154,9 @@ class Wordpress
3057
3154
  text_column('다음 작업 딜레이'){
3058
3155
  editable true
3059
3156
  }
3060
- text_column('등록 버튼 딜레이'){
3061
- editable true
3062
- }
3157
+ # text_column('등록 버튼 딜레이'){
3158
+ # editable true
3159
+ # }
3063
3160
  text_column('시도 횟수'){
3064
3161
 
3065
3162
  }
@@ -3071,6 +3168,7 @@ class Wordpress
3071
3168
 
3072
3169
  horizontal_box{
3073
3170
  stretchy false
3171
+
3074
3172
  @data['포스트설정']['captcha_api_key'] = entry(){
3075
3173
  text 'captcha_api_key 입력'
3076
3174
  }
@@ -3081,9 +3179,9 @@ class Wordpress
3081
3179
  @data['table_delay_input'] = entry{
3082
3180
  text '딜레이 ex) 3'
3083
3181
  }
3084
- @data['table_delay_input2'] = entry{
3085
- text '등록전딜레이'
3086
- }
3182
+ #@data['table_delay_input2'] = entry{
3183
+ # text '등록전딜레이'
3184
+ #}
3087
3185
 
3088
3186
  button('전체설정'){
3089
3187
  on_clicked{
@@ -3091,7 +3189,7 @@ class Wordpress
3091
3189
 
3092
3190
  @data['table'][n][6] = @data['table_counter_input'].text.to_i
3093
3191
  @data['table'][n][7] = @data['table_delay_input'].text.to_i
3094
- @data['table'][n][8] = @data['table_delay_input2'].text.to_i
3192
+ #@data['table'][n][8] = @data['table_delay_input2'].text.to_i
3095
3193
  @data['table'] << []
3096
3194
  @data['table'].pop
3097
3195
  end
@@ -4462,7 +4560,6 @@ class Wordpress
4462
4560
  }
4463
4561
  }
4464
4562
 
4465
-
4466
4563
 
4467
4564
 
4468
4565
  horizontal_box{
@@ -4470,6 +4567,31 @@ class Wordpress
4470
4567
  @data['무한반복'] = checkbox('무한반복'){
4471
4568
  stretchy false
4472
4569
  }
4570
+
4571
+
4572
+
4573
+ @data['포스트설정']['글발생하기'] = checkbox('글 발행하기'){
4574
+ stretchy false
4575
+ on_toggled{
4576
+ if @data['포스트설정']['글발생하기'].checked? == true
4577
+ if @data['포스트설정']['글임시저장'].checked?
4578
+ @data['포스트설정']['글임시저장'].checked = false
4579
+ end
4580
+ end
4581
+ }
4582
+ }
4583
+ @data['포스트설정']['글임시저장'] = checkbox('글 임시저장'){
4584
+ stretchy false
4585
+ on_toggled{
4586
+ if @data['포스트설정']['글임시저장'].checked? == true
4587
+ if @data['포스트설정']['글발생하기'].checked?
4588
+ @data['포스트설정']['글발생하기'].checked = false
4589
+ end
4590
+ end
4591
+ }
4592
+ }
4593
+
4594
+
4473
4595
  button('작업시작'){
4474
4596
  on_clicked{
4475
4597
  if @user_login_ok == 1
@@ -4510,7 +4632,7 @@ class Wordpress
4510
4632
  @data['포스트설정']['중앙정렬'].checked = true
4511
4633
  @data['포스트설정']['전체공개'].checked = true
4512
4634
  @data['포스트설정']['댓글허용'].checked = true
4513
-
4635
+ @data['포스트설정']['글발생하기'].checked = true
4514
4636
 
4515
4637
  }.show
4516
4638
  end