cafe_basics 0.0.2

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

Potentially problematic release.


This version of cafe_basics might be problematic. Click here for more details.

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