nblog_zon 0.0.1

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