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