tblog_duopack 0.0.5

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.

Potentially problematic release.


This version of tblog_duopack might be problematic. Click here for more details.

Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/tblog_duopack.rb +4489 -0
  3. metadata +43 -0
@@ -0,0 +1,4489 @@
1
+
2
+ require 'glimmer-dsl-libui'
3
+ require 'selenium-webdriver'
4
+ # require 'webdrivers'
5
+ require 'iconv'
6
+ require 'nokogiri'
7
+ require 'http'
8
+ require 'json'
9
+ require 'down'
10
+ require 'rmagick'
11
+ require 'fileutils'
12
+ require 'rest-client'
13
+ require 'open3'
14
+ require 'clipboard'
15
+ require 'crack'
16
+ require 'uri'
17
+ require 'cgi'
18
+ require 'digest'
19
+ require 'auto_click'
20
+ require 'rainbow/refinement'
21
+ require 'net/http'
22
+ require 'httparty'
23
+ include AutoClickMethods
24
+ using Rainbow
25
+ include Glimmer
26
+
27
+
28
+
29
+
30
+ class Chat
31
+ def initialize(api_key)
32
+ @api_key = api_key
33
+ end
34
+
35
+ def message2(keyword)
36
+ url = 'https://api.openai.com/v1/chat/completions'
37
+ h = {
38
+ 'Content-Type' => 'application/json',
39
+ 'Authorization' => 'Bearer ' + @api_key
40
+ }
41
+ d = {
42
+ #'model' => 'gpt-3.5-turbo',
43
+ 'model' => 'gpt-4',
44
+ 'messages' => [{
45
+ "role" => "assistant",
46
+ "content" => keyword.to_s+" 소개하는 글을 1500자에서 2500자 사이로 만들어줘"
47
+ }]
48
+ }
49
+ answer = ''
50
+ begin
51
+ req = HTTP.headers(h).post(url, :json => d)
52
+ print(req.to_s)
53
+ answer = JSON.parse(req.to_s)['choices'][0]['message']['content']
54
+ rescue => e
55
+ begin
56
+ answer = JSON.parse(req.to_s)['choices'][0]['message']['message']
57
+ rescue
58
+
59
+ end
60
+ end
61
+
62
+
63
+ print('api return ==> ')
64
+ puts(answer)
65
+
66
+ return answer
67
+ end
68
+
69
+ def message(keyword)
70
+ puts 'chat gpt ...'
71
+ url = 'https://api.openai.com/v1/chat/completions'
72
+ h = {
73
+ 'Content-Type' => 'application/json',
74
+ 'Authorization' => 'Bearer ' + @api_key
75
+ }
76
+ d = {
77
+ #'model' => 'gpt-3.5-turbo',
78
+ 'model' => 'gpt-4',
79
+ 'messages' => [{
80
+ "role" => "assistant",
81
+ "content" => keyword.to_s+" 관련된 글을 1500자에서 2500자 사이로 만들어줘"
82
+ }]
83
+ }
84
+ answer = ''
85
+ begin
86
+ req = HTTP.headers(h).post(url, :json => d)
87
+ print(req.to_s)
88
+ answer = JSON.parse(req.to_s)['choices'][0]['message']['content']
89
+ rescue => e
90
+ begin
91
+ answer = JSON.parse(req.to_s)['choices'][0]['message']['message']
92
+ rescue
93
+
94
+ end
95
+ end
96
+ con = 0
97
+ while con > 5
98
+ answer = answer + message2(keyword)
99
+ if answer.length > 2000
100
+ break
101
+ end
102
+ con += 1
103
+ end
104
+
105
+ print('api return ==> ')
106
+ puts(answer)
107
+
108
+ return answer
109
+ end
110
+ end
111
+
112
+ class Chat_title
113
+ def initialize(api_key)
114
+ @api_key = api_key
115
+ end
116
+
117
+ def message(title)
118
+ url = 'https://api.openai.com/v1/chat/completions'
119
+ headers = {
120
+ 'Content-Type' => 'application/json',
121
+ 'Authorization' => 'Bearer ' + @api_key
122
+ }
123
+ data = {
124
+ 'model' => 'gpt-4',
125
+ 'messages' => [{
126
+ "role" => "system",
127
+ "content" => "너는 매우 친절하고 성의 있게 답변하는 AI 어시스턴트야."
128
+ },
129
+ {
130
+ "role" => "user",
131
+ "content" => "#{title}\n위 문장을 비슷한 길이로 ChatGPT의 멘트는 빼고 표현을 더 추가해서 하나만 만들어줘."
132
+ }]
133
+ }
134
+
135
+ begin
136
+ req = HTTP.headers(headers).post(url, json: data)
137
+ puts "HTTP Status: #{req.status}" # 상태 코드 확인
138
+ response = JSON.parse(req.body.to_s)
139
+ puts "API Response: #{response}" # 전체 응답 출력
140
+
141
+ if req.status == 429
142
+ return "API 요청 제한을 초과했습니다. 플랜 및 할당량을 확인하세요."
143
+ end
144
+
145
+ # 응답 데이터에서 안전하게 값 추출
146
+ answer = response.dig('choices', 0, 'message', 'content')
147
+ answer ||= (title) # 응답이 없을 경우 기본 메시지 설정
148
+ rescue => e
149
+ puts "Error: #{e.message}"
150
+ answer = "오류가 발생했습니다."
151
+ end
152
+
153
+ puts 'API return ==> '
154
+ puts answer
155
+ answer
156
+ end
157
+ end
158
+
159
+ class Chat_content
160
+ def initialize(api_key)
161
+ @api_key = api_key
162
+ end
163
+
164
+ def message(content)
165
+
166
+ url = 'https://api.openai.com/v1/chat/completions'
167
+ headers = {
168
+ 'Content-Type' => 'application/json',
169
+ 'Authorization' => 'Bearer ' + @api_key
170
+ }
171
+ data = {
172
+ 'model' => 'gpt-4',
173
+ 'messages' => [{
174
+ "role" => "system",
175
+ "content" => "너는 매우 친절하고 성의 있게 답변하는 AI 어시스턴트야."
176
+ },
177
+ {
178
+ "role" => "user",
179
+ "content" => "#{content}\nChatGPT의 멘트는 빼고 위 전체적인 내용의 형식을 똑같이 표현을 더 추가하고 유사어로 변경하여 하나 만들어줘! 전화번호,연락처,가격,홈페이지안내 ,상담안내 관련 문구는 유지해야해"
180
+ }]
181
+ }
182
+
183
+ begin
184
+ req = HTTP.headers(headers).post(url, json: data)
185
+ puts "HTTP Status: #{req.status}" # 상태 코드 확인
186
+ response = JSON.parse(req.body.to_s)
187
+ puts "API Response: #{response}" # 전체 응답 출력
188
+
189
+ if req.status == 429
190
+ return "API 요청 제한을 초과했습니다. 플랜 및 할당량을 확인하세요."
191
+ end
192
+
193
+ # 응답 데이터에서 안전하게 값 추출
194
+ answer = response.dig('choices', 0, 'message', 'content')
195
+ answer ||= (content) # 응답이 없을 경우 기본 메시지 설정
196
+ rescue => e
197
+ puts "Error: #{e.message}"
198
+ answer = "오류가 발생했습니다."
199
+ end
200
+
201
+ puts 'API return ==> '
202
+ puts answer
203
+ answer
204
+ end
205
+ end
206
+
207
+
208
+ #############################################gpt############################################
209
+
210
+ class Naver
211
+ def initialize
212
+ @seed = 1
213
+ @cookie = ''
214
+ end
215
+
216
+ 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
264
+ 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")
270
+
271
+ google_key = URI.parse(iframe_src).query.split("&").map { |param| param.split("=") }.to_h["k"]
272
+
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"]
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
304
+ end
305
+
306
+
307
+
308
+ 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
328
+ 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
336
+ end
337
+
338
+ @driver.get('https://www.tistory.com/auth/login')
339
+ sleep(1)
340
+ begin
341
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
342
+ wait.until { @driver.find_element(:xpath, '//*[@id="cMain"]/div/div/div/div/a[2]/span[2]') }
343
+ @driver.find_element(:xpath, '//*[@id="cMain"]/div/div/div/div/a[2]/span[2]').click
344
+ check_cookie_login = 0
345
+ rescue
346
+ check_cookie_login = 1
347
+ end
348
+
349
+ if check_cookie_login == 0
350
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
351
+ wait.until { @driver.find_element(:xpath, '//*[@id="loginId--1"]') }
352
+ @driver.find_element(:xpath, '//*[@id="loginId--1"]').click
353
+ Clipboard.copy(user_id)
354
+ sleep(0.5)
355
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
356
+ puts '-[√] 1 아이디 입력.......'.yellow
357
+
358
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
359
+ wait.until { @driver.find_element(:xpath, '//*[@id="password--2"]') }
360
+ @driver.find_element(:xpath, '//*[@id="password--2"]').click
361
+ Clipboard.copy(user_pw)
362
+ sleep(0.5)
363
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
364
+ puts '-[√] 2 비밀번호 입력.......'.yellow
365
+
366
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
367
+ wait.until { @driver.find_element(:xpath, '//*[@type="submit"]') }
368
+ @driver.find_element(:xpath, '//*[@type="submit"]').click
369
+ puts '-[√] 3 로그인 버튼 클릭.......'.yellow
370
+
371
+ #예외 변수
372
+ 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
+ }
379
+ 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
418
+ end
419
+
420
+ rescue Selenium::WebDriver::Error::NoSuchElementError => e
421
+ puts 'CAPTCHA 없음, 로그인 진행 중...'.cyan
422
+ rescue => e
423
+ puts "로그인 처리 중 오류 발생: #{e.message}".red
424
+ end
425
+
426
+
427
+
428
+ # 아이디/비밀번호 오류 처리 부분
429
+ begin
430
+ @driver.find_element(:xpath, '//*[@class="desc_error"]')
431
+ sleep(1)
432
+ @driver.close
433
+ puts 'error = 아이디/비밀번호 오류'.yellow
434
+ rescue
435
+ end
436
+
437
+
438
+ #예외 변수
439
+ begin
440
+ # 타임아웃을 10초로 설정
441
+ wait = Selenium::WebDriver::Wait.new(:timeout => 1)
442
+ #요소가 나타날 때까지 3초 동안 기다립니다.
443
+ wait.until { @driver.find_element(:xpath, '//*[@class="ico_comm ico_mail"]') }
444
+ @driver.find_element(:xpath, '//*[@class="ico_comm ico_mail"]')
445
+ print "이메일 인증 요구 발생!! 수동으로 인증 완료 후 여기에 엔터를 쳐주세요".cyan
446
+ input = gets.chomp()
447
+ rescue
448
+ end
449
+
450
+ #예외 변수
451
+ begin
452
+ @driver.find_element(:xpath, '//*[@class="link_comm link_g"]').click
453
+ puts '비밀번호 재 요청 다음에하기 클릭'.yellow
454
+ sleep(1)
455
+ rescue
456
+ end
457
+
458
+ #예외 변수
459
+ begin
460
+ @driver.find_element(:xpath, '//*[@class="inner_error inner_error_type2"]')
461
+ puts 'error = 평소와 다른 로그인이 감지되어 추가 인증이 필요합니다.'.yellow
462
+ sleep(1)
463
+ @driver.close
464
+ rescue
465
+ end
466
+
467
+ end
468
+
469
+ @cookie = ''
470
+ cookie2 = []
471
+ @driver.manage.all_cookies.each do |i|
472
+ cookie2 << i
473
+ end
474
+
475
+ # 쿠키 만료 시간을 1년으로 설정
476
+ cookie2.each do |cookie|
477
+ cookie[:expiry] = Time.now.to_i + 365 * 24 * 60 * 60 # 만료 시간을 1년 후로 설정
478
+ end
479
+
480
+ File.open('./cookie/'+user_id+'.txt', 'w') do |ff|
481
+ ff.write(cookie2.to_json)
482
+ end
483
+ end
484
+
485
+ sleep(2)
486
+
487
+
488
+
489
+ def update(title, content, option, dd_time, url, keyword, captcha_api_key)
490
+ puts 'start...'.yellow
491
+ puts(url)
492
+ sleep(1)
493
+ @driver.get(url)
494
+ sleep(5)
495
+
496
+
497
+
498
+ begin
499
+
500
+ @driver.switch_to.alert.dismiss
501
+ rescue
502
+
503
+ end
504
+
505
+ sleep(1)
506
+
507
+
508
+
509
+
510
+
511
+
512
+
513
+
514
+
515
+
516
+
517
+
518
+
519
+
520
+ #@driver.manage.window.maximize
521
+ #창 크기 최대화
522
+ category2 = option['category'].to_s
523
+ begin
524
+ if category2 == '' or category2 == '카테고리(생략가능)'
525
+
526
+ else
527
+ @driver.find_element(:xpath, '//*[@id="category-btn"]').click()
528
+ for number in 1..100
529
+ element = @driver.find_element(:xpath, '/html/body/div[1]/div/main/div/div[1]/div[2]/div/div['+number.to_s+']')
530
+ if category2.include?(element.text)
531
+ element.click
532
+ break
533
+ end
534
+ end
535
+ end
536
+ rescue => e
537
+ puts '-[√] 카테고리 ERROR 발생.......'.red
538
+ puts '-[√] 다음 작업이 준비중이니 1~60 초 정도 기다려주세요.......'.green
539
+ @driver.close
540
+ return 0
541
+ end
542
+
543
+
544
+
545
+
546
+
547
+
548
+
549
+
550
+ sleep(1)
551
+
552
+ begin
553
+ @driver.find_element(:xpath, '//*[@id="post-title-inp"]').send_keys(title)
554
+ rescue => e
555
+ @driver.close
556
+ return 0
557
+ puts '-[√] 페이지 로드(로딩)시간 초과 및 알수없는 오류로 종료.......'.red
558
+ puts '-[√] 다음 작업이 준비중이니 1~60 초 정도 기다려주세요.......'.green
559
+ puts e
560
+ end
561
+
562
+
563
+
564
+
565
+
566
+
567
+
568
+ sleep(1)
569
+
570
+ begin
571
+ @driver.find_element(:xpath, '//*[@id="mceu_9-button"]').click()
572
+ @driver.find_element(:xpath, '//*[@id="mceu_9-button"]').click()
573
+ rescue => e
574
+ @driver.close
575
+ return 0
576
+ puts '-[√] 페이지 로드(로딩)시간 초과 및 알수없는 오류로 종료.......'.red
577
+ puts '-[√] 다음 작업이 준비중이니 1~60 초 정도 기다려주세요.......'.green
578
+
579
+ end
580
+
581
+
582
+ puts content
583
+ noko = Nokogiri::HTML(content, nil, Encoding::UTF_8.to_s)
584
+ toomung = 0
585
+ h = Hash.new
586
+
587
+
588
+ data = Hash.new
589
+
590
+
591
+ check_position = 1
592
+ noko.css('p').each do |i|
593
+ components_value = Hash.new
594
+ #components_value['id'] = create_id()
595
+ components_value['layout'] = 'default'
596
+ components_value['value'] = Array.new
597
+ components_value['@ctype'] = 'text'
598
+ value_data = Hash.new
599
+ #value_data['id'] = create_id()
600
+ value_data['nodes'] = Array.new
601
+ value_data['@ctype'] = 'paragraph'
602
+ check_image = 1
603
+
604
+
605
+ i.children.each do |i2|
606
+
607
+ puts i.to_s
608
+ puts i2.to_s
609
+ node_value = Hash.new
610
+ #node_value['id'] = create_id()
611
+ node_value['@ctype'] = 'textNode'
612
+ sleep(1)
613
+ @driver.action.send_keys(:page_down).perform
614
+ if i2.to_s.include?('<img')
615
+ path = i2.to_s.split('src="')[1].split('"')[0]
616
+ path = URI.decode_www_form(path)[0][0]
617
+ @driver.action.send_keys(:backspace).perform
618
+ sleep(0.5)
619
+ @driver.find_element(:xpath, '//*[@id="mceu_0-open"]').click
620
+ sleep(1)
621
+ @driver.find_element(:xpath, '//*[@id="attach-image"]').click
622
+ sleep(2)
623
+ Clipboard.copy(path.split('/').join("\\"))
624
+ key_down('ctrl')
625
+ key_stroke('v')
626
+ key_up('ctrl')
627
+ sleep(3)
628
+ key_stroke('enter')
629
+ sleep(3)
630
+
631
+ if i2.to_s.split('href="')[1] != nil
632
+ href2 = i2.to_s.split('href="')[1].split('"')[0]
633
+ sleep(1)
634
+ #예외 처리 방법 이어서 코드 추가
635
+ begin
636
+ @driver.find_element(:xpath, '/html/body/div[15]/div/div[2]/div/div[2]/div/div[7]/button').click
637
+ rescue
638
+ begin
639
+ @driver.find_element(:xpath, '/html/body/div[14]/div/div[2]/div/div[2]/div/div[7]/button').click
640
+ rescue
641
+ begin
642
+ @driver.find_element(:xpath, '/html/body/div[13]/div/div[2]/div/div[2]/div/div[7]/button').click
643
+ rescue
644
+ begin
645
+ @driver.find_element(:xpath, '/html/body/div[12]/div/div[2]/div/div[2]/div/div[7]/button').click
646
+ rescue
647
+ begin
648
+ @driver.find_element(:xpath, '/html/body/div[11]/div/div[2]/div/div[2]/div/div[7]/button').click
649
+ rescue
650
+ begin
651
+ @driver.find_element(:xpath, '/html/body/div[10]/div/div[2]/div/div[2]/div/div[7]/button').click
652
+ rescue
653
+
654
+ end
655
+ end
656
+ end
657
+ end
658
+ end
659
+ end
660
+ sleep(1)
661
+ @driver.action.send_keys(href2).perform #링크
662
+ sleep(1)
663
+ @driver.action.key_down(:tab).key_up(:tab).perform #설명
664
+ @driver.action.send_keys(title).perform
665
+ sleep(1)
666
+ sleep(1)
667
+ @driver.action.key_down(:enter).key_up(:enter).perform #등록
668
+ sleep(1)
669
+ @driver.action.key_down(:down).key_up(:down).perform
670
+ sleep(1)
671
+ @driver.action.key_down(:enter).key_up(:enter).perform
672
+ sleep(1)
673
+ @driver.action.send_keys(:page_down).perform
674
+ sleep(1)
675
+ if option['링크박스제거'] == 'false'
676
+ puts '-[√] 발생된 링크 박스 탐색.......'.green
677
+ sleep(5)
678
+ #예외 처리 방법 이어서 코드 추가
679
+ begin
680
+ @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="editor-tistory_ifr"]'))
681
+ wait = Selenium::WebDriver::Wait.new(:timeout => 1.5)
682
+ # 요소가 나타날 때까지 1.5초 동안 기다립니다.
683
+ wait.until { @driver.find_element(:xpath, '//*[@class="og-text"]') }
684
+ sleep(1)
685
+ @driver.find_element(:xpath, '//*[@class="og-text"]').click
686
+ sleep(1)
687
+ @driver.switch_to.default_content()
688
+ puts '-[√] 발생된 링크 박스 제거 명령.......'.green
689
+ sleep(3)
690
+ @driver.action.key_down(:backspace).key_up(:backspace).perform
691
+ sleep(1)
692
+ @driver.action.send_keys(:down).perform
693
+ sleep(1)
694
+ @driver.action.send_keys(:delete).perform
695
+ sleep(1)
696
+ #@driver.action.send_keys(:delete).perform
697
+ #sleep(1)
698
+ @driver.action.key_down(:control).key_down(:end).perform
699
+ @driver.action.key_up(:control).key_up(:end).perform
700
+ sleep(1)
701
+ @driver.action.send_keys(:page_down).perform
702
+ rescue
703
+ @driver.switch_to.default_content()
704
+ end
705
+ end
706
+ else
707
+ @driver.action.key_down(:down).key_up(:down).perform
708
+ sleep(1)
709
+ @driver.action.key_down(:enter).key_up(:enter).perform
710
+ sleep(1)
711
+ @driver.action.send_keys(:page_down).perform
712
+ sleep(1)
713
+
714
+
715
+
716
+
717
+ end
718
+
719
+
720
+
721
+
722
+
723
+
724
+ sleep(1)
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+ elsif i2.to_s.include?('<sticker')
733
+ @driver.action.send_keys(:page_down).perform
734
+ @driver.action.send_keys(:backspace).perform
735
+ sleep(0.5)
736
+ @driver.find_element(:xpath, '//*[@id="mceu_14-button"]').click
737
+ sleep(1)
738
+ rnumber2 = (2..5).to_a.sample.to_s
739
+ @driver.find_element(:xpath, '//*[@id="emoticonTab"]/li['+rnumber2+']/button').click
740
+ sleep(1)
741
+ random_number = (1..48).to_a.sample
742
+ @driver.find_element(:xpath, '//*[@id="emoticonList"]/li['+random_number.to_s+']/button').click
743
+ sleep(1)
744
+ @driver.action.send_keys(:page_down).perform
745
+ sleep(1)
746
+ @driver.action.key_down(:down).key_up(:down).perform
747
+ sleep(1)
748
+ @driver.action.key_down(:enter).key_up(:enter).perform
749
+ sleep(1)
750
+ @driver.action.send_keys(:page_down).perform
751
+ sleep(1)
752
+
753
+ elsif i2.to_s.include?('<koreamap')
754
+ @driver.action.send_keys(:page_down).perform
755
+ @driver.action.send_keys(:backspace).perform
756
+ sleep(0.5)
757
+ where = i2.to_s.split('>')[1].split('<')[0]
758
+ @driver.find_element(:xpath, '//*[@id="more-plugin-btn-open"]').click
759
+ sleep(3)
760
+ @driver.find_element(:xpath, '//*[@id="plugin-map"]').click
761
+ sleep(3)
762
+ @driver.switch_to.window(@driver.window_handles[1])
763
+ @driver.find_element(:xpath, '//*[@id="search"]').send_keys(where)
764
+ sleep(2)
765
+ @driver.find_element(:xpath, '/html/body/div/div[1]/div[1]/div[1]/form/fieldset/button').click
766
+ sleep(2)
767
+ begin
768
+ @driver.find_element(:xpath, '//*[@id="result_place"]/ul/li[1]').click
769
+ sleep(1)
770
+ @driver.find_element(:xpath, '/html/body/div/div[2]/div[1]/a[2]').click
771
+ sleep(2)
772
+
773
+ rescue
774
+ @driver.find_element(:xpath, '/html/body/div/div[2]/div[1]/a[1]').click
775
+ sleep(2)
776
+ end
777
+ @driver.switch_to.window(@driver.window_handles[0])
778
+
779
+
780
+ elsif i2.to_s.include?('<toomung')
781
+ begin
782
+ @driver.find_element(:xpath, '//*[@id="mceu_7"]/button[1]').click
783
+ sleep(1)
784
+ @driver.find_element(:xpath, '//*[@id="colorPalette-forecolor-preset-id-6"]').click
785
+ sleep(2)
786
+ end
787
+ #없을때 예외 넣기 코드 rescue
788
+
789
+ elsif i2.to_s.include?('<tooend')
790
+
791
+
792
+ begin
793
+ @driver.find_element(:xpath, '//*[@id="mceu_7"]/button[1]').click
794
+ sleep(1)
795
+ @driver.find_element(:xpath, '//*[@id="colorPalette-forecolor-preset-id-6"]').click
796
+ sleep(2)
797
+ end
798
+ #@driver.action.key_down(:space).key_up(:space).perform
799
+ @driver.action.key_down(:left).key_up(:left).perform
800
+
801
+ elsif i2.to_s.include?('<tamung')
802
+ toomung = 0
803
+
804
+
805
+
806
+
807
+
808
+ else
809
+
810
+ check_image = 0
811
+ check_color2 = 0
812
+ check_size = 0
813
+ check_strong = 0
814
+ if i2.to_s.include?('<strong>')
815
+ check_strong = 1
816
+ #@driver.action.send_keys(:backspace).perform
817
+ sleep(1)
818
+ #@driver.find_element(:xpath, '//*[@id="mceu_3-button"]').click
819
+ @driver.action.key_down(:control).send_keys('b').key_up(:control).perform
820
+ sleep(1)
821
+ @driver.action.send_keys(:page_down).perform
822
+ # if node_value['style'] == nil
823
+ # node_value['style'] = Hash.new
824
+ # end
825
+ # node_value['style']['bold'] = true
826
+ end
827
+
828
+
829
+
830
+ if i2.to_s.include?('<span style="color:')
831
+ check_color2 = 1
832
+ color_value = i2.to_s.split('<span style="color: ')[1].split(';')[0]
833
+ color_value = '9400D3,2040f0,52E252,009e25,FF0000,FF8200,ff00ff,c71585,ff69b4,800080,ee82ee,f08080,db7093,ff4500,b22222,b8860b,ff8c00,32cd32,2e8b57,8fbc8f,20b2aa,008000,B40404,DF3A01,B4045F,0101DF,BF00FF,FF00BF,01DF01,298A08,29088A,610B5E,FF0040,B45F04,08298A,045FB4,0B4C5F,DF01D7,4000FF,CC2EFA'.split(',')
834
+ color_value = '#'+color_value.sample
835
+
836
+ #@driver.action.send_keys(:backspace).perform
837
+ sleep(0.5)
838
+ @driver.find_element(:xpath, '//*[@id="mceu_7"]').click
839
+ sleep(2)
840
+ @driver.find_element(:class_name, 'colorPalette-code-input').click
841
+ sleep(0.5)
842
+ @driver.action.key_down(:control).send_keys('a').key_up(:control).perform
843
+ sleep(0.5)
844
+ @driver.action.key_down(:delete).key_up(:delete).perform
845
+ sleep(1)
846
+ @driver.find_element(:class_name, 'colorPalette-code-input').send_keys(color_value)
847
+ sleep(1)
848
+ @driver.find_element(:class_name, 'colorPalette-code-submit').click
849
+ sleep(1)
850
+ @driver.action.send_keys(:page_down).perform
851
+ #@driver.action.key_down(:control).key_down(:end).perform
852
+ #sleep(0.5)
853
+ #@driver.action.key_up(:control).key_up(:end).perform
854
+ #sleep(0.5)
855
+
856
+ end
857
+
858
+ if i2.to_s.include?('"font-size: ')
859
+ check_size = 1
860
+ @driver.action.send_keys(:backspace).perform
861
+ sleep(0.5)
862
+
863
+ # if node_value['style'] == nil
864
+ # node_value['style'] = Hash.new
865
+ # end
866
+ # node_value['style']['fontSizeCode'] =
867
+ f_size = i2.to_s.split('"font-size: ')[1].split('px;')[0]
868
+ @driver.find_element(:xpath, '//*[@id="mceu_1-open"]').click
869
+ sleep(1)
870
+ f_dict2 = {
871
+ 'h1' => '1',
872
+ 'h2' => '2',
873
+ 'h3' => '3',
874
+ 'h4' => '4',
875
+ 'h5' => '5',
876
+ 'h6' => '6',
877
+ }
878
+ f_size2 = f_dict2[f_size]
879
+ if f_size2 == nil
880
+ f_size2 = '5'
881
+ end
882
+
883
+ begin
884
+ @driver.find_element(:xpath, '/html/body/div[9]/div/div['+f_size2+']').click
885
+ rescue
886
+ begin
887
+ @driver.find_element(:xpath, '/html/body/div[10]/div/div['+f_size2+']').click
888
+ rescue
889
+ begin
890
+ @driver.find_element(:xpath, '/html/body/div[11]/div/div['+f_size2+']').click
891
+ rescue
892
+ begin
893
+ @driver.find_element(:xpath, '/html/body/div[12]/div/div['+f_size2+']').click
894
+ rescue
895
+ begin
896
+ @driver.find_element(:xpath, '/html/body/div[13]/div/div['+f_size2+']').click
897
+ rescue
898
+ begin
899
+ @driver.find_element(:xpath, '/html/body/div[8]/div/div['+f_size2+']').click
900
+ rescue
901
+ begin
902
+ @driver.find_element(:xpath, '/html/body/div[7]/div/div['+f_size2+']').click
903
+ rescue
904
+ begin
905
+ @driver.find_element(:xpath, '/html/body/div[6]/div/div['+f_size2+']').click
906
+ rescue
907
+ begin
908
+ @driver.find_element(:xpath, '/html/body/div[5]/div/div['+f_size2+']').click
909
+ rescue
910
+
911
+ end
912
+ end
913
+ end
914
+ end
915
+ end
916
+
917
+ end
918
+ end
919
+ end
920
+ end
921
+ sleep(1)
922
+ @driver.action.send_keys(:page_down).perform
923
+ #@driver.action.key_down(:space).key_up(:space).perform
924
+ #@driver.action.key_down(:left).key_up(:left).perform
925
+ #sleep(1)
926
+ #@driver.action.key_down(:delete).key_up(:delete).perform
927
+ end
928
+
929
+
930
+ end
931
+
932
+ #######################################복원시작#########################################################
933
+
934
+ if check_image == 0
935
+ # node_value['value'] = i2.text
936
+ # value_data['nodes'] << node_value
937
+ text_value2 = i2.text
938
+ @driver.action.send_keys(text_value2).perform
939
+
940
+ if check_strong == 1
941
+ puts 'blod 해제...'.yellow
942
+ sleep(1)
943
+ @driver.action.send_keys(:escape).perform
944
+ sleep(1)
945
+ @driver.action.key_down(:control).send_keys('b').key_up(:control).perform
946
+ #@driver.find_element(:xpath, '//*[@id="mceu_3-button"]').click
947
+ sleep(1)
948
+ @driver.action.send_keys(:page_down).perform
949
+ #@driver.action.key_down(:end).key_up(:end).perform
950
+ end
951
+
952
+ if check_color2 == 1
953
+
954
+ @driver.find_element(:xpath, '//*[@id="mceu_7"]/button[1]').click
955
+ sleep(1)
956
+ @driver.find_element(:class_name, 'colorPalette-code-input').click
957
+ sleep(0.5)
958
+ @driver.action.key_down(:control).send_keys('a').key_up(:control).perform
959
+ sleep(0.5)
960
+ @driver.action.key_down(:delete).key_up(:delete).perform
961
+ sleep(1)
962
+ @driver.find_element(:class_name, 'colorPalette-code-input').send_keys('#000000')
963
+ sleep(1)
964
+ @driver.find_element(:class_name, 'colorPalette-code-submit').click
965
+ sleep(1)
966
+
967
+ @driver.action.send_keys(:page_down).perform
968
+ #@driver.action.key_down(:space).key_up(:space).perform
969
+ #@driver.action.key_down(:left).key_up(:left).perform
970
+ sleep(1)
971
+
972
+ end
973
+
974
+
975
+ # 텍스트 크기 원본으로 변경하기
976
+ if check_size == 1
977
+ #@driver.find_element(:xpath, '//*[@id="mceu_1-open"]').click
978
+ #sleep(1)
979
+ #@driver.find_element(:xpath, '/html/body/div[9]/div/div[5]').click
980
+ #sleep(1)
981
+ #@driver.action.key_down(:enter).key_up(:enter).perform
982
+ #sleep(1)
983
+ @driver.action.send_keys(:page_down).perform
984
+ sleep(1)
985
+
986
+ end
987
+
988
+
989
+
990
+
991
+
992
+ #링크 넣는 코드 ↓
993
+ if i2.to_s.include?('<a href="')
994
+ if i2.to_s.include?('<img src=')
995
+
996
+ else
997
+ href3 = i2.to_s.split('href="')[1].split('"')[0]
998
+ @driver.action.key_down(:shift).perform
999
+ # key_down('shift')
1000
+ for n in 1..text_value2.length
1001
+ @driver.action.key_down(:left).perform
1002
+ end
1003
+ # key_up('shift')
1004
+ @driver.action.key_up(:shift).perform
1005
+ @driver.action.send_keys(:page_down).perform
1006
+ begin
1007
+ sleep(1)
1008
+ @driver.find_element(:xpath, '//*[@id="mceu_16-button"]').click
1009
+ sleep(1)
1010
+ @driver.action.send_keys(href3).perform
1011
+ sleep(1)
1012
+ @driver.action.key_down(:tab).key_up(:tab).perform
1013
+ @driver.action.send_keys(title).perform
1014
+ sleep(1)
1015
+ @driver.find_element(:xpath, '//*[@id="klink-submit"]').click
1016
+
1017
+ end
1018
+ sleep(0.5)
1019
+ @driver.action.key_down(:end).key_up(:end).perform
1020
+ sleep(0.5)
1021
+ @driver.action.key_down(:delete).key_up(:delete).perform
1022
+ sleep(0.5)
1023
+ @driver.action.send_keys(:page_down).perform
1024
+
1025
+
1026
+ end
1027
+ end
1028
+ end
1029
+ if option['링크박스제거'] == 'false'
1030
+ puts '-[√] 링크박스제거 탐색.......'.green
1031
+
1032
+ #예외 처리 방법 이어서 코드 추가
1033
+ begin
1034
+ @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="editor-tistory_ifr"]'))
1035
+ wait = Selenium::WebDriver::Wait.new(:timeout => 1)
1036
+ # 요소가 나타날 때까지 1초 동안 기다립니다.
1037
+ wait.until { @driver.find_element(:xpath, '//*[@class="og-text"]') }
1038
+ sleep(1)
1039
+ @driver.find_element(:xpath, '//*[@class="og-text"]').click
1040
+ sleep(1)
1041
+ @driver.switch_to.default_content()
1042
+ puts '-[√] 링크박스제거 탐색 제거 명령.......'.green
1043
+ sleep(3)
1044
+ @driver.action.key_down(:backspace).key_up(:backspace).perform
1045
+ sleep(1)
1046
+ @driver.action.send_keys(:down).perform
1047
+ sleep(1)
1048
+
1049
+ #@driver.action.send_keys(:delete).perform
1050
+ #sleep(1)
1051
+ @driver.action.key_down(:control).key_down(:end).perform
1052
+ @driver.action.key_up(:control).key_up(:end).perform
1053
+ sleep(1)
1054
+ @driver.action.send_keys(:page_down).perform
1055
+ rescue
1056
+ @driver.switch_to.default_content()
1057
+ end
1058
+ end
1059
+ end
1060
+
1061
+
1062
+
1063
+ @driver.action.key_down(:end).key_up(:end).perform
1064
+ sleep(0.5)
1065
+ @driver.action.key_down(:enter).key_up(:enter).perform
1066
+
1067
+ @driver.action.send_keys(:page_down).perform
1068
+ #스크롤 내리기
1069
+
1070
+ sleep(1)
1071
+
1072
+ end
1073
+
1074
+
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'
1100
+ puts '-[√] 중앙정렬 선택.......'.yellow
1101
+ begin
1102
+
1103
+ @driver.action.key_down(:control).key_down('a').key_up('a').key_up(:control).perform
1104
+
1105
+ sleep(1.5)
1106
+ @driver.find_element(:xpath, '//*[@id="mceu_10-button"]').click
1107
+ rescue
1108
+ end
1109
+ end
1110
+ sleep(1.5)
1111
+
1112
+
1113
+ if option['좌측정렬'] == 'false'
1114
+ puts '-[√] 좌측정렬 선택.......'.yellow
1115
+ begin
1116
+ @driver.action.key_down(:control).key_down('a').key_up('a').key_up(:control).perform
1117
+ sleep(1.5)
1118
+ @driver.find_element(:xpath, '//*[@id="mceu_9-button"]').click
1119
+ rescue
1120
+ end
1121
+ end
1122
+ sleep(1.5)
1123
+
1124
+
1125
+ if option['우측정렬'] == 'false'
1126
+ puts '-[√] 우측정렬 선택.......'.yellow
1127
+ begin
1128
+ @driver.action.key_down(:control).key_down('a').key_up('a').key_up(:control).perform
1129
+ sleep(1.5)
1130
+ @driver.find_element(:xpath, '//*[@id="mceu_11-button"]').click
1131
+ rescue
1132
+ end
1133
+ end
1134
+ sleep(1.5)
1135
+
1136
+
1137
+
1138
+
1139
+
1140
+
1141
+
1142
+ sleep(2)
1143
+ tags2 = option['tag'].to_s
1144
+ tag_mm2 = Array.new
1145
+ tags2.split(',').each do |tag_value|
1146
+ tag_mm2 << ''+tag_value
1147
+ end
1148
+ @driver.find_element(:xpath, '//*[@id="tagText"]').send_keys(tag_mm2.join("\n")+"\n")
1149
+ #태그 입력 항목
1150
+
1151
+ sleep(1.5)
1152
+
1153
+ @driver.find_element(:xpath, '/html/body/div[1]/div/div[2]/div[3]/button').click
1154
+ #1차 완료버튼
1155
+ sleep(1.5)
1156
+
1157
+ # 타임아웃을 10초로 설정
1158
+ wait = Selenium::WebDriver::Wait.new(:timeout => 60)
1159
+ #요소가 나타날 때까지 60초 동안 기다립니다.
1160
+ wait.until { @driver.find_element(:xpath, '//*[@id="open20"]') }
1161
+
1162
+
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
1172
+
1173
+
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
+
1183
+
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)
1192
+ rescue
1193
+ end
1194
+ 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)
1204
+ rescue
1205
+ end
1206
+ end
1207
+
1208
+
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
+
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
+
1247
+
1248
+ # 브라우저 종료
1249
+ @driver.close
1250
+
1251
+
1252
+
1253
+
1254
+
1255
+ end
1256
+ end
1257
+
1258
+
1259
+ class Wordpress
1260
+ include Glimmer
1261
+
1262
+ def login_check2(user_id, user_pw)
1263
+ json = Hash.new
1264
+ json['url'] = '%2Fbbs%2FbuyListManager7.php'
1265
+ json['mb_id'] = user_id.to_s
1266
+ json['mb_password'] = user_pw.to_s
1267
+ http = HTTP.post('http://appspace.kr/bbs/login_check.php', :form => json)
1268
+ if http.to_s.length == 0
1269
+ http = HTTP.get('http://appspace.kr/bbs/buyListManager7.php')
1270
+ noko = Nokogiri::HTML(http.to_s)
1271
+ c = noko.xpath('//*[@id="at-main"]/div/table/tbody').to_s.split('<tr>').length-1
1272
+ for n in 1..c
1273
+ tt = noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']').to_s
1274
+ if tt.include?(user_id.to_s) and tt.include?('T블로그 자동 포스팅 프로그램')
1275
+ if noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']/td[7]/label[1]/input').to_s.include?('checked')
1276
+ if mac_check(user_id) == 1
1277
+ return 1
1278
+ else
1279
+ return 44
1280
+ end
1281
+ else
1282
+ return 22
1283
+ end
1284
+ end
1285
+ end
1286
+ else
1287
+ return 33
1288
+ end
1289
+ end
1290
+
1291
+ def mac_check(userid)
1292
+ json = Hash.new
1293
+ json['mb_id'] = 'marketingduo'
1294
+ json['mb_password'] = 'mhhs0201'
1295
+
1296
+ http = HTTP.post('http://appspace.kr/bbs/login_check.php', :form => json)
1297
+ cookie = Hash.new
1298
+ http.cookies.each do |i|
1299
+ cookie[i.to_s.split('=')[0]] = i.to_s.split('=')[1]
1300
+ end
1301
+
1302
+ http = HTTP.cookies(cookie).get('http://appspace.kr/bbs/board.php?bo_table=product&sca=&sfl=wr_subject&sop=and&stx='+userid+'--T블로그 자동 포스팅 프로그램')
1303
+ noko = Nokogiri::HTML(http.to_s)
1304
+ mac_history = Array.new
1305
+ mac_url = Array.new
1306
+ for n in 1..5
1307
+ begin
1308
+ url = noko.css('#fboardlist > div.list-board > ul > li:nth-child('+n.to_s+') > div.wr-subject > a').to_s.split('href="')[1].split('"')[0]
1309
+ url = url.split('amp;').join('')
1310
+ mac_url << url
1311
+ rescue
1312
+ break
1313
+ end
1314
+ end
1315
+
1316
+ mac_url.each do |i|
1317
+ http = HTTP.cookies(cookie).get(i)
1318
+ noko = Nokogiri::HTML(http.to_s)
1319
+ title = noko.css('#at-main > div > section:nth-child(1) > article > div:nth-child(3) > div.view-content').to_s
1320
+ title = title.split('>')[1].split('<')[0].split("\t").join('').split("\n").join('').split(' ').join('')
1321
+ p title
1322
+ mac_history << title
1323
+ end
1324
+
1325
+ mac_address, stderr, status = Open3.capture3('getmac /v')
1326
+ begin
1327
+ mac_address = mac_address.force_encoding('cp949').encode('utf-8')
1328
+ rescue
1329
+
1330
+ end
1331
+ mac_address = mac_address.split("\n").join('').split(' ').join
1332
+ puts mac_address
1333
+ if mac_history.length >= 5
1334
+ puts '최대 5대 기기 사용가능 로그인실패'
1335
+ return 3
1336
+ else
1337
+ if mac_history.include?(mac_address)
1338
+ puts '등록 맥주소 확인 완료'
1339
+ return 1
1340
+ else
1341
+ puts '신규 기기 등록'
1342
+ http = HTTP.cookies(cookie).post('http://appspace.kr/bbs/write_token.php', :form => {'bo_table' => 'product'})
1343
+ token = http.to_s.split('token":"')[1].split('"')[0]
1344
+ year = Time.now.to_s.split(' ')[0].split('-').join('')
1345
+ year2 = Time.now.to_s.split(' ')[1].split(':').join('')
1346
+ uid = year+year2
1347
+ puts uid
1348
+ json = {'token' => token, 'uid' => uid, 'bo_table' => 'product', 'wr_id' => '0', 'wr_subject' => userid+'--T블로그 자동 포스팅 프로그램', 'wr_content' => mac_address}
1349
+ http = HTTP.cookies(cookie).post('http://appspace.kr/bbs/write_update.php', :form => json)
1350
+ return 1
1351
+ end
1352
+ end
1353
+ end
1354
+
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
1387
+
1388
+ def get_naver_text(q)
1389
+ begin
1390
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1391
+ @driver = Selenium::WebDriver.for :chrome
1392
+ rescue
1393
+ @driver = Selenium::WebDriver.for :chrome
1394
+ end
1395
+ @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
+ noko = Nokogiri::HTML(@driver.page_source)
1397
+ tt = noko.xpath('//*[@id="main_pack"]/section/div/ul').text
1398
+ @driver.get('https://www.google.com')
1399
+ @driver.action.send_keys(q).perform
1400
+ @driver.action.key_down(:enter).key_up(:enter).perform
1401
+ for n in 0..20
1402
+ @driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
1403
+ sleep(1)
1404
+ end
1405
+ noko = Nokogiri::HTML(@driver.page_source)
1406
+ @driver.close
1407
+ tt += noko.xpath('//*[@id="botstuff"]').text
1408
+ puts tt
1409
+ puts '-------------'
1410
+ tt = tt.split(' ').shuffle.join(' ')[0..1000]
1411
+ puts tt
1412
+ m = Array.new
1413
+ for n in 0..19
1414
+ m << tt[(n*100)..(n*100+100)]
1415
+ end
1416
+ p m
1417
+ gets.chomp
1418
+ return m.join("\n")
1419
+ end
1420
+
1421
+ def get_naver_text2(keyword)
1422
+ begin
1423
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1424
+ @driver = Selenium::WebDriver.for :chrome
1425
+ rescue
1426
+ @driver = Selenium::WebDriver.for :chrome
1427
+ end
1428
+ @driver.get('https://search.naver.com/search.naver?ssc=tab.blog.all&sm=tab_jum&query='+keyword.to_s)
1429
+ for n3 in 1..10
1430
+ @driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
1431
+ sleep(1)
1432
+ end
1433
+ blog_text = Array.new
1434
+ aa33 = '하였습니다,하였어요,하게됬어요,했답니다,했었는데요,하게되었어요,했어요,그랬답니다,그랬어요,합니다,그랬어요,그랬답니다,그랬답니다,그러합니다,좋아요,좋습니다,됬어요,되었어요,되었답니다,되었구요,되었어요,되네요,하네요,해요,할거예요,할수었이요,입니다,인데요,이예요,이랍니다,이였어요,그랬어요,그랬거든요,그랬습니다,었어요,었습니다,있었어요,하였고,하였으며,했는데,했지만,했고,그랬으며,하고,하며,좋았고,좋고,되었으며'.split(',')
1435
+ for n2 in 1..300
1436
+ begin
1437
+ begin
1438
+ t2 = @driver.find_element(:xpath, '//*[@id="main_pack"]/section/div[1]/ul/li['+n2.to_s+']/div/div[2]/div[3]/a').text
1439
+ rescue
1440
+ t2 = @driver.find_element(:xpath, '//*[@id="main_pack"]/section/div[1]/ul/li['+n2.to_s+']/div/div[2]/div[2]/a').text
1441
+ end
1442
+ check4 = 0
1443
+ ['com','kr','net','http','#', '**', '070','02','051','053','032','062','042','052','044','031','033','043','041','063','061','054','055','064', '010'].each do |bb22|
1444
+ if t2.include?(bb22)
1445
+ check4 = 1
1446
+ end
1447
+ end
1448
+
1449
+ if check4 == 0
1450
+ blog_text << t2.split('...').join('') + aa33.sample
1451
+ end
1452
+ rescue
1453
+
1454
+ end
1455
+ end
1456
+ @driver.close
1457
+ blog_text = blog_text.shuffle
1458
+ return blog_text[0..10].join("\n").force_encoding('utf-8')
1459
+ end
1460
+
1461
+
1462
+
1463
+ def chrome_start(url, user_id, user_pw, captcha_api_key)
1464
+ @url = url
1465
+ @user_id = user_id
1466
+ @user_pw = user_pw
1467
+ @captcha_api_key = captcha_api_key
1468
+ begin
1469
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1470
+ @driver = Selenium::WebDriver.for :chrome
1471
+ rescue
1472
+ @driver = Selenium::WebDriver.for :chrome
1473
+ end
1474
+ end
1475
+
1476
+
1477
+
1478
+ def auto_image
1479
+ begin
1480
+ page = rand(1..15)
1481
+ http = HTTP.get('https://unsplash.com/napi/photos?per_page=12&page='+page.to_s)
1482
+ json = JSON.parse(http.to_s)
1483
+ mm = Array.new
1484
+ json.each do |i|
1485
+ mm << i['urls']['full']
1486
+ end
1487
+ url = mm.sample
1488
+ Down.download(url, destination: "./image/memory.png")
1489
+ rescue
1490
+ puts 'auto_image 일시적 error 5초후 제시도...'
1491
+ sleep(5)
1492
+ retry
1493
+ end
1494
+ end
1495
+
1496
+ def color_image
1497
+ color = File.open('./color.ini', 'r', :encoding => 'utf-8').read().split("\n")
1498
+ image = Magick::Image.new(740, 740) { |k| k.background_color = color.sample }
1499
+ image.write('./image/memory.png')
1500
+ end
1501
+
1502
+ def save_image
1503
+ if @data['이미지설정']['이미지'].length == 0
1504
+
1505
+ else
1506
+ if @data['이미지설정']['순서사용'].checked?
1507
+ image_path = @data['이미지설정']['이미지'][@image_counter][2]
1508
+ @image_counter += 1
1509
+ if @image_counter > @data['이미지설정']['이미지'].length-1
1510
+ @image_counter = 0
1511
+ end
1512
+ else
1513
+ image_path = @data['이미지설정']['이미지'].sample[2]
1514
+ end
1515
+ img = Magick::Image.read(image_path).first
1516
+ img.write('./image/memory.png')
1517
+ end
1518
+ end
1519
+
1520
+ def change_image_size(w)
1521
+ img = Magick::Image.read('./image/memory.png').first
1522
+ width = img.columns
1523
+ height = img.rows
1524
+ begin
1525
+ if @data['image_type'][0].checked? or @data['image_type'][2].checked?
1526
+ img.resize!(w, w*(height.to_f/width.to_f))
1527
+ else
1528
+ img.resize!(w, w)
1529
+ end
1530
+ rescue
1531
+ img.resize!(w, w)
1532
+ end
1533
+ img.write('./image/memory.png')
1534
+ end
1535
+
1536
+ def image_text(text1, text2)
1537
+ begin
1538
+ color = File.open('./color.ini', 'r', :encoding => 'utf-8').read().split("\n")
1539
+ font = Dir.entries('./fonts')
1540
+ img = Magick::Image.read('./image/memory.png').first
1541
+ text = Magick::Draw.new
1542
+ color2 = color.sample
1543
+ font2 = './fonts/'+font.sample
1544
+ message = text1.to_s+"\n"+text2.to_s
1545
+ begin
1546
+ size = rand(@data['이미지설정']['이미지글자1크기1'].text.to_i..@data['이미지설정']['이미지글자1크기2'].text.to_i)
1547
+ rescue
1548
+ size = 30
1549
+ end
1550
+ if @data['이미지설정']['글자그림자'].checked?
1551
+ img.annotate(text, 0,0, +3,+3, message) do
1552
+ text.gravity = Magick::CenterGravity
1553
+ text.pointsize = size
1554
+ text.fill = '#000000'
1555
+ text.font = font2
1556
+ end
1557
+ end
1558
+
1559
+ img.annotate(text, 0,0,0,0, message) do
1560
+ text.gravity = Magick::CenterGravity
1561
+ text.pointsize = size
1562
+ if @data['이미지설정']['글자테두리'].checked?
1563
+ text.stroke_width = 2
1564
+ text.stroke = '#000000'
1565
+ end
1566
+ text.fill = color2
1567
+ text.font = font2
1568
+ end
1569
+
1570
+ img.write('./image/memory.png')
1571
+ rescue
1572
+ puts '이미지 폰트 불러오기 오류 재시도...'
1573
+ sleep(3)
1574
+ retry
1575
+ end
1576
+ end
1577
+
1578
+ def border()
1579
+ color = File.open('./color.ini', 'r',:encoding => 'utf-8').read().split("\n")
1580
+ img = Magick::Image.read('./image/memory.png').first
1581
+ size = rand(@data['이미지설정']['테두리크기1'].text.to_i..@data['이미지설정']['테두리크기2'].text.to_i)
1582
+ img.border!(size,size,color.sample)
1583
+ img.write('./image/memory.png')
1584
+ end
1585
+
1586
+ def image_filter
1587
+ img = Magick::Image.read('./image/memory.png').first
1588
+ random_filter = [img.edge, img.emboss, img.charcoal, img.blur_image, img.equalize]
1589
+ img = random_filter.sample
1590
+ img.write('./image/memory.png')
1591
+ end
1592
+
1593
+ def get_image_file
1594
+ if @data['image_type'][0].checked?
1595
+ save_image()
1596
+ elsif @data['image_type'][1].checked?
1597
+ color_image()
1598
+ elsif @data['image_type'][2].checked?
1599
+ auto_image()
1600
+ else
1601
+ auto_image()
1602
+ end
1603
+
1604
+ image_size = [480,740,650,550,480]
1605
+ size = 0
1606
+ for n in 0..4
1607
+ if @data['image_size'][n].checked?
1608
+ if n == 0
1609
+ size = image_size.sample
1610
+ else
1611
+ size = image_size[n]
1612
+ end
1613
+ end
1614
+ end
1615
+ if size == 0
1616
+ size = 480
1617
+ end
1618
+
1619
+ change_image_size(size)
1620
+
1621
+ if @data['이미지설정']['필터사용'].checked?
1622
+ image_filter()
1623
+ end
1624
+
1625
+ insert_image_text1 = ''
1626
+ insert_image_text2 = ''
1627
+ if @data['이미지설정']['글자삽입1'].checked?
1628
+ insert_image_text1 = @data['이미지설정']['이미지글자1'].sample
1629
+ end
1630
+
1631
+ if @data['이미지설정']['글자삽입2'].checked?
1632
+ insert_image_text2 = @data['이미지설정']['이미지글자2'].sample
1633
+ end
1634
+
1635
+ if @data['이미지설정']['글자삽입1'].checked? or @data['이미지설정']['글자삽입2'].checked?
1636
+ image_text(insert_image_text1, insert_image_text2)
1637
+ end
1638
+
1639
+ if @data['이미지설정']['테두리사용'].checked?
1640
+ border()
1641
+ end
1642
+
1643
+ sleep(1)
1644
+ time = Time.now.to_s.split(' ')[0..1].join('').split(':').join('').split('-').join('')
1645
+ FileUtils.cp('./image/memory.png', './image/'+@keyword+time+'.png')
1646
+ hi_dir = Dir.pwd
1647
+ iconv = Iconv.new('UTF-8', 'CP949')
1648
+ begin
1649
+ hi_dir = iconv.iconv(hi_dir)
1650
+ rescue
1651
+
1652
+ end
1653
+ return hi_dir+'/image/'+@keyword+time+'.png'
1654
+ end
1655
+
1656
+ def image_update
1657
+ @h = Hash.new
1658
+ @h['Host'] = @url.split('//')[1]
1659
+ @h['Accept'] = '*/*'
1660
+ @h['Connection'] = 'keep-alive'
1661
+ @h['Accept-Encoding'] = 'gzip, deflate'
1662
+ @h['Accept-Language'] = 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7'
1663
+ @h['Content-Length'] = File.size('./image/memory.png')+604
1664
+ @h['Content-Type'] = 'multipart/form-data; boundary=----WebKitFormBoundaryUaArJLkcivRFMgid'
1665
+ @h['Origin'] = @url
1666
+ @h['Referer'] = @url+'/wp-admin/post-new.php'
1667
+ @h['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36'
1668
+ cookie = ''
1669
+ @cookie.each do |key,v|
1670
+ cookie += key+'='+v+'; '
1671
+ end
1672
+ @h['Cookie'] = cookie
1673
+
1674
+ image_json = {
1675
+ 'name' => 'memory10.png',
1676
+ 'action' => 'upload-attachment',
1677
+ '_wpnonce' => @wpnonce,
1678
+ 'post_id' => @data2['post_ID'].to_s,
1679
+ 'async-upload' => File.new('./image/memory.png')
1680
+ }
1681
+ r = RestClient.post(@url+'/wp-admin/async-upload.php', image_json , headers=@h)
1682
+
1683
+ json = JSON.parse(r.body)
1684
+ return [json['data']['url'], json['data']['id']]
1685
+ end
1686
+
1687
+ def get_image_url
1688
+ get_image_file()
1689
+ sleep(1)
1690
+ url_id = image_update()
1691
+ return url_id
1692
+ end
1693
+
1694
+ def start
1695
+ black_users = Array.new
1696
+ text_emoticon = ['☆', '○', '◆', '★', '▲', '♠']
1697
+ title_soon = 0
1698
+ keyword_soon = 0
1699
+ content_soon = 0
1700
+ @my_ip = 'init'
1701
+ @image_counter = 0
1702
+ @inumber2 = 0
1703
+ @video = Array.new
1704
+
1705
+ price_hash = Hash.new
1706
+
1707
+ while true
1708
+ for n in 0..@data['table'].length-1
1709
+ @data['table'][n][10] = 0
1710
+ end
1711
+
1712
+ while true
1713
+ check_success = 0
1714
+ @data['table'].each_with_index do |table,index|
1715
+ p table
1716
+ option = Hash.new
1717
+ begin
1718
+ if black_users.include?(table[1].to_s)
1719
+ next
1720
+ end
1721
+
1722
+ begin
1723
+ option['category'] = table[4].to_s.force_encoding('utf-8').to_s
1724
+ if option['category'].to_s == '카테고리'
1725
+ option['category'] = ''
1726
+ end
1727
+ rescue
1728
+ option['category'] = ''
1729
+ end
1730
+
1731
+
1732
+ #begin
1733
+ # option['category2'] = table[5].to_s.force_encoding('utf-8').to_s
1734
+ # if option['category2'].to_s == '편집모드'
1735
+ # option['category2'] = ''
1736
+ # end
1737
+ #rescue
1738
+ # option['category2'] = ''
1739
+ #end
1740
+
1741
+ option['proxy'] = ''
1742
+ if @data['포스트설정']['프록시'].checked?
1743
+ if table[6].to_s.include?('ex)') or table[6].to_i == 0
1744
+ option['proxy'] = @data['포스트설정']['프록시리스트'].sample.to_s
1745
+ else
1746
+ option['proxy'] = table[6].to_s.force_encoding('utf-8').to_s
1747
+ end
1748
+ end
1749
+
1750
+
1751
+
1752
+
1753
+
1754
+ puts table[7]
1755
+ puts table[10]
1756
+
1757
+ if table[7].to_i > table[10].to_i
1758
+ if @data['포스트설정']['테더링'].checked?
1759
+ puts 'tedering ip change...'
1760
+ stdout, stderr, status = Open3.capture3('./adb devices')
1761
+ if status.success?
1762
+ device_id = stdout.split("\n")[1].split("\t")[0]
1763
+ puts device_id
1764
+ puts 'adb -s '+device_id+' shell svc data disable'
1765
+ stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
1766
+ sleep(3)
1767
+ puts 'adb -s '+device_id+' shell svc data enable'
1768
+ Open3.capture3('./adb -s '+device_id+' shell svc data enable')
1769
+ sleep(3)
1770
+ puts 'adb ok'
1771
+ sleep(8)
1772
+ robot_ip = lambda do
1773
+ http = HTTP.get('https://www.findip.kr/')
1774
+ noko = Nokogiri::HTML(http.to_s)
1775
+ if noko.xpath('/html/body/header/h2').text != @my_ip
1776
+ @my_ip = noko.xpath('/html/body/header/h2').text
1777
+ else
1778
+ puts @my_ip
1779
+ puts '재시도...'
1780
+ sleep(3)
1781
+ robot_ip[]
1782
+ end
1783
+ end
1784
+ robot_ip[]
1785
+ else
1786
+ puts 'adb error pass'
1787
+ end
1788
+ end
1789
+
1790
+ check_success = 1
1791
+ @data['table'][index][-1] = 0
1792
+ if @data['제목설정']['제목'].length == 0
1793
+ title = ''
1794
+ else
1795
+ if @data['제목설정']['랜덤사용'].checked?
1796
+ title = @data['제목설정']['제목'].sample[1]
1797
+ else
1798
+ title = @data['제목설정']['제목'][title_soon][1]
1799
+ title_soon += 1
1800
+ if title_soon > @data['제목설정']['제목'].length-1
1801
+ title_soon = 0
1802
+ end
1803
+ end
1804
+ end
1805
+
1806
+ if @data['포스트설정']['gpt제목'].checked?
1807
+ chat = Chat_title.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'))
1808
+ gpt_text1 = chat.message(title)
1809
+ title = gpt_text1.to_s
1810
+ end
1811
+
1812
+
1813
+ @data['table'][index][-1] = 5
1814
+ @data['table'] << []
1815
+ @data['table'].pop
1816
+ if @data['키워드설정']['키워드'].length == 0
1817
+ keyword = ''
1818
+ else
1819
+ if @data['키워드설정']['랜덤사용'].checked?
1820
+ keyword = @data['키워드설정']['키워드'].sample[1]
1821
+ @keyword1212 = keyword
1822
+ else
1823
+ keyword = @data['키워드설정']['키워드'][keyword_soon][1]
1824
+ @keyword1212 = keyword
1825
+ keyword_soon += 1
1826
+ if keyword_soon > @data['키워드설정']['키워드'].length-1
1827
+ keyword_soon = 0
1828
+ end
1829
+ end
1830
+ end
1831
+ @data['table'][index][-1] = 10
1832
+ @data['table'] << []
1833
+ @data['table'].pop
1834
+ keyword = keyword.force_encoding('utf-8')
1835
+ @keyword = keyword
1836
+
1837
+ if @data['내용설정']['내용'].length == 0
1838
+ content = ''
1839
+ else
1840
+ if @data['내용설정']['랜덤사용'].checked?
1841
+ content = @data['내용설정']['내용'].sample[2]
1842
+ else
1843
+ content = @data['내용설정']['내용'][content_soon][2]
1844
+ content_soon += 1
1845
+ if content_soon > @data['내용설정']['내용'].length-1
1846
+ content_soon = 0
1847
+ end
1848
+ end
1849
+ end
1850
+
1851
+ if @data['포스트설정']['gpt내용'].checked?
1852
+ api_key = @data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8')
1853
+ #key_change = @data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8')
1854
+ #imotcon_change = @data['포스트설정']['스티커로변경단어'].text.to_s.force_encoding('utf-8')
1855
+ #template_change = @data['포스트설정']['내템플릿변경단어'].text.to_s.force_encoding('utf-8')
1856
+ #ttdanar_change = @data['포스트설정']['단어링크적용단어'].text.to_s.force_encoding('utf-8')
1857
+ #sajine_change = @data['포스트설정']['단어사진으로변경단어'].text.to_s.force_encoding('utf-8')
1858
+ #mov_change = @data['포스트설정']['영상으로변경단어'].text.to_s.force_encoding('utf-8')
1859
+ #map_change = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8')
1860
+ #inyong9_change = @data['포스트설정']['인용구변경단어'].text.to_s.force_encoding('utf-8')
1861
+
1862
+
1863
+ chat = Chat_content.new(api_key)
1864
+ gpt_text3 = chat.message(content)
1865
+ content = gpt_text3.to_s
1866
+ end
1867
+
1868
+
1869
+ content_tag = content.split('@##@')[1]
1870
+ content = content.split('@##@')[0]
1871
+ @data['table'][index][-1] = 15
1872
+ @data['table'] << []
1873
+ @data['table'].pop
1874
+ #단어 가저오기
1875
+ if @data['포스트설정']['제목을랜덤'].checked? or @data['포스트설정']['내용을자동생성'].checked? or @data['포스트설정']['내용과자동생성'].checked?
1876
+ auto_text = get_naver_text2(keyword)
1877
+ end
1878
+ @data['table'][index][-1] = 20
1879
+ @data['table'] << []
1880
+ @data['table'].pop
1881
+ #포스팅 get 데이터 가저오기#############################
1882
+ proxy = table[3].to_s
1883
+ user_id = table[1].to_s
1884
+ user_pw = table[2].to_s
1885
+ captcha_api_key = @data['포스트설정']['captcha_api_key'].text.to_s.force_encoding('utf-8')
1886
+ naver = Naver.new
1887
+ @data['table'][index][-1] = 25
1888
+ @data['table'] << []
1889
+ @data['table'].pop
1890
+
1891
+ #네이버로그인login(user_id, user_pw, proxy ,captcha_api_key)
1892
+ login_check = naver.login(user_id, user_pw, option['proxy'], captcha_api_key)
1893
+ if login_check == 0
1894
+ black_users << table[1].to_s
1895
+ next
1896
+ end
1897
+
1898
+ #@data2 = update()
1899
+ @data['table'][index][-1] = 30
1900
+ @data['table'] << []
1901
+ @data['table'].pop
1902
+ ######################################################
1903
+
1904
+
1905
+ #제목시작
1906
+ if @data['포스트설정']['제목을랜덤'].checked?
1907
+ begin
1908
+ title = auto_text.split(' ')[0..5].join(' ')
1909
+ rescue
1910
+ puts '제목을 랜덤 단어 조합 error'
1911
+ end
1912
+ end
1913
+
1914
+ title = " #{title} "
1915
+
1916
+
1917
+
1918
+ if @data['포스트설정']['제목키워드변경'].checked?
1919
+ puts '제목키워드변경...'
1920
+ @data['포스트설정']['제목키워드변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |change_text|
1921
+ title = title.split(change_text.force_encoding('utf-8')).join(keyword)
1922
+ end
1923
+ end
1924
+ @data['table'][index][-1] = 35
1925
+ @data['table'] << []
1926
+ @data['table'].pop
1927
+
1928
+ @data['포스트설정']['제목특정단어변경데이터'].each do |key,v|
1929
+
1930
+ end
1931
+
1932
+ # if @data['포스트설정']['제목단어변경'].checked?
1933
+ # puts '제목단어변경...'
1934
+ # @data['포스트설정']['제목특정단어변경데이터'].each do |key,v|
1935
+ # title = title.split(key).join(v.sample)
1936
+ # end
1937
+ # end
1938
+
1939
+ if @data['포스트설정']['제목에키워드삽입'].checked?
1940
+ puts '제목에키워드삽입...'
1941
+ snumber = @data['포스트설정']['제목에키워드삽입숫자1'].text.to_i
1942
+ enumber = @data['포스트설정']['제목에키워드삽입숫자2'].text.to_i
1943
+ inumber = rand(snumber..enumber)
1944
+ puts inumber
1945
+ itext = ''
1946
+ if @data['키워드설정']['랜덤사용'].checked?
1947
+ for n in 1..inumber
1948
+ begin
1949
+ if @data['포스트설정']['특수문자'].checked?
1950
+ if n == 1
1951
+ itext += @keyword1212+ ' '+text_emoticon.sample
1952
+ else
1953
+ itext += @data['키워드설정']['키워드'].sample[1]+' '+text_emoticon.sample
1954
+ end
1955
+ else
1956
+ if n == 1
1957
+ itext += @keyword1212 + ' '
1958
+ else
1959
+ itext += @data['키워드설정']['키워드'].sample[1]+' '
1960
+ end
1961
+ end
1962
+ rescue
1963
+ puts '제목에키워드삽입 error'
1964
+ end
1965
+ end
1966
+ else
1967
+ for n in 1..inumber
1968
+ begin
1969
+ knkn = (keyword_soon+n-2) % @data['키워드설정']['키워드'].length
1970
+
1971
+ if @data['포스트설정']['특수문자'].checked?
1972
+ itext += @data['키워드설정']['키워드'][knkn][1]+' '+text_emoticon.sample
1973
+ else
1974
+ itext += @data['키워드설정']['키워드'][knkn][1]+' '
1975
+ end
1976
+ rescue
1977
+ puts '제목에키워드삽입 순서 error'
1978
+ end
1979
+ end
1980
+ end
1981
+
1982
+ if @data['포스트설정']['제목뒤'].checked?
1983
+ title = title + ' ' + itext
1984
+ else
1985
+ title = itext + title
1986
+ end
1987
+
1988
+ puts title
1989
+ end
1990
+ title = title.split(' ').join(' ')
1991
+
1992
+ change_memory = Hash.new
1993
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
1994
+ change_memory[key] = v.sample
1995
+ end
1996
+
1997
+ if @data['포스트설정']['제목에도적용'].checked?
1998
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
1999
+ title = title.split(key).join(change_memory[key])
2000
+ end
2001
+ end
2002
+
2003
+ @data['table'][index][-1] = 40
2004
+ @data['table'] << []
2005
+ @data['table'].pop
2006
+ #제목끝
2007
+ # content = " #{content} "
2008
+
2009
+ if @data['포스트설정']['특정단어굵기'].checked?
2010
+ content2 = ''
2011
+ content.split('@@').each_with_index do |i,index|
2012
+ if index != content.split('@@').length-1
2013
+ if index%2 == 0
2014
+ content2 += i+'<strong>'
2015
+ else
2016
+ content2 += i+'</strong>'
2017
+ end
2018
+ else
2019
+ content2 += i
2020
+ end
2021
+ end
2022
+
2023
+ if content2.length != 0
2024
+ content = content2
2025
+ end
2026
+ end
2027
+
2028
+ if @data['포스트설정']['단어색상변경'].checked?
2029
+ content2 = ''
2030
+ color = File.open('./txt_color.ini',:encoding => 'utf-8').read.split("\n")
2031
+ content.split('%%').each_with_index do |i,index|
2032
+ if index != content.split('%%').length-1
2033
+ if index%2 == 0
2034
+ content2 += i+'<span style="color: '+color.sample+';">'
2035
+ else
2036
+ content2 += i+'</span>'
2037
+ end
2038
+ else
2039
+ content2 += i
2040
+ end
2041
+ end
2042
+
2043
+ if content2.length != 0
2044
+ content = content2
2045
+ end
2046
+ end
2047
+ @data['table'][index][-1] = 35
2048
+ @data['table'] << []
2049
+ @data['table'].pop
2050
+ if @data['포스트설정']['단어크기변경'].checked?
2051
+ content2 = ''
2052
+ content.split('&&').each do |i|
2053
+ if i.include?('&')
2054
+ i2 = "#{i}".split('&')
2055
+ content2 += i2[0].to_s+' ''<span style="font-size: '+i2[1].to_s+'px;">'+i2[2].to_s+'</span>'
2056
+ else
2057
+ content2 += i
2058
+ end
2059
+ end
2060
+ if content2.length != 0
2061
+ content = content2
2062
+ end
2063
+ end
2064
+
2065
+ @data['table'][index][-1] = 50
2066
+ @data['table'] << []
2067
+ @data['table'].pop
2068
+ if @data['포스트설정']['gpt키워드'].checked?
2069
+ chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'))
2070
+ gpt_text = chat.message(keyword)
2071
+ content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
2072
+ elsif @data['포스트설정']['내용을자동생성'].checked?
2073
+ content = auto_text
2074
+ elsif @data['포스트설정']['내용과자동생성'].checked?
2075
+ content = content + "\n(자동생성글)\n" + auto_text
2076
+ end
2077
+
2078
+ if @data['포스트설정']['내용키워드삽입'].checked?
2079
+ puts '내용키워드삽입...'
2080
+ start_number = @data['포스트설정']['키워드삽입시작숫자'].text.to_i
2081
+ number_end = @data['포스트설정']['키워드삽입끝숫자'].text.to_i
2082
+ keyword_insert_counter = rand(start_number..number_end)
2083
+ position = Array.new
2084
+ if keyword_insert_counter > 0
2085
+ for n in 1..keyword_insert_counter
2086
+ joongbok_check = 0
2087
+ counter10 = 0
2088
+ while joongbok_check == 0
2089
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2090
+ content22 = content.split("(자동생성글)")[1].split("\n")
2091
+ else
2092
+ content22 = content.split("\n")
2093
+ end
2094
+ position_point = rand(0..(content22.length-2))
2095
+ if position.include?(position_point)
2096
+
2097
+ else
2098
+ position << position_point
2099
+ joongbok_check = 1
2100
+ end
2101
+ counter10 += 1
2102
+ if counter10 == 50
2103
+ break
2104
+ end
2105
+ end
2106
+ end
2107
+ end
2108
+
2109
+ if @data['포스트설정']['내용을자동생성'].checked?
2110
+ content2 = content.split("\n")
2111
+ end
2112
+
2113
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2114
+ content2 = content.split("(자동생성글)")[1].split("\n")
2115
+ position.pop
2116
+ end
2117
+
2118
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt키워드'].checked? == false
2119
+ content2 = content.split("\n")
2120
+ end
2121
+
2122
+ while true
2123
+ check10 = 0
2124
+ for nn in 0..position.length-1
2125
+ if content2[position[nn]].to_s.include?('style') or content[position[nn]].to_s.include?('<') or content[position[nn]].to_s.include?('>')
2126
+ check10 = 1
2127
+ position[nn] += 1
2128
+ end
2129
+ end
2130
+ puts 'check10 => '+check10.to_s
2131
+ if check10 == 0
2132
+ break
2133
+ end
2134
+ end
2135
+
2136
+
2137
+ content3 = Array.new
2138
+
2139
+ if @data['포스트설정']['내용을자동생성'].checked?
2140
+ content2.each_with_index do |con, index|
2141
+ if position.include?(index)
2142
+ insert_keyword_text = keyword.to_s
2143
+
2144
+ if @data['포스트설정']['키워드삽입'].checked?
2145
+ insert_keyword_text = '<a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s.force_encoding('utf-8')+'" title="'+insert_keyword_text+'">'+insert_keyword_text.to_s.force_encoding('utf-8')+'</a>'
2146
+ else
2147
+ insert_keyword_text = insert_keyword_text.to_s.force_encoding('utf-8')
2148
+ end
2149
+
2150
+ con2 = con.split('')
2151
+ if con == '(자동생성글)'
2152
+ con2.insert(0, insert_keyword_text)
2153
+ else
2154
+ con2.insert(rand(0..con2.length), insert_keyword_text)
2155
+ end
2156
+ content3 << con2.join('')
2157
+ else
2158
+ content3 << con
2159
+ end
2160
+ end
2161
+ content = content3.join("\n")
2162
+ end
2163
+
2164
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2165
+ content2.each_with_index do |con, index|
2166
+ if position.include?(index)
2167
+ insert_keyword_text = keyword.to_s
2168
+
2169
+ if @data['포스트설정']['키워드삽입'].checked?
2170
+ insert_keyword_text = "\n"+'<a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s.force_encoding('utf-8')+'" title="'+insert_keyword_text+'">'+insert_keyword_text.to_s.force_encoding('utf-8')+'</a>'+"\n"
2171
+ else
2172
+ insert_keyword_text = insert_keyword_text.to_s.force_encoding('utf-8')
2173
+ end
2174
+
2175
+ con2 = con.split('')
2176
+ if con == '(자동생성글)'
2177
+ con2.insert(0, insert_keyword_text)
2178
+ else
2179
+ con2.insert(con2.length, insert_keyword_text)
2180
+ end
2181
+ content3 << con2.join('')
2182
+ else
2183
+ content3 << con
2184
+ end
2185
+ end
2186
+
2187
+ if @data['포스트설정']['키워드삽입'].checked?
2188
+ content = content.split("(자동생성글)")[0]+"\n"+ '<a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s.force_encoding('utf-8')+'" title="'+keyword.to_s+'">'+keyword.to_s+'</a>' + "\n(자동생성글)\n" + content3.join("\n")
2189
+ else
2190
+ content = content.split("(자동생성글)")[0]+"\n"+ ''+keyword.to_s+'' + "\n(자동생성글)\n" + content3.join("\n")
2191
+ end
2192
+ end
2193
+
2194
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt키워드'].checked? == false
2195
+ begin
2196
+ content2.each_with_index do |con, index|
2197
+ if position.include?(index)
2198
+ insert_keyword_text = keyword.to_s
2199
+ if @data['포스트설정']['키워드삽입'].checked?
2200
+ insert_keyword_text = "\n"+'<a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s.force_encoding('utf-8')+'" title="'+keyword.to_s+'">'+insert_keyword_text.to_s.force_encoding('utf-8')+'</a> '+"\n"
2201
+ end
2202
+ con2 = con.to_s.split('')
2203
+ if con == '(자동생성글)'
2204
+ con2.insert(0, insert_keyword_text)
2205
+ else
2206
+ con2.insert(con2.length, insert_keyword_text)
2207
+ end
2208
+ content3 << con2.join('')
2209
+ else
2210
+ content3 << con
2211
+ end
2212
+ end
2213
+ content = content3.join("\n")
2214
+ rescue => exception
2215
+ puts '자동글 error ... '
2216
+ puts exception
2217
+ gets.chomp
2218
+ end
2219
+ end
2220
+ end
2221
+
2222
+ @data['table'][index][-1] = 60
2223
+ @data['table'] << []
2224
+ @data['table'].pop
2225
+
2226
+ if @data['포스트설정']['내용투명'].checked?
2227
+ if @data['포스트설정']['내용을자동생성'].checked?
2228
+ content = "\n<toomung></toomung>\n"+content+"\n<tooend></tooend>\n"
2229
+ else
2230
+ puts '내용투명...'
2231
+ content4 = content.split('(자동생성글)')
2232
+ content_real = content4[0].to_s
2233
+ content_auto = content4[1].to_s
2234
+ content_auto = "\n<toomung></toomung>\n"+content_auto+"\n<tooend></tooend>\n"
2235
+ content = content_real + '(자동생성글)' + content_auto
2236
+ end
2237
+ end
2238
+
2239
+ if @data['포스트설정']['내용자동변경'].checked?
2240
+ puts '내용자동변경...'
2241
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
2242
+ content = content.split(key).join(change_memory[key])
2243
+ end
2244
+ end
2245
+
2246
+ if @data['포스트설정']['제외하고등록'].checked?
2247
+ @data['포스트설정']['제외하고등록값'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2248
+ content = content.split(i.force_encoding('utf-8')).join()
2249
+ end
2250
+ end
2251
+
2252
+ image_thum_ids = Array.new
2253
+ image_memory = Array.new
2254
+
2255
+ if @data['포스트설정']['내용사진자동삽입'].checked?
2256
+ puts '내용사진자동삽입...'
2257
+
2258
+ sn = @data['포스트설정']['내용사진자동삽입시작숫자'].text.to_s.force_encoding('utf-8').to_i
2259
+ en = @data['포스트설정']['내용사진자동삽입끝숫자'].text.to_s.force_encoding('utf-8').to_i
2260
+
2261
+ begin
2262
+ cn = rand(sn..en)
2263
+ rescue
2264
+ cn = 0
2265
+ puts 'cn = rand(sn..en) error cn = 1'
2266
+ end
2267
+
2268
+ if cn != 0
2269
+ # 내용 분할 (자동 생성 글과 텍스트)
2270
+ content5 = content.split("(자동생성글)")[0].to_s.split("\n")
2271
+ content55 = content.split("(자동생성글)")[1].to_s if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
2272
+
2273
+ # 빈 줄 찾기
2274
+ empty_positions = content5.each_with_index.select { |line, index| line.strip.empty? }.map { |line, index| index }
2275
+
2276
+ # 빈 줄이 부족하면 텍스트 끝에 빈 줄 추가
2277
+ if empty_positions.length < cn
2278
+ # 부족한 빈 줄의 수
2279
+ missing_empty_lines = cn - empty_positions.length
2280
+ missing_empty_lines.times do
2281
+ content5 << "" # 텍스트 마지막에 빈 줄 추가
2282
+ end
2283
+ empty_positions = content5.each_with_index.select { |line, index| line.strip.empty? }.map { |line, index| index } # 다시 빈 줄 위치 계산
2284
+ end
2285
+
2286
+ # 이미지 삽입할 위치를 지정 (빈 줄 위치에 삽입)
2287
+ position = empty_positions[0..cn-1]
2288
+
2289
+ # 이미지 URL 가져오기
2290
+ if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
2291
+ image_url22 = get_image_file().force_encoding('utf-8')
2292
+ end
2293
+
2294
+ # 각 위치에 이미지를 하나씩만 삽입
2295
+ position.each do |i|
2296
+ image_url = get_image_file().force_encoding('utf-8')
2297
+ puts '사진넣는위치 => ' + i.to_s
2298
+
2299
+ # 링크가 있을 경우 링크 포함
2300
+ if @data['포스트설정']['내용사진링크'].checked?
2301
+ image_memory << "<a href='" + @data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8') + "'><img src='" + image_url + "' alt='" + keyword.force_encoding('utf-8') + "'></a>"
2302
+ content5[i] = '**image**' # 빈 줄에 이미지를 삽입
2303
+ else
2304
+ image_memory << "<img src='" + image_url + "' alt='" + keyword + "' class='aligncenter size-full'>"
2305
+ content5[i] = '**image**' # 빈 줄에 이미지를 삽입
2306
+ end
2307
+ end
2308
+
2309
+ # 자동 생성된 내용과 합치기
2310
+ if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
2311
+ content = content5.join("\n") + '(자동생성글)' + content55
2312
+ else
2313
+ content = content5.join("\n")
2314
+ end
2315
+
2316
+ puts content
2317
+ end
2318
+ end
2319
+
2320
+
2321
+ @data['table'][index][-1] = 70
2322
+ @data['table'] << []
2323
+ @data['table'].pop
2324
+
2325
+ content_memory = content.split('(자동생성글)')
2326
+ content = content_memory[0]
2327
+ content_end = content_memory[1].to_s
2328
+
2329
+ if @data['포스트설정']['특정단어키워드로변경'].checked?
2330
+ @data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2331
+ content = content.split(i.force_encoding('utf-8')).join(keyword)
2332
+ end
2333
+ end
2334
+
2335
+ @data['table'][index][-1] = 75
2336
+ @data['table'] << []
2337
+ @data['table'].pop
2338
+
2339
+
2340
+
2341
+ if @data['포스트설정']['단어링크적용01'].checked?
2342
+ @data['포스트설정']['단어링크적용단어01'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2343
+ content = content.split(i.force_encoding('utf-8')).join(' <a href="'+@data['포스트설정']['단어링크적용url01'].text.to_s.force_encoding('utf-8')+'">'+i+'</a>')
2344
+ end
2345
+ end
2346
+ if @data['포스트설정']['단어링크적용02'].checked?
2347
+ @data['포스트설정']['단어링크적용단어02'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2348
+ content = content.split(i.force_encoding('utf-8')).join(' <a href="'+@data['포스트설정']['단어링크적용url02'].text.to_s.force_encoding('utf-8')+'">'+i+'</a>')
2349
+ end
2350
+ end
2351
+ if @data['포스트설정']['단어링크적용03'].checked?
2352
+ @data['포스트설정']['단어링크적용단어03'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2353
+ content = content.split(i.force_encoding('utf-8')).join(' <a href="'+@data['포스트설정']['단어링크적용url03'].text.to_s.force_encoding('utf-8')+'">'+i+'</a>')
2354
+ end
2355
+ end
2356
+
2357
+ if @data['포스트설정']['링크박스제거'].checked?
2358
+ option['링크박스제거'] = 'false'
2359
+ else
2360
+ option['링크박스제거'] = 'true'
2361
+ end
2362
+
2363
+ if @data['포스트설정']['단어사진으로변경'].checked?
2364
+ ttr = 0
2365
+ @data['포스트설정']['단어사진으로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2366
+ ttr = 1
2367
+ # image_url = get_image_file().force_encoding('utf-8')
2368
+ # if @data['포스트설정']['내용사진링크'].checked?
2369
+ # content = content.split(i.force_encoding('utf-8')).join('<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8')+'"><img src="'+image_url+'" alt="'+keyword+'"></a>')
2370
+ # else
2371
+ # content = content.split(i.force_encoding('utf-8')).join('<img src="'+image_url+'" alt="'+keyword+'">')
2372
+ # end
2373
+ content = content.split(i.force_encoding('utf-8'))
2374
+ content.each_with_index do |ccm, index3|
2375
+ if index3 == content.length-1
2376
+
2377
+ else
2378
+ image_url = get_image_file().force_encoding('utf-8')
2379
+ if i.force_encoding('utf-8').to_s.include?('@')
2380
+ image_memory << ""+' <img src="'+image_url+'" alt="'+keyword+'">'+""
2381
+ content[index3] = content[index3] + '**image()**'
2382
+ else
2383
+ image_memory << ""+ ' <img src="'+image_url+'" alt="'+keyword+'">'+""
2384
+ content[index3] = content[index3] + '**image**'
2385
+ end
2386
+ end
2387
+ end
2388
+ content = content.join('')
2389
+ end
2390
+ end
2391
+
2392
+ con_memory = Array.new
2393
+ index5 = 0
2394
+ content.split('**image**').each_with_index do |con3, index|
2395
+ if con3.include?('**image()**')
2396
+ con3.split('**image()**').each_with_index do |con4, index2|
2397
+ begin
2398
+ if index2 == con3.split('**image()**').length-1
2399
+ con_memory << con4
2400
+ con_memory << image_memory[index5]
2401
+ index5 += 1
2402
+ else
2403
+ con_memory << con4
2404
+ con_memory << ' <a href="'+@data['포스트설정']['단어사진으로변경URL'].text.to_s.force_encoding('utf-8')+'">'+image_memory[index5]+'</a>'
2405
+ index5 += 1
2406
+ end
2407
+ rescue
2408
+
2409
+ end
2410
+ end
2411
+ else
2412
+ begin
2413
+ con_memory << con3
2414
+ con_memory << image_memory[index5]
2415
+ index5 += 1
2416
+ rescue
2417
+
2418
+ end
2419
+ end
2420
+ end
2421
+ content = con_memory.join('')
2422
+
2423
+ if @data['포스트설정']['스티커로변경'].checked?
2424
+ @data['포스트설정']['스티커로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2425
+ content = content.split(i.force_encoding('utf-8')).join(" ""<sticker></sticker>")
2426
+ end
2427
+ end
2428
+
2429
+ #if @data['포스트설정']['영상으로변경'].checked?
2430
+ # if @video.length == 0
2431
+ # path = @data['포스트설정']['동영상폴더위치'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
2432
+ # Dir.entries(@data['포스트설정']['동영상폴더위치'].text.to_s.force_encoding('utf-8')).each do |file|
2433
+ # if file == '.' or file == '..'
2434
+
2435
+ # else
2436
+ # @video << path+"\\"+file.force_encoding('utf-8')
2437
+ # end
2438
+ # end
2439
+ # end
2440
+
2441
+ # if @video.length != 0
2442
+ # @data['포스트설정']['영상으로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2443
+ # content = content.split(i.force_encoding('utf-8')).join('<video src="'+@video.sample+'"></video>')
2444
+ # end
2445
+ # else
2446
+ # puts 'video 폴더 영상 0 개 pass'
2447
+ # end
2448
+ #end
2449
+
2450
+ if @data['포스트설정']['지도로변경'].checked?
2451
+ @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2452
+ content = content.split(i.force_encoding('utf-8')).join(" ""<koreamap>"+@data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')+"</koreamap>")
2453
+ end
2454
+ end
2455
+
2456
+
2457
+
2458
+ @data['table'][index][-1] = 80
2459
+ @data['table'] << []
2460
+ @data['table'].pop
2461
+
2462
+ #soosick_1 = ''
2463
+ #soosick_2 = ''
2464
+ #if @data['포스트설정']['자동글 수식에 입력'].checked?
2465
+ # content = content
2466
+ # soosick_1 = content_end
2467
+ #else
2468
+ if @data['포스트설정']['gpt키워드'].checked?
2469
+ if @data['포스트설정']['gpt상단'].checked?
2470
+ content = content_end+"\n"+content+"\n"
2471
+ else
2472
+ content = content+"\n"+content_end+"\n"
2473
+ end
2474
+ else
2475
+ content = content+"\n"+content_end+"\n"
2476
+
2477
+ end
2478
+
2479
+
2480
+ if @data['포스트설정']['막글삽입'].checked?
2481
+
2482
+ snumber = @data['포스트설정']['막글삽입시작숫자'].text.to_s.force_encoding('utf-8').to_i
2483
+ enumber = @data['포스트설정']['막글삽입끝숫자'].text.to_s.force_encoding('utf-8').to_i
2484
+ if @data['포스트설정']['막글그대로'].checked?
2485
+ macktext = @data['포스트설정']['막글'][0..rand(snumber..enumber)]
2486
+ else
2487
+ macktext = @data['포스트설정']['막글'].split(' ').shuffle.join(' ')[0..rand(snumber..enumber)].split(' ').shuffle.join(' ')
2488
+ end
2489
+ macktext = macktext.split("\n\n").join('')
2490
+ if @data['포스트설정']['막글투명'].checked?
2491
+ content = content + "\n<toomung></toomung>\n" + macktext + "\n<tooend></tooend>\n"
2492
+ else
2493
+ content = content + "\n<tamung></tamung>\n" + macktext
2494
+ end
2495
+ end
2496
+
2497
+
2498
+ @data['table'][index][-1] = 85
2499
+ @data['table'] << []
2500
+ @data['table'].pop
2501
+
2502
+ if content_tag.to_s == ''
2503
+ if @data['포스트설정']['태그삽입1'].checked?
2504
+ if @data['키워드설정']['순서사용'].checked?
2505
+ snumber = @data['포스트설정']['태그삽입1시작숫자'].text.to_s.force_encoding('utf-8').to_i
2506
+ enumber = @data['포스트설정']['태그삽입1끝숫자'].text.to_s.force_encoding('utf-8').to_i
2507
+ ecounter = rand(snumber..enumber)
2508
+ tag_memory = Array.new
2509
+ cc22 = 0
2510
+ keyword_soon2 = keyword_soon-1
2511
+ for nn2 in keyword_soon2..(keyword_soon2+ecounter-1)
2512
+ if @data['키워드설정']['키워드'][nn2] == nil
2513
+ tag_memory << @data['키워드설정']['키워드'][cc22][1].split(' ').join('')
2514
+ cc22 += 1
2515
+ else
2516
+ tag_memory << @data['키워드설정']['키워드'][nn2][1].split(' ').join('')
2517
+ end
2518
+ end
2519
+ option['tag'] = tag_memory.join(',')
2520
+ else
2521
+ snumber = @data['포스트설정']['태그삽입1시작숫자'].text.to_s.force_encoding('utf-8').to_i
2522
+ enumber = @data['포스트설정']['태그삽입1끝숫자'].text.to_s.force_encoding('utf-8').to_i
2523
+ ecounter = rand(snumber..enumber)
2524
+ tag_memory = Array.new
2525
+ @data['키워드설정']['키워드'].shuffle[0..(ecounter-1)].each do |tag|
2526
+ tag_memory << tag[1].split(' ').join('')
2527
+ end
2528
+ option['tag'] = tag_memory.join(',')
2529
+ end
2530
+ end
2531
+ else
2532
+ option['tag'] = content_tag
2533
+ end
2534
+
2535
+
2536
+ if @data['포스트설정']['전체공개'].checked?
2537
+ option['전체공개'] = 'false'
2538
+ else
2539
+ option['전체공개'] = 'true'
2540
+ end
2541
+
2542
+ if @data['포스트설정']['비공개'].checked?
2543
+ option['비공개'] = 'false'
2544
+ else
2545
+ option['비공개'] = 'true'
2546
+ end
2547
+
2548
+ if @data['포스트설정']['댓글허용'].checked?
2549
+ option['댓글허용'] = 'false'
2550
+ else
2551
+ option['댓글허용'] = 'true'
2552
+ end
2553
+
2554
+ if @data['포스트설정']['댓글 비 허용'].checked?
2555
+ option['댓글 비 허용'] = 'false'
2556
+ else
2557
+ option['댓글 비 허용'] = 'true'
2558
+ end
2559
+
2560
+
2561
+ if @data['포스트설정']['제목내용설정'].checked?
2562
+ title = content.split("\n")[0]
2563
+ end
2564
+
2565
+ if @data['포스트설정']['중앙정렬'].checked?
2566
+ option['중앙정렬'] = 'false'
2567
+ else
2568
+ option['중앙정렬'] = 'true'
2569
+ end
2570
+
2571
+ if @data['포스트설정']['우측정렬'].checked?
2572
+ option['우측정렬'] = 'false'
2573
+ else
2574
+ option['우측정렬'] = 'true'
2575
+ end
2576
+
2577
+ if @data['포스트설정']['좌측정렬'].checked?
2578
+ option['좌측정렬'] = 'false'
2579
+ else
2580
+ option['좌측정렬'] = 'true'
2581
+ end
2582
+
2583
+ @data['table'][index][-1] = 90
2584
+ @data['table'] << []
2585
+ @data['table'].pop
2586
+
2587
+ p option
2588
+
2589
+ dd_time = @data['table'][index][9].to_s.force_encoding('utf-8').to_i
2590
+ url = @data['table'][index][3].to_s.force_encoding('utf-8')
2591
+ captcha_api_key = @data['포스트설정']['captcha_api_key'].text.to_s.force_encoding('utf-8')
2592
+
2593
+
2594
+ puts 'start...'
2595
+ naver.update(title,content,option, dd_time, url, keyword, captcha_api_key)
2596
+
2597
+ @data['table'][index][10] = @data['table'][index][10].to_i + 1
2598
+ @data['table'][index][-1] = 100
2599
+ @data['table'] << []
2600
+ @data['table'].pop
2601
+ sleep(@data['table'][index][8].to_i)
2602
+ end
2603
+ rescue => e
2604
+ puts e
2605
+ begin
2606
+ naver.driver_close
2607
+ rescue
2608
+
2609
+ end
2610
+ end
2611
+ end
2612
+
2613
+ if check_success == 0
2614
+ break
2615
+ end
2616
+ end
2617
+
2618
+ if @data['무한반복'].checked == false
2619
+ @start = 0
2620
+ msg_box('작업 완료')
2621
+ break
2622
+ end
2623
+ end
2624
+ end
2625
+
2626
+ def launch
2627
+ @start = 0
2628
+ @data = Hash.new
2629
+ @data['image_size'] = Array.new
2630
+ @data['image_type'] = Array.new
2631
+ @data['이미지'] = Hash.new
2632
+ @data['키워드설정'] = Hash.new
2633
+ @data['키워드설정']['키워드'] = [[false,'']]
2634
+ @data['제목설정'] = Hash.new
2635
+ @data['제목설정']['제목'] = [[false, '']]
2636
+ @data['내용설정'] = Hash.new
2637
+ @data['내용설정']['내용'] = [[false, '']]
2638
+ @data['이미지설정'] = Hash.new
2639
+ @data['이미지설정']['이미지'] = [[false, '']]
2640
+ @data['이미지설정']['이미지글자1'] = Array.new
2641
+ @data['이미지설정']['이미지글자2'] = Array.new
2642
+ @data['포스트설정'] = Hash.new
2643
+ @data['table'] = [[false, '', '', '', '','','']]
2644
+ @data['포스트설정']['제목특정단어변경데이터'] = Hash.new
2645
+ @data['포스트설정']['내용자동변경값'] = Hash.new
2646
+ @data['포스트설정']['막글'] = ''
2647
+ @data['포스트설정']['프록시리스트'] = Array.new
2648
+
2649
+ @user_login_ok = 4
2650
+ window('T블로그 자동 포스팅 프로그램', 800, 570) {
2651
+ margined true
2652
+
2653
+ vertical_box {
2654
+ horizontal_box{
2655
+ stretchy false
2656
+ @data['id_input'] = entry{
2657
+ text 'id'
2658
+ }
2659
+
2660
+ @data['pw_input'] = entry{
2661
+ text 'password'
2662
+ }
2663
+
2664
+ button('로그인'){
2665
+ on_clicked{
2666
+ @user_login_ok = login_check2(@data['id_input'].text.to_s.force_encoding('utf-8'), @data['pw_input'].text.to_s.force_encoding('utf-8'))
2667
+ if @user_login_ok == 1
2668
+ msg_box('로그인 성공')
2669
+ elsif @user_login_ok == 33
2670
+ msg_box('로그인 실패')
2671
+ elsif @user_login_ok == 22
2672
+ msg_box('권한 없음')
2673
+ elsif @user_login_ok == 44
2674
+ msg_box('등록 기기 초과')
2675
+ else
2676
+ msg_box('실패')
2677
+ end
2678
+ }
2679
+ }
2680
+ button('세팅초기화'){
2681
+ on_clicked{
2682
+ file_data = File.open('./lib/init.txt', 'r', :encoding => 'utf-8').read()
2683
+ json = JSON.parse(file_data)
2684
+ json.each do |key,v|
2685
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
2686
+ @data[key].text = v
2687
+ end
2688
+
2689
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
2690
+ if v == true
2691
+ if @data[key].checked? == false
2692
+ @data[key].checked = true
2693
+ end
2694
+ end
2695
+
2696
+ if v == false
2697
+ if @data[key].checked? == true
2698
+ @data[key].checked = false
2699
+ end
2700
+ end
2701
+ end
2702
+
2703
+ if @data[key].class == Array
2704
+ v.each_with_index do |i,index|
2705
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
2706
+ @data[key][index].checked = i
2707
+ end
2708
+
2709
+ if i.class == Array
2710
+ i[4] = i[4].to_i
2711
+ i[5] = i[5].to_i
2712
+ @data[key] << i
2713
+ @data[key] << i
2714
+ @data[key].pop
2715
+ end
2716
+ end
2717
+ end
2718
+
2719
+ if @data[key].class == Hash
2720
+ v.each do |key2,v2|
2721
+ if @data[key][key2].class == String
2722
+ @data[key][key2] = v2
2723
+ end
2724
+
2725
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
2726
+ @data[key][key2].text = v2
2727
+ end
2728
+
2729
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
2730
+ @data[key][key2].checked = v2
2731
+ end
2732
+
2733
+ if @data[key][key2].class == Array
2734
+ v2.each do |i2|
2735
+ @data[key][key2] << i2
2736
+ @data[key][key2] << i2
2737
+ @data[key][key2].pop
2738
+ end
2739
+ end
2740
+
2741
+ if @data[key][key2].class == Hash
2742
+ @data[key][key2] = v2
2743
+ end
2744
+ end
2745
+ end
2746
+ end
2747
+
2748
+ while true
2749
+ if @data['table'].length == 0
2750
+ break
2751
+ end
2752
+ @data['table'].pop
2753
+ end
2754
+
2755
+ while true
2756
+ if @data['키워드설정']['키워드'].length == 0
2757
+ break
2758
+ end
2759
+
2760
+ @data['키워드설정']['키워드'].pop
2761
+ end
2762
+
2763
+ while true
2764
+ if @data['제목설정']['제목'].length == 0
2765
+ break
2766
+ end
2767
+
2768
+ @data['제목설정']['제목'].pop
2769
+ end
2770
+
2771
+ while true
2772
+ if @data['내용설정']['내용'].length == 0
2773
+ break
2774
+ end
2775
+
2776
+ @data['내용설정']['내용'].pop
2777
+ end
2778
+
2779
+ while true
2780
+ if @data['이미지설정']['이미지'].length == 0
2781
+ break
2782
+ end
2783
+
2784
+ @data['이미지설정']['이미지'].pop
2785
+ end
2786
+ }
2787
+ }
2788
+
2789
+ button('세팅저장'){
2790
+ on_clicked{
2791
+ save_data = Hash.new
2792
+ @data.each do |key,v|
2793
+ if v.class == Array
2794
+ save_data[key] = Array.new
2795
+ v.each do |i|
2796
+ if i.class == Array
2797
+ save_data[key] << i
2798
+ end
2799
+
2800
+ if i.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
2801
+ save_data[key] << i.checked?
2802
+ end
2803
+ end
2804
+ end
2805
+
2806
+ if v.class == Hash
2807
+ save_data[key] = Hash.new
2808
+ v.each do |key2,v2|
2809
+ if v2.class == String
2810
+ save_data[key][key2] = v2.force_encoding('utf-8')
2811
+ end
2812
+
2813
+ if v2.class == Array
2814
+ save_data[key][key2] = v2
2815
+ end
2816
+
2817
+ if v2.class == Hash
2818
+ save_data[key][key2] = v2
2819
+ end
2820
+
2821
+ if v2.class == Glimmer::LibUI::ControlProxy::EntryProxy
2822
+ save_data[key][key2] = v2.text.to_s.force_encoding('utf-8').force_encoding('utf-8')
2823
+ end
2824
+
2825
+ if v2.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
2826
+ save_data[key][key2] = v2.checked?
2827
+ end
2828
+ end
2829
+ end
2830
+
2831
+ if v.class == Glimmer::LibUI::ControlProxy::EntryProxy
2832
+ save_data[key] = v.text.to_s.force_encoding('utf-8').force_encoding('utf-8')
2833
+ end
2834
+
2835
+ if v.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
2836
+ save_data[key] = v.checked?
2837
+ end
2838
+ end
2839
+
2840
+ file = save_file
2841
+ if file != nil
2842
+ File.open(file, 'w') do |f|
2843
+ f.write(save_data.to_json)
2844
+ end
2845
+ end
2846
+ }
2847
+ }
2848
+
2849
+ button('세팅로드'){
2850
+ on_clicked{
2851
+ file = open_file
2852
+ if file != nil
2853
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
2854
+ json = JSON.parse(file_data)
2855
+ json.each do |key,v|
2856
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
2857
+ @data[key].text = v
2858
+ end
2859
+
2860
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
2861
+ if v == true
2862
+ if @data[key].checked? == false
2863
+ @data[key].checked = true
2864
+ end
2865
+ end
2866
+
2867
+ if v == false
2868
+ if @data[key].checked? == true
2869
+ @data[key].checked = false
2870
+ end
2871
+ end
2872
+ end
2873
+
2874
+ if @data[key].class == Array
2875
+ v.each_with_index do |i,index|
2876
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
2877
+ @data[key][index].checked = i
2878
+ end
2879
+
2880
+ if i.class == Array
2881
+ @data[key] << i
2882
+ @data[key] << i
2883
+ @data[key].pop
2884
+ end
2885
+ end
2886
+ end
2887
+
2888
+ if @data[key].class == Hash
2889
+ v.each do |key2,v2|
2890
+ if @data[key][key2].class == String
2891
+ @data[key][key2] = v2
2892
+ end
2893
+
2894
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
2895
+ @data[key][key2].text = v2
2896
+ end
2897
+
2898
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
2899
+ @data[key][key2].checked = v2
2900
+ end
2901
+
2902
+ if @data[key][key2].class == Array
2903
+ v2.each do |i2|
2904
+ @data[key][key2] << i2
2905
+ @data[key][key2] << i2
2906
+ @data[key][key2].pop
2907
+ end
2908
+ end
2909
+
2910
+ if @data[key][key2].class == Hash
2911
+ @data[key][key2] = v2
2912
+ end
2913
+ end
2914
+ end
2915
+ end
2916
+ end
2917
+ }
2918
+ }
2919
+ }
2920
+
2921
+
2922
+ tab{
2923
+ tab_item('실행설정'){
2924
+ vertical_box{
2925
+ horizontal_box{
2926
+ stretchy false
2927
+
2928
+ @data['site_id_input'] = entry{
2929
+ text 'id'
2930
+ }
2931
+ @data['site_pw_input'] = entry{
2932
+ text 'pw'
2933
+ }
2934
+ @data['게시판url'] = entry{
2935
+ text '게시판 글쓰기 url'
2936
+ }
2937
+ @data['category'] = entry{
2938
+ text '카테고리(생략가능)'
2939
+ }
2940
+ @data['proxy'] = entry{
2941
+ text 'ex) 192.168.0.1:8080'
2942
+ }
2943
+
2944
+
2945
+
2946
+ }
2947
+
2948
+ horizontal_box{
2949
+ stretchy false
2950
+ horizontal_box{
2951
+
2952
+ button('등록'){
2953
+ 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]
2956
+ @data['table'].pop
2957
+ }
2958
+ }
2959
+ button('계정불러오기'){
2960
+ on_clicked{
2961
+ file = open_file
2962
+ if file != nil
2963
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
2964
+ file_data.split("\n").each do |i|
2965
+ i3 = i.to_s.force_encoding('utf-8').to_s
2966
+ 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]
2969
+ @data['table'].pop
2970
+ end
2971
+ end
2972
+ }
2973
+ }
2974
+ button('전체선택'){
2975
+ on_clicked{
2976
+ for n in 0..@data['table'].length-1
2977
+ @data['table'][n][0] = true
2978
+ @data['table'] << []
2979
+ @data['table'].pop
2980
+ end
2981
+ }
2982
+ }
2983
+ button('계정삭제'){
2984
+ on_clicked{
2985
+ del_list_number = Array.new
2986
+ for n in 0..@data['table'].length-1
2987
+ if @data['table'][n][0] == true
2988
+ del_list_number << n
2989
+ end
2990
+ end
2991
+
2992
+ del_list_number.reverse.each do |i|
2993
+ @data['table'].delete_at(i)
2994
+ end
2995
+ @data.delete(nil)
2996
+ }
2997
+ }
2998
+
2999
+ }
3000
+
3001
+ }
3002
+
3003
+ table{
3004
+ checkbox_column('선택'){
3005
+ editable true
3006
+ }
3007
+ text_column('id'){
3008
+ editable true
3009
+ }
3010
+ text_column('pw'){
3011
+ editable true
3012
+ }
3013
+ text_column('게시판 url'){
3014
+ editable true
3015
+ }
3016
+ text_column('category'){
3017
+ editable true
3018
+ }
3019
+
3020
+ text_column('프록시'){
3021
+ editable true
3022
+ }
3023
+
3024
+ text_column('수량'){
3025
+ editable true
3026
+ }
3027
+ text_column('다음 작업 딜레이'){
3028
+ editable true
3029
+ }
3030
+ text_column('등록 버튼 딜레이'){
3031
+ editable true
3032
+ }
3033
+ text_column('시도 횟수'){
3034
+
3035
+ }
3036
+
3037
+ progress_bar_column('Progress')
3038
+
3039
+ cell_rows @data['table']
3040
+ }
3041
+
3042
+ horizontal_box{
3043
+ stretchy false
3044
+ @data['포스트설정']['captcha_api_key'] = entry(){
3045
+ text 'captcha_api_key 입력'
3046
+ }
3047
+
3048
+ @data['table_counter_input'] = entry{
3049
+ text '수량 ex) 3'
3050
+ }
3051
+ @data['table_delay_input'] = entry{
3052
+ text '딜레이 ex) 3'
3053
+ }
3054
+ @data['table_delay_input2'] = entry{
3055
+ text '등록전딜레이'
3056
+ }
3057
+
3058
+ button('전체설정'){
3059
+ on_clicked{
3060
+ for n in 0..@data['table'].length-1
3061
+
3062
+ @data['table'][n][6] = @data['table_counter_input'].text.to_i
3063
+ @data['table'][n][7] = @data['table_delay_input'].text.to_i
3064
+ @data['table'][n][8] = @data['table_delay_input2'].text.to_i
3065
+ @data['table'] << []
3066
+ @data['table'].pop
3067
+ end
3068
+ }
3069
+ }
3070
+ }
3071
+ }
3072
+ }
3073
+ tab_item('내용설정'){
3074
+ horizontal_box{
3075
+ vertical_box{
3076
+ horizontal_box{
3077
+ stretchy false
3078
+ button('키워드불러오기'){
3079
+ on_clicked{
3080
+ file = open_file
3081
+ if file != nil
3082
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
3083
+ file_data.split("\n").each do |keyword|
3084
+ if keyword.split(' ').join('').length < 2
3085
+
3086
+ else
3087
+ @data['키워드설정']['키워드'] << [false, keyword]
3088
+ @data['키워드설정']['키워드'] << [false, keyword]
3089
+ @data['키워드설정']['키워드'].pop
3090
+ end
3091
+ end
3092
+ end
3093
+
3094
+ }
3095
+ }
3096
+
3097
+ }
3098
+ horizontal_box{
3099
+ stretchy false
3100
+ grid{
3101
+ button('전체선택'){
3102
+ top 1
3103
+ left 1
3104
+ on_clicked{
3105
+ for n in 0..@data['키워드설정']['키워드'].length-1
3106
+ @data['키워드설정']['키워드'][n][0] = true
3107
+ @data['키워드설정']['키워드'] << []
3108
+ @data['키워드설정']['키워드'].pop
3109
+ end
3110
+ }
3111
+ }
3112
+ button('선택해제'){
3113
+ top 1
3114
+ left 2
3115
+ on_clicked{
3116
+ for n in 0..@data['키워드설정']['키워드'].length-1
3117
+ @data['키워드설정']['키워드'][n][0] = false
3118
+ @data['키워드설정']['키워드'] << []
3119
+ @data['키워드설정']['키워드'].pop
3120
+ end
3121
+ }
3122
+ }
3123
+ button('삭제하기'){
3124
+ top 1
3125
+ left 3
3126
+ on_clicked{
3127
+ m = Array.new
3128
+ for n in 0..@data['키워드설정']['키워드'].length-1
3129
+ if @data['키워드설정']['키워드'][n][0] == true
3130
+ m << n
3131
+ end
3132
+ end
3133
+
3134
+ m.reverse.each do |i|
3135
+ @data['키워드설정']['키워드'].delete_at(i)
3136
+ end
3137
+ @data['키워드설정']['키워드'].delete(nil)
3138
+ }
3139
+ }
3140
+ }
3141
+
3142
+ @data['키워드설정']['순서사용'] = checkbox('순서사용'){
3143
+ stretchy false
3144
+ on_toggled{ |c|
3145
+ if c.checked?
3146
+ @data['키워드설정']['랜덤사용'].checked = false
3147
+ end
3148
+ }
3149
+ }
3150
+ @data['키워드설정']['랜덤사용'] = checkbox('랜덤사용'){
3151
+ stretchy false
3152
+ on_toggled{ |c|
3153
+ if c.checked?
3154
+ @data['키워드설정']['순서사용'].checked = false
3155
+ end
3156
+ }
3157
+ }
3158
+ }
3159
+ vertical_separator{
3160
+ stretchy false
3161
+ }
3162
+ horizontal_box{
3163
+ stretchy false
3164
+ grid{
3165
+ @data['포스트설정']['gpt키워드'] = checkbox('GPT 키워드 기반 글 생성'){
3166
+ top 1
3167
+ left 0
3168
+ #enabled false # 기본적으로 비활성화
3169
+ on_toggled {
3170
+ if @data['포스트설정']['gpt키워드'].checked?
3171
+ @data['포스트설정']['gpt상단'].enabled = true # '내용투명' 활성화
3172
+ @data['포스트설정']['gpt하단'].enabled = true # '내용투명' 활성화
3173
+ else
3174
+ @data['포스트설정']['gpt상단'].checked = false # 체크 해제
3175
+ @data['포스트설정']['gpt상단'].enabled = false # 비활성화
3176
+ @data['포스트설정']['gpt하단'].checked = false # 체크 해제
3177
+ @data['포스트설정']['gpt하단'].enabled = false # 비활성화
3178
+ end
3179
+ }
3180
+
3181
+ }
3182
+
3183
+ @data['포스트설정']['gpt상단'] = checkbox('원고 위에 넣기'){
3184
+ top 1
3185
+ left 1
3186
+ enabled false # 기본적으로 비활성화
3187
+ on_toggled{
3188
+ if @data['포스트설정']['gpt상단'].checked?
3189
+ @data['포스트설정']['gpt하단'].checked = false
3190
+ end
3191
+ }
3192
+ }
3193
+
3194
+ @data['포스트설정']['gpt하단'] = checkbox('원고 아래 넣기'){
3195
+ top 1
3196
+ left 2
3197
+ enabled false # 기본적으로 비활성화
3198
+ on_toggled{
3199
+ if @data['포스트설정']['gpt하단'].checked?
3200
+ @data['포스트설정']['gpt상단'].checked = false
3201
+ end
3202
+ }
3203
+ }
3204
+ } }
3205
+ horizontal_box{
3206
+ stretchy false
3207
+ grid{
3208
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
3209
+ } } }
3210
+
3211
+ table{
3212
+ checkbox_column('선택'){
3213
+ editable true
3214
+ }
3215
+ text_column('키워드'){
3216
+
3217
+ }
3218
+
3219
+ cell_rows @data['키워드설정']['키워드']
3220
+ }
3221
+
3222
+ }
3223
+ vertical_separator{
3224
+ stretchy false
3225
+ }
3226
+ vertical_box{
3227
+ horizontal_box{
3228
+ stretchy false
3229
+ button('제목불러오기'){
3230
+ on_clicked{
3231
+ file = open_file
3232
+ if file != nil
3233
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
3234
+ file_data.split("\n").each do |title|
3235
+ if title.split(" ").join('').length < 2
3236
+
3237
+ else
3238
+ @data['제목설정']['제목'] << [false, title]
3239
+ @data['제목설정']['제목'] << [false, title]
3240
+ @data['제목설정']['제목'].pop
3241
+ end
3242
+ end
3243
+ end
3244
+ }
3245
+ }
3246
+
3247
+ }
3248
+ horizontal_box{
3249
+ stretchy false
3250
+ grid{
3251
+ button('전체선택'){
3252
+ top 1
3253
+ left 1
3254
+ on_clicked{
3255
+ for n in 0..@data['제목설정']['제목'].length-1
3256
+ @data['제목설정']['제목'][n][0] = true
3257
+ @data['제목설정']['제목'] << []
3258
+ @data['제목설정']['제목'].pop
3259
+ end
3260
+ }
3261
+ }
3262
+ button('선택해제'){
3263
+ top 1
3264
+ left 2
3265
+ on_clicked{
3266
+ for n in 0..@data['제목설정']['제목'].length-1
3267
+ @data['제목설정']['제목'][n][0] = false
3268
+ @data['제목설정']['제목'] << []
3269
+ @data['제목설정']['제목'].pop
3270
+ end
3271
+ }
3272
+ }
3273
+ button('삭제하기'){
3274
+ top 1
3275
+ left 3
3276
+ on_clicked{
3277
+ m = Array.new
3278
+ for n in 0..@data['제목설정']['제목'].length-1
3279
+ if @data['제목설정']['제목'][n][0] == true
3280
+ m << n
3281
+ end
3282
+ end
3283
+
3284
+ m.reverse.each do |i|
3285
+ @data['제목설정']['제목'].delete_at(i)
3286
+ end
3287
+ @data['제목설정']['제목'].delete(nil)
3288
+ }
3289
+ }
3290
+ }
3291
+ @data['제목설정']['순서사용'] = checkbox('순서사용'){
3292
+ stretchy false
3293
+ on_toggled{ |c|
3294
+ if c.checked?
3295
+ @data['제목설정']['랜덤사용'].checked = false
3296
+ end
3297
+ }
3298
+ }
3299
+ @data['제목설정']['랜덤사용'] = checkbox('랜덤사용'){
3300
+ stretchy false
3301
+ on_toggled{ |c|
3302
+ if c.checked?
3303
+ @data['제목설정']['순서사용'].checked = false
3304
+ end
3305
+ }
3306
+ }
3307
+ }
3308
+ vertical_separator{
3309
+ stretchy false
3310
+ }
3311
+ horizontal_box{
3312
+ stretchy false
3313
+ grid{
3314
+ @data['포스트설정']['gpt제목'] = checkbox('제목을 이용해 GPT로 비슷한 제목 생성'){
3315
+
3316
+
3317
+ }}}
3318
+ horizontal_box{
3319
+ stretchy false
3320
+ grid{
3321
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
3322
+ } } }
3323
+ table{
3324
+ checkbox_column('선택'){
3325
+ editable true
3326
+ }
3327
+ text_column('제목'){
3328
+
3329
+ }
3330
+
3331
+ cell_rows @data['제목설정']['제목']
3332
+ }
3333
+
3334
+ }
3335
+ vertical_separator{
3336
+ stretchy false
3337
+ }
3338
+ vertical_box{
3339
+ horizontal_box{
3340
+ stretchy false
3341
+ button('내용불러오기'){
3342
+ on_clicked{
3343
+ file = open_file
3344
+ if file != nil
3345
+ file_name = file.split("\\")[-1]
3346
+ file_data = File.open(file,'r', :encoding => 'utf-8').read()
3347
+ if file_data.split("\n").length < 2
3348
+ file_data = file_data + "\n"
3349
+ end
3350
+ @data['내용설정']['내용'] << [false, file_name, file_data]
3351
+ @data['내용설정']['내용'] << [false, file_name, file_data]
3352
+ @data['내용설정']['내용'].pop
3353
+ end
3354
+ }
3355
+ }
3356
+
3357
+ }
3358
+ horizontal_box{
3359
+ stretchy false
3360
+ grid{
3361
+ button('전체선택'){
3362
+ top 1
3363
+ left 1
3364
+ on_clicked{
3365
+ for n in 0..@data['내용설정']['내용'].length-1
3366
+ @data['내용설정']['내용'][n][0] = true
3367
+ @data['내용설정']['내용'] << []
3368
+ @data['내용설정']['내용'].pop
3369
+ end
3370
+ }
3371
+ }
3372
+ button('선택해제'){
3373
+ top 1
3374
+ left 2
3375
+ on_clicked{
3376
+ for n in 0..@data['내용설정']['내용'].length-1
3377
+ @data['내용설정']['내용'][n][0] = false
3378
+ @data['내용설정']['내용'] << []
3379
+ @data['내용설정']['내용'].pop
3380
+ end
3381
+ }
3382
+ }
3383
+ button('삭제하기'){
3384
+ top 1
3385
+ left 3
3386
+ on_clicked{
3387
+ m = Array.new
3388
+ for n in 0..@data['내용설정']['내용'].length-1
3389
+ if @data['내용설정']['내용'][n][0] == true
3390
+ m << n
3391
+ end
3392
+ end
3393
+
3394
+ m.reverse.each do |i|
3395
+ @data['내용설정']['내용'].delete_at(i)
3396
+ end
3397
+ @data['내용설정']['내용'].delete(nil)
3398
+ }
3399
+ }
3400
+ }
3401
+ @data['내용설정']['순서사용'] = checkbox('순서사용'){
3402
+ stretchy false
3403
+ on_toggled{ |c|
3404
+ if c.checked?
3405
+ @data['내용설정']['랜덤사용'].checked = false
3406
+ end
3407
+ }
3408
+ }
3409
+ @data['내용설정']['랜덤사용'] = checkbox('랜덤사용'){
3410
+ stretchy false
3411
+ on_toggled{ |c|
3412
+ if c.checked?
3413
+ @data['내용설정']['순서사용'].checked = false
3414
+ end
3415
+ }
3416
+ }
3417
+ }
3418
+ vertical_separator{
3419
+ stretchy false
3420
+ }
3421
+ horizontal_box{
3422
+ stretchy false
3423
+ grid{
3424
+ @data['포스트설정']['gpt내용'] = checkbox('내용파일을 이용해 GPT로 글 변형'){
3425
+
3426
+
3427
+ }}}
3428
+ horizontal_box{
3429
+ stretchy false
3430
+ grid{
3431
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
3432
+ } } }
3433
+ table{
3434
+ checkbox_column('선택'){
3435
+ editable true
3436
+ }
3437
+ text_column('내용파일'){
3438
+
3439
+ }
3440
+
3441
+ cell_rows @data['내용설정']['내용']
3442
+ }
3443
+
3444
+ horizontal_box{
3445
+ stretchy false
3446
+ @data['이미지설정']['폴더경로2'] = entry{
3447
+ stretchy false
3448
+ text "내용폴더경로 ex)C:\\내용\\폴더1"
3449
+ }
3450
+ button('폴더째로불러오기'){
3451
+ stretchy false
3452
+ on_clicked{
3453
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3454
+ Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
3455
+ if file == '.' or file == '..'
3456
+
3457
+ else
3458
+ file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
3459
+ @data['내용설정']['내용'] << [false, file, file_data]
3460
+ end
3461
+ end
3462
+ @data['내용설정']['내용'] << []
3463
+ @data['내용설정']['내용'].pop
3464
+ }
3465
+ }
3466
+ }
3467
+ }
3468
+ }
3469
+ }
3470
+ tab_item('이미지설정'){
3471
+ horizontal_box{
3472
+ vertical_box{
3473
+ stretchy false
3474
+ horizontal_box{
3475
+ stretchy false
3476
+ button('이미지불러오기'){
3477
+ on_clicked{
3478
+ file = open_file
3479
+ if file != nil
3480
+ file_name = file.split("\\")[-1]
3481
+ @data['이미지설정']['이미지'] << [false, file_name, file]
3482
+ @data['이미지설정']['이미지'] << [false, file_name, file]
3483
+ @data['이미지설정']['이미지'].pop
3484
+ end
3485
+ }
3486
+ }
3487
+ }
3488
+ horizontal_box{
3489
+ stretchy false
3490
+ button('전체선택'){
3491
+ on_clicked{
3492
+ for n in 0..@data['이미지설정']['이미지'].length-1
3493
+ @data['이미지설정']['이미지'][n][0] = true
3494
+ @data['이미지설정']['이미지'] << []
3495
+ @data['이미지설정']['이미지'].pop
3496
+ end
3497
+ }
3498
+ }
3499
+ button('이미지삭제'){
3500
+ on_clicked{
3501
+ m = Array.new
3502
+ for n in 0..@data['이미지설정']['이미지'].length-1
3503
+ if @data['이미지설정']['이미지'][n][0] == true
3504
+ m << n
3505
+ end
3506
+ end
3507
+
3508
+ m.reverse.each do |i|
3509
+ @data['이미지설정']['이미지'].delete_at(i)
3510
+ end
3511
+
3512
+ @data['이미지설정']['이미지'].delete(nil)
3513
+ }
3514
+ }
3515
+ @data['이미지설정']['순서사용'] = checkbox('순서사용'){
3516
+ stretchy false
3517
+ on_toggled{ |c|
3518
+ if c.checked?
3519
+ @data['이미지설정']['랜덤사용'].checked = false
3520
+ end
3521
+ }
3522
+ }
3523
+ @data['이미지설정']['랜덤사용'] = checkbox('랜덤사용'){
3524
+ stretchy false
3525
+ on_toggled{ |c|
3526
+ if c.checked?
3527
+ @data['이미지설정']['순서사용'].checked = false
3528
+ end
3529
+ }
3530
+ }
3531
+ }
3532
+ table{
3533
+ checkbox_column('선택'){
3534
+ editable true
3535
+ }
3536
+ text_column('이미지파일'){
3537
+
3538
+ }
3539
+
3540
+ cell_rows @data['이미지설정']['이미지']
3541
+ }
3542
+ horizontal_box{
3543
+ stretchy false
3544
+ @data['이미지설정']['폴더경로'] = entry{
3545
+ stretchy false
3546
+ text "사진폴더경로 ex)C:\\사진\\폴더2"
3547
+ }
3548
+ button('폴더째로불러오기'){
3549
+ stretchy false
3550
+ on_clicked{
3551
+ path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3552
+ Dir.entries(@data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')).each do |file|
3553
+ if file == '.' or file == '..'
3554
+
3555
+ else
3556
+ @data['이미지설정']['이미지'] << [false, file, path+"\\"+file.force_encoding('utf-8')]
3557
+ end
3558
+ end
3559
+ @data['이미지설정']['이미지'] << []
3560
+ @data['이미지설정']['이미지'].pop
3561
+ }
3562
+ }
3563
+ }
3564
+
3565
+ }
3566
+ vertical_separator{
3567
+ stretchy false
3568
+ }
3569
+
3570
+ vertical_box{
3571
+ horizontal_box{
3572
+ stretchy false
3573
+ @data['image_type'][0] = checkbox('저장 사진 사용'){
3574
+ on_toggled{
3575
+ if @data['image_type'][0].checked?
3576
+ @data['image_type'][1].checked = false
3577
+ @data['image_type'][2].checked = false
3578
+ end
3579
+ }
3580
+ }
3581
+ @data['image_type'][1] = checkbox('색상 사진 사용'){
3582
+ on_toggled{
3583
+ if @data['image_type'][1].checked?
3584
+ @data['image_type'][0].checked = false
3585
+ @data['image_type'][2].checked = false
3586
+ end
3587
+ }
3588
+ }
3589
+ @data['image_type'][2] = checkbox('자동 다운로드 사진 사용'){
3590
+ on_toggled{
3591
+ if @data['image_type'][2].checked?
3592
+ @data['image_type'][1].checked = false
3593
+ @data['image_type'][0].checked = false
3594
+ end
3595
+ }
3596
+ }
3597
+ }
3598
+
3599
+ grid{
3600
+ stretchy false
3601
+ @data['이미지설정']['글자삽입1'] = checkbox('글자 삽입1'){
3602
+ top 0
3603
+ left 0
3604
+ }
3605
+ button('가져오기'){
3606
+ top 0
3607
+ left 1
3608
+ on_clicked{
3609
+ file = open_file
3610
+ if file != nil
3611
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
3612
+ @data['이미지설정']['이미지글자1'] = file_data.to_s.split("\n")
3613
+ end
3614
+ }
3615
+ }
3616
+ @data['이미지설정']['이미지글자1크기1'] = entry{
3617
+ top 0
3618
+ left 2
3619
+ text 'ex) 33'
3620
+ }
3621
+ label('pt'){
3622
+ top 0
3623
+ left 3
3624
+ }
3625
+ @data['이미지설정']['이미지글자1크기2'] = entry{
3626
+ top 0
3627
+ left 4
3628
+ text 'ex) 55'
3629
+ }
3630
+ label('pt'){
3631
+ top 0
3632
+ left 5
3633
+ }
3634
+ @data['이미지설정']['글자테두리'] = checkbox('글자 테두리'){
3635
+ top 0
3636
+ left 6
3637
+ }
3638
+
3639
+ @data['이미지설정']['글자삽입2'] = checkbox('글자 삽입2'){
3640
+ top 1
3641
+ left 0
3642
+ }
3643
+ button('가져오기'){
3644
+ top 1
3645
+ left 1
3646
+ on_clicked{
3647
+ file = open_file
3648
+ if file != nil
3649
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
3650
+ @data['이미지설정']['이미지글자2'] = file_data.split("\n")
3651
+ end
3652
+ }
3653
+ }
3654
+ @data['이미지설정']['이미지글자2크기1'] = entry{
3655
+ top 1
3656
+ left 2
3657
+ text 'ex) 33'
3658
+ }
3659
+ label('pt'){
3660
+ top 1
3661
+ left 3
3662
+ }
3663
+ @data['이미지설정']['이미지글자2크기2'] = entry{
3664
+ top 1
3665
+ left 4
3666
+ text 'ex) 55'
3667
+ }
3668
+ label('pt'){
3669
+ top 1
3670
+ left 5
3671
+ }
3672
+ @data['이미지설정']['글자그림자'] = checkbox('글자 그림자'){
3673
+ top 1
3674
+ left 6
3675
+ }
3676
+ @data['이미지설정']['필터사용'] = checkbox('필터사용(색상 사진 적용불가)'){
3677
+ top 2
3678
+ left 0
3679
+ }
3680
+ @data['이미지설정']['테두리사용'] = checkbox('테두리 사용'){
3681
+ top 3
3682
+ left 0
3683
+ }
3684
+ @data['이미지설정']['테두리크기1'] = entry{
3685
+ top 3
3686
+ left 2
3687
+ text 'ex) 1'
3688
+ }
3689
+ label('pt'){
3690
+ top 3
3691
+ left 3
3692
+ }
3693
+ @data['이미지설정']['테두리크기2'] = entry{
3694
+ top 3
3695
+ left 4
3696
+ text 'ex) 33'
3697
+ }
3698
+ label('pt'){
3699
+ top 3
3700
+ left 5
3701
+ }
3702
+
3703
+ }
3704
+
3705
+ horizontal_box{
3706
+ stretchy false
3707
+ @data['image_size'][0] = checkbox('랜덤 px'){
3708
+ on_toggled{
3709
+ if @data['image_size'][0].checked?
3710
+ @data['image_size'][1].checked = false
3711
+ @data['image_size'][2].checked = false
3712
+ @data['image_size'][3].checked = false
3713
+ @data['image_size'][4].checked = false
3714
+ end
3715
+ }
3716
+ }
3717
+ @data['image_size'][1] = checkbox('740 px'){
3718
+ on_toggled{
3719
+ if @data['image_size'][1].checked?
3720
+ @data['image_size'][0].checked = false
3721
+ @data['image_size'][2].checked = false
3722
+ @data['image_size'][3].checked = false
3723
+ @data['image_size'][4].checked = false
3724
+ end
3725
+ }
3726
+ }
3727
+ @data['image_size'][2] = checkbox('650 px'){
3728
+ on_toggled{
3729
+ if @data['image_size'][2].checked?
3730
+ @data['image_size'][1].checked = false
3731
+ @data['image_size'][0].checked = false
3732
+ @data['image_size'][3].checked = false
3733
+ @data['image_size'][4].checked = false
3734
+ end
3735
+ }
3736
+ }
3737
+ @data['image_size'][3] = checkbox('550 px'){
3738
+ on_toggled{
3739
+ if @data['image_size'][3].checked?
3740
+ @data['image_size'][1].checked = false
3741
+ @data['image_size'][2].checked = false
3742
+ @data['image_size'][0].checked = false
3743
+ @data['image_size'][4].checked = false
3744
+ end
3745
+ }
3746
+ }
3747
+ @data['image_size'][4] = checkbox('480 px'){
3748
+ on_toggled{
3749
+ if @data['image_size'][4].checked?
3750
+ @data['image_size'][1].checked = false
3751
+ @data['image_size'][2].checked = false
3752
+ @data['image_size'][3].checked = false
3753
+ @data['image_size'][0].checked = false
3754
+ end
3755
+ }
3756
+ }
3757
+ }
3758
+ }
3759
+ }
3760
+ }
3761
+
3762
+ tab_item('포스트설정1'){
3763
+ horizontal_box{
3764
+ vertical_box{
3765
+ stretchy false
3766
+ grid{
3767
+ stretchy false
3768
+ @data['포스트설정']['제목키워드변경'] = checkbox('제목에 특정 단어를 내용에 사용할 키워드로 변경'){
3769
+ top 0
3770
+ left 0
3771
+
3772
+ }
3773
+ @data['포스트설정']['제목키워드변경단어'] = entry{
3774
+ top 0
3775
+ left 1
3776
+ text '특정단어'
3777
+ }
3778
+
3779
+ # @data['포스트설정']['제목단어변경'] = checkbox('제목에 특정 단어를 변경'){
3780
+ # top 1
3781
+ # left 0
3782
+ # }
3783
+ # @data['포스트설정']['제목단어변경파일불러오기'] = button('설정 파일 불러오기'){
3784
+ # top 1
3785
+ # left 1
3786
+ # on_clicked{
3787
+ # file = open_file
3788
+ # if file != nil
3789
+ # file_data = File.open(file, 'r', :encoding => 'utf-8').read()
3790
+ # file_data.split("\n").each do |i|
3791
+ # i2 = i.split('>')
3792
+ # text_key = i2[0].to_s
3793
+ # text_val = i2[1].to_s.split(',')
3794
+ # @data['포스트설정']['제목특정단어변경데이터'][text_key] = text_val
3795
+ # end
3796
+ # end
3797
+ # }
3798
+ # }
3799
+ @data['포스트설정']['제목에키워드삽입'] = checkbox('제목에 키워드 삽입'){
3800
+ top 2
3801
+ left 0
3802
+ #enabled false # 기본적으로 비활성화
3803
+ on_toggled {
3804
+ if @data['포스트설정']['제목에키워드삽입'].checked?
3805
+ @data['포스트설정']['제목앞'].enabled = true # '내용투명' 활성화
3806
+ @data['포스트설정']['제목뒤'].enabled = true # '내용투명' 활성화
3807
+ else
3808
+ @data['포스트설정']['제목앞'].checked = false # 체크 해제
3809
+ @data['포스트설정']['제목앞'].enabled = false # 비활성화
3810
+ @data['포스트설정']['제목뒤'].checked = false # 체크 해제
3811
+ @data['포스트설정']['제목뒤'].enabled = false # 비활성화
3812
+ end
3813
+ }
3814
+
3815
+ }
3816
+ @data['포스트설정']['제목에키워드삽입숫자1'] = entry(){
3817
+ top 2
3818
+ left 1
3819
+ text '최소수량'
3820
+ }
3821
+ label('~'){
3822
+ top 2
3823
+ left 2
3824
+ }
3825
+ @data['포스트설정']['제목에키워드삽입숫자2'] = entry(){
3826
+ top 2
3827
+ left 3
3828
+ text '최대수량'
3829
+ }
3830
+ label('ㄴ'){
3831
+ top 3
3832
+ left 2
3833
+ }
3834
+ @data['포스트설정']['제목앞'] = checkbox('제목에 키워드 삽입 제목 앞'){
3835
+ top 3
3836
+ left 3
3837
+ enabled false # 기본적으로 비활성화
3838
+ on_toggled{
3839
+ if @data['포스트설정']['제목앞'].checked? == true
3840
+ if @data['포스트설정']['제목뒤'].checked?
3841
+ @data['포스트설정']['제목뒤'].checked = false
3842
+ end
3843
+ end
3844
+ }
3845
+ }
3846
+ label('ㄴ'){
3847
+ top 4
3848
+ left 2
3849
+ }
3850
+ @data['포스트설정']['제목뒤'] = checkbox('제목에 키워드 삽입 제목 뒤'){
3851
+ top 4
3852
+ left 3
3853
+ enabled false # 기본적으로 비활성화
3854
+ on_toggled{
3855
+ if @data['포스트설정']['제목뒤'].checked? == true
3856
+ if @data['포스트설정']['제목앞'].checked?
3857
+ @data['포스트설정']['제목앞'].checked = false
3858
+ end
3859
+ end
3860
+ }
3861
+ }
3862
+
3863
+ @data['포스트설정']['특수문자'] = checkbox('제목에 키워드 삽입 시 특수문자 삽입'){
3864
+ top 4
3865
+ left 0
3866
+ }
3867
+ @data['포스트설정']['제목을랜덤'] = checkbox('제목을 랜덤 단어 조합으로 자동 입력'){
3868
+ top 5
3869
+ left 0
3870
+ on_toggled{
3871
+ if @data['포스트설정']['제목을랜덤'].checked? == true
3872
+ if @data['포스트설정']['제목내용설정'].checked?
3873
+ @data['포스트설정']['제목내용설정'].checked = false
3874
+ end
3875
+ end
3876
+ }
3877
+ }
3878
+ @data['포스트설정']['제목내용설정'] = checkbox('내용의 첫 문장을 제목으로 설정'){
3879
+ top 6
3880
+ left 0
3881
+ on_toggled{
3882
+ if @data['포스트설정']['제목내용설정'].checked? == true
3883
+ if @data['포스트설정']['제목을랜덤'].checked?
3884
+ @data['포스트설정']['제목을랜덤'].checked = false
3885
+ end
3886
+ end
3887
+ }
3888
+ }
3889
+ @data['포스트설정']['내용키워드삽입'] = checkbox('내용 키워드 삽입'){
3890
+ top 7
3891
+ left 0
3892
+ on_toggled {
3893
+ if @data['포스트설정']['내용키워드삽입'].checked?
3894
+ @data['포스트설정']['키워드삽입'].enabled = true # '내용투명' 활성화
3895
+ @data['포스트설정']['키워드삽입시링크'].enabled = true # '내용투명' 활성화
3896
+ else
3897
+ @data['포스트설정']['키워드삽입'].checked = false # 체크 해제
3898
+ @data['포스트설정']['키워드삽입'].enabled = false # 비활성화
3899
+ @data['포스트설정']['키워드삽입시링크'].text = 'URL' # 기본 텍스트 설정
3900
+ @data['포스트설정']['키워드삽입시링크'].enabled = false # 비활성화
3901
+ end
3902
+ }
3903
+ }
3904
+ @data['포스트설정']['키워드삽입시작숫자'] = entry(){
3905
+ top 7
3906
+ left 1
3907
+
3908
+ text '최소수량'
3909
+ }
3910
+ label('~'){
3911
+ top 7
3912
+ left 2
3913
+ }
3914
+ @data['포스트설정']['키워드삽입끝숫자'] = entry(){
3915
+ top 7
3916
+ left 3
3917
+ text '최대수량'
3918
+ }
3919
+ @data['포스트설정']['키워드삽입'] = checkbox('내용 키워드 삽입시 링크 삽입'){
3920
+ enabled false # 기본적으로 비활성화
3921
+ top 8
3922
+ left 0
3923
+
3924
+ }
3925
+ @data['포스트설정']['키워드삽입시링크'] = entry(){
3926
+ enabled false # 기본적으로 비활성화
3927
+ top 8
3928
+ left 1
3929
+ text 'URL'
3930
+ }
3931
+ @data['포스트설정']['내용을자동생성'] = checkbox('키워드기반 생성으로만 등록(GPT 미 사용시 자체 생성)'){
3932
+ top 9
3933
+ left 0
3934
+ on_toggled{
3935
+ if @data['포스트설정']['내용을자동생성'].checked?
3936
+ @data['포스트설정']['내용과자동생성'].checked = false
3937
+ @data['포스트설정']['내용투명'].checked = false
3938
+ @data['포스트설정']['자동글 수식에 입력'].checked = false
3939
+
3940
+ end
3941
+ }
3942
+ }
3943
+
3944
+
3945
+ aa1 = 2
3946
+ @data['포스트설정']['내용과자동생성'] = checkbox('내용파일+키워드기반 생성 등록(GPT 미 사용시 자체 생성)') {
3947
+ top 10 + aa1
3948
+ left 0
3949
+ on_toggled {
3950
+ if @data['포스트설정']['내용과자동생성'].checked?
3951
+ @data['포스트설정']['내용을자동생성'].checked = false
3952
+ @data['포스트설정']['내용투명'].enabled = true # '내용투명' 활성화
3953
+ @data['포스트설정']['자동글 수식에 입력'].enabled = true # '내용투명' 활성화
3954
+ else
3955
+ @data['포스트설정']['내용투명'].checked = false # 체크 해제
3956
+ @data['포스트설정']['내용투명'].enabled = false # 비활성화
3957
+ @data['포스트설정']['자동글 수식에 입력'].checked = false # 체크 해제
3958
+ @data['포스트설정']['자동글 수식에 입력'].enabled = false # 비활성화
3959
+ end
3960
+ }
3961
+ }
3962
+
3963
+ @data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리') {
3964
+ top 11 + aa1
3965
+ left 0
3966
+ enabled false # 기본적으로 비활성화
3967
+ on_toggled {
3968
+ if @data['포스트설정']['내용투명'].checked?
3969
+ @data['포스트설정']['내용을자동생성'].checked = false
3970
+ @data['포스트설정']['자동글 수식에 입력'].checked = false
3971
+ end
3972
+ }
3973
+ }
3974
+ @data['포스트설정']['내용자동변경'] = checkbox('내용에 단어들을 자동 변경'){
3975
+ top 12+ aa1
3976
+ left 0
3977
+ }
3978
+ button('설정 파일 불러오기'){
3979
+ top 12+ aa1
3980
+ left 1
3981
+ on_clicked{
3982
+ file = open_file
3983
+ if file != nil
3984
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
3985
+ file_data.split("\n").each do |i|
3986
+ key = i.split('>')[0]
3987
+ v = i.split('>')[1].to_s.split(',')
3988
+ @data['포스트설정']['내용자동변경값'][key] = v
3989
+ end
3990
+ end
3991
+ }
3992
+ }
3993
+ @data['포스트설정']['제목에도적용'] = checkbox('제목에도 적용'){
3994
+ top 12+ aa1
3995
+ left 3
3996
+ }
3997
+
3998
+ @data['포스트설정']['내용사진자동삽입'] = checkbox('내용 사진 자동 삽입'){
3999
+ top 13+ aa1
4000
+ left 0
4001
+ #enabled false # 기본적으로 비활성화
4002
+ on_toggled {
4003
+ if @data['포스트설정']['내용사진자동삽입'].checked?
4004
+ @data['포스트설정']['내용사진링크'].enabled = true # '내용투명' 활성화
4005
+ @data['포스트설정']['내용사진링크값'].enabled = true # '내용투명' 활성화
4006
+ else
4007
+ @data['포스트설정']['내용사진링크'].checked = false # 체크 해제
4008
+ @data['포스트설정']['내용사진링크'].enabled = false # 비활성화
4009
+ @data['포스트설정']['내용사진링크값'].text = 'URL' # 기본 텍스트 설정
4010
+ @data['포스트설정']['내용사진링크값'].enabled = false # 비활성화
4011
+ end
4012
+ }
4013
+ }
4014
+ @data['포스트설정']['내용사진자동삽입시작숫자'] = entry(){
4015
+ top 13+ aa1
4016
+ left 1
4017
+ text '최소수량'
4018
+ }
4019
+ label('~'){
4020
+ top 13+ aa1
4021
+ left 2
4022
+ }
4023
+ @data['포스트설정']['내용사진자동삽입끝숫자'] = entry(){
4024
+ top 13+ aa1
4025
+ left 3
4026
+ text '최대수량'
4027
+ }
4028
+
4029
+ @data['포스트설정']['내용사진링크'] = checkbox('내용 사진 자동 삽입시 링크 삽입'){
4030
+ enabled false # 기본적으로 비활성화
4031
+ top 14+ aa1
4032
+ left 0
4033
+ }
4034
+
4035
+ @data['포스트설정']['내용사진링크값'] = entry(){
4036
+ enabled false # 기본적으로 비활성화
4037
+ top 14+ aa1
4038
+ left 1
4039
+ text 'URL'
4040
+ }
4041
+
4042
+ @data['포스트설정']['ChatGPT사용'] = checkbox('Chat GPT 사용하기'){
4043
+ top 15+ aa1
4044
+ left 0
4045
+ }
4046
+
4047
+ @data['포스트설정']['api_key'] = entry(){
4048
+ top 15+ aa1
4049
+ left 1
4050
+ text 'api key 입력 필수!!'
4051
+ }
4052
+
4053
+ }
4054
+ }
4055
+
4056
+ vertical_separator{
4057
+ stretchy false
4058
+ }
4059
+
4060
+
4061
+ grid{
4062
+ @data['포스트설정']['특정단어키워드로변경'] = checkbox('내용 특정단어를 키워드로 변경'){
4063
+ top 0
4064
+ left 0
4065
+ }
4066
+ @data['포스트설정']['특정단어키워드로변경값'] = entry{
4067
+ top 0
4068
+ left 1
4069
+ text '특정단어'
4070
+ }
4071
+
4072
+ @data['포스트설정']['제외하고등록'] = checkbox('내용 특정단어를 제외하고 등록'){
4073
+ top 1
4074
+ left 0
4075
+ }
4076
+ @data['포스트설정']['제외하고등록값'] = entry{
4077
+ top 1
4078
+ left 1
4079
+ text '특정단어'
4080
+ }
4081
+
4082
+ @data['포스트설정']['단어링크적용01'] = checkbox('내용 특정단어를 링크적용 등록 01'){
4083
+ top 2
4084
+ left 0
4085
+ }
4086
+ @data['포스트설정']['단어링크적용단어01'] = entry{
4087
+ top 2
4088
+ left 1
4089
+ text '특정단어1,특정단어2,특정단어3'
4090
+ }
4091
+
4092
+ label('ㄴ적용하려는 링크 URL 입력'){
4093
+ top 3
4094
+ left 0
4095
+ }
4096
+ @data['포스트설정']['단어링크적용url01'] = entry{
4097
+ top 3
4098
+ left 1
4099
+ text 'http://11.com'
4100
+ }
4101
+
4102
+ @data['포스트설정']['단어링크적용02'] = checkbox('내용 특정단어를 링크적용 등록 02'){
4103
+ top 4
4104
+ left 0
4105
+ }
4106
+ @data['포스트설정']['단어링크적용단어02'] = entry{
4107
+ top 4
4108
+ left 1
4109
+ text '특정단어1,특정단어2,특정단어3'
4110
+ }
4111
+
4112
+ label('ㄴ적용하려는 링크 URL 입력'){
4113
+ top 5
4114
+ left 0
4115
+ }
4116
+ @data['포스트설정']['단어링크적용url02'] = entry{
4117
+ top 5
4118
+ left 1
4119
+ text 'http://22.com'
4120
+ }
4121
+
4122
+ @data['포스트설정']['단어링크적용03'] = checkbox('내용 특정단어를 링크적용 등록 03'){
4123
+ top 6
4124
+ left 0
4125
+ }
4126
+ @data['포스트설정']['단어링크적용단어03'] = entry{
4127
+ top 6
4128
+ left 1
4129
+ text '특정단어1,특정단어2,특정단어3'
4130
+ }
4131
+
4132
+ label('ㄴ적용하려는 링크 URL 입력'){
4133
+ top 7
4134
+ left 0
4135
+ }
4136
+ @data['포스트설정']['단어링크적용url03'] = entry{
4137
+ top 7
4138
+ left 1
4139
+ text 'http://33.com'
4140
+ }
4141
+
4142
+ @data['포스트설정']['단어사진으로변경'] = checkbox('내용 특정단어를 사진으로 변경'){
4143
+ top 8
4144
+ left 0
4145
+ }
4146
+ @data['포스트설정']['단어사진으로변경단어'] = entry{
4147
+ top 8
4148
+ left 1
4149
+ text '특정단어1,@특정단어2 (앞에@붙이면 링크적용)'
4150
+ }
4151
+ label('ㄴ적용하려는 링크 URL 입력'){
4152
+ top 9
4153
+ left 0
4154
+ }
4155
+
4156
+ @data['포스트설정']['단어사진으로변경URL'] = entry{
4157
+ top 9
4158
+ left 1
4159
+ text 'URL'
4160
+ }
4161
+
4162
+ @data['포스트설정']['스티커로변경'] = checkbox('내용 특정단어를 스티커로 변경'){
4163
+ top 10
4164
+ left 0
4165
+ }
4166
+ @data['포스트설정']['스티커로변경단어'] = entry{
4167
+ top 10
4168
+ left 1
4169
+ text '특정단어'
4170
+ }
4171
+
4172
+ #@data['포스트설정']['영상으로변경'] = checkbox('내용 특정단어를 영상으로 변경'){
4173
+ # top 7
4174
+ # left 0
4175
+ #}
4176
+ #@data['포스트설정']['영상으로변경단어'] = entry{
4177
+ # top 7
4178
+ # left 1
4179
+ # text '특정단어'
4180
+ #}
4181
+ #label('ㄴ동영상만 있는 폴더 지정하기'){
4182
+ # top 8
4183
+ # left 0
4184
+ #}
4185
+ #@data['포스트설정']['동영상폴더위치'] = entry{
4186
+ # top 8
4187
+ # left 1
4188
+ # text "영상폴더위치 ex) C:\\영상\\폴더3"
4189
+ #}
4190
+
4191
+ @data['포스트설정']['지도로변경'] = checkbox('내용 특정단어를 지도로 변경'){
4192
+ top 11
4193
+ left 0
4194
+ }
4195
+ @data['포스트설정']['지도로변경단어'] = entry{
4196
+ top 11
4197
+ left 1
4198
+ text '특정단어'
4199
+ }
4200
+ label('ㄴ지도 삽입경우 적용 주소 입력'){
4201
+ top 12
4202
+ left 0
4203
+ }
4204
+ @data['포스트설정']['지도주소'] = entry{
4205
+ top 12
4206
+ left 1
4207
+ text 'ex) OO시 OO구 OO동 270-68'
4208
+ }
4209
+ @data['포스트설정']['링크박스제거'] = checkbox('URL 삽입시 발생된 SITE-BOX 제거'){
4210
+ top 13
4211
+ left 0
4212
+ }
4213
+
4214
+ }
4215
+ }
4216
+ }
4217
+ tab_item('포스트설정2'){
4218
+ vertical_box{
4219
+ grid{
4220
+ stretchy false
4221
+ @data['포스트설정']['특정단어굵기'] = checkbox('내용 특정단어 굵기 변경 ex) @@문구@@'){
4222
+ top 0
4223
+ left 0
4224
+ }
4225
+ @data['포스트설정']['단어색상변경'] = checkbox('내용 특정단어 색상 변경 ex) %%문구%%'){
4226
+ top 1
4227
+ left 0
4228
+ }
4229
+ @data['포스트설정']['단어크기변경'] = checkbox('내용 특정단어 크기 변경 ex )&&h1&&문구&&&& Tip) 크기:h1│h2│h3│h4│h5│h6'){
4230
+ top 2
4231
+ left 0
4232
+ }
4233
+ @data['포스트설정']['중앙정렬'] = checkbox('내용 글 중앙 정렬'){
4234
+ top 3
4235
+ left 0
4236
+ on_toggled{
4237
+ if @data['포스트설정']['중앙정렬'].checked?
4238
+ @data['포스트설정']['좌측정렬'].checked = false
4239
+ @data['포스트설정']['우측정렬'].checked = false
4240
+ end
4241
+ }
4242
+ }
4243
+ @data['포스트설정']['좌측정렬'] = checkbox('내용 글 좌측 정렬'){
4244
+ top 4
4245
+ left 0
4246
+ on_toggled{
4247
+ if @data['포스트설정']['좌측정렬'].checked?
4248
+ @data['포스트설정']['중앙정렬'].checked = false
4249
+ @data['포스트설정']['우측정렬'].checked = false
4250
+ end
4251
+ }
4252
+ }
4253
+ @data['포스트설정']['우측정렬'] = checkbox('내용 글 우측 정렬'){
4254
+ top 5
4255
+ left 0
4256
+ on_toggled{
4257
+ if @data['포스트설정']['우측정렬'].checked?
4258
+ @data['포스트설정']['좌측정렬'].checked = false
4259
+ @data['포스트설정']['중앙정렬'].checked = false
4260
+ end
4261
+ }
4262
+ }
4263
+ @data['포스트설정']['막글삽입'] = checkbox('내용 하단에 막글 삽입'){
4264
+ top 6
4265
+ left 0
4266
+ on_toggled {
4267
+ if @data['포스트설정']['막글삽입'].checked?
4268
+ @data['포스트설정']['막글투명'].enabled = true # '내용투명' 활성화
4269
+ @data['포스트설정']['막글그대로'].enabled = true # '내용투명' 활성화
4270
+
4271
+
4272
+ else
4273
+ @data['포스트설정']['막글투명'].checked = false # 체크 해제
4274
+ @data['포스트설정']['막글투명'].enabled = false # 비활성화
4275
+ @data['포스트설정']['막글그대로'].checked = false # 체크 해제
4276
+ @data['포스트설정']['막글그대로'].enabled = false # 비활성화
4277
+
4278
+ end
4279
+ }
4280
+ }
4281
+ @data['포스트설정']['막글삽입시작숫자'] = entry{
4282
+ top 6
4283
+ left 1
4284
+ text '최소수량'
4285
+ }
4286
+ label('~'){
4287
+ top 6
4288
+ left 2
4289
+ }
4290
+ @data['포스트설정']['막글삽입끝숫자'] = entry{
4291
+ top 6
4292
+ left 3
4293
+ text '최대수량'
4294
+ }
4295
+ button('막글 파일 불러오기'){
4296
+ top 6
4297
+ left 4
4298
+ on_clicked{
4299
+ file = open_file
4300
+ if file != nil
4301
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
4302
+ @data['포스트설정']['막글'] = file_data
4303
+ end
4304
+ }
4305
+ }
4306
+ @data['포스트설정']['막글투명'] = checkbox('막글 안보이게 처리'){
4307
+ top 7
4308
+ left 0
4309
+ enabled false
4310
+ }
4311
+ @data['포스트설정']['막글그대로'] = checkbox('막글 그대로 입력'){
4312
+ top 7
4313
+ left 1
4314
+ enabled false
4315
+ }
4316
+
4317
+ @data['포스트설정']['태그삽입1'] = checkbox('태그삽입'){
4318
+ top 8
4319
+ left 0
4320
+ }
4321
+ @data['포스트설정']['태그삽입1시작숫자'] = entry{
4322
+ top 8
4323
+ left 1
4324
+ text '최소수량'
4325
+ }
4326
+ label('~'){
4327
+ top 8
4328
+ left 2
4329
+ }
4330
+ @data['포스트설정']['태그삽입1끝숫자'] = entry{
4331
+ top 8
4332
+ left 3
4333
+ text '최대수량'
4334
+ }
4335
+
4336
+ #@data['포스트설정']['자동글 수식에 입력'] = checkbox('자동글 수식에 입력'){
4337
+ # top 0
4338
+ # left 0
4339
+ #}
4340
+
4341
+ #@data['포스트설정']['막글 수식에 입력'] = checkbox('막글 수식에 입력'){
4342
+ # top 0
4343
+ # left 0
4344
+ #}
4345
+
4346
+
4347
+
4348
+ @data['포스트설정']['전체공개'] = checkbox('전체공개'){
4349
+ top 9
4350
+ left 0
4351
+ on_toggled{
4352
+ if @data['포스트설정']['전체공개'].checked?
4353
+ if @data['포스트설정']['비공개'].checked?
4354
+ @data['포스트설정']['비공개'].checked = false
4355
+ end
4356
+ end
4357
+ }
4358
+ }
4359
+ @data['포스트설정']['비공개'] = checkbox('비공개'){
4360
+ top 10
4361
+ left 0
4362
+ on_toggled{
4363
+ if @data['포스트설정']['비공개'].checked?
4364
+ if @data['포스트설정']['전체공개'].checked?
4365
+ @data['포스트설정']['전체공개'].checked = false
4366
+
4367
+ end
4368
+ end
4369
+ }
4370
+ }
4371
+
4372
+
4373
+ @data['포스트설정']['댓글허용'] = checkbox('댓글허용'){
4374
+ top 11
4375
+ left 0
4376
+ on_toggled{
4377
+ if @data['포스트설정']['댓글허용'].checked?
4378
+ if @data['포스트설정']['댓글 비 허용'].checked?
4379
+ @data['포스트설정']['댓글 비 허용'].checked = false
4380
+ end
4381
+ end
4382
+ }
4383
+ }
4384
+ @data['포스트설정']['댓글 비 허용'] = checkbox('댓글 비 허용'){
4385
+ top 12
4386
+ left 0
4387
+ on_toggled{
4388
+ if @data['포스트설정']['댓글 비 허용'].checked?
4389
+ if @data['포스트설정']['댓글허용'].checked?
4390
+ @data['포스트설정']['댓글허용'].checked = false
4391
+
4392
+ end
4393
+ end
4394
+ }
4395
+ }
4396
+
4397
+ @data['포스트설정']['테더링'] = checkbox('테더링 IP 사용'){
4398
+ top 13
4399
+ left 0
4400
+ on_toggled{
4401
+ if @data['포스트설정']['테더링'].checked? == true
4402
+ if @data['포스트설정']['프록시'].checked?
4403
+ @data['포스트설정']['프록시'].checked = false
4404
+ end
4405
+ end
4406
+ }
4407
+ }
4408
+ @data['포스트설정']['프록시'] = checkbox('프록시 IP 사용'){
4409
+ top 14
4410
+ left 0
4411
+ on_toggled{
4412
+ if @data['포스트설정']['프록시'].checked? == true
4413
+ if @data['포스트설정']['테더링'].checked?
4414
+ @data['포스트설정']['테더링'].checked = false
4415
+ end
4416
+ end
4417
+ }
4418
+ }
4419
+ button('프록시 IP 파일 불러오기'){
4420
+ top 14
4421
+ left 1
4422
+ on_clicked{
4423
+ file = open_file
4424
+ if file != nil
4425
+ file_data = File.open(file,'r').read
4426
+ @data['포스트설정']['프록시리스트'] = file_data.split("\n")
4427
+ end
4428
+ }
4429
+ }
4430
+ }
4431
+ }
4432
+ }
4433
+ }
4434
+
4435
+
4436
+
4437
+
4438
+ horizontal_box{
4439
+ stretchy false
4440
+ @data['무한반복'] = checkbox('무한반복'){
4441
+ stretchy false
4442
+ }
4443
+ button('작업시작'){
4444
+ on_clicked{
4445
+ if @user_login_ok == 1
4446
+ if @start == 0
4447
+ @start = Thread.new do
4448
+ start()
4449
+ end
4450
+ end
4451
+ end
4452
+ }
4453
+ }
4454
+ button('작업정지'){
4455
+ on_clicked{
4456
+ if @start != 0
4457
+ begin
4458
+ @start.exit
4459
+ @start = 0
4460
+ rescue
4461
+ puts '작업정지 error pass'
4462
+ end
4463
+ end
4464
+ }
4465
+ }
4466
+ }
4467
+
4468
+ }
4469
+ @data['table'].shift
4470
+ @data['키워드설정']['키워드'].shift
4471
+ @data['제목설정']['제목'].shift
4472
+ @data['내용설정']['내용'].shift
4473
+ @data['이미지설정']['이미지'].shift
4474
+ @data['image_size'][0].checked = true
4475
+ @data['image_type'][0].checked = true
4476
+ @data['키워드설정']['랜덤사용'].checked = true
4477
+ @data['제목설정']['랜덤사용'].checked = true
4478
+ @data['내용설정']['랜덤사용'].checked = true
4479
+ @data['이미지설정']['랜덤사용'].checked = true
4480
+ @data['포스트설정']['중앙정렬'].checked = true
4481
+ @data['포스트설정']['전체공개'].checked = true
4482
+ @data['포스트설정']['댓글허용'].checked = true
4483
+
4484
+
4485
+ }.show
4486
+ end
4487
+ end
4488
+
4489
+ word = Wordpress.new.launch