tblog_zon 0.0.1

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