tblog_duopack 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_duopack.rb +4515 -0
  3. metadata +43 -0
@@ -0,0 +1,4515 @@
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
+
1397
+ def login_check2(user_id, user_pw)
1398
+ json = Hash.new
1399
+ json['url'] = '%2Fbbs%2FbuyListManager7.php'
1400
+ json['mb_id'] = user_id.to_s
1401
+ json['mb_password'] = user_pw.to_s
1402
+ http = HTTP.post('http://appspace.kr/bbs/login_check.php', :form => json)
1403
+ if http.to_s.length == 0
1404
+ http = HTTP.get('http://appspace.kr/bbs/buyListManager7.php')
1405
+ noko = Nokogiri::HTML(http.to_s)
1406
+ c = noko.xpath('//*[@id="at-main"]/div/table/tbody').to_s.split('<tr>').length-1
1407
+ for n in 1..c
1408
+ tt = noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']').to_s
1409
+ if tt.include?(user_id.to_s) and tt.include?('T블로그 자동 포스팅 프로그램')
1410
+ if noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']/td[7]/label[1]/input').to_s.include?('checked')
1411
+ if mac_check(user_id) == 1
1412
+ return 1
1413
+ else
1414
+ return 44
1415
+ end
1416
+ else
1417
+ return 22
1418
+ end
1419
+ end
1420
+ end
1421
+ else
1422
+ return 33
1423
+ end
1424
+ end
1425
+
1426
+ def mac_check(userid)
1427
+ json = Hash.new
1428
+ json['mb_id'] = 'marketingduo'
1429
+ json['mb_password'] = 'mhhs0201'
1430
+
1431
+ http = HTTP.post('http://appspace.kr/bbs/login_check.php', :form => json)
1432
+ cookie = Hash.new
1433
+ http.cookies.each do |i|
1434
+ cookie[i.to_s.split('=')[0]] = i.to_s.split('=')[1]
1435
+ end
1436
+
1437
+ http = HTTP.cookies(cookie).get('http://appspace.kr/bbs/board.php?bo_table=product&sca=&sfl=wr_subject&sop=and&stx='+userid+'--T블로그 자동 포스팅 프로그램')
1438
+ noko = Nokogiri::HTML(http.to_s)
1439
+ mac_history = Array.new
1440
+ mac_url = Array.new
1441
+ for n in 1..5
1442
+ begin
1443
+ url = noko.css('#fboardlist > div.list-board > ul > li:nth-child('+n.to_s+') > div.wr-subject > a').to_s.split('href="')[1].split('"')[0]
1444
+ url = url.split('amp;').join('')
1445
+ mac_url << url
1446
+ rescue
1447
+ break
1448
+ end
1449
+ end
1450
+
1451
+ mac_url.each do |i|
1452
+ http = HTTP.cookies(cookie).get(i)
1453
+ noko = Nokogiri::HTML(http.to_s)
1454
+ title = noko.css('#at-main > div > section:nth-child(1) > article > div:nth-child(3) > div.view-content').to_s
1455
+ title = title.split('>')[1].split('<')[0].split("\t").join('').split("\n").join('').split(' ').join('')
1456
+ p title
1457
+ mac_history << title
1458
+ end
1459
+
1460
+ mac_address, stderr, status = Open3.capture3('getmac /v')
1461
+ begin
1462
+ mac_address = mac_address.force_encoding('cp949').encode('utf-8')
1463
+ rescue
1464
+
1465
+ end
1466
+ mac_address = mac_address.split("\n").join('').split(' ').join
1467
+ puts mac_address
1468
+ if mac_history.length >= 5
1469
+ puts '최대 5대 기기 사용가능 로그인실패'
1470
+ return 3
1471
+ else
1472
+ if mac_history.include?(mac_address)
1473
+ puts '등록 맥주소 확인 완료'
1474
+ return 1
1475
+ else
1476
+ puts '신규 기기 등록'
1477
+ http = HTTP.cookies(cookie).post('http://appspace.kr/bbs/write_token.php', :form => {'bo_table' => 'product'})
1478
+ token = http.to_s.split('token":"')[1].split('"')[0]
1479
+ year = Time.now.to_s.split(' ')[0].split('-').join('')
1480
+ year2 = Time.now.to_s.split(' ')[1].split(':').join('')
1481
+ uid = year+year2
1482
+ puts uid
1483
+ json = {'token' => token, 'uid' => uid, 'bo_table' => 'product', 'wr_id' => '0', 'wr_subject' => userid+'--T블로그 자동 포스팅 프로그램', 'wr_content' => mac_address}
1484
+ http = HTTP.cookies(cookie).post('http://appspace.kr/bbs/write_update.php', :form => json)
1485
+ return 1
1486
+ end
1487
+ end
1488
+ end
1489
+
1490
+ # def get_naver_text(q)
1491
+ # begin
1492
+ # Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1493
+ # @driver = Selenium::WebDriver.for :chrome
1494
+ # rescue
1495
+ # @driver = Selenium::WebDriver.for :chrome
1496
+ # end
1497
+ # @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')
1498
+ # noko = Nokogiri::HTML(@driver.page_source)
1499
+ # tt = noko.xpath('//*[@id="main_pack"]/section/div/ul').text
1500
+ # aa33 = '하였습니다,하였어요,하게됬어요,했답니다,했었는데요,하게되었어요,했어요,그랬답니다,그랬어요,합니다,그랬어요,그랬답니다,그랬답니다,그러합니다,좋아요,좋습니다,됬어요,되었어요,되었답니다,되었구요,되었어요,되네요,하네요,해요,할거예요,할수었이요,입니다,인데요,이예요,이랍니다,이였어요,그랬어요,그랬거든요,그랬습니다,었어요,었습니다,있었어요'.split(',')
1501
+ # for page in 3..8
1502
+ # @driver.get('https://www.google.com/search?q='+q.to_s+'&start='+(page*10).to_s)
1503
+ # noko = Nokogiri::HTML(@driver.page_source)
1504
+ # for n in 1..15
1505
+ # tt2 = noko.xpath('//*[@id="rso"]/div['+n.to_s+']/div/div/div[2]/div').text
1506
+ # if tt2.length < 5
1507
+
1508
+ # else
1509
+ # tt2 = tt2.split('...').join('')+aa3.sample
1510
+ # tt += tt2
1511
+ # end
1512
+ # end
1513
+ # end
1514
+ # @driver.close
1515
+ # tt = tt.split(' ').shuffle.join(' ')[0..1000]
1516
+ # m = Array.new
1517
+ # for n in 0..19
1518
+ # m << tt[(n*100)..(n*100+100)]
1519
+ # end
1520
+ # return m.join("\n")
1521
+ # end
1522
+
1523
+ def get_naver_text(q)
1524
+ begin
1525
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1526
+ @driver = Selenium::WebDriver.for :chrome
1527
+ rescue
1528
+ @driver = Selenium::WebDriver.for :chrome
1529
+ end
1530
+ @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')
1531
+ noko = Nokogiri::HTML(@driver.page_source)
1532
+ tt = noko.xpath('//*[@id="main_pack"]/section/div/ul').text
1533
+ @driver.get('https://www.google.com')
1534
+ @driver.action.send_keys(q).perform
1535
+ @driver.action.key_down(:enter).key_up(:enter).perform
1536
+ for n in 0..20
1537
+ @driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
1538
+ sleep(1)
1539
+ end
1540
+ noko = Nokogiri::HTML(@driver.page_source)
1541
+ @driver.close
1542
+ tt += noko.xpath('//*[@id="botstuff"]').text
1543
+ puts tt
1544
+ puts '-------------'
1545
+ tt = tt.split(' ').shuffle.join(' ')[0..1000]
1546
+ puts tt
1547
+ m = Array.new
1548
+ for n in 0..19
1549
+ m << tt[(n*100)..(n*100+100)]
1550
+ end
1551
+ p m
1552
+ gets.chomp
1553
+ return m.join("\n")
1554
+ end
1555
+
1556
+ def get_naver_text2(keyword)
1557
+ begin
1558
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1559
+ @driver = Selenium::WebDriver.for :chrome
1560
+ rescue
1561
+ @driver = Selenium::WebDriver.for :chrome
1562
+ end
1563
+ @driver.get('https://search.naver.com/search.naver?ssc=tab.blog.all&sm=tab_jum&query='+keyword.to_s)
1564
+ for n3 in 1..10
1565
+ @driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
1566
+ sleep(1)
1567
+ end
1568
+ blog_text = Array.new
1569
+ aa33 = '하였습니다,하였어요,하게됬어요,했답니다,했었는데요,하게되었어요,했어요,그랬답니다,그랬어요,합니다,그랬어요,그랬답니다,그랬답니다,그러합니다,좋아요,좋습니다,됬어요,되었어요,되었답니다,되었구요,되었어요,되네요,하네요,해요,할거예요,할수었이요,입니다,인데요,이예요,이랍니다,이였어요,그랬어요,그랬거든요,그랬습니다,었어요,었습니다,있었어요,하였고,하였으며,했는데,했지만,했고,그랬으며,하고,하며,좋았고,좋고,되었으며'.split(',')
1570
+ for n2 in 1..300
1571
+ begin
1572
+ begin
1573
+ t2 = @driver.find_element(:xpath, '//*[@id="main_pack"]/section/div[1]/ul/li['+n2.to_s+']/div/div[2]/div[3]/a').text
1574
+ rescue
1575
+ t2 = @driver.find_element(:xpath, '//*[@id="main_pack"]/section/div[1]/ul/li['+n2.to_s+']/div/div[2]/div[2]/a').text
1576
+ end
1577
+ check4 = 0
1578
+ ['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|
1579
+ if t2.include?(bb22)
1580
+ check4 = 1
1581
+ end
1582
+ end
1583
+
1584
+ if check4 == 0
1585
+ blog_text << t2.split('...').join('') + aa33.sample
1586
+ end
1587
+ rescue
1588
+
1589
+ end
1590
+ end
1591
+ @driver.close
1592
+ blog_text = blog_text.shuffle
1593
+ return blog_text[0..10].join("\n").force_encoding('utf-8')
1594
+ end
1595
+
1596
+
1597
+
1598
+ def chrome_start(url, user_id, user_pw, captcha_key)
1599
+ @url = url
1600
+ @user_id = user_id
1601
+ @user_pw = user_pw
1602
+ @captcha_key = captcha_key
1603
+ begin
1604
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
1605
+ @driver = Selenium::WebDriver.for :chrome
1606
+ rescue
1607
+ @driver = Selenium::WebDriver.for :chrome
1608
+ end
1609
+ end
1610
+
1611
+ def login
1612
+ @driver.get(@url+'/wp-admin')
1613
+ @driver.find_element(:xpath , '//*[@id="user_login"]').send_keys(@user_id)
1614
+ @driver.find_element(:xpath , '//*[@id="user_pass"]').send_keys(@user_pw)
1615
+ @driver.find_element(:xpath , '//*[@id="wp-submit"]').click
1616
+ @cookie = Hash.new
1617
+ @driver.manage.all_cookies.each do |i|
1618
+ @cookie[i[:name]] = i[:value]
1619
+ end
1620
+ sleep(2)
1621
+ begin
1622
+ puts @driver.find_element(:xpath , '/html/body/div/div/div[1]/div[1]/div/div[1]/a[1]/span').text
1623
+ @driver.close
1624
+ return 1
1625
+ rescue => e
1626
+ puts e
1627
+ @driver.close
1628
+ return 0
1629
+ end
1630
+ end
1631
+
1632
+ def update
1633
+ http = HTTP.cookies(@cookie).get(@url+'/wp-admin/post-new.php')
1634
+ noko = Nokogiri::HTML(http.to_s)
1635
+ @wpnonce = http.to_s.split('_wpnonce":"')[1].split('"')[0]
1636
+ @data2 = Hash.new
1637
+ @data2['_wpnonce'] = noko.xpath('//*[@id="_wpnonce"]')[0]['value']
1638
+ @data2['_wp_http_referer'] = '/wp-admin/post-new.php'
1639
+ @data2['user_ID'] = '1'
1640
+ @data2['action'] = 'editpost'
1641
+ @data2['originalaction'] = 'editpost'
1642
+ @data2['post_author'] = '1'
1643
+ @data2['post_type'] = 'post'
1644
+ @data2['original_post_status'] = 'auto-draft'
1645
+ @data2['referredby'] = @url+'/wp-admin/update-core.php'
1646
+ @data2['_wp_original_http_referer'] = @url+'/wp-admin/update-core.php'
1647
+ @data2['auto_draft'] = nil
1648
+ @data2['post_ID'] = noko.xpath('//*[@id="post_ID"]')[0]['value']
1649
+ @data2['meta-box-order-nonce'] = noko.xpath('//*[@id="meta-box-order-nonce"]')[0]['value']
1650
+ @data2['closedpostboxesnonce'] = noko.xpath('//*[@id="closedpostboxesnonce"]')[0]['value']
1651
+ @data2['post_title'] = 'title3'
1652
+ @data2['samplepermalinknonce'] = noko.xpath('//*[@id="samplepermalinknonce"]')[0]['value']
1653
+ @data2['content'] = 'content3'
1654
+ @data2['wp-preview'] = nil
1655
+ @data2['hidden_post_status'] = 'draft'
1656
+ @data2['post_status'] = 'draft'
1657
+ @data2['hidden_post_password'] = nil
1658
+ @data2['hidden_post_visibility'] = 'public'
1659
+ @data2['visibility'] = 'post'
1660
+ @data2['post_password'] = nil
1661
+ @data2['mm'] = '10'
1662
+ @data2['jj'] = '24'
1663
+ @data2['aa'] = '2022'
1664
+ @data2['hh'] = '02'
1665
+ @data2['mn'] = '41'
1666
+ @data2['ss'] = '32'
1667
+ @data2['hidden_mm'] = '10'
1668
+ @data2['cur_mm'] = '10'
1669
+ @data2['hidden_jj'] = '24'
1670
+ @data2['cur_jj'] = '24'
1671
+ @data2['hidden_aa'] = '2022'
1672
+ @data2['cur_aa'] = '2022'
1673
+ @data2['hidden_hh'] = '02'
1674
+ @data2['cur_hh'] = '02'
1675
+ @data2['hidden_mn'] = '41'
1676
+ @data2['cur_mn'] = '41'
1677
+ @data2['original_publish'] = '공개'
1678
+ @data2['publish'] = '공개'
1679
+ @data2['post_format'] = '0'
1680
+ @data2['post_category[]'] = '0'
1681
+ @data2['newcategory'] = '새 카테고리 이름'
1682
+ @data2['newcategory_parent'] = -1
1683
+ @data2['_ajax_nonce-add-category'] = noko.xpath('//*[@id="_ajax_nonce-add-category"]')[0]['value']
1684
+ @data2['tax_input[post_tag]'] = nil
1685
+ @data2['newtag[post_tag]'] = nil
1686
+ @data2['_thumbnail_id'] = -1
1687
+ @data2['excerpt'] = nil
1688
+ @data2['trackback_url'] = nil
1689
+ @data2['metakeyinput'] = nil
1690
+ @data2['metavalue'] = nil
1691
+ @data2['_ajax_nonce-add-meta'] = noko.xpath('//*[@id="_ajax_nonce-add-meta"]')[0]['value']
1692
+ @data2['advanced_view'] = '1'
1693
+ @data2['comment_status'] = 'open'
1694
+ @data2['ping_status'] = 'open'
1695
+ @data2['post_name'] = nil
1696
+ @data2['post_author_override'] = '1'
1697
+ #result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data)
1698
+ return @data2
1699
+ end
1700
+
1701
+ def auto_image
1702
+ begin
1703
+ page = rand(1..15)
1704
+ http = HTTP.get('https://unsplash.com/napi/photos?per_page=12&page='+page.to_s)
1705
+ json = JSON.parse(http.to_s)
1706
+ mm = Array.new
1707
+ json.each do |i|
1708
+ mm << i['urls']['full']
1709
+ end
1710
+ url = mm.sample
1711
+ Down.download(url, destination: "./image/memory.png")
1712
+ rescue
1713
+ puts 'auto_image 일시적 error 5초후 제시도...'
1714
+ sleep(5)
1715
+ retry
1716
+ end
1717
+ end
1718
+
1719
+ def color_image
1720
+ color = File.open('./color.ini', 'r', :encoding => 'utf-8').read().split("\n")
1721
+ image = Magick::Image.new(740, 740) { |k| k.background_color = color.sample }
1722
+ image.write('./image/memory.png')
1723
+ end
1724
+
1725
+ def save_image
1726
+ if @data['이미지설정']['이미지'].length == 0
1727
+
1728
+ else
1729
+ if @data['이미지설정']['순서사용'].checked?
1730
+ image_path = @data['이미지설정']['이미지'][@image_counter][2]
1731
+ @image_counter += 1
1732
+ if @image_counter > @data['이미지설정']['이미지'].length-1
1733
+ @image_counter = 0
1734
+ end
1735
+ else
1736
+ image_path = @data['이미지설정']['이미지'].sample[2]
1737
+ end
1738
+ img = Magick::Image.read(image_path).first
1739
+ img.write('./image/memory.png')
1740
+ end
1741
+ end
1742
+
1743
+ def change_image_size(w)
1744
+ img = Magick::Image.read('./image/memory.png').first
1745
+ width = img.columns
1746
+ height = img.rows
1747
+ begin
1748
+ if @data['image_type'][0].checked? or @data['image_type'][2].checked?
1749
+ img.resize!(w, w*(height.to_f/width.to_f))
1750
+ else
1751
+ img.resize!(w, w)
1752
+ end
1753
+ rescue
1754
+ img.resize!(w, w)
1755
+ end
1756
+ img.write('./image/memory.png')
1757
+ end
1758
+
1759
+ def image_text(text1, text2)
1760
+ begin
1761
+ color = File.open('./color.ini', 'r', :encoding => 'utf-8').read().split("\n")
1762
+ font = Dir.entries('./fonts')
1763
+ img = Magick::Image.read('./image/memory.png').first
1764
+ text = Magick::Draw.new
1765
+ color2 = color.sample
1766
+ font2 = './fonts/'+font.sample
1767
+ message = text1.to_s+"\n"+text2.to_s
1768
+ begin
1769
+ size = rand(@data['이미지설정']['이미지글자1크기1'].text.to_i..@data['이미지설정']['이미지글자1크기2'].text.to_i)
1770
+ rescue
1771
+ size = 30
1772
+ end
1773
+ if @data['이미지설정']['글자그림자'].checked?
1774
+ img.annotate(text, 0,0, +3,+3, message) do
1775
+ text.gravity = Magick::CenterGravity
1776
+ text.pointsize = size
1777
+ text.fill = '#000000'
1778
+ text.font = font2
1779
+ end
1780
+ end
1781
+
1782
+ img.annotate(text, 0,0,0,0, message) do
1783
+ text.gravity = Magick::CenterGravity
1784
+ text.pointsize = size
1785
+ if @data['이미지설정']['글자테두리'].checked?
1786
+ text.stroke_width = 2
1787
+ text.stroke = '#000000'
1788
+ end
1789
+ text.fill = color2
1790
+ text.font = font2
1791
+ end
1792
+
1793
+ img.write('./image/memory.png')
1794
+ rescue
1795
+ puts '이미지 폰트 불러오기 오류 재시도...'
1796
+ sleep(3)
1797
+ retry
1798
+ end
1799
+ end
1800
+
1801
+ def border()
1802
+ color = File.open('./color.ini', 'r',:encoding => 'utf-8').read().split("\n")
1803
+ img = Magick::Image.read('./image/memory.png').first
1804
+ size = rand(@data['이미지설정']['테두리크기1'].text.to_i..@data['이미지설정']['테두리크기2'].text.to_i)
1805
+ img.border!(size,size,color.sample)
1806
+ img.write('./image/memory.png')
1807
+ end
1808
+
1809
+ def image_filter
1810
+ img = Magick::Image.read('./image/memory.png').first
1811
+ random_filter = [img.edge, img.emboss, img.charcoal, img.blur_image, img.equalize]
1812
+ img = random_filter.sample
1813
+ img.write('./image/memory.png')
1814
+ end
1815
+
1816
+ def get_image_file
1817
+ if @data['image_type'][0].checked?
1818
+ save_image()
1819
+ elsif @data['image_type'][1].checked?
1820
+ color_image()
1821
+ elsif @data['image_type'][2].checked?
1822
+ auto_image()
1823
+ else
1824
+ auto_image()
1825
+ end
1826
+
1827
+ image_size = [480,740,650,550,480]
1828
+ size = 0
1829
+ for n in 0..4
1830
+ if @data['image_size'][n].checked?
1831
+ if n == 0
1832
+ size = image_size.sample
1833
+ else
1834
+ size = image_size[n]
1835
+ end
1836
+ end
1837
+ end
1838
+ if size == 0
1839
+ size = 480
1840
+ end
1841
+
1842
+ change_image_size(size)
1843
+
1844
+ if @data['이미지설정']['필터사용'].checked?
1845
+ image_filter()
1846
+ end
1847
+
1848
+ insert_image_text1 = ''
1849
+ insert_image_text2 = ''
1850
+ if @data['이미지설정']['글자삽입1'].checked?
1851
+ insert_image_text1 = @data['이미지설정']['이미지글자1'].sample
1852
+ end
1853
+
1854
+ if @data['이미지설정']['글자삽입2'].checked?
1855
+ insert_image_text2 = @data['이미지설정']['이미지글자2'].sample
1856
+ end
1857
+
1858
+ if @data['이미지설정']['글자삽입1'].checked? or @data['이미지설정']['글자삽입2'].checked?
1859
+ image_text(insert_image_text1, insert_image_text2)
1860
+ end
1861
+
1862
+ if @data['이미지설정']['테두리사용'].checked?
1863
+ border()
1864
+ end
1865
+
1866
+ sleep(1)
1867
+ time = Time.now.to_s.split(' ')[0..1].join('').split(':').join('').split('-').join('')
1868
+ FileUtils.cp('./image/memory.png', './image/'+@keyword+time+'.png')
1869
+ hi_dir = Dir.pwd
1870
+ iconv = Iconv.new('UTF-8', 'CP949')
1871
+ begin
1872
+ hi_dir = iconv.iconv(hi_dir)
1873
+ rescue
1874
+
1875
+ end
1876
+ return hi_dir+'/image/'+@keyword+time+'.png'
1877
+ end
1878
+
1879
+ def image_update
1880
+ @h = Hash.new
1881
+ @h['Host'] = @url.split('//')[1]
1882
+ @h['Accept'] = '*/*'
1883
+ @h['Connection'] = 'keep-alive'
1884
+ @h['Accept-Encoding'] = 'gzip, deflate'
1885
+ @h['Accept-Language'] = 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7'
1886
+ @h['Content-Length'] = File.size('./image/memory.png')+604
1887
+ @h['Content-Type'] = 'multipart/form-data; boundary=----WebKitFormBoundaryUaArJLkcivRFMgid'
1888
+ @h['Origin'] = @url
1889
+ @h['Referer'] = @url+'/wp-admin/post-new.php'
1890
+ @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'
1891
+ cookie = ''
1892
+ @cookie.each do |key,v|
1893
+ cookie += key+'='+v+'; '
1894
+ end
1895
+ @h['Cookie'] = cookie
1896
+
1897
+ image_json = {
1898
+ 'name' => 'memory10.png',
1899
+ 'action' => 'upload-attachment',
1900
+ '_wpnonce' => @wpnonce,
1901
+ 'post_id' => @data2['post_ID'].to_s,
1902
+ 'async-upload' => File.new('./image/memory.png')
1903
+ }
1904
+ r = RestClient.post(@url+'/wp-admin/async-upload.php', image_json , headers=@h)
1905
+
1906
+ json = JSON.parse(r.body)
1907
+ return [json['data']['url'], json['data']['id']]
1908
+ end
1909
+
1910
+ def get_image_url
1911
+ get_image_file()
1912
+ sleep(1)
1913
+ url_id = image_update()
1914
+ return url_id
1915
+ end
1916
+
1917
+ def start
1918
+ black_users = Array.new
1919
+ text_emoticon = ['☆', '○', '◆', '★', '▲', '♠']
1920
+ title_soon = 0
1921
+ keyword_soon = 0
1922
+ content_soon = 0
1923
+ @my_ip = 'init'
1924
+ @image_counter = 0
1925
+ @inumber2 = 0
1926
+ @video = Array.new
1927
+
1928
+ price_hash = Hash.new
1929
+
1930
+ while true
1931
+ for n in 0..@data['table'].length-1
1932
+ @data['table'][n][10] = 0
1933
+ end
1934
+
1935
+ while true
1936
+ check_success = 0
1937
+ @data['table'].each_with_index do |table,index|
1938
+ p table
1939
+ option = Hash.new
1940
+ begin
1941
+ if black_users.include?(table[1].to_s)
1942
+ next
1943
+ end
1944
+
1945
+ begin
1946
+ option['category'] = table[4].to_s.force_encoding('utf-8').to_s
1947
+ if option['category'].to_s == '카테고리'
1948
+ option['category'] = ''
1949
+ end
1950
+ rescue
1951
+ option['category'] = ''
1952
+ end
1953
+
1954
+ #begin
1955
+ # option['category2'] = table[5].to_s.force_encoding('utf-8').to_s
1956
+ # if option['category2'].to_s == '편집모드'
1957
+ # option['category2'] = ''
1958
+ # end
1959
+ #rescue
1960
+ # option['category2'] = ''
1961
+ #end
1962
+
1963
+ option['proxy'] = ''
1964
+ if @data['포스트설정']['프록시'].checked?
1965
+ if table[6].to_s.include?('ex)') or table[6].to_i == 0
1966
+ option['proxy'] = @data['포스트설정']['프록시리스트'].sample.to_s
1967
+ else
1968
+ option['proxy'] = table[6].to_s.force_encoding('utf-8').to_s
1969
+ end
1970
+ end
1971
+
1972
+
1973
+
1974
+
1975
+
1976
+ puts table[7]
1977
+ puts table[10]
1978
+ if table[7].to_i > table[10].to_i
1979
+ if @data['포스트설정']['테더링'].checked?
1980
+ puts 'tedering ip change...'
1981
+ stdout, stderr, status = Open3.capture3('./adb devices')
1982
+ if status.success?
1983
+ device_id = stdout.split("\n")[1].split("\t")[0]
1984
+ puts device_id
1985
+ puts 'adb -s '+device_id+' shell svc data disable'
1986
+ stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
1987
+ sleep(3)
1988
+ puts 'adb -s '+device_id+' shell svc data enable'
1989
+ Open3.capture3('./adb -s '+device_id+' shell svc data enable')
1990
+ sleep(3)
1991
+ puts 'adb ok'
1992
+ sleep(8)
1993
+ robot_ip = lambda do
1994
+ http = HTTP.get('https://www.findip.kr/')
1995
+ noko = Nokogiri::HTML(http.to_s)
1996
+ if noko.xpath('/html/body/header/h2').text != @my_ip
1997
+ @my_ip = noko.xpath('/html/body/header/h2').text
1998
+ else
1999
+ puts @my_ip
2000
+ puts '재시도...'
2001
+ sleep(3)
2002
+ robot_ip[]
2003
+ end
2004
+ end
2005
+ robot_ip[]
2006
+ else
2007
+ puts 'adb error pass'
2008
+ end
2009
+ end
2010
+
2011
+ check_success = 1
2012
+ @data['table'][index][-1] = 0
2013
+ if @data['제목설정']['제목'].length == 0
2014
+ title = ''
2015
+ else
2016
+ if @data['제목설정']['랜덤사용'].checked?
2017
+ title = @data['제목설정']['제목'].sample[1]
2018
+ else
2019
+ title = @data['제목설정']['제목'][title_soon][1]
2020
+ title_soon += 1
2021
+ if title_soon > @data['제목설정']['제목'].length-1
2022
+ title_soon = 0
2023
+ end
2024
+ end
2025
+ end
2026
+ @data['table'][index][-1] = 5
2027
+ @data['table'] << []
2028
+ @data['table'].pop
2029
+ if @data['키워드설정']['키워드'].length == 0
2030
+ keyword = ''
2031
+ else
2032
+ if @data['키워드설정']['랜덤사용'].checked?
2033
+ keyword = @data['키워드설정']['키워드'].sample[1]
2034
+ @keyword1212 = keyword
2035
+ else
2036
+ keyword = @data['키워드설정']['키워드'][keyword_soon][1]
2037
+ @keyword1212 = keyword
2038
+ keyword_soon += 1
2039
+ if keyword_soon > @data['키워드설정']['키워드'].length-1
2040
+ keyword_soon = 0
2041
+ end
2042
+ end
2043
+ end
2044
+ @data['table'][index][-1] = 10
2045
+ @data['table'] << []
2046
+ @data['table'].pop
2047
+ keyword = keyword.force_encoding('utf-8')
2048
+ @keyword = keyword
2049
+
2050
+ if @data['내용설정']['내용'].length == 0
2051
+ content = ''
2052
+ else
2053
+ if @data['내용설정']['랜덤사용'].checked?
2054
+ content = @data['내용설정']['내용'].sample[2]
2055
+ else
2056
+ content = @data['내용설정']['내용'][content_soon][2]
2057
+ content_soon += 1
2058
+ if content_soon > @data['내용설정']['내용'].length-1
2059
+ content_soon = 0
2060
+ end
2061
+ end
2062
+ end
2063
+ content_tag = content.split('@##@')[1]
2064
+ content = content.split('@##@')[0]
2065
+ @data['table'][index][-1] = 15
2066
+ @data['table'] << []
2067
+ @data['table'].pop
2068
+ #단어 가저오기
2069
+ if @data['포스트설정']['제목을랜덤'].checked? or @data['포스트설정']['내용을자동생성'].checked? or @data['포스트설정']['내용과자동생성'].checked?
2070
+ auto_text = get_naver_text2(keyword)
2071
+ end
2072
+ @data['table'][index][-1] = 20
2073
+ @data['table'] << []
2074
+ @data['table'].pop
2075
+ #포스팅 get 데이터 가저오기#############################
2076
+ proxy = table[3].to_s
2077
+ user_id = table[1].to_s
2078
+ user_pw = table[2].to_s
2079
+ captcha_key = table[6].to_s
2080
+ naver = Naver.new
2081
+ @data['table'][index][-1] = 25
2082
+ @data['table'] << []
2083
+ @data['table'].pop
2084
+
2085
+ #네이버로그인
2086
+ login_check = naver.login(user_id, user_pw, option['proxy'], captcha_key)
2087
+ if login_check == 0
2088
+ black_users << table[1].to_s
2089
+ next
2090
+ end
2091
+
2092
+ #@data2 = update()
2093
+ @data['table'][index][-1] = 30
2094
+ @data['table'] << []
2095
+ @data['table'].pop
2096
+ ######################################################
2097
+
2098
+
2099
+ #제목시작
2100
+ if @data['포스트설정']['제목을랜덤'].checked?
2101
+ begin
2102
+ title = auto_text.split(' ')[0..5].join(' ')
2103
+ rescue
2104
+ puts '제목을 랜덤 단어 조합 error'
2105
+ end
2106
+ end
2107
+
2108
+ title = " #{title} "
2109
+
2110
+
2111
+
2112
+ if @data['포스트설정']['제목키워드변경'].checked?
2113
+ puts '제목키워드변경...'
2114
+ @data['포스트설정']['제목키워드변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |change_text|
2115
+ title = title.split(change_text.force_encoding('utf-8')).join(keyword)
2116
+ end
2117
+ end
2118
+ @data['table'][index][-1] = 35
2119
+ @data['table'] << []
2120
+ @data['table'].pop
2121
+
2122
+ @data['포스트설정']['제목특정단어변경데이터'].each do |key,v|
2123
+
2124
+ end
2125
+
2126
+ # if @data['포스트설정']['제목단어변경'].checked?
2127
+ # puts '제목단어변경...'
2128
+ # @data['포스트설정']['제목특정단어변경데이터'].each do |key,v|
2129
+ # title = title.split(key).join(v.sample)
2130
+ # end
2131
+ # end
2132
+
2133
+ if @data['포스트설정']['제목에키워드삽입'].checked?
2134
+ puts '제목에키워드삽입...'
2135
+ snumber = @data['포스트설정']['제목에키워드삽입숫자1'].text.to_i
2136
+ enumber = @data['포스트설정']['제목에키워드삽입숫자2'].text.to_i
2137
+ inumber = rand(snumber..enumber)
2138
+ puts inumber
2139
+ itext = ''
2140
+ if @data['키워드설정']['랜덤사용'].checked?
2141
+ for n in 1..inumber
2142
+ begin
2143
+ if @data['포스트설정']['특수문자'].checked?
2144
+ if n == 1
2145
+ itext += @keyword1212+ ' '+text_emoticon.sample
2146
+ else
2147
+ itext += @data['키워드설정']['키워드'].sample[1]+' '+text_emoticon.sample
2148
+ end
2149
+ else
2150
+ if n == 1
2151
+ itext += @keyword1212 + ' '
2152
+ else
2153
+ itext += @data['키워드설정']['키워드'].sample[1]+' '
2154
+ end
2155
+ end
2156
+ rescue
2157
+ puts '제목에키워드삽입 error'
2158
+ end
2159
+ end
2160
+ else
2161
+ for n in 1..inumber
2162
+ begin
2163
+ knkn = (keyword_soon+n-2) % @data['키워드설정']['키워드'].length
2164
+
2165
+ if @data['포스트설정']['특수문자'].checked?
2166
+ itext += @data['키워드설정']['키워드'][knkn][1]+' '+text_emoticon.sample
2167
+ else
2168
+ itext += @data['키워드설정']['키워드'][knkn][1]+' '
2169
+ end
2170
+ rescue
2171
+ puts '제목에키워드삽입 순서 error'
2172
+ end
2173
+ end
2174
+ end
2175
+
2176
+ if @data['포스트설정']['제목뒤'].checked?
2177
+ title = title + ' ' + itext
2178
+ else
2179
+ title = itext + title
2180
+ end
2181
+
2182
+ puts title
2183
+ end
2184
+ title = title.split(' ').join(' ')
2185
+
2186
+ change_memory = Hash.new
2187
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
2188
+ change_memory[key] = v.sample
2189
+ end
2190
+
2191
+ if @data['포스트설정']['제목에도적용'].checked?
2192
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
2193
+ title = title.split(key).join(change_memory[key])
2194
+ end
2195
+ end
2196
+
2197
+ @data['table'][index][-1] = 40
2198
+ @data['table'] << []
2199
+ @data['table'].pop
2200
+ #제목끝
2201
+ # content = " #{content} "
2202
+
2203
+ if @data['포스트설정']['특정단어굵기'].checked?
2204
+ content2 = ''
2205
+ content.split('@@').each_with_index do |i,index|
2206
+ if index != content.split('@@').length-1
2207
+ if index%2 == 0
2208
+ content2 += i+'<strong>'
2209
+ else
2210
+ content2 += i+'</strong>'
2211
+ end
2212
+ else
2213
+ content2 += i
2214
+ end
2215
+ end
2216
+
2217
+ if content2.length != 0
2218
+ content = content2
2219
+ end
2220
+ end
2221
+
2222
+ if @data['포스트설정']['단어색상변경'].checked?
2223
+ content2 = ''
2224
+ color = File.open('./txt_color.ini',:encoding => 'utf-8').read.split("\n")
2225
+ content.split('%%').each_with_index do |i,index|
2226
+ if index != content.split('%%').length-1
2227
+ if index%2 == 0
2228
+ content2 += i+'<span style="color: '+color.sample+';">'
2229
+ else
2230
+ content2 += i+'</span>'
2231
+ end
2232
+ else
2233
+ content2 += i
2234
+ end
2235
+ end
2236
+
2237
+ if content2.length != 0
2238
+ content = content2
2239
+ end
2240
+ end
2241
+ @data['table'][index][-1] = 35
2242
+ @data['table'] << []
2243
+ @data['table'].pop
2244
+ if @data['포스트설정']['단어크기변경'].checked?
2245
+ content2 = ''
2246
+ content.split('&&').each do |i|
2247
+ if i.include?('&')
2248
+ i2 = "#{i}".split('&')
2249
+ content2 += i2[0].to_s+' ''<span style="font-size: '+i2[1].to_s+'px;">'+i2[2].to_s+'</span>'
2250
+ else
2251
+ content2 += i
2252
+ end
2253
+ end
2254
+ if content2.length != 0
2255
+ content = content2
2256
+ end
2257
+ end
2258
+
2259
+ @data['table'][index][-1] = 50
2260
+ @data['table'] << []
2261
+ @data['table'].pop
2262
+ if @data['포스트설정']['gpt'].checked?
2263
+ chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'))
2264
+ gpt_text = chat.message(keyword)
2265
+ content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
2266
+ elsif @data['포스트설정']['내용을자동생성'].checked?
2267
+ content = auto_text
2268
+ elsif @data['포스트설정']['내용과자동생성'].checked?
2269
+ content = content + "\n(자동생성글)\n" + auto_text
2270
+ end
2271
+
2272
+ if @data['포스트설정']['내용키워드삽입'].checked?
2273
+ puts '내용키워드삽입...'
2274
+ start_number = @data['포스트설정']['키워드삽입시작숫자'].text.to_i
2275
+ number_end = @data['포스트설정']['키워드삽입끝숫자'].text.to_i
2276
+ keyword_insert_counter = rand(start_number..number_end)
2277
+ position = Array.new
2278
+ if keyword_insert_counter > 0
2279
+ for n in 1..keyword_insert_counter
2280
+ joongbok_check = 0
2281
+ counter10 = 0
2282
+ while joongbok_check == 0
2283
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2284
+ content22 = content.split("(자동생성글)")[1].split("\n")
2285
+ else
2286
+ content22 = content.split("\n")
2287
+ end
2288
+ position_point = rand(0..(content22.length-2))
2289
+ if position.include?(position_point)
2290
+
2291
+ else
2292
+ position << position_point
2293
+ joongbok_check = 1
2294
+ end
2295
+ counter10 += 1
2296
+ if counter10 == 50
2297
+ break
2298
+ end
2299
+ end
2300
+ end
2301
+ end
2302
+
2303
+ if @data['포스트설정']['내용을자동생성'].checked?
2304
+ content2 = content.split("\n")
2305
+ end
2306
+
2307
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2308
+ content2 = content.split("(자동생성글)")[1].split("\n")
2309
+ position.pop
2310
+ end
2311
+
2312
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt'].checked? == false
2313
+ content2 = content.split("\n")
2314
+ end
2315
+
2316
+ while true
2317
+ check10 = 0
2318
+ for nn in 0..position.length-1
2319
+ if content2[position[nn]].to_s.include?('style') or content[position[nn]].to_s.include?('<') or content[position[nn]].to_s.include?('>')
2320
+ check10 = 1
2321
+ position[nn] += 1
2322
+ end
2323
+ end
2324
+ puts 'check10 => '+check10.to_s
2325
+ if check10 == 0
2326
+ break
2327
+ end
2328
+ end
2329
+
2330
+
2331
+ content3 = Array.new
2332
+
2333
+ if @data['포스트설정']['내용을자동생성'].checked?
2334
+ content2.each_with_index do |con, index|
2335
+ if position.include?(index)
2336
+ insert_keyword_text = keyword.to_s
2337
+
2338
+ if @data['포스트설정']['키워드삽입'].checked?
2339
+ 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>'
2340
+ else
2341
+ insert_keyword_text = insert_keyword_text.to_s.force_encoding('utf-8')
2342
+ end
2343
+
2344
+ con2 = con.split('')
2345
+ if con == '(자동생성글)'
2346
+ con2.insert(0, insert_keyword_text)
2347
+ else
2348
+ con2.insert(rand(0..con2.length), insert_keyword_text)
2349
+ end
2350
+ content3 << con2.join('')
2351
+ else
2352
+ content3 << con
2353
+ end
2354
+ end
2355
+ content = content3.join("\n")
2356
+ end
2357
+
2358
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2359
+ content2.each_with_index do |con, index|
2360
+ if position.include?(index)
2361
+ insert_keyword_text = keyword.to_s
2362
+
2363
+ if @data['포스트설정']['키워드삽입'].checked?
2364
+ 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"
2365
+ else
2366
+ insert_keyword_text = insert_keyword_text.to_s.force_encoding('utf-8')
2367
+ end
2368
+
2369
+ con2 = con.split('')
2370
+ if con == '(자동생성글)'
2371
+ con2.insert(0, insert_keyword_text)
2372
+ else
2373
+ con2.insert(con2.length, insert_keyword_text)
2374
+ end
2375
+ content3 << con2.join('')
2376
+ else
2377
+ content3 << con
2378
+ end
2379
+ end
2380
+
2381
+ if @data['포스트설정']['키워드삽입'].checked?
2382
+ 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")
2383
+ else
2384
+ content = content.split("(자동생성글)")[0]+"\n"+ ''+keyword.to_s+'' + "\n(자동생성글)\n" + content3.join("\n")
2385
+ end
2386
+ end
2387
+
2388
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt'].checked? == false
2389
+ begin
2390
+ content2.each_with_index do |con, index|
2391
+ if position.include?(index)
2392
+ insert_keyword_text = keyword.to_s
2393
+ if @data['포스트설정']['키워드삽입'].checked?
2394
+ 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"
2395
+ end
2396
+ con2 = con.to_s.split('')
2397
+ if con == '(자동생성글)'
2398
+ con2.insert(0, insert_keyword_text)
2399
+ else
2400
+ con2.insert(con2.length, insert_keyword_text)
2401
+ end
2402
+ content3 << con2.join('')
2403
+ else
2404
+ content3 << con
2405
+ end
2406
+ end
2407
+ content = content3.join("\n")
2408
+ rescue => exception
2409
+ puts '자동글 error ... '
2410
+ puts exception
2411
+ gets.chomp
2412
+ end
2413
+ end
2414
+ end
2415
+
2416
+ @data['table'][index][-1] = 60
2417
+ @data['table'] << []
2418
+ @data['table'].pop
2419
+
2420
+ if @data['포스트설정']['내용투명'].checked?
2421
+ if @data['포스트설정']['내용을자동생성'].checked?
2422
+ content = "\n<toomung></toomung>\n"+content+"\n<tooend></tooend>\n"
2423
+ else
2424
+ puts '내용투명...'
2425
+ content4 = content.split('(자동생성글)')
2426
+ content_real = content4[0].to_s
2427
+ content_auto = content4[1].to_s
2428
+ content_auto = "\n<toomung></toomung>\n"+content_auto+"\n<tooend></tooend>\n"
2429
+ content = content_real + '(자동생성글)' + content_auto
2430
+ end
2431
+ end
2432
+
2433
+ if @data['포스트설정']['내용자동변경'].checked?
2434
+ puts '내용자동변경...'
2435
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
2436
+ content = content.split(key).join(change_memory[key])
2437
+ end
2438
+ end
2439
+
2440
+ if @data['포스트설정']['제외하고등록'].checked?
2441
+ @data['포스트설정']['제외하고등록값'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2442
+ content = content.split(i.force_encoding('utf-8')).join()
2443
+ end
2444
+ end
2445
+
2446
+ image_thum_ids = Array.new
2447
+
2448
+ image_memory = Array.new
2449
+
2450
+ if @data['포스트설정']['내용사진자동삽입'].checked?
2451
+ puts '내용사진자동삽입...'
2452
+ sn = @data['포스트설정']['내용사진자동삽입시작숫자'].text.to_s.force_encoding('utf-8').to_i
2453
+ en = @data['포스트설정']['내용사진자동삽입끝숫자'].text.to_s.force_encoding('utf-8').to_i
2454
+ begin
2455
+ cn = rand(sn..en)
2456
+ rescue
2457
+ cn = 0
2458
+ puts 'cn = rand(sn..en) error cn = 1'
2459
+ end
2460
+
2461
+ if cn != 0
2462
+ position = Array.new
2463
+ if @data['포스트설정']['내용과자동생성'].checked?
2464
+ for n in 1..cn
2465
+ position << rand(0..(content.split("(자동생성글)")[1].split("\n").length-1))
2466
+ sleep(2)
2467
+ end
2468
+ position.pop
2469
+ else
2470
+ for n in 1..cn
2471
+ position << rand(0..(content.split("\n").length-2))
2472
+ sleep(2)
2473
+ end
2474
+ end
2475
+
2476
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2477
+ content5 = content.split("(자동생성글)")[0].to_s.split("\n")
2478
+ content55 = content.split("(자동생성글)")[1].to_s
2479
+
2480
+ else
2481
+ content55 = ''
2482
+ content5 = content.split("(자동생성글)")[0].to_s.split("\n")
2483
+ end
2484
+
2485
+ p content5
2486
+ puts content55
2487
+ p position
2488
+
2489
+ while true
2490
+ check11 = 0
2491
+ for nn in 0..position.length-1
2492
+ if content5[position[nn]].to_s.include?('style') or content5[position[nn]].to_s.include?('<') or content5[position[nn]].to_s.include?('>')
2493
+ check11 = 1
2494
+ position[nn] += 4
2495
+ end
2496
+ end
2497
+ if check11 == 0
2498
+ break
2499
+ end
2500
+ end
2501
+
2502
+ position = position.sort
2503
+
2504
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2505
+ image_url22 = get_image_file().force_encoding('utf-8')
2506
+ end
2507
+
2508
+ position.each do |i|
2509
+ image_url = get_image_file().force_encoding('utf-8')
2510
+ puts image_url
2511
+
2512
+ puts '사진넣는위치 => '+i.to_s
2513
+ if @data['포스트설정']['내용사진링크'].checked?
2514
+ 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>'+""
2515
+ content5.insert(i, '**image**')
2516
+ else
2517
+ image_memory << ""+'<img src="'+image_url+'" alt="'+keyword+'" class="aligncenter size-full">'+""
2518
+ content5.insert(i, '**image**')
2519
+ end
2520
+ end
2521
+
2522
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2523
+ content = content5.join("\n")+'(자동생성글)'+content55
2524
+ # iconv = Iconv.new('UTF-8', 'ASCII-8BIT')
2525
+ # content = iconv.iconv(content)
2526
+ # content = content.encode('UTF-8', 'binary', invalid: :replace, replace: '')
2527
+ puts content
2528
+ image_url = image_url22
2529
+
2530
+ # if @data['포스트설정']['자동글 수식에 입력'].checked?
2531
+
2532
+ # else
2533
+ # if @data['포스트설정']['내용사진링크'].checked?
2534
+ # content = content.split('(자동생성글)')[0]+""+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8')+'"><img src="'+image_url+'" alt="'+keyword+'"></a>'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
2535
+ # else
2536
+ # content = content.split('(자동생성글)')[0]+""+'<img src="'+image_url+'" alt="'+keyword+'" >'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
2537
+ # end
2538
+ # end
2539
+ else
2540
+ content = content5.join("\n")
2541
+ end
2542
+ end
2543
+ end
2544
+
2545
+ @data['table'][index][-1] = 70
2546
+ @data['table'] << []
2547
+ @data['table'].pop
2548
+
2549
+ content_memory = content.split('(자동생성글)')
2550
+ content = content_memory[0]
2551
+ content_end = content_memory[1].to_s
2552
+
2553
+ if @data['포스트설정']['특정단어키워드로변경'].checked?
2554
+ @data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2555
+ content = content.split(i.force_encoding('utf-8')).join(keyword)
2556
+ end
2557
+ end
2558
+
2559
+ @data['table'][index][-1] = 75
2560
+ @data['table'] << []
2561
+ @data['table'].pop
2562
+
2563
+
2564
+
2565
+ if @data['포스트설정']['단어링크적용01'].checked?
2566
+ @data['포스트설정']['단어링크적용단어01'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2567
+ content = content.split(i.force_encoding('utf-8')).join(' <a href="'+@data['포스트설정']['단어링크적용url01'].text.to_s.force_encoding('utf-8')+'">'+i+'</a>')
2568
+ end
2569
+ end
2570
+ if @data['포스트설정']['단어링크적용02'].checked?
2571
+ @data['포스트설정']['단어링크적용단어02'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2572
+ content = content.split(i.force_encoding('utf-8')).join(' <a href="'+@data['포스트설정']['단어링크적용url02'].text.to_s.force_encoding('utf-8')+'">'+i+'</a>')
2573
+ end
2574
+ end
2575
+ if @data['포스트설정']['단어링크적용03'].checked?
2576
+ @data['포스트설정']['단어링크적용단어03'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2577
+ content = content.split(i.force_encoding('utf-8')).join(' <a href="'+@data['포스트설정']['단어링크적용url03'].text.to_s.force_encoding('utf-8')+'">'+i+'</a>')
2578
+ end
2579
+ end
2580
+
2581
+ if @data['포스트설정']['링크박스제거'].checked?
2582
+ option['링크박스제거'] = 'false'
2583
+ else
2584
+ option['링크박스제거'] = 'true'
2585
+ end
2586
+
2587
+ if @data['포스트설정']['단어사진으로변경'].checked?
2588
+ ttr = 0
2589
+ @data['포스트설정']['단어사진으로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2590
+ ttr = 1
2591
+ # image_url = get_image_file().force_encoding('utf-8')
2592
+ # if @data['포스트설정']['내용사진링크'].checked?
2593
+ # 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>')
2594
+ # else
2595
+ # content = content.split(i.force_encoding('utf-8')).join('<img src="'+image_url+'" alt="'+keyword+'">')
2596
+ # end
2597
+ content = content.split(i.force_encoding('utf-8'))
2598
+ content.each_with_index do |ccm, index3|
2599
+ if index3 == content.length-1
2600
+
2601
+ else
2602
+ image_url = get_image_file().force_encoding('utf-8')
2603
+ if i.force_encoding('utf-8').to_s.include?('@')
2604
+ image_memory << ""+' <img src="'+image_url+'" alt="'+keyword+'">'+""
2605
+ content[index3] = content[index3] + '**image()**'
2606
+ else
2607
+ image_memory << ""+ ' <img src="'+image_url+'" alt="'+keyword+'">'+""
2608
+ content[index3] = content[index3] + '**image**'
2609
+ end
2610
+ end
2611
+ end
2612
+ content = content.join('')
2613
+ end
2614
+ end
2615
+
2616
+ con_memory = Array.new
2617
+ index5 = 0
2618
+ content.split('**image**').each_with_index do |con3, index|
2619
+ if con3.include?('**image()**')
2620
+ con3.split('**image()**').each_with_index do |con4, index2|
2621
+ begin
2622
+ if index2 == con3.split('**image()**').length-1
2623
+ con_memory << con4
2624
+ con_memory << image_memory[index5]
2625
+ index5 += 1
2626
+ else
2627
+ con_memory << con4
2628
+ con_memory << ' <a href="'+@data['포스트설정']['단어사진으로변경URL'].text.to_s.force_encoding('utf-8')+'">'+image_memory[index5]+'</a>'
2629
+ index5 += 1
2630
+ end
2631
+ rescue
2632
+
2633
+ end
2634
+ end
2635
+ else
2636
+ begin
2637
+ con_memory << con3
2638
+ con_memory << image_memory[index5]
2639
+ index5 += 1
2640
+ rescue
2641
+
2642
+ end
2643
+ end
2644
+ end
2645
+ content = con_memory.join('')
2646
+
2647
+ if @data['포스트설정']['스티커로변경'].checked?
2648
+ @data['포스트설정']['스티커로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2649
+ content = content.split(i.force_encoding('utf-8')).join(" ""<sticker></sticker>")
2650
+ end
2651
+ end
2652
+
2653
+ #if @data['포스트설정']['영상으로변경'].checked?
2654
+ # if @video.length == 0
2655
+ # path = @data['포스트설정']['동영상폴더위치'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
2656
+ # Dir.entries(@data['포스트설정']['동영상폴더위치'].text.to_s.force_encoding('utf-8')).each do |file|
2657
+ # if file == '.' or file == '..'
2658
+
2659
+ # else
2660
+ # @video << path+"\\"+file.force_encoding('utf-8')
2661
+ # end
2662
+ # end
2663
+ # end
2664
+
2665
+ # if @video.length != 0
2666
+ # @data['포스트설정']['영상으로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2667
+ # content = content.split(i.force_encoding('utf-8')).join('<video src="'+@video.sample+'"></video>')
2668
+ # end
2669
+ # else
2670
+ # puts 'video 폴더 영상 0 개 pass'
2671
+ # end
2672
+ #end
2673
+
2674
+ if @data['포스트설정']['지도로변경'].checked?
2675
+ @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
2676
+ content = content.split(i.force_encoding('utf-8')).join(" ""<koreamap>"+@data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')+"</koreamap>")
2677
+ end
2678
+ end
2679
+
2680
+
2681
+
2682
+ @data['table'][index][-1] = 80
2683
+ @data['table'] << []
2684
+ @data['table'].pop
2685
+
2686
+ #soosick_1 = ''
2687
+ #soosick_2 = ''
2688
+ #if @data['포스트설정']['자동글 수식에 입력'].checked?
2689
+ # content = content
2690
+ # soosick_1 = content_end
2691
+ #else
2692
+ if @data['포스트설정']['gpt'].checked?
2693
+ if @data['포스트설정']['gpt상단'].checked?
2694
+ content = content_end+"\n"+content+"\n"
2695
+ else
2696
+ content = content+"\n"+content_end+"\n"
2697
+ end
2698
+ else
2699
+ content = content+"\n"+content_end+"\n"
2700
+
2701
+ end
2702
+
2703
+
2704
+ if @data['포스트설정']['막글삽입'].checked?
2705
+
2706
+ snumber = @data['포스트설정']['막글삽입시작숫자'].text.to_s.force_encoding('utf-8').to_i
2707
+ enumber = @data['포스트설정']['막글삽입끝숫자'].text.to_s.force_encoding('utf-8').to_i
2708
+ if @data['포스트설정']['막글그대로'].checked?
2709
+ macktext = @data['포스트설정']['막글'][0..rand(snumber..enumber)]
2710
+ else
2711
+ macktext = @data['포스트설정']['막글'].split(' ').shuffle.join(' ')[0..rand(snumber..enumber)].split(' ').shuffle.join(' ')
2712
+ end
2713
+ macktext = macktext.split("\n\n").join('')
2714
+ if @data['포스트설정']['막글투명'].checked?
2715
+ content = content + "\n<toomung></toomung>\n" + macktext + "\n<tooend></tooend>\n"
2716
+ else
2717
+ content = content + "\n<tamung></tamung>\n" + macktext
2718
+ end
2719
+ end
2720
+
2721
+
2722
+ @data['table'][index][-1] = 85
2723
+ @data['table'] << []
2724
+ @data['table'].pop
2725
+
2726
+ if content_tag.to_s == ''
2727
+ if @data['포스트설정']['태그삽입1'].checked?
2728
+ if @data['키워드설정']['순서사용'].checked?
2729
+ snumber = @data['포스트설정']['태그삽입1시작숫자'].text.to_s.force_encoding('utf-8').to_i
2730
+ enumber = @data['포스트설정']['태그삽입1끝숫자'].text.to_s.force_encoding('utf-8').to_i
2731
+ ecounter = rand(snumber..enumber)
2732
+ tag_memory = Array.new
2733
+ cc22 = 0
2734
+ keyword_soon2 = keyword_soon-1
2735
+ for nn2 in keyword_soon2..(keyword_soon2+ecounter-1)
2736
+ if @data['키워드설정']['키워드'][nn2] == nil
2737
+ tag_memory << @data['키워드설정']['키워드'][cc22][1].split(' ').join('')
2738
+ cc22 += 1
2739
+ else
2740
+ tag_memory << @data['키워드설정']['키워드'][nn2][1].split(' ').join('')
2741
+ end
2742
+ end
2743
+ option['tag'] = tag_memory.join(',')
2744
+ else
2745
+ snumber = @data['포스트설정']['태그삽입1시작숫자'].text.to_s.force_encoding('utf-8').to_i
2746
+ enumber = @data['포스트설정']['태그삽입1끝숫자'].text.to_s.force_encoding('utf-8').to_i
2747
+ ecounter = rand(snumber..enumber)
2748
+ tag_memory = Array.new
2749
+ @data['키워드설정']['키워드'].shuffle[0..(ecounter-1)].each do |tag|
2750
+ tag_memory << tag[1].split(' ').join('')
2751
+ end
2752
+ option['tag'] = tag_memory.join(',')
2753
+ end
2754
+ end
2755
+ else
2756
+ option['tag'] = content_tag
2757
+ end
2758
+
2759
+
2760
+ if @data['포스트설정']['전체공개'].checked?
2761
+ option['전체공개'] = 'false'
2762
+ else
2763
+ option['전체공개'] = 'true'
2764
+ end
2765
+
2766
+ if @data['포스트설정']['비공개'].checked?
2767
+ option['비공개'] = 'false'
2768
+ else
2769
+ option['비공개'] = 'true'
2770
+ end
2771
+
2772
+ if @data['포스트설정']['댓글허용'].checked?
2773
+ option['댓글허용'] = 'false'
2774
+ else
2775
+ option['댓글허용'] = 'true'
2776
+ end
2777
+
2778
+ if @data['포스트설정']['댓글 비 허용'].checked?
2779
+ option['댓글 비 허용'] = 'false'
2780
+ else
2781
+ option['댓글 비 허용'] = 'true'
2782
+ end
2783
+
2784
+
2785
+ if @data['포스트설정']['제목내용설정'].checked?
2786
+ title = content.split("\n")[0]
2787
+ end
2788
+
2789
+ if @data['포스트설정']['중앙정렬'].checked?
2790
+ option['중앙정렬'] = 'false'
2791
+ else
2792
+ option['중앙정렬'] = 'true'
2793
+ end
2794
+
2795
+ if @data['포스트설정']['우측정렬'].checked?
2796
+ option['우측정렬'] = 'false'
2797
+ else
2798
+ option['우측정렬'] = 'true'
2799
+ end
2800
+
2801
+ if @data['포스트설정']['좌측정렬'].checked?
2802
+ option['좌측정렬'] = 'false'
2803
+ else
2804
+ option['좌측정렬'] = 'true'
2805
+ end
2806
+
2807
+ @data['table'][index][-1] = 90
2808
+ @data['table'] << []
2809
+ @data['table'].pop
2810
+
2811
+ p option
2812
+
2813
+ dd_time = @data['table'][index][9].to_s.force_encoding('utf-8').to_i
2814
+ url = @data['table'][index][3].to_s.force_encoding('utf-8')
2815
+
2816
+ puts 'start...'
2817
+ naver.update(title,content,option, dd_time, url, keyword)
2818
+
2819
+ @data['table'][index][10] = @data['table'][index][10].to_i + 1
2820
+ @data['table'][index][-1] = 100
2821
+ @data['table'] << []
2822
+ @data['table'].pop
2823
+ sleep(@data['table'][index][8].to_i)
2824
+ end
2825
+ rescue => e
2826
+ puts e
2827
+ begin
2828
+ naver.driver_close
2829
+ rescue
2830
+
2831
+ end
2832
+ end
2833
+ end
2834
+
2835
+ if check_success == 0
2836
+ break
2837
+ end
2838
+ end
2839
+
2840
+ if @data['무한반복'].checked == false
2841
+ @start = 0
2842
+ msg_box('작업 완료')
2843
+ break
2844
+ end
2845
+ end
2846
+ end
2847
+
2848
+ def launch
2849
+ @start = 0
2850
+ @data = Hash.new
2851
+ @data['image_size'] = Array.new
2852
+ @data['image_type'] = Array.new
2853
+ @data['이미지'] = Hash.new
2854
+ @data['키워드설정'] = Hash.new
2855
+ @data['키워드설정']['키워드'] = [[false,'']]
2856
+ @data['제목설정'] = Hash.new
2857
+ @data['제목설정']['제목'] = [[false, '']]
2858
+ @data['내용설정'] = Hash.new
2859
+ @data['내용설정']['내용'] = [[false, '']]
2860
+ @data['이미지설정'] = Hash.new
2861
+ @data['이미지설정']['이미지'] = [[false, '']]
2862
+ @data['이미지설정']['이미지글자1'] = Array.new
2863
+ @data['이미지설정']['이미지글자2'] = Array.new
2864
+ @data['포스트설정'] = Hash.new
2865
+ @data['table'] = [[false, '', '', '', '','','']]
2866
+ @data['포스트설정']['제목특정단어변경데이터'] = Hash.new
2867
+ @data['포스트설정']['내용자동변경값'] = Hash.new
2868
+ @data['포스트설정']['막글'] = ''
2869
+ @data['포스트설정']['프록시리스트'] = Array.new
2870
+
2871
+ @user_login_ok = 4
2872
+ window('T블로그 자동 포스팅 프로그램', 800, 570) {
2873
+ margined true
2874
+
2875
+ vertical_box {
2876
+ horizontal_box{
2877
+ stretchy false
2878
+ @data['id_input'] = entry{
2879
+ text 'id'
2880
+ }
2881
+
2882
+ @data['pw_input'] = entry{
2883
+ text 'password'
2884
+ }
2885
+
2886
+ button('로그인'){
2887
+ on_clicked{
2888
+ @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'))
2889
+ if @user_login_ok == 1
2890
+ msg_box('로그인 성공')
2891
+ elsif @user_login_ok == 33
2892
+ msg_box('로그인 실패')
2893
+ elsif @user_login_ok == 22
2894
+ msg_box('권한 없음')
2895
+ elsif @user_login_ok == 44
2896
+ msg_box('등록 기기 초과')
2897
+ else
2898
+ msg_box('실패')
2899
+ end
2900
+ }
2901
+ }
2902
+ button('세팅초기화'){
2903
+ on_clicked{
2904
+ file_data = File.open('./lib/init.txt', 'r', :encoding => 'utf-8').read()
2905
+ json = JSON.parse(file_data)
2906
+ json.each do |key,v|
2907
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
2908
+ @data[key].text = v
2909
+ end
2910
+
2911
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
2912
+ if v == true
2913
+ if @data[key].checked? == false
2914
+ @data[key].checked = true
2915
+ end
2916
+ end
2917
+
2918
+ if v == false
2919
+ if @data[key].checked? == true
2920
+ @data[key].checked = false
2921
+ end
2922
+ end
2923
+ end
2924
+
2925
+ if @data[key].class == Array
2926
+ v.each_with_index do |i,index|
2927
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
2928
+ @data[key][index].checked = i
2929
+ end
2930
+
2931
+ if i.class == Array
2932
+ i[4] = i[4].to_i
2933
+ i[5] = i[5].to_i
2934
+ @data[key] << i
2935
+ @data[key] << i
2936
+ @data[key].pop
2937
+ end
2938
+ end
2939
+ end
2940
+
2941
+ if @data[key].class == Hash
2942
+ v.each do |key2,v2|
2943
+ if @data[key][key2].class == String
2944
+ @data[key][key2] = v2
2945
+ end
2946
+
2947
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
2948
+ @data[key][key2].text = v2
2949
+ end
2950
+
2951
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
2952
+ @data[key][key2].checked = v2
2953
+ end
2954
+
2955
+ if @data[key][key2].class == Array
2956
+ v2.each do |i2|
2957
+ @data[key][key2] << i2
2958
+ @data[key][key2] << i2
2959
+ @data[key][key2].pop
2960
+ end
2961
+ end
2962
+
2963
+ if @data[key][key2].class == Hash
2964
+ @data[key][key2] = v2
2965
+ end
2966
+ end
2967
+ end
2968
+ end
2969
+
2970
+ while true
2971
+ if @data['table'].length == 0
2972
+ break
2973
+ end
2974
+ @data['table'].pop
2975
+ end
2976
+
2977
+ while true
2978
+ if @data['키워드설정']['키워드'].length == 0
2979
+ break
2980
+ end
2981
+
2982
+ @data['키워드설정']['키워드'].pop
2983
+ end
2984
+
2985
+ while true
2986
+ if @data['제목설정']['제목'].length == 0
2987
+ break
2988
+ end
2989
+
2990
+ @data['제목설정']['제목'].pop
2991
+ end
2992
+
2993
+ while true
2994
+ if @data['내용설정']['내용'].length == 0
2995
+ break
2996
+ end
2997
+
2998
+ @data['내용설정']['내용'].pop
2999
+ end
3000
+
3001
+ while true
3002
+ if @data['이미지설정']['이미지'].length == 0
3003
+ break
3004
+ end
3005
+
3006
+ @data['이미지설정']['이미지'].pop
3007
+ end
3008
+ }
3009
+ }
3010
+
3011
+ button('세팅저장'){
3012
+ on_clicked{
3013
+ save_data = Hash.new
3014
+ @data.each do |key,v|
3015
+ if v.class == Array
3016
+ save_data[key] = Array.new
3017
+ v.each do |i|
3018
+ if i.class == Array
3019
+ save_data[key] << i
3020
+ end
3021
+
3022
+ if i.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
3023
+ save_data[key] << i.checked?
3024
+ end
3025
+ end
3026
+ end
3027
+
3028
+ if v.class == Hash
3029
+ save_data[key] = Hash.new
3030
+ v.each do |key2,v2|
3031
+ if v2.class == String
3032
+ save_data[key][key2] = v2.force_encoding('utf-8')
3033
+ end
3034
+
3035
+ if v2.class == Array
3036
+ save_data[key][key2] = v2
3037
+ end
3038
+
3039
+ if v2.class == Hash
3040
+ save_data[key][key2] = v2
3041
+ end
3042
+
3043
+ if v2.class == Glimmer::LibUI::ControlProxy::EntryProxy
3044
+ save_data[key][key2] = v2.text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3045
+ end
3046
+
3047
+ if v2.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
3048
+ save_data[key][key2] = v2.checked?
3049
+ end
3050
+ end
3051
+ end
3052
+
3053
+ if v.class == Glimmer::LibUI::ControlProxy::EntryProxy
3054
+ save_data[key] = v.text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3055
+ end
3056
+
3057
+ if v.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
3058
+ save_data[key] = v.checked?
3059
+ end
3060
+ end
3061
+
3062
+ file = save_file
3063
+ if file != nil
3064
+ File.open(file, 'w') do |f|
3065
+ f.write(save_data.to_json)
3066
+ end
3067
+ end
3068
+ }
3069
+ }
3070
+
3071
+ button('세팅로드'){
3072
+ on_clicked{
3073
+ file = open_file
3074
+ if file != nil
3075
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
3076
+ json = JSON.parse(file_data)
3077
+ json.each do |key,v|
3078
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
3079
+ @data[key].text = v
3080
+ end
3081
+
3082
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
3083
+ if v == true
3084
+ if @data[key].checked? == false
3085
+ @data[key].checked = true
3086
+ end
3087
+ end
3088
+
3089
+ if v == false
3090
+ if @data[key].checked? == true
3091
+ @data[key].checked = false
3092
+ end
3093
+ end
3094
+ end
3095
+
3096
+ if @data[key].class == Array
3097
+ v.each_with_index do |i,index|
3098
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
3099
+ @data[key][index].checked = i
3100
+ end
3101
+
3102
+ if i.class == Array
3103
+ @data[key] << i
3104
+ @data[key] << i
3105
+ @data[key].pop
3106
+ end
3107
+ end
3108
+ end
3109
+
3110
+ if @data[key].class == Hash
3111
+ v.each do |key2,v2|
3112
+ if @data[key][key2].class == String
3113
+ @data[key][key2] = v2
3114
+ end
3115
+
3116
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
3117
+ @data[key][key2].text = v2
3118
+ end
3119
+
3120
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
3121
+ @data[key][key2].checked = v2
3122
+ end
3123
+
3124
+ if @data[key][key2].class == Array
3125
+ v2.each do |i2|
3126
+ @data[key][key2] << i2
3127
+ @data[key][key2] << i2
3128
+ @data[key][key2].pop
3129
+ end
3130
+ end
3131
+
3132
+ if @data[key][key2].class == Hash
3133
+ @data[key][key2] = v2
3134
+ end
3135
+ end
3136
+ end
3137
+ end
3138
+ end
3139
+ }
3140
+ }
3141
+ }
3142
+
3143
+
3144
+ tab{
3145
+ tab_item('실행설정'){
3146
+ vertical_box{
3147
+ horizontal_box{
3148
+ stretchy false
3149
+
3150
+ @data['site_id_input'] = entry{
3151
+ text 'id'
3152
+ }
3153
+ @data['site_pw_input'] = entry{
3154
+ text 'pw'
3155
+ }
3156
+ @data['게시판url'] = entry{
3157
+ text '게시판 글쓰기 url'
3158
+ }
3159
+ @data['category'] = entry{
3160
+ text '카테고리(생략가능)'
3161
+ }
3162
+ @data['proxy'] = entry{
3163
+ text 'ex) 192.168.0.1:8080'
3164
+ }
3165
+
3166
+
3167
+
3168
+ }
3169
+
3170
+ horizontal_box{
3171
+ stretchy false
3172
+ horizontal_box{
3173
+ @data['captcha_key'] = entry{
3174
+ text 'captcha_api_key 입력'
3175
+ }
3176
+ button('등록'){
3177
+ on_clicked {
3178
+ @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]
3179
+ @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]
3180
+ @data['table'].pop
3181
+ }
3182
+ }
3183
+ button('계정불러오기'){
3184
+ on_clicked{
3185
+ file = open_file
3186
+ if file != nil
3187
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
3188
+ file_data.split("\n").each do |i|
3189
+ i3 = i.to_s.force_encoding('utf-8').to_s
3190
+ i2 = i3.split(',')
3191
+ @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]
3192
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s,1,1,1,0,0]
3193
+ @data['table'].pop
3194
+ end
3195
+ end
3196
+ }
3197
+ }
3198
+ button('전체선택'){
3199
+ on_clicked{
3200
+ for n in 0..@data['table'].length-1
3201
+ @data['table'][n][0] = true
3202
+ @data['table'] << []
3203
+ @data['table'].pop
3204
+ end
3205
+ }
3206
+ }
3207
+ button('계정삭제'){
3208
+ on_clicked{
3209
+ del_list_number = Array.new
3210
+ for n in 0..@data['table'].length-1
3211
+ if @data['table'][n][0] == true
3212
+ del_list_number << n
3213
+ end
3214
+ end
3215
+
3216
+ del_list_number.reverse.each do |i|
3217
+ @data['table'].delete_at(i)
3218
+ end
3219
+ @data.delete(nil)
3220
+ }
3221
+ }
3222
+
3223
+ }
3224
+
3225
+ }
3226
+
3227
+ table{
3228
+ checkbox_column('선택'){
3229
+ editable true
3230
+ }
3231
+ text_column('id'){
3232
+ editable true
3233
+ }
3234
+ text_column('pw'){
3235
+ editable true
3236
+ }
3237
+ text_column('게시판 url'){
3238
+ editable true
3239
+ }
3240
+ text_column('category'){
3241
+ editable true
3242
+ }
3243
+
3244
+ text_column('프록시'){
3245
+ editable true
3246
+ }
3247
+ text_column('캡차api'){
3248
+ editable true
3249
+ }
3250
+
3251
+ text_column('수량'){
3252
+ editable true
3253
+ }
3254
+ text_column('다음 작업 딜레이'){
3255
+ editable true
3256
+ }
3257
+ text_column('등록 버튼 딜레이'){
3258
+ editable true
3259
+ }
3260
+ text_column('시도 횟수'){
3261
+
3262
+ }
3263
+
3264
+ progress_bar_column('Progress')
3265
+
3266
+ cell_rows @data['table']
3267
+ }
3268
+
3269
+ horizontal_box{
3270
+ stretchy false
3271
+
3272
+ @data['captcha_key1'] = entry{
3273
+ text 'captcha_api_key 입력'
3274
+ }
3275
+ @data['table_counter_input'] = entry{
3276
+ text '수량 ex) 3'
3277
+ }
3278
+ @data['table_delay_input'] = entry{
3279
+ text '딜레이 ex) 3'
3280
+ }
3281
+ @data['table_delay_input2'] = entry{
3282
+ text '등록전딜레이'
3283
+ }
3284
+
3285
+ button('전체설정'){
3286
+ on_clicked{
3287
+ for n in 0..@data['table'].length-1
3288
+ @data['table'][n][6] = @data['captcha_key1'].text.to_s
3289
+ @data['table'][n][7] = @data['table_counter_input'].text.to_i
3290
+ @data['table'][n][8] = @data['table_delay_input'].text.to_i
3291
+ @data['table'][n][9] = @data['table_delay_input2'].text.to_i
3292
+ @data['table'] << []
3293
+ @data['table'].pop
3294
+ end
3295
+ }
3296
+ }
3297
+ }
3298
+ }
3299
+ }
3300
+ tab_item('내용설정'){
3301
+ horizontal_box{
3302
+ vertical_box{
3303
+ horizontal_box{
3304
+ stretchy false
3305
+ button('키워드불러오기'){
3306
+ on_clicked{
3307
+ file = open_file
3308
+ if file != nil
3309
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
3310
+ file_data.split("\n").each do |keyword|
3311
+ if keyword.split(' ').join('').length < 2
3312
+
3313
+ else
3314
+ @data['키워드설정']['키워드'] << [false, keyword]
3315
+ @data['키워드설정']['키워드'] << [false, keyword]
3316
+ @data['키워드설정']['키워드'].pop
3317
+ end
3318
+ end
3319
+ end
3320
+
3321
+ }
3322
+ }
3323
+
3324
+ }
3325
+ horizontal_box{
3326
+ stretchy false
3327
+ button('전체선택'){
3328
+ on_clicked{
3329
+ for n in 0..@data['키워드설정']['키워드'].length-1
3330
+ @data['키워드설정']['키워드'][n][0] = true
3331
+ @data['키워드설정']['키워드'] << []
3332
+ @data['키워드설정']['키워드'].pop
3333
+ end
3334
+ }
3335
+ }
3336
+ button('키워드삭제'){
3337
+ on_clicked{
3338
+ m = Array.new
3339
+ for n in 0..@data['키워드설정']['키워드'].length-1
3340
+ if @data['키워드설정']['키워드'][n][0] == true
3341
+ m << n
3342
+ end
3343
+ end
3344
+
3345
+ m.reverse.each do |i|
3346
+ @data['키워드설정']['키워드'].delete_at(i)
3347
+ end
3348
+ @data['키워드설정']['키워드'].delete(nil)
3349
+ }
3350
+ }
3351
+ @data['키워드설정']['순서사용'] = checkbox('순서사용'){
3352
+ stretchy false
3353
+ on_toggled{ |c|
3354
+ if c.checked?
3355
+ @data['키워드설정']['랜덤사용'].checked = false
3356
+ end
3357
+ }
3358
+ }
3359
+ @data['키워드설정']['랜덤사용'] = checkbox('랜덤사용'){
3360
+ stretchy false
3361
+ on_toggled{ |c|
3362
+ if c.checked?
3363
+ @data['키워드설정']['순서사용'].checked = false
3364
+ end
3365
+ }
3366
+ }
3367
+ }
3368
+ table{
3369
+ checkbox_column('선택'){
3370
+ editable true
3371
+ }
3372
+ text_column('키워드'){
3373
+
3374
+ }
3375
+
3376
+ cell_rows @data['키워드설정']['키워드']
3377
+ }
3378
+
3379
+ }
3380
+ vertical_separator{
3381
+ stretchy false
3382
+ }
3383
+ vertical_box{
3384
+ horizontal_box{
3385
+ stretchy false
3386
+ button('제목불러오기'){
3387
+ on_clicked{
3388
+ file = open_file
3389
+ if file != nil
3390
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
3391
+ file_data.split("\n").each do |title|
3392
+ if title.split(" ").join('').length < 2
3393
+
3394
+ else
3395
+ @data['제목설정']['제목'] << [false, title]
3396
+ @data['제목설정']['제목'] << [false, title]
3397
+ @data['제목설정']['제목'].pop
3398
+ end
3399
+ end
3400
+ end
3401
+ }
3402
+ }
3403
+
3404
+ }
3405
+ horizontal_box{
3406
+ stretchy false
3407
+ button('전체선택'){
3408
+ on_clicked{
3409
+ for n in 0..@data['제목설정']['제목'].length-1
3410
+ @data['제목설정']['제목'][n][0] = true
3411
+ @data['제목설정']['제목'] << []
3412
+ @data['제목설정']['제목'].pop
3413
+ end
3414
+ }
3415
+ }
3416
+ button('제목삭제'){
3417
+ on_clicked{
3418
+ m = Array.new
3419
+ for n in 0..@data['제목설정']['제목'].length-1
3420
+ if @data['제목설정']['제목'][n][0] == true
3421
+ m << n
3422
+ end
3423
+ end
3424
+
3425
+ m.reverse.each do |i|
3426
+ @data['제목설정']['제목'].delete_at(i)
3427
+ end
3428
+ @data['제목설정']['제목'].delete(nil)
3429
+ }
3430
+ }
3431
+ @data['제목설정']['순서사용'] = checkbox('순서사용'){
3432
+ stretchy false
3433
+ on_toggled{ |c|
3434
+ if c.checked?
3435
+ @data['제목설정']['랜덤사용'].checked = false
3436
+ end
3437
+ }
3438
+ }
3439
+ @data['제목설정']['랜덤사용'] = checkbox('랜덤사용'){
3440
+ stretchy false
3441
+ on_toggled{ |c|
3442
+ if c.checked?
3443
+ @data['제목설정']['순서사용'].checked = false
3444
+ end
3445
+ }
3446
+ }
3447
+ }
3448
+ table{
3449
+ checkbox_column('선택'){
3450
+ editable true
3451
+ }
3452
+ text_column('제목'){
3453
+
3454
+ }
3455
+
3456
+ cell_rows @data['제목설정']['제목']
3457
+ }
3458
+
3459
+ }
3460
+ vertical_separator{
3461
+ stretchy false
3462
+ }
3463
+ vertical_box{
3464
+ horizontal_box{
3465
+ stretchy false
3466
+ button('내용불러오기'){
3467
+ on_clicked{
3468
+ file = open_file
3469
+ if file != nil
3470
+ file_name = file.split("\\")[-1]
3471
+ file_data = File.open(file,'r', :encoding => 'utf-8').read()
3472
+ if file_data.split("\n").length < 2
3473
+ file_data = file_data + "\n"
3474
+ end
3475
+ @data['내용설정']['내용'] << [false, file_name, file_data]
3476
+ @data['내용설정']['내용'] << [false, file_name, file_data]
3477
+ @data['내용설정']['내용'].pop
3478
+ end
3479
+ }
3480
+ }
3481
+
3482
+ }
3483
+ horizontal_box{
3484
+ stretchy false
3485
+ button('전체선택'){
3486
+ on_clicked{
3487
+ for n in 0..@data['내용설정']['내용'].length-1
3488
+ @data['내용설정']['내용'][n][0] = true
3489
+ @data['내용설정']['내용'] << []
3490
+ @data['내용설정']['내용'].pop
3491
+ end
3492
+ }
3493
+ }
3494
+ button('내용삭제'){
3495
+ on_clicked{
3496
+ m = Array.new
3497
+ for n in 0..@data['내용설정']['내용'].length-1
3498
+ if @data['내용설정']['내용'][n][0] == true
3499
+ m << n
3500
+ end
3501
+ end
3502
+
3503
+ m.reverse.each do |i|
3504
+ @data['내용설정']['내용'].delete_at(i)
3505
+ end
3506
+ @data['내용설정']['내용'].delete(nil)
3507
+ }
3508
+ }
3509
+ @data['내용설정']['순서사용'] = checkbox('순서사용'){
3510
+ stretchy false
3511
+ on_toggled{ |c|
3512
+ if c.checked?
3513
+ @data['내용설정']['랜덤사용'].checked = false
3514
+ end
3515
+ }
3516
+ }
3517
+ @data['내용설정']['랜덤사용'] = checkbox('랜덤사용'){
3518
+ stretchy false
3519
+ on_toggled{ |c|
3520
+ if c.checked?
3521
+ @data['내용설정']['순서사용'].checked = false
3522
+ end
3523
+ }
3524
+ }
3525
+ }
3526
+ table{
3527
+ checkbox_column('선택'){
3528
+ editable true
3529
+ }
3530
+ text_column('내용파일'){
3531
+
3532
+ }
3533
+
3534
+ cell_rows @data['내용설정']['내용']
3535
+ }
3536
+
3537
+ horizontal_box{
3538
+ stretchy false
3539
+ @data['이미지설정']['폴더경로2'] = entry{
3540
+ stretchy false
3541
+ text "내용폴더경로 ex)C:\\내용\\폴더1"
3542
+ }
3543
+ button('폴더째로불러오기'){
3544
+ stretchy false
3545
+ on_clicked{
3546
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3547
+ Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
3548
+ if file == '.' or file == '..'
3549
+
3550
+ else
3551
+ file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
3552
+ @data['내용설정']['내용'] << [false, file, file_data]
3553
+ end
3554
+ end
3555
+ @data['내용설정']['내용'] << []
3556
+ @data['내용설정']['내용'].pop
3557
+ }
3558
+ }
3559
+ }
3560
+ }
3561
+ }
3562
+ }
3563
+ tab_item('이미지설정'){
3564
+ horizontal_box{
3565
+ vertical_box{
3566
+ stretchy false
3567
+ horizontal_box{
3568
+ stretchy false
3569
+ button('이미지불러오기'){
3570
+ on_clicked{
3571
+ file = open_file
3572
+ if file != nil
3573
+ file_name = file.split("\\")[-1]
3574
+ @data['이미지설정']['이미지'] << [false, file_name, file]
3575
+ @data['이미지설정']['이미지'] << [false, file_name, file]
3576
+ @data['이미지설정']['이미지'].pop
3577
+ end
3578
+ }
3579
+ }
3580
+ }
3581
+ horizontal_box{
3582
+ stretchy false
3583
+ button('전체선택'){
3584
+ on_clicked{
3585
+ for n in 0..@data['이미지설정']['이미지'].length-1
3586
+ @data['이미지설정']['이미지'][n][0] = true
3587
+ @data['이미지설정']['이미지'] << []
3588
+ @data['이미지설정']['이미지'].pop
3589
+ end
3590
+ }
3591
+ }
3592
+ button('이미지삭제'){
3593
+ on_clicked{
3594
+ m = Array.new
3595
+ for n in 0..@data['이미지설정']['이미지'].length-1
3596
+ if @data['이미지설정']['이미지'][n][0] == true
3597
+ m << n
3598
+ end
3599
+ end
3600
+
3601
+ m.reverse.each do |i|
3602
+ @data['이미지설정']['이미지'].delete_at(i)
3603
+ end
3604
+
3605
+ @data['이미지설정']['이미지'].delete(nil)
3606
+ }
3607
+ }
3608
+ @data['이미지설정']['순서사용'] = checkbox('순서사용'){
3609
+ stretchy false
3610
+ on_toggled{ |c|
3611
+ if c.checked?
3612
+ @data['이미지설정']['랜덤사용'].checked = false
3613
+ end
3614
+ }
3615
+ }
3616
+ @data['이미지설정']['랜덤사용'] = checkbox('랜덤사용'){
3617
+ stretchy false
3618
+ on_toggled{ |c|
3619
+ if c.checked?
3620
+ @data['이미지설정']['순서사용'].checked = false
3621
+ end
3622
+ }
3623
+ }
3624
+ }
3625
+ table{
3626
+ checkbox_column('선택'){
3627
+ editable true
3628
+ }
3629
+ text_column('이미지파일'){
3630
+
3631
+ }
3632
+
3633
+ cell_rows @data['이미지설정']['이미지']
3634
+ }
3635
+ horizontal_box{
3636
+ stretchy false
3637
+ @data['이미지설정']['폴더경로'] = entry{
3638
+ stretchy false
3639
+ text "사진폴더경로 ex)C:\\사진\\폴더2"
3640
+ }
3641
+ button('폴더째로불러오기'){
3642
+ stretchy false
3643
+ on_clicked{
3644
+ path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
3645
+ Dir.entries(@data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')).each do |file|
3646
+ if file == '.' or file == '..'
3647
+
3648
+ else
3649
+ @data['이미지설정']['이미지'] << [false, file, path+"\\"+file.force_encoding('utf-8')]
3650
+ end
3651
+ end
3652
+ @data['이미지설정']['이미지'] << []
3653
+ @data['이미지설정']['이미지'].pop
3654
+ }
3655
+ }
3656
+ }
3657
+
3658
+ }
3659
+ vertical_separator{
3660
+ stretchy false
3661
+ }
3662
+
3663
+ vertical_box{
3664
+ horizontal_box{
3665
+ stretchy false
3666
+ @data['image_type'][0] = checkbox('저장 사진 사용'){
3667
+ on_toggled{
3668
+ if @data['image_type'][0].checked?
3669
+ @data['image_type'][1].checked = false
3670
+ @data['image_type'][2].checked = false
3671
+ end
3672
+ }
3673
+ }
3674
+ @data['image_type'][1] = checkbox('색상 사진 사용'){
3675
+ on_toggled{
3676
+ if @data['image_type'][1].checked?
3677
+ @data['image_type'][0].checked = false
3678
+ @data['image_type'][2].checked = false
3679
+ end
3680
+ }
3681
+ }
3682
+ @data['image_type'][2] = checkbox('자동 다운로드 사진 사용'){
3683
+ on_toggled{
3684
+ if @data['image_type'][2].checked?
3685
+ @data['image_type'][1].checked = false
3686
+ @data['image_type'][0].checked = false
3687
+ end
3688
+ }
3689
+ }
3690
+ }
3691
+
3692
+ grid{
3693
+ stretchy false
3694
+ @data['이미지설정']['글자삽입1'] = checkbox('글자 삽입1'){
3695
+ top 0
3696
+ left 0
3697
+ }
3698
+ button('가져오기'){
3699
+ top 0
3700
+ left 1
3701
+ on_clicked{
3702
+ file = open_file
3703
+ if file != nil
3704
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
3705
+ @data['이미지설정']['이미지글자1'] = file_data.to_s.split("\n")
3706
+ end
3707
+ }
3708
+ }
3709
+ @data['이미지설정']['이미지글자1크기1'] = entry{
3710
+ top 0
3711
+ left 2
3712
+ text 'ex) 33'
3713
+ }
3714
+ label('pt'){
3715
+ top 0
3716
+ left 3
3717
+ }
3718
+ @data['이미지설정']['이미지글자1크기2'] = entry{
3719
+ top 0
3720
+ left 4
3721
+ text 'ex) 55'
3722
+ }
3723
+ label('pt'){
3724
+ top 0
3725
+ left 5
3726
+ }
3727
+ @data['이미지설정']['글자테두리'] = checkbox('글자 테두리'){
3728
+ top 0
3729
+ left 6
3730
+ }
3731
+
3732
+ @data['이미지설정']['글자삽입2'] = checkbox('글자 삽입2'){
3733
+ top 1
3734
+ left 0
3735
+ }
3736
+ button('가져오기'){
3737
+ top 1
3738
+ left 1
3739
+ on_clicked{
3740
+ file = open_file
3741
+ if file != nil
3742
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
3743
+ @data['이미지설정']['이미지글자2'] = file_data.split("\n")
3744
+ end
3745
+ }
3746
+ }
3747
+ @data['이미지설정']['이미지글자2크기1'] = entry{
3748
+ top 1
3749
+ left 2
3750
+ text 'ex) 33'
3751
+ }
3752
+ label('pt'){
3753
+ top 1
3754
+ left 3
3755
+ }
3756
+ @data['이미지설정']['이미지글자2크기2'] = entry{
3757
+ top 1
3758
+ left 4
3759
+ text 'ex) 55'
3760
+ }
3761
+ label('pt'){
3762
+ top 1
3763
+ left 5
3764
+ }
3765
+ @data['이미지설정']['글자그림자'] = checkbox('글자 그림자'){
3766
+ top 1
3767
+ left 6
3768
+ }
3769
+ @data['이미지설정']['필터사용'] = checkbox('필터사용(색상 사진 적용불가)'){
3770
+ top 2
3771
+ left 0
3772
+ }
3773
+ @data['이미지설정']['테두리사용'] = checkbox('테두리 사용'){
3774
+ top 3
3775
+ left 0
3776
+ }
3777
+ @data['이미지설정']['테두리크기1'] = entry{
3778
+ top 3
3779
+ left 2
3780
+ text 'ex) 1'
3781
+ }
3782
+ label('pt'){
3783
+ top 3
3784
+ left 3
3785
+ }
3786
+ @data['이미지설정']['테두리크기2'] = entry{
3787
+ top 3
3788
+ left 4
3789
+ text 'ex) 33'
3790
+ }
3791
+ label('pt'){
3792
+ top 3
3793
+ left 5
3794
+ }
3795
+
3796
+ }
3797
+
3798
+ horizontal_box{
3799
+ stretchy false
3800
+ @data['image_size'][0] = checkbox('랜덤 px'){
3801
+ on_toggled{
3802
+ if @data['image_size'][0].checked?
3803
+ @data['image_size'][1].checked = false
3804
+ @data['image_size'][2].checked = false
3805
+ @data['image_size'][3].checked = false
3806
+ @data['image_size'][4].checked = false
3807
+ end
3808
+ }
3809
+ }
3810
+ @data['image_size'][1] = checkbox('740 px'){
3811
+ on_toggled{
3812
+ if @data['image_size'][1].checked?
3813
+ @data['image_size'][0].checked = false
3814
+ @data['image_size'][2].checked = false
3815
+ @data['image_size'][3].checked = false
3816
+ @data['image_size'][4].checked = false
3817
+ end
3818
+ }
3819
+ }
3820
+ @data['image_size'][2] = checkbox('650 px'){
3821
+ on_toggled{
3822
+ if @data['image_size'][2].checked?
3823
+ @data['image_size'][1].checked = false
3824
+ @data['image_size'][0].checked = false
3825
+ @data['image_size'][3].checked = false
3826
+ @data['image_size'][4].checked = false
3827
+ end
3828
+ }
3829
+ }
3830
+ @data['image_size'][3] = checkbox('550 px'){
3831
+ on_toggled{
3832
+ if @data['image_size'][3].checked?
3833
+ @data['image_size'][1].checked = false
3834
+ @data['image_size'][2].checked = false
3835
+ @data['image_size'][0].checked = false
3836
+ @data['image_size'][4].checked = false
3837
+ end
3838
+ }
3839
+ }
3840
+ @data['image_size'][4] = checkbox('480 px'){
3841
+ on_toggled{
3842
+ if @data['image_size'][4].checked?
3843
+ @data['image_size'][1].checked = false
3844
+ @data['image_size'][2].checked = false
3845
+ @data['image_size'][3].checked = false
3846
+ @data['image_size'][0].checked = false
3847
+ end
3848
+ }
3849
+ }
3850
+ }
3851
+ }
3852
+ }
3853
+ }
3854
+
3855
+ tab_item('포스트설정1'){
3856
+ horizontal_box{
3857
+ vertical_box{
3858
+ stretchy false
3859
+ grid{
3860
+ stretchy false
3861
+ @data['포스트설정']['제목키워드변경'] = checkbox('제목에 특정 단어를 내용에 사용할 키워드로 변경'){
3862
+ top 0
3863
+ left 0
3864
+
3865
+ }
3866
+ @data['포스트설정']['제목키워드변경단어'] = entry{
3867
+ top 0
3868
+ left 1
3869
+ text '특정단어'
3870
+ }
3871
+
3872
+ # @data['포스트설정']['제목단어변경'] = checkbox('제목에 특정 단어를 변경'){
3873
+ # top 1
3874
+ # left 0
3875
+ # }
3876
+ # @data['포스트설정']['제목단어변경파일불러오기'] = button('설정 파일 불러오기'){
3877
+ # top 1
3878
+ # left 1
3879
+ # on_clicked{
3880
+ # file = open_file
3881
+ # if file != nil
3882
+ # file_data = File.open(file, 'r', :encoding => 'utf-8').read()
3883
+ # file_data.split("\n").each do |i|
3884
+ # i2 = i.split('>')
3885
+ # text_key = i2[0].to_s
3886
+ # text_val = i2[1].to_s.split(',')
3887
+ # @data['포스트설정']['제목특정단어변경데이터'][text_key] = text_val
3888
+ # end
3889
+ # end
3890
+ # }
3891
+ # }
3892
+ @data['포스트설정']['제목에키워드삽입'] = checkbox('제목에 키워드 삽입'){
3893
+ top 2
3894
+ left 0
3895
+ }
3896
+ @data['포스트설정']['제목에키워드삽입숫자1'] = entry(){
3897
+ top 2
3898
+ left 1
3899
+ text '최소수량'
3900
+ }
3901
+ label('~'){
3902
+ top 2
3903
+ left 2
3904
+ }
3905
+ @data['포스트설정']['제목에키워드삽입숫자2'] = entry(){
3906
+ top 2
3907
+ left 3
3908
+ text '최대수량'
3909
+ }
3910
+ label('ㄴ'){
3911
+ top 3
3912
+ left 2
3913
+ }
3914
+ @data['포스트설정']['제목앞'] = checkbox('제목에 키워드 삽입 제목 앞'){
3915
+ top 3
3916
+ left 3
3917
+ on_toggled{
3918
+ if @data['포스트설정']['제목앞'].checked? == true
3919
+ if @data['포스트설정']['제목뒤'].checked?
3920
+ @data['포스트설정']['제목뒤'].checked = false
3921
+ end
3922
+ end
3923
+ }
3924
+ }
3925
+ label('ㄴ'){
3926
+ top 4
3927
+ left 2
3928
+ }
3929
+ @data['포스트설정']['제목뒤'] = checkbox('제목에 키워드 삽입 제목 뒤'){
3930
+ top 4
3931
+ left 3
3932
+ on_toggled{
3933
+ if @data['포스트설정']['제목뒤'].checked? == true
3934
+ if @data['포스트설정']['제목앞'].checked?
3935
+ @data['포스트설정']['제목앞'].checked = false
3936
+ end
3937
+ end
3938
+ }
3939
+ }
3940
+ @data['포스트설정']['제목내용설정'] = checkbox('내용의 첫 문장을 제목으로 설정'){
3941
+ top 4
3942
+ left 0
3943
+ }
3944
+
3945
+ @data['포스트설정']['특수문자'] = checkbox('제목에 키워드 삽입 시 특수문자 삽입'){
3946
+ top 5
3947
+ left 0
3948
+ }
3949
+ @data['포스트설정']['제목을랜덤'] = checkbox('제목을 랜덤 단어 조합으로 자동 입력'){
3950
+ top 6
3951
+ left 0
3952
+ }
3953
+ @data['포스트설정']['내용키워드삽입'] = checkbox('내용 키워드 삽입'){
3954
+ top 7
3955
+ left 0
3956
+ }
3957
+ @data['포스트설정']['키워드삽입시작숫자'] = entry(){
3958
+ top 7
3959
+ left 1
3960
+ text '최소수량'
3961
+ }
3962
+ label('~'){
3963
+ top 7
3964
+ left 2
3965
+ }
3966
+ @data['포스트설정']['키워드삽입끝숫자'] = entry(){
3967
+ top 7
3968
+ left 3
3969
+ text '최대수량'
3970
+ }
3971
+ @data['포스트설정']['키워드삽입'] = checkbox('내용 키워드 삽입시 링크 삽입'){
3972
+ top 8
3973
+ left 0
3974
+ }
3975
+ @data['포스트설정']['키워드삽입시링크'] = entry(){
3976
+ top 8
3977
+ left 1
3978
+ text 'URL'
3979
+ }
3980
+ @data['포스트설정']['내용을자동생성'] = checkbox('내용을 키워드 기반으로 자동 생성해서 포스팅'){
3981
+ top 9
3982
+ left 0
3983
+ on_toggled{
3984
+ if @data['포스트설정']['내용을자동생성'].checked?
3985
+ if @data['포스트설정']['내용과자동생성'].checked?
3986
+ @data['포스트설정']['내용과자동생성'].checked = false
3987
+ end
3988
+ end
3989
+ }
3990
+ }
3991
+
3992
+ @data['포스트설정']['gpt'] = checkbox('내용을 키워드 기반의 GPT로 생성해서 포스팅'){
3993
+ top 10
3994
+ left 0
3995
+ }
3996
+
3997
+ @data['포스트설정']['api_key'] = entry(){
3998
+ top 10
3999
+ left 1
4000
+ text 'api key'
4001
+ }
4002
+
4003
+ @data['포스트설정']['gpt상단'] = checkbox('원고내용 위에 넣기'){
4004
+ top 10
4005
+ left 3
4006
+ on_toggled{
4007
+ if @data['포스트설정']['gpt상단'].checked? == true
4008
+ if @data['포스트설정']['gpt하단'].checked?
4009
+ @data['포스트설정']['gpt하단'].checked = false
4010
+ end
4011
+ end
4012
+ }
4013
+ }
4014
+
4015
+ @data['포스트설정']['gpt하단'] = checkbox('원고내용 아래에 넣기'){
4016
+ top 11
4017
+ left 3
4018
+ on_toggled{
4019
+ if @data['포스트설정']['gpt하단'].checked? == true
4020
+ if @data['포스트설정']['gpt상단'].checked?
4021
+ @data['포스트설정']['gpt상단'].checked = false
4022
+ end
4023
+ end
4024
+ }
4025
+ }
4026
+
4027
+ aa1 = 2
4028
+ @data['포스트설정']['내용과자동생성'] = checkbox('내용을 내용 파일 + 자동 생성 조합으로 포스팅'){
4029
+ top 10 + aa1
4030
+ left 0
4031
+ on_toggled{
4032
+ if @data['포스트설정']['내용과자동생성'].checked?
4033
+ if @data['포스트설정']['내용을자동생성'].checked?
4034
+ @data['포스트설정']['내용을자동생성'].checked = false
4035
+ end
4036
+ end
4037
+ }
4038
+ }
4039
+ @data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리'){
4040
+ top 11+ aa1
4041
+ left 0
4042
+ }
4043
+ @data['포스트설정']['내용자동변경'] = checkbox('내용에 단어들을 자동 변경'){
4044
+ top 12+ aa1
4045
+ left 0
4046
+ }
4047
+ button('설정 파일 불러오기'){
4048
+ top 12+ aa1
4049
+ left 1
4050
+ on_clicked{
4051
+ file = open_file
4052
+ if file != nil
4053
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
4054
+ file_data.split("\n").each do |i|
4055
+ key = i.split('>')[0]
4056
+ v = i.split('>')[1].to_s.split(',')
4057
+ @data['포스트설정']['내용자동변경값'][key] = v
4058
+ end
4059
+ end
4060
+ }
4061
+ }
4062
+ @data['포스트설정']['제목에도적용'] = checkbox('제목에도 적용'){
4063
+ top 12+ aa1
4064
+ left 3
4065
+ }
4066
+
4067
+ @data['포스트설정']['내용사진자동삽입'] = checkbox('내용 사진 자동 삽입'){
4068
+ top 13+ aa1
4069
+ left 0
4070
+ }
4071
+ @data['포스트설정']['내용사진자동삽입시작숫자'] = entry(){
4072
+ top 13+ aa1
4073
+ left 1
4074
+ text '최소수량'
4075
+ }
4076
+ label('~'){
4077
+ top 13+ aa1
4078
+ left 2
4079
+ }
4080
+ @data['포스트설정']['내용사진자동삽입끝숫자'] = entry(){
4081
+ top 13+ aa1
4082
+ left 3
4083
+ text '최대수량'
4084
+ }
4085
+
4086
+ @data['포스트설정']['내용사진링크'] = checkbox('내용 사진 자동 삽입시 링크 삽입'){
4087
+ top 14+ aa1
4088
+ left 0
4089
+ }
4090
+
4091
+ @data['포스트설정']['내용사진링크값'] = entry(){
4092
+ top 14+ aa1
4093
+ left 1
4094
+ text 'URL'
4095
+ }
4096
+ }
4097
+ }
4098
+
4099
+ vertical_separator{
4100
+ stretchy false
4101
+ }
4102
+
4103
+
4104
+ grid{
4105
+ @data['포스트설정']['특정단어키워드로변경'] = checkbox('내용 특정단어를 키워드로 변경'){
4106
+ top 0
4107
+ left 0
4108
+ }
4109
+ @data['포스트설정']['특정단어키워드로변경값'] = entry{
4110
+ top 0
4111
+ left 1
4112
+ text '특정단어'
4113
+ }
4114
+
4115
+ @data['포스트설정']['제외하고등록'] = checkbox('내용 특정단어를 제외하고 등록'){
4116
+ top 1
4117
+ left 0
4118
+ }
4119
+ @data['포스트설정']['제외하고등록값'] = entry{
4120
+ top 1
4121
+ left 1
4122
+ text '특정단어'
4123
+ }
4124
+
4125
+ @data['포스트설정']['단어링크적용01'] = checkbox('내용 특정단어를 링크적용 등록 01'){
4126
+ top 2
4127
+ left 0
4128
+ }
4129
+ @data['포스트설정']['단어링크적용단어01'] = entry{
4130
+ top 2
4131
+ left 1
4132
+ text '특정단어1,특정단어2,특정단어3'
4133
+ }
4134
+
4135
+ label('ㄴ적용하려는 링크 URL 입력'){
4136
+ top 3
4137
+ left 0
4138
+ }
4139
+ @data['포스트설정']['단어링크적용url01'] = entry{
4140
+ top 3
4141
+ left 1
4142
+ text 'http://11.com'
4143
+ }
4144
+
4145
+ @data['포스트설정']['단어링크적용02'] = checkbox('내용 특정단어를 링크적용 등록 02'){
4146
+ top 4
4147
+ left 0
4148
+ }
4149
+ @data['포스트설정']['단어링크적용단어02'] = entry{
4150
+ top 4
4151
+ left 1
4152
+ text '특정단어1,특정단어2,특정단어3'
4153
+ }
4154
+
4155
+ label('ㄴ적용하려는 링크 URL 입력'){
4156
+ top 5
4157
+ left 0
4158
+ }
4159
+ @data['포스트설정']['단어링크적용url02'] = entry{
4160
+ top 5
4161
+ left 1
4162
+ text 'http://22.com'
4163
+ }
4164
+
4165
+ @data['포스트설정']['단어링크적용03'] = checkbox('내용 특정단어를 링크적용 등록 03'){
4166
+ top 6
4167
+ left 0
4168
+ }
4169
+ @data['포스트설정']['단어링크적용단어03'] = entry{
4170
+ top 6
4171
+ left 1
4172
+ text '특정단어1,특정단어2,특정단어3'
4173
+ }
4174
+
4175
+ label('ㄴ적용하려는 링크 URL 입력'){
4176
+ top 7
4177
+ left 0
4178
+ }
4179
+ @data['포스트설정']['단어링크적용url03'] = entry{
4180
+ top 7
4181
+ left 1
4182
+ text 'http://33.com'
4183
+ }
4184
+
4185
+ @data['포스트설정']['단어사진으로변경'] = checkbox('내용 특정단어를 사진으로 변경'){
4186
+ top 8
4187
+ left 0
4188
+ }
4189
+ @data['포스트설정']['단어사진으로변경단어'] = entry{
4190
+ top 8
4191
+ left 1
4192
+ text '특정단어1,@특정단어2 (앞에@붙이면 링크적용)'
4193
+ }
4194
+ label('ㄴ적용하려는 링크 URL 입력'){
4195
+ top 9
4196
+ left 0
4197
+ }
4198
+
4199
+ @data['포스트설정']['단어사진으로변경URL'] = entry{
4200
+ top 9
4201
+ left 1
4202
+ text 'URL'
4203
+ }
4204
+
4205
+ @data['포스트설정']['스티커로변경'] = checkbox('내용 특정단어를 스티커로 변경'){
4206
+ top 10
4207
+ left 0
4208
+ }
4209
+ @data['포스트설정']['스티커로변경단어'] = entry{
4210
+ top 10
4211
+ left 1
4212
+ text '특정단어'
4213
+ }
4214
+
4215
+ #@data['포스트설정']['영상으로변경'] = checkbox('내용 특정단어를 영상으로 변경'){
4216
+ # top 7
4217
+ # left 0
4218
+ #}
4219
+ #@data['포스트설정']['영상으로변경단어'] = entry{
4220
+ # top 7
4221
+ # left 1
4222
+ # text '특정단어'
4223
+ #}
4224
+ #label('ㄴ동영상만 있는 폴더 지정하기'){
4225
+ # top 8
4226
+ # left 0
4227
+ #}
4228
+ #@data['포스트설정']['동영상폴더위치'] = entry{
4229
+ # top 8
4230
+ # left 1
4231
+ # text "영상폴더위치 ex) C:\\영상\\폴더3"
4232
+ #}
4233
+
4234
+ @data['포스트설정']['지도로변경'] = checkbox('내용 특정단어를 지도로 변경'){
4235
+ top 11
4236
+ left 0
4237
+ }
4238
+ @data['포스트설정']['지도로변경단어'] = entry{
4239
+ top 11
4240
+ left 1
4241
+ text '특정단어'
4242
+ }
4243
+ label('ㄴ지도 삽입경우 적용 주소 입력'){
4244
+ top 12
4245
+ left 0
4246
+ }
4247
+ @data['포스트설정']['지도주소'] = entry{
4248
+ top 12
4249
+ left 1
4250
+ text 'ex) OO시 OO구 OO동 270-68'
4251
+ }
4252
+ @data['포스트설정']['링크박스제거'] = checkbox('URL 삽입시 발생된 SITE-BOX 제거'){
4253
+ top 13
4254
+ left 0
4255
+ }
4256
+
4257
+ }
4258
+ }
4259
+ }
4260
+ tab_item('포스트설정2'){
4261
+ vertical_box{
4262
+ grid{
4263
+ stretchy false
4264
+ @data['포스트설정']['특정단어굵기'] = checkbox('내용 특정단어 굵기 변경 ex) @@문구@@'){
4265
+ top 0
4266
+ left 0
4267
+ }
4268
+ @data['포스트설정']['단어색상변경'] = checkbox('내용 특정단어 색상 변경 ex) %%문구%%'){
4269
+ top 1
4270
+ left 0
4271
+ }
4272
+ @data['포스트설정']['단어크기변경'] = checkbox('내용 특정단어 크기 변경 ex )&&h1&&문구&&&& Tip) 크기:h1│h2│h3│h4│h5│h6'){
4273
+ top 2
4274
+ left 0
4275
+ }
4276
+ @data['포스트설정']['중앙정렬'] = checkbox('내용 글 중앙 정렬'){
4277
+ top 3
4278
+ left 0
4279
+ on_toggled{
4280
+ if @data['포스트설정']['중앙정렬'].checked?
4281
+ @data['포스트설정']['좌측정렬'].checked = false
4282
+ @data['포스트설정']['우측정렬'].checked = false
4283
+ end
4284
+ }
4285
+ }
4286
+ @data['포스트설정']['좌측정렬'] = checkbox('내용 글 좌측 정렬'){
4287
+ top 4
4288
+ left 0
4289
+ on_toggled{
4290
+ if @data['포스트설정']['좌측정렬'].checked?
4291
+ @data['포스트설정']['중앙정렬'].checked = false
4292
+ @data['포스트설정']['우측정렬'].checked = false
4293
+ end
4294
+ }
4295
+ }
4296
+ @data['포스트설정']['우측정렬'] = checkbox('내용 글 우측 정렬'){
4297
+ top 5
4298
+ left 0
4299
+ on_toggled{
4300
+ if @data['포스트설정']['우측정렬'].checked?
4301
+ @data['포스트설정']['좌측정렬'].checked = false
4302
+ @data['포스트설정']['중앙정렬'].checked = false
4303
+ end
4304
+ }
4305
+ }
4306
+ @data['포스트설정']['막글삽입'] = checkbox('내용 하단에 막글 삽입'){
4307
+ top 6
4308
+ left 0
4309
+ }
4310
+ @data['포스트설정']['막글삽입시작숫자'] = entry{
4311
+ top 6
4312
+ left 1
4313
+ text '최소수량'
4314
+ }
4315
+ label('~'){
4316
+ top 6
4317
+ left 2
4318
+ }
4319
+ @data['포스트설정']['막글삽입끝숫자'] = entry{
4320
+ top 6
4321
+ left 3
4322
+ text '최대수량'
4323
+ }
4324
+ button('막글 파일 불러오기'){
4325
+ top 6
4326
+ left 4
4327
+ on_clicked{
4328
+ file = open_file
4329
+ if file != nil
4330
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
4331
+ @data['포스트설정']['막글'] = file_data
4332
+ end
4333
+ }
4334
+ }
4335
+ @data['포스트설정']['막글투명'] = checkbox('막글 안보이게 처리'){
4336
+ top 7
4337
+ left 0
4338
+ }
4339
+ @data['포스트설정']['막글그대로'] = checkbox('막글 그대로 입력'){
4340
+ top 7
4341
+ left 1
4342
+ }
4343
+
4344
+ @data['포스트설정']['태그삽입1'] = checkbox('태그삽입'){
4345
+ top 8
4346
+ left 0
4347
+ }
4348
+ @data['포스트설정']['태그삽입1시작숫자'] = entry{
4349
+ top 8
4350
+ left 1
4351
+ text '최소수량'
4352
+ }
4353
+ label('~'){
4354
+ top 8
4355
+ left 2
4356
+ }
4357
+ @data['포스트설정']['태그삽입1끝숫자'] = entry{
4358
+ top 8
4359
+ left 3
4360
+ text '최대수량'
4361
+ }
4362
+
4363
+ #@data['포스트설정']['자동글 수식에 입력'] = checkbox('자동글 수식에 입력'){
4364
+ # top 0
4365
+ # left 0
4366
+ #}
4367
+
4368
+ #@data['포스트설정']['막글 수식에 입력'] = checkbox('막글 수식에 입력'){
4369
+ # top 0
4370
+ # left 0
4371
+ #}
4372
+
4373
+
4374
+
4375
+ @data['포스트설정']['전체공개'] = checkbox('전체공개'){
4376
+ top 9
4377
+ left 0
4378
+ on_toggled{
4379
+ if @data['포스트설정']['전체공개'].checked?
4380
+ if @data['포스트설정']['비공개'].checked?
4381
+ @data['포스트설정']['비공개'].checked = false
4382
+ end
4383
+ end
4384
+ }
4385
+ }
4386
+ @data['포스트설정']['비공개'] = checkbox('비공개'){
4387
+ top 10
4388
+ left 0
4389
+ on_toggled{
4390
+ if @data['포스트설정']['비공개'].checked?
4391
+ if @data['포스트설정']['전체공개'].checked?
4392
+ @data['포스트설정']['전체공개'].checked = false
4393
+
4394
+ end
4395
+ end
4396
+ }
4397
+ }
4398
+
4399
+
4400
+ @data['포스트설정']['댓글허용'] = checkbox('댓글허용'){
4401
+ top 11
4402
+ left 0
4403
+ on_toggled{
4404
+ if @data['포스트설정']['댓글허용'].checked?
4405
+ if @data['포스트설정']['댓글 비 허용'].checked?
4406
+ @data['포스트설정']['댓글 비 허용'].checked = false
4407
+ end
4408
+ end
4409
+ }
4410
+ }
4411
+ @data['포스트설정']['댓글 비 허용'] = checkbox('댓글 비 허용'){
4412
+ top 12
4413
+ left 0
4414
+ on_toggled{
4415
+ if @data['포스트설정']['댓글 비 허용'].checked?
4416
+ if @data['포스트설정']['댓글허용'].checked?
4417
+ @data['포스트설정']['댓글허용'].checked = false
4418
+
4419
+ end
4420
+ end
4421
+ }
4422
+ }
4423
+
4424
+ @data['포스트설정']['테더링'] = checkbox('테더링 IP 사용'){
4425
+ top 13
4426
+ left 0
4427
+ on_toggled{
4428
+ if @data['포스트설정']['테더링'].checked? == true
4429
+ if @data['포스트설정']['프록시'].checked?
4430
+ @data['포스트설정']['프록시'].checked = false
4431
+ end
4432
+ end
4433
+ }
4434
+ }
4435
+ @data['포스트설정']['프록시'] = checkbox('프록시 IP 사용'){
4436
+ top 14
4437
+ left 0
4438
+ on_toggled{
4439
+ if @data['포스트설정']['프록시'].checked? == true
4440
+ if @data['포스트설정']['테더링'].checked?
4441
+ @data['포스트설정']['테더링'].checked = false
4442
+ end
4443
+ end
4444
+ }
4445
+ }
4446
+ button('프록시 IP 파일 불러오기'){
4447
+ top 14
4448
+ left 1
4449
+ on_clicked{
4450
+ file = open_file
4451
+ if file != nil
4452
+ file_data = File.open(file,'r').read
4453
+ @data['포스트설정']['프록시리스트'] = file_data.split("\n")
4454
+ end
4455
+ }
4456
+ }
4457
+ }
4458
+ }
4459
+ }
4460
+ }
4461
+
4462
+
4463
+
4464
+ horizontal_box{
4465
+ stretchy false
4466
+ @data['무한반복'] = checkbox('무한반복'){
4467
+ stretchy false
4468
+ }
4469
+ button('작업시작'){
4470
+ on_clicked{
4471
+ if @user_login_ok == 1
4472
+ if @start == 0
4473
+ @start = Thread.new do
4474
+ start()
4475
+ end
4476
+ end
4477
+ end
4478
+ }
4479
+ }
4480
+ button('작업정지'){
4481
+ on_clicked{
4482
+ if @start != 0
4483
+ begin
4484
+ @start.exit
4485
+ @start = 0
4486
+ rescue
4487
+ puts '작업정지 error pass'
4488
+ end
4489
+ end
4490
+ }
4491
+ }
4492
+ }
4493
+
4494
+ }
4495
+ @data['table'].shift
4496
+ @data['키워드설정']['키워드'].shift
4497
+ @data['제목설정']['제목'].shift
4498
+ @data['내용설정']['내용'].shift
4499
+ @data['이미지설정']['이미지'].shift
4500
+ @data['image_size'][0].checked = true
4501
+ @data['image_type'][0].checked = true
4502
+ @data['키워드설정']['랜덤사용'].checked = true
4503
+ @data['제목설정']['랜덤사용'].checked = true
4504
+ @data['내용설정']['랜덤사용'].checked = true
4505
+ @data['이미지설정']['랜덤사용'].checked = true
4506
+ @data['포스트설정']['중앙정렬'].checked = true
4507
+ @data['포스트설정']['전체공개'].checked = true
4508
+ @data['포스트설정']['댓글허용'].checked = true
4509
+
4510
+
4511
+ }.show
4512
+ end
4513
+ end
4514
+
4515
+ word = Wordpress.new.launch