CAFE_General 0.0.01

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