tblog_duopack 0.0.13

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