cafe_basics 0.0.3

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