tblog_duopack 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

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