cafe_buy_duo 0.0.2 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cafe_buy_duo.rb +540 -377
  3. metadata +2 -2
data/lib/cafe_buy_duo.rb CHANGED
@@ -17,27 +17,29 @@ require 'cgi'
17
17
  require 'digest'
18
18
  require 'auto_click'
19
19
  require 'rainbow/refinement'
20
- require 'watir'
21
20
  include AutoClickMethods
22
21
  using Rainbow
23
-
22
+ include Glimmer
24
23
 
25
24
  class Chat
25
+
26
26
  def initialize(api_key)
27
27
  @api_key = api_key
28
28
  end
29
29
 
30
30
  def message2(keyword)
31
+ puts'[GPT] 키워드 기반 글을 생성 중입니다.......'.yellow
31
32
  url = 'https://api.openai.com/v1/chat/completions'
32
33
  h = {
33
34
  'Content-Type' => 'application/json',
34
35
  'Authorization' => 'Bearer ' + @api_key
35
36
  }
36
37
  d = {
37
- 'model' => 'gpt-3.5-turbo',
38
+ #'model' => 'gpt-3.5-turbo',
39
+ 'model' => 'gpt-4',
38
40
  'messages' => [{
39
41
  "role" => "assistant",
40
- "content" => keyword.to_s+" 소개하는 글만들어줘"
42
+ "content" => keyword.to_s+" 소개하는 글을 1500자에서 2500자 사이로 만들어줘"
41
43
  }]
42
44
  }
43
45
  answer = ''
@@ -68,10 +70,11 @@ class Chat
68
70
  'Authorization' => 'Bearer ' + @api_key
69
71
  }
70
72
  d = {
71
- 'model' => 'gpt-3.5-turbo',
73
+ #'model' => 'gpt-3.5-turbo',
74
+ 'model' => 'gpt-4',
72
75
  'messages' => [{
73
76
  "role" => "assistant",
74
- "content" => keyword.to_s+" 소개하는 글만들어줘"
77
+ "content" => keyword.to_s+" 관련된 글을 1500자에서 2500자 사이로 만들어줘"
75
78
  }]
76
79
  }
77
80
  answer = ''
@@ -102,23 +105,137 @@ class Chat
102
105
  end
103
106
  end
104
107
 
108
+ class Chat_title
109
+
110
+ def initialize(api_key)
111
+ @api_key = api_key
112
+ end
113
+
114
+ def message(title)
115
+ puts'[GPT] 유사 제목을 생성 중입니다.......'.yellow
116
+ url = 'https://api.openai.com/v1/chat/completions'
117
+ headers = {
118
+ 'Content-Type' => 'application/json',
119
+ 'Authorization' => 'Bearer ' + @api_key
120
+ }
121
+ data = {
122
+ 'model' => 'gpt-4',
123
+ 'messages' => [{
124
+ "role" => "system",
125
+ "content" => "너는 매우 친절하고 성의 있게 답변하는 AI 어시스턴트야."
126
+ },
127
+ {
128
+ "role" => "user",
129
+ "content" => "#{title}\n위 문장을 비슷한 길이로 ChatGPT의 멘트는 빼고 표현을 더 추가해서 하나만 만들어줘."
130
+ }]
131
+ }
132
+
133
+ begin
134
+ req = HTTP.headers(headers).post(url, json: data)
135
+ puts "HTTP Status: #{req.status}" # 상태 코드 확인
136
+ response = JSON.parse(req.body.to_s)
137
+ puts "API Response: #{response}" # 전체 응답 출력
138
+
139
+ if req.status == 429
140
+ return "API 요청 제한을 초과했습니다. 플랜 및 할당량을 확인하세요."
141
+ end
142
+
143
+ # 응답 데이터에서 안전하게 값 추출
144
+ answer = response.dig('choices', 0, 'message', 'content')
145
+ answer ||= (title) # 응답이 없을 경우 기본 메시지 설정
146
+ rescue => e
147
+ puts "Error: #{e.message}"
148
+ answer = "오류가 발생했습니다."
149
+ end
150
+
151
+ puts 'API return ==> '
152
+ puts answer
153
+ answer
154
+ end
155
+ end
156
+
157
+ class Chat_content
158
+
159
+ def initialize(api_key)
160
+ @api_key = api_key
161
+ end
162
+
163
+ def message(content)
164
+ puts'[GPT] 유사 내용을 생성 중입니다! 조금만 기다려주세요.......'.yellow
165
+ url = 'https://api.openai.com/v1/chat/completions'
166
+ headers = {
167
+ 'Content-Type' => 'application/json',
168
+ 'Authorization' => 'Bearer ' + @api_key
169
+ }
170
+ data = {
171
+ 'model' => 'gpt-4',
172
+ 'messages' => [{
173
+ "role" => "system",
174
+ "content" => "너는 매우 친절하고 성의 있게 답변하는 AI 어시스턴트야."
175
+ },
176
+ {
177
+ "role" => "user",
178
+ "content" => "#{content}\nChatGPT의 멘트는 빼고 위 전체적인 내용의 형식을 똑같이 표현을 더 추가하고 유사어로 변경하여 하나 만들어줘! 전화번호,연락처,가격,홈페이지안내 ,상담안내 관련 문구는 유지해야해"
179
+ }]
180
+ }
181
+
182
+ begin
183
+ req = HTTP.headers(headers).post(url, json: data)
184
+ puts "HTTP Status: #{req.status}" # 상태 코드 확인
185
+ response = JSON.parse(req.body.to_s)
186
+ puts "API Response: #{response}" # 전체 응답 출력
187
+
188
+ if req.status == 429
189
+ return "API 요청 제한을 초과했습니다. 플랜 및 할당량을 확인하세요."
190
+ end
191
+
192
+ # 응답 데이터에서 안전하게 값 추출
193
+ answer = response.dig('choices', 0, 'message', 'content')
194
+ answer ||= (content) # 응답이 없을 경우 기본 메시지 설정
195
+ rescue => e
196
+ puts "Error: #{e.message}"
197
+ answer = "오류가 발생했습니다."
198
+ end
199
+
200
+ puts 'API return ==> '
201
+ puts answer
202
+ answer
203
+ end
204
+ end
205
+
206
+
207
+ #############################################gpt############################################
208
+
105
209
  class Naver
106
210
  def initialize
107
211
  @seed = 1
108
- @cookie = ''
109
212
  end
213
+ def chrome_setup(user_id)
214
+ naver_cookie_dir = "C:/naver_cookie"
215
+ FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
216
+ system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id}})
110
217
 
111
- def chrome_start(proxy)
218
+ end
219
+ def chrome_start(proxy, user_id)
220
+ naver_cookie_dir = "C:/naver_cookie"
221
+ FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
112
222
  if proxy == ''
113
223
  begin
114
224
  Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
115
- @driver = Selenium::WebDriver.for :chrome
225
+ options = Selenium::WebDriver::Chrome::Options.new
226
+ options.page_load_strategy = :normal
227
+ options.timeouts = {page_load: 20_000}
228
+ options.page_load_strategy = 'none'
229
+ options.add_argument('--remote-debugging-port=9222')
230
+ options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
231
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
116
232
  rescue
117
- @driver = Selenium::WebDriver.for :chrome
233
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
118
234
  end
119
235
  else
120
236
  begin
121
237
  Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
238
+ options = Selenium::WebDriver::Chrome::Options.new
122
239
  # profile = Selenium::WebDriver::Chrome::Profile.new
123
240
  # profile['network.proxy.type'] = 1
124
241
  # profile['network.proxy.http'] = proxy.split(':')[0]
@@ -127,177 +244,114 @@ class Naver
127
244
  # options.profile = profile
128
245
  options = Selenium::WebDriver::Chrome::Options.new
129
246
  options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
130
- @driver = Selenium::WebDriver.for(:chrome, options: options)
247
+ options.page_load_strategy = :normal
248
+ options.timeouts = {page_load: 20_000}
249
+ options.page_load_strategy = 'none'
250
+ options.add_argument('--remote-debugging-port=9222')
251
+ options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
252
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
131
253
  rescue => e
132
254
  puts e
133
255
  puts 'proxy error...'
134
256
  begin
135
257
  Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
136
- @driver = Selenium::WebDriver.for :chrome
258
+ options = Selenium::WebDriver::Chrome::Options.new
259
+ options.page_load_strategy = :normal
260
+ options.timeouts = {page_load: 20_000}
261
+ options.page_load_strategy = 'none'
262
+ options.add_argument('--remote-debugging-port=9222')
263
+ options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
264
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
137
265
  rescue
138
- @driver = Selenium::WebDriver.for :chrome
266
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
139
267
  end
140
268
  end
141
269
  end
142
270
  end
143
271
 
272
+
273
+
144
274
  def login(user_id, user_pw, proxy)
145
275
  @user_id = user_id
146
276
  @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 == '..'
277
+ current_dir = File.dirname(__FILE__)
278
+ naver_cookie_dir = "C:/naver_cookie"
279
+ FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
154
280
 
155
- else
156
- user_cookie_file << i
157
- end
281
+
282
+
283
+ unless File.exist?("C:/naver_cookie/" + user_id)
284
+ driverfile_src = File.join(current_dir, 'driverfile')
285
+ if Dir.exist?(driverfile_src)
286
+ FileUtils.cp_r(driverfile_src, "C:/naver_cookie/" + user_id)
287
+
158
288
  end
159
- rescue
289
+ end
160
290
 
161
- end
291
+ # 새로운 스레드 생성 및 실행
292
+ Thread.new { chrome_setup(user_id) }
293
+ sleep(3)
162
294
 
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
295
 
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
296
+ chrome_start(proxy, user_id)
297
+ @driver.get('https://www.naver.com')
298
+ puts'[Step.01] 계정 로그인 및 세션 확인.......'.yellow
299
+
176
300
 
177
- end
178
301
  sleep(1)
179
- @driver.get('https://www.naver.com')
302
+
180
303
  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
304
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
305
+ #요소가 나타날 때까지 3초 동안 기다립니다.
306
+ wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]') }
307
+ sleep(1.5)
308
+ @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]').click
187
309
  check_cookie_login = 0
310
+ sleep(1)
188
311
  rescue
189
312
  check_cookie_login = 1
313
+ puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
314
+ sleep(2.5)
190
315
  end
191
316
 
192
317
  if check_cookie_login == 0
318
+ puts'[Step.02] 계정 세션이 없거나 기간 만료로 인해 로그인 시도.......'.yellow
193
319
  # @driver.find_element(:xpath, '//*[@id="right-content-area"]/div[1]/div[1]/div/a').click
194
320
  sleep(3)
195
- @driver.find_element(:xpath, '//*[@id="login_keep_wrap"]/div[2]/span/label').click
196
- sleep(2)
321
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
322
+ #요소가 나타날 때까지 3초 동안 기다립니다.
323
+ wait.until { @driver.find_element(:xpath, '//*[@for="switch"]') }
324
+ sleep(1.5)
325
+ @driver.find_element(:xpath, '//*[@id="login_keep_wrap"]/div[1]/label').click
326
+ sleep(1.5)
197
327
  @driver.find_element(:xpath, '//*[@id="id"]').click
198
328
  Clipboard.copy(user_id)
199
329
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
200
- sleep(3)
330
+ sleep(1.5)
201
331
  @driver.find_element(:xpath, '//*[@id="pw"]').click
202
332
  Clipboard.copy(user_pw)
203
333
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
204
- sleep(3)
334
+ sleep(1.5)
205
335
  @driver.find_element(:xpath, '//*[@id="log.login"]').click
206
- sleep(3)
336
+ sleep(2.5)
337
+
207
338
  else
208
339
  # @driver.switch_to.default_content
209
340
  end
210
341
 
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
342
  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
343
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
344
+ #요소가 나타날 때까지 3초 동안 기다립니다.
345
+ wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
346
+
231
347
  rescue => e
348
+ puts '-[√] 로그인 실패!!.......'.red
232
349
  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
350
  @driver.close
281
- rescue
282
-
351
+ return 0
283
352
  end
284
353
  end
285
354
 
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
355
  def create_id
302
356
  @seed += 1
303
357
  hash = Digest::SHA256.hexdigest((Time.now.to_i+@seed).to_s).to_s
@@ -942,52 +996,10 @@ end
942
996
  noko = Nokogiri::HTML(content, nil, Encoding::UTF_8.to_s)
943
997
  toomung = 0
944
998
  h = Hash.new
945
- # h[:authority] = 'blog.naver.com'
946
- # h[:method] = 'POST'
947
- # h[:path] = '/RabbitWrite.naver'
948
- # h[:scheme] = 'https'
949
- # h['accept'] = 'application/json, text/plain, */*'
950
- # h['accept-encoding'] = 'gzip, deflate, br'
951
- # h['accept-language'] = 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7'
952
- # h['content-type'] = 'application/x-www-form-urlencoded'
953
- # h['cookie'] = @cookie
954
- # h['origin'] = 'https://blog.naver.com'
955
- # h['referer'] = 'https://blog.naver.com/'+@user_id+'/postwrite?categoryNo=1'
956
- # h['sec-ch-ua'] = '"Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"'
957
- # h['sec-ch-ua-mobile'] = '?0'
958
- # h['sec-ch-ua-platform'] = '"Windows"'
959
- # h['sec-fetch-dest'] = 'empty'
960
- # h['sec-fetch-mode'] = 'cors'
961
- # h['sec-fetch-site'] = 'same-origin'
962
- # 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'
999
+
963
1000
 
964
1001
  data = Hash.new
965
- # data['blogId'] = @user_id
966
- # data['documentModel'] = Hash.new
967
- # data['documentModel']['documentId'] = ''
968
- # data['documentModel']['document'] = Hash.new
969
- # data['documentModel']['document']['version'] = '2.6.0'
970
- # data['documentModel']['document']['theme'] = 'default'
971
- # data['documentModel']['document']['language'] = 'ko-KR'
972
- # data['documentModel']['document']['components'] = Array.new
973
- # data['documentModel']['document']['components'][0] = {
974
- # 'id' => create_id(),
975
- # 'layout' => 'default',
976
- # 'title' => [
977
- # {
978
- # 'id' => create_id(),
979
- # 'nodes' => [{
980
- # 'id' => create_id(),
981
- # 'value' => title,
982
- # '@ctype' => 'textNode'
983
- # }],
984
- # '@ctype' => 'paragraph'
985
- # }
986
- # ],
987
- # 'subTitle' => nil,
988
- # 'align' => 'left',
989
- # '@ctype' => 'documentTitle'
990
- # }
1002
+
991
1003
 
992
1004
  check_position = 1
993
1005
  noko.css('p').each do |i|
@@ -1037,21 +1049,7 @@ end
1037
1049
  sleep(3)
1038
1050
  key_stroke('enter')
1039
1051
  sleep(3)
1040
- # @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
1041
- # puts path = CGI.unescape(path)
1042
- # image_data = image_update(path)
1043
- # components_value = Hash.new
1044
- # components_value['id'] = create_id()
1045
- # components_value['layout'] = 'default'
1046
- # begin
1047
- # if i.to_s.split('text-align: ')[1].split(';')[0] == 'center'
1048
- # components_value['align'] = 'center'
1049
- # elsif i.to_s.split('text-align: ')[1].split(';')[0] == 'right'
1050
- # components_value['align'] = 'right'
1051
- # else
1052
-
1053
- # end
1054
- # rescue
1052
+
1055
1053
 
1056
1054
  if i2.to_s.split('href="')[1] != nil
1057
1055
  href2 = i2.to_s.split('href="')[1].split('"')[0]
@@ -1067,30 +1065,7 @@ end
1067
1065
  #key_stroke('enter')
1068
1066
  sleep(1)
1069
1067
  end
1070
- # end
1071
- # components_value['src'] = 'https://blogfiles.pstatic.net'+image_data['item']['url']+'?type=w1'
1072
- # components_value['internalResource'] = true
1073
- # components_value['represent'] = true
1074
- # components_value['path'] = image_data['item']['url']
1075
- # components_value['domain'] = "https://blogfiles.pstatic.net"
1076
- # components_value['fileSize'] = image_data['item']['fileSize'].to_i
1077
- # components_value['width'] = image_data['item']['width'].to_i
1078
- # components_value['widthPercentage'] = 0
1079
- # components_value['height'] = image_data['item']['height'].to_i
1080
- # components_value['fileName'] = image_data['item']['fileName'].to_i
1081
- # components_value['caption'] = nil
1082
- # if i2.to_s.split('href="')[1] != nil
1083
- # components_value['link'] = CGI.unescape(i2.to_s.split('href="')[1].split('"')[0])
1084
- # end
1085
- # components_value['format'] = 'normal'
1086
- # components_value['displayFormat'] = 'normal'
1087
- # components_value['imageLoaded'] = true
1088
- # components_value['contentMode'] = 'fit'
1089
- # components_value['origin'] = {
1090
- # 'srcFrom' => 'local',
1091
- # '@ctype' => 'imageOrigin'
1092
- # }
1093
- # components_value['@ctype'] = 'image'
1068
+
1094
1069
  elsif i2.to_s.include?('<video')
1095
1070
  path = i2.to_s.split('src="')[1].split('"')[0]
1096
1071
  path = URI.decode_www_form(path)[0][0]
@@ -1106,7 +1081,14 @@ end
1106
1081
  key_up('ctrl')
1107
1082
  sleep(3)
1108
1083
  key_stroke('enter')
1109
- sleep(3)
1084
+ sleep(2)
1085
+
1086
+ @driver.find_element(:xpath, '//*[@id="nvu_inp_box_title"]').send_keys(title)
1087
+ sleep(1)
1088
+ @driver.find_element(:xpath, '//*[@id="nvu_inp_box_description"]').send_keys(title)
1089
+ sleep(1)
1090
+ @driver.find_element(:xpath, '//*[@id="nvu_inp_box_tag"]').send_keys(title)
1091
+ sleep(1)
1110
1092
 
1111
1093
  for n in 1..10
1112
1094
  puts @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text
@@ -1115,11 +1097,16 @@ end
1115
1097
  end
1116
1098
  sleep(10)
1117
1099
  end
1118
- @driver.find_element(:xpath, '//*[@id="nvu_inp_box_title"]').send_keys(title)
1119
- sleep(5)
1120
1100
  @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[3]/button/span').click
1121
1101
  sleep(3)
1122
-
1102
+ @driver.action.key_down(:up).key_up(:up).perform #x탭
1103
+ sleep(1)
1104
+ @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
1105
+ @driver.action.send_keys(title).perform
1106
+ sleep(1)
1107
+ @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1108
+ sleep(1)
1109
+
1123
1110
  elsif i2.to_s.include?('<inyonggoo')
1124
1111
  if i2.text == ''
1125
1112
 
@@ -2008,108 +1995,19 @@ class Wordpress
2008
1995
 
2009
1996
 
2010
1997
 
1998
+ #def chrome_start(url, user_id, user_pw)
1999
+ # @url = url
2000
+ # @user_id = user_id
2001
+ # @user_pw = user_pw
2002
+ # begin
2003
+ # Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
2004
+ # @driver = Selenium::WebDriver.for :chrome
2005
+ # rescue
2006
+ # @driver = Selenium::WebDriver.for :chrome
2007
+ # end
2008
+ #end
2011
2009
 
2012
- def chrome_start(url, user_id, user_pw)
2013
- @url = url
2014
- @user_id = user_id
2015
- @user_pw = user_pw
2016
- begin
2017
- Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
2018
- @driver = Selenium::WebDriver.for :chrome
2019
- rescue
2020
- @driver = Selenium::WebDriver.for :chrome
2021
- end
2022
- end
2023
-
2024
- def login
2025
- @driver.get(@url+'/wp-admin')
2026
- @driver.find_element(:xpath , '//*[@id="user_login"]').send_keys(@user_id)
2027
- @driver.find_element(:xpath , '//*[@id="user_pass"]').send_keys(@user_pw)
2028
- @driver.find_element(:xpath , '//*[@id="wp-submit"]').click
2029
- @cookie = Hash.new
2030
- @driver.manage.all_cookies.each do |i|
2031
- @cookie[i[:name]] = i[:value]
2032
- end
2033
- sleep(2)
2034
- begin
2035
- puts @driver.find_element(:xpath , '/html/body/div/div/div[1]/div[1]/div/div[1]/a[1]/span').text
2036
- @driver.close
2037
- return 1
2038
- rescue => e
2039
- puts e
2040
- @driver.close
2041
- return 0
2042
- end
2043
- end
2044
2010
 
2045
- def update
2046
- http = HTTP.cookies(@cookie).get(@url+'/wp-admin/post-new.php')
2047
- noko = Nokogiri::HTML(http.to_s)
2048
- @wpnonce = http.to_s.split('_wpnonce":"')[1].split('"')[0]
2049
- @data2 = Hash.new
2050
- @data2['_wpnonce'] = noko.xpath('//*[@id="_wpnonce"]')[0]['value']
2051
- @data2['_wp_http_referer'] = '/wp-admin/post-new.php'
2052
- @data2['user_ID'] = '1'
2053
- @data2['action'] = 'editpost'
2054
- @data2['originalaction'] = 'editpost'
2055
- @data2['post_author'] = '1'
2056
- @data2['post_type'] = 'post'
2057
- @data2['original_post_status'] = 'auto-draft'
2058
- @data2['referredby'] = @url+'/wp-admin/update-core.php'
2059
- @data2['_wp_original_http_referer'] = @url+'/wp-admin/update-core.php'
2060
- @data2['auto_draft'] = nil
2061
- @data2['post_ID'] = noko.xpath('//*[@id="post_ID"]')[0]['value']
2062
- @data2['meta-box-order-nonce'] = noko.xpath('//*[@id="meta-box-order-nonce"]')[0]['value']
2063
- @data2['closedpostboxesnonce'] = noko.xpath('//*[@id="closedpostboxesnonce"]')[0]['value']
2064
- @data2['post_title'] = 'title3'
2065
- @data2['samplepermalinknonce'] = noko.xpath('//*[@id="samplepermalinknonce"]')[0]['value']
2066
- @data2['content'] = 'content3'
2067
- @data2['wp-preview'] = nil
2068
- @data2['hidden_post_status'] = 'draft'
2069
- @data2['post_status'] = 'draft'
2070
- @data2['hidden_post_password'] = nil
2071
- @data2['hidden_post_visibility'] = 'public'
2072
- @data2['visibility'] = 'post'
2073
- @data2['post_password'] = nil
2074
- @data2['mm'] = '10'
2075
- @data2['jj'] = '24'
2076
- @data2['aa'] = '2022'
2077
- @data2['hh'] = '02'
2078
- @data2['mn'] = '41'
2079
- @data2['ss'] = '32'
2080
- @data2['hidden_mm'] = '10'
2081
- @data2['cur_mm'] = '10'
2082
- @data2['hidden_jj'] = '24'
2083
- @data2['cur_jj'] = '24'
2084
- @data2['hidden_aa'] = '2022'
2085
- @data2['cur_aa'] = '2022'
2086
- @data2['hidden_hh'] = '02'
2087
- @data2['cur_hh'] = '02'
2088
- @data2['hidden_mn'] = '41'
2089
- @data2['cur_mn'] = '41'
2090
- @data2['original_publish'] = '공개'
2091
- @data2['publish'] = '공개'
2092
- @data2['post_format'] = '0'
2093
- @data2['post_category[]'] = '0'
2094
- @data2['newcategory'] = '새 카테고리 이름'
2095
- @data2['newcategory_parent'] = -1
2096
- @data2['_ajax_nonce-add-category'] = noko.xpath('//*[@id="_ajax_nonce-add-category"]')[0]['value']
2097
- @data2['tax_input[post_tag]'] = nil
2098
- @data2['newtag[post_tag]'] = nil
2099
- @data2['_thumbnail_id'] = -1
2100
- @data2['excerpt'] = nil
2101
- @data2['trackback_url'] = nil
2102
- @data2['metakeyinput'] = nil
2103
- @data2['metavalue'] = nil
2104
- @data2['_ajax_nonce-add-meta'] = noko.xpath('//*[@id="_ajax_nonce-add-meta"]')[0]['value']
2105
- @data2['advanced_view'] = '1'
2106
- @data2['comment_status'] = 'open'
2107
- @data2['ping_status'] = 'open'
2108
- @data2['post_name'] = nil
2109
- @data2['post_author_override'] = '1'
2110
- #result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data)
2111
- return @data2
2112
- end
2113
2011
 
2114
2012
  def auto_image
2115
2013
  begin
@@ -2452,6 +2350,13 @@ class Wordpress
2452
2350
  end
2453
2351
  end
2454
2352
  end
2353
+
2354
+ if @data['포스트설정']['gpt제목'].checked?
2355
+ chat = Chat_title.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'))
2356
+ gpt_text1 = chat.message(title)
2357
+ title = gpt_text1.to_s
2358
+ end
2359
+
2455
2360
  @data['table'][index][-1] = 5
2456
2361
  @data['table'] << []
2457
2362
  @data['table'].pop
@@ -2489,6 +2394,25 @@ class Wordpress
2489
2394
  end
2490
2395
  end
2491
2396
  end
2397
+
2398
+
2399
+ if @data['포스트설정']['gpt내용'].checked?
2400
+ api_key = @data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8')
2401
+ #key_change = @data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8')
2402
+ #imotcon_change = @data['포스트설정']['스티커로변경단어'].text.to_s.force_encoding('utf-8')
2403
+ #template_change = @data['포스트설정']['내템플릿변경단어'].text.to_s.force_encoding('utf-8')
2404
+ #ttdanar_change = @data['포스트설정']['단어링크적용단어'].text.to_s.force_encoding('utf-8')
2405
+ #sajine_change = @data['포스트설정']['단어사진으로변경단어'].text.to_s.force_encoding('utf-8')
2406
+ #mov_change = @data['포스트설정']['영상으로변경단어'].text.to_s.force_encoding('utf-8')
2407
+ #map_change = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8')
2408
+ #inyong9_change = @data['포스트설정']['인용구변경단어'].text.to_s.force_encoding('utf-8')
2409
+
2410
+
2411
+ chat = Chat_content.new(api_key)
2412
+ gpt_text3 = chat.message(content)
2413
+ content = gpt_text3.to_s
2414
+ end
2415
+
2492
2416
  content_tag = content.split('@##@')[1]
2493
2417
  content = content.split('@##@')[0]
2494
2418
  @data['table'][index][-1] = 15
@@ -2687,7 +2611,7 @@ class Wordpress
2687
2611
  @data['table'][index][-1] = 50
2688
2612
  @data['table'] << []
2689
2613
  @data['table'].pop
2690
- if @data['포스트설정']['gpt'].checked?
2614
+ if @data['포스트설정']['gpt키워드'].checked?
2691
2615
  chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'))
2692
2616
  gpt_text = chat.message(keyword)
2693
2617
  content = content + "\n(자동생성글)\n" + gpt_text
@@ -2708,7 +2632,7 @@ class Wordpress
2708
2632
  joongbok_check = 0
2709
2633
  counter10 = 0
2710
2634
  while joongbok_check == 0
2711
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2635
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2712
2636
  content22 = content.split("(자동생성글)")[1].split("\n")
2713
2637
  else
2714
2638
  content22 = content.split("\n")
@@ -2732,12 +2656,12 @@ class Wordpress
2732
2656
  content2 = content.split("\n")
2733
2657
  end
2734
2658
 
2735
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2659
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2736
2660
  content2 = content.split("(자동생성글)")[1].split("\n")
2737
2661
  position.pop
2738
2662
  end
2739
2663
 
2740
- if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt'].checked? == false
2664
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt키워드'].checked? == false
2741
2665
  content2 = content.split("\n")
2742
2666
  end
2743
2667
 
@@ -2783,7 +2707,7 @@ class Wordpress
2783
2707
  content = content3.join("\n")
2784
2708
  end
2785
2709
 
2786
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2710
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2787
2711
  content2.each_with_index do |con, index|
2788
2712
  if position.include?(index)
2789
2713
  insert_keyword_text = keyword.to_s
@@ -2813,7 +2737,7 @@ class Wordpress
2813
2737
  end
2814
2738
  end
2815
2739
 
2816
- if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt'].checked? == false
2740
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['gpt키워드'].checked? == false
2817
2741
  begin
2818
2742
  content2.each_with_index do |con, index|
2819
2743
  if position.include?(index)
@@ -2908,7 +2832,7 @@ class Wordpress
2908
2832
  end
2909
2833
  end
2910
2834
 
2911
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2835
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2912
2836
  if @data['포스트설정']['자동글 수식에 입력'].checked?
2913
2837
  content5 = content.split("(자동생성글)")[0].to_s.split("\n")
2914
2838
  content55 = content.split("(자동생성글)")[1].to_s
@@ -2940,7 +2864,7 @@ class Wordpress
2940
2864
 
2941
2865
  position = position.sort
2942
2866
  ##여기서부터 이미지 순서대로 안되서 변경####-------------------------------------------------------------------------------
2943
- # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2867
+ # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2944
2868
  # image_url22 = get_image_file().force_encoding('utf-8')
2945
2869
  # end
2946
2870
 
@@ -2958,7 +2882,7 @@ class Wordpress
2958
2882
  # end
2959
2883
  # end
2960
2884
 
2961
- # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2885
+ # if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2962
2886
  # content = content5.join("\n")+'(자동생성글)'+content55
2963
2887
  # iconv = Iconv.new('UTF-8', 'ASCII-8BIT')
2964
2888
  # content = iconv.iconv(content)
@@ -2978,7 +2902,7 @@ class Wordpress
2978
2902
  ###여기까지 이미지 순서대로 안되서 변경##-------------------------------------------------------------------------------
2979
2903
 
2980
2904
  ##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
2981
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2905
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
2982
2906
  sleep(2)
2983
2907
  puts '이미지 자동 세탁 중 · · · '
2984
2908
  end
@@ -2997,7 +2921,7 @@ class Wordpress
2997
2921
  end
2998
2922
  sleep(2)
2999
2923
  puts '이미지 자동 세탁 완료 · · · '
3000
- if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt'].checked?
2924
+ if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
3001
2925
  content = content5.join("\n")+'(자동생성글)'+content55
3002
2926
  puts content
3003
2927
  ##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
@@ -3137,7 +3061,7 @@ class Wordpress
3137
3061
  content = content
3138
3062
  soosick_1 = content_end
3139
3063
  else
3140
- if @data['포스트설정']['gpt'].checked?
3064
+ if @data['포스트설정']['gpt키워드'].checked?
3141
3065
  if @data['포스트설정']['gpt상단'].checked?
3142
3066
  content = content_end+"\n"+content+"\n"
3143
3067
  else
@@ -3812,7 +3736,10 @@ class Wordpress
3812
3736
  }
3813
3737
  horizontal_box{
3814
3738
  stretchy false
3739
+ grid{
3815
3740
  button('전체선택'){
3741
+ top 1
3742
+ left 1
3816
3743
  on_clicked{
3817
3744
  for n in 0..@data['키워드설정']['키워드'].length-1
3818
3745
  @data['키워드설정']['키워드'][n][0] = true
@@ -3821,7 +3748,20 @@ class Wordpress
3821
3748
  end
3822
3749
  }
3823
3750
  }
3824
- button('키워드삭제'){
3751
+ button('선택해제'){
3752
+ top 1
3753
+ left 2
3754
+ on_clicked{
3755
+ for n in 0..@data['키워드설정']['키워드'].length-1
3756
+ @data['키워드설정']['키워드'][n][0] = false
3757
+ @data['키워드설정']['키워드'] << []
3758
+ @data['키워드설정']['키워드'].pop
3759
+ end
3760
+ }
3761
+ }
3762
+ button('삭제하기'){
3763
+ top 1
3764
+ left 3
3825
3765
  on_clicked{
3826
3766
  m = Array.new
3827
3767
  for n in 0..@data['키워드설정']['키워드'].length-1
@@ -3836,6 +3776,8 @@ class Wordpress
3836
3776
  @data['키워드설정']['키워드'].delete(nil)
3837
3777
  }
3838
3778
  }
3779
+ }
3780
+
3839
3781
  @data['키워드설정']['순서사용'] = checkbox('순서사용'){
3840
3782
  stretchy false
3841
3783
  on_toggled{ |c|
@@ -3853,6 +3795,59 @@ class Wordpress
3853
3795
  }
3854
3796
  }
3855
3797
  }
3798
+ vertical_separator{
3799
+ stretchy false
3800
+ }
3801
+ horizontal_box{
3802
+ stretchy false
3803
+ grid{
3804
+ @data['포스트설정']['gpt키워드'] = checkbox('GPT 키워드 기반 글 생성'){
3805
+ top 1
3806
+ left 0
3807
+ #enabled false # 기본적으로 비활성화
3808
+ on_toggled {
3809
+ if @data['포스트설정']['gpt키워드'].checked?
3810
+ @data['포스트설정']['gpt상단'].enabled = true # '내용투명' 활성화
3811
+ @data['포스트설정']['gpt하단'].enabled = true # '내용투명' 활성화
3812
+ else
3813
+ @data['포스트설정']['gpt상단'].checked = false # 체크 해제
3814
+ @data['포스트설정']['gpt상단'].enabled = false # 비활성화
3815
+ @data['포스트설정']['gpt하단'].checked = false # 체크 해제
3816
+ @data['포스트설정']['gpt하단'].enabled = false # 비활성화
3817
+ end
3818
+ }
3819
+
3820
+ }
3821
+
3822
+ @data['포스트설정']['gpt상단'] = checkbox('원고 위에 넣기'){
3823
+ top 1
3824
+ left 1
3825
+ enabled false # 기본적으로 비활성화
3826
+ on_toggled{
3827
+ if @data['포스트설정']['gpt상단'].checked?
3828
+ @data['포스트설정']['gpt하단'].checked = false
3829
+ end
3830
+ }
3831
+ }
3832
+
3833
+ @data['포스트설정']['gpt하단'] = checkbox('원고 아래 넣기'){
3834
+ top 1
3835
+ left 2
3836
+ enabled false # 기본적으로 비활성화
3837
+ on_toggled{
3838
+ if @data['포스트설정']['gpt하단'].checked?
3839
+ @data['포스트설정']['gpt상단'].checked = false
3840
+ end
3841
+ }
3842
+ }
3843
+ } }
3844
+ horizontal_box{
3845
+ stretchy false
3846
+ grid{
3847
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
3848
+ } } }
3849
+
3850
+
3856
3851
  table{
3857
3852
  checkbox_column('선택'){
3858
3853
  editable true
@@ -3863,7 +3858,9 @@ class Wordpress
3863
3858
 
3864
3859
  cell_rows @data['키워드설정']['키워드']
3865
3860
  }
3866
-
3861
+
3862
+
3863
+
3867
3864
  }
3868
3865
  vertical_separator{
3869
3866
  stretchy false
@@ -3892,7 +3889,10 @@ class Wordpress
3892
3889
  }
3893
3890
  horizontal_box{
3894
3891
  stretchy false
3892
+ grid{
3895
3893
  button('전체선택'){
3894
+ top 1
3895
+ left 1
3896
3896
  on_clicked{
3897
3897
  for n in 0..@data['제목설정']['제목'].length-1
3898
3898
  @data['제목설정']['제목'][n][0] = true
@@ -3901,7 +3901,20 @@ class Wordpress
3901
3901
  end
3902
3902
  }
3903
3903
  }
3904
- button('제목삭제'){
3904
+ button('선택해제'){
3905
+ top 1
3906
+ left 2
3907
+ on_clicked{
3908
+ for n in 0..@data['제목설정']['제목'].length-1
3909
+ @data['제목설정']['제목'][n][0] = false
3910
+ @data['제목설정']['제목'] << []
3911
+ @data['제목설정']['제목'].pop
3912
+ end
3913
+ }
3914
+ }
3915
+ button('삭제하기'){
3916
+ top 1
3917
+ left 3
3905
3918
  on_clicked{
3906
3919
  m = Array.new
3907
3920
  for n in 0..@data['제목설정']['제목'].length-1
@@ -3916,6 +3929,7 @@ class Wordpress
3916
3929
  @data['제목설정']['제목'].delete(nil)
3917
3930
  }
3918
3931
  }
3932
+ }
3919
3933
  @data['제목설정']['순서사용'] = checkbox('순서사용'){
3920
3934
  stretchy false
3921
3935
  on_toggled{ |c|
@@ -3933,6 +3947,23 @@ class Wordpress
3933
3947
  }
3934
3948
  }
3935
3949
  }
3950
+ vertical_separator{
3951
+ stretchy false
3952
+ }
3953
+ horizontal_box{
3954
+ stretchy false
3955
+ grid{
3956
+ @data['포스트설정']['gpt제목'] = checkbox('제목을 이용해 GPT로 비슷한 제목 생성'){
3957
+
3958
+
3959
+ }}}
3960
+ horizontal_box{
3961
+ stretchy false
3962
+ grid{
3963
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
3964
+ } } }
3965
+
3966
+
3936
3967
  table{
3937
3968
  checkbox_column('선택'){
3938
3969
  editable true
@@ -3943,6 +3974,7 @@ class Wordpress
3943
3974
 
3944
3975
  cell_rows @data['제목설정']['제목']
3945
3976
  }
3977
+
3946
3978
 
3947
3979
  }
3948
3980
  vertical_separator{
@@ -3970,7 +4002,10 @@ class Wordpress
3970
4002
  }
3971
4003
  horizontal_box{
3972
4004
  stretchy false
4005
+ grid{
3973
4006
  button('전체선택'){
4007
+ top 1
4008
+ left 1
3974
4009
  on_clicked{
3975
4010
  for n in 0..@data['내용설정']['내용'].length-1
3976
4011
  @data['내용설정']['내용'][n][0] = true
@@ -3979,7 +4014,20 @@ class Wordpress
3979
4014
  end
3980
4015
  }
3981
4016
  }
3982
- button('내용삭제'){
4017
+ button('선택해제'){
4018
+ top 1
4019
+ left 2
4020
+ on_clicked{
4021
+ for n in 0..@data['내용설정']['내용'].length-1
4022
+ @data['내용설정']['내용'][n][0] = false
4023
+ @data['내용설정']['내용'] << []
4024
+ @data['내용설정']['내용'].pop
4025
+ end
4026
+ }
4027
+ }
4028
+ button('삭제하기'){
4029
+ top 1
4030
+ left 3
3983
4031
  on_clicked{
3984
4032
  m = Array.new
3985
4033
  for n in 0..@data['내용설정']['내용'].length-1
@@ -3994,6 +4042,7 @@ class Wordpress
3994
4042
  @data['내용설정']['내용'].delete(nil)
3995
4043
  }
3996
4044
  }
4045
+ }
3997
4046
  @data['내용설정']['순서사용'] = checkbox('순서사용'){
3998
4047
  stretchy false
3999
4048
  on_toggled{ |c|
@@ -4011,6 +4060,22 @@ class Wordpress
4011
4060
  }
4012
4061
  }
4013
4062
  }
4063
+ vertical_separator{
4064
+ stretchy false
4065
+ }
4066
+ horizontal_box{
4067
+ stretchy false
4068
+ grid{
4069
+ @data['포스트설정']['gpt내용'] = checkbox('내용파일을 이용해 GPT로 글 변형'){
4070
+
4071
+
4072
+ }}}
4073
+ horizontal_box{
4074
+ stretchy false
4075
+ grid{
4076
+ label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
4077
+ } } }
4078
+
4014
4079
  table{
4015
4080
  checkbox_column('선택'){
4016
4081
  editable true
@@ -4028,8 +4093,8 @@ class Wordpress
4028
4093
  stretchy false
4029
4094
  text "내용폴더경로 ex)C:\\내용\\폴더1"
4030
4095
  }
4031
- button('폴더째로불러오기'){
4032
- stretchy false
4096
+ button('폴더째로 불러오기'){
4097
+
4033
4098
  on_clicked{
4034
4099
  path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
4035
4100
  Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
@@ -4127,7 +4192,7 @@ class Wordpress
4127
4192
  text "사진폴더경로 ex)C:\\사진\\폴더2"
4128
4193
  }
4129
4194
  button('폴더째로불러오기'){
4130
- stretchy false
4195
+
4131
4196
  on_clicked{
4132
4197
  path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
4133
4198
  Dir.entries(@data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')).each do |file|
@@ -4380,6 +4445,18 @@ class Wordpress
4380
4445
  @data['포스트설정']['제목에키워드삽입'] = checkbox('제목에 키워드 삽입'){
4381
4446
  top 2
4382
4447
  left 0
4448
+ #enabled false # 기본적으로 비활성화
4449
+ on_toggled {
4450
+ if @data['포스트설정']['제목에키워드삽입'].checked?
4451
+ @data['포스트설정']['제목앞'].enabled = true # '내용투명' 활성화
4452
+ @data['포스트설정']['제목뒤'].enabled = true # '내용투명' 활성화
4453
+ else
4454
+ @data['포스트설정']['제목앞'].checked = false # 체크 해제
4455
+ @data['포스트설정']['제목앞'].enabled = false # 비활성화
4456
+ @data['포스트설정']['제목뒤'].checked = false # 체크 해제
4457
+ @data['포스트설정']['제목뒤'].enabled = false # 비활성화
4458
+ end
4459
+ }
4383
4460
  }
4384
4461
  @data['포스트설정']['제목에키워드삽입숫자1'] = entry(){
4385
4462
  top 2
@@ -4402,6 +4479,7 @@ class Wordpress
4402
4479
  @data['포스트설정']['제목앞'] = checkbox('제목에 키워드 삽입 제목 앞'){
4403
4480
  top 3
4404
4481
  left 3
4482
+ enabled false # 기본적으로 비활성화
4405
4483
  on_toggled{
4406
4484
  if @data['포스트설정']['제목앞'].checked? == true
4407
4485
  if @data['포스트설정']['제목뒤'].checked?
@@ -4417,6 +4495,7 @@ class Wordpress
4417
4495
  @data['포스트설정']['제목뒤'] = checkbox('제목에 키워드 삽입 제목 뒤'){
4418
4496
  top 4
4419
4497
  left 3
4498
+ enabled false # 기본적으로 비활성화
4420
4499
  on_toggled{
4421
4500
  if @data['포스트설정']['제목뒤'].checked? == true
4422
4501
  if @data['포스트설정']['제목앞'].checked?
@@ -4425,26 +4504,51 @@ class Wordpress
4425
4504
  end
4426
4505
  }
4427
4506
  }
4428
- @data['포스트설정']['제목내용설정'] = checkbox('내용의 문장을 제목으로 설정'){
4507
+ @data['포스트설정']['특수문자'] = checkbox('제목에 키워드 삽입 특수문자 삽입'){
4429
4508
  top 4
4430
4509
  left 0
4431
4510
  }
4432
-
4433
- @data['포스트설정']['특수문자'] = checkbox('제목에 키워드 삽입 시 특수문자 삽입'){
4511
+ @data['포스트설정']['제목을랜덤'] = checkbox('제목을 랜덤 단어 조합으로 자동 입력'){
4434
4512
  top 5
4435
4513
  left 0
4514
+ on_toggled{
4515
+ if @data['포스트설정']['제목을랜덤'].checked? == true
4516
+ if @data['포스트설정']['제목내용설정'].checked?
4517
+ @data['포스트설정']['제목내용설정'].checked = false
4518
+ end
4519
+ end
4520
+ }
4436
4521
  }
4437
- @data['포스트설정']['제목을랜덤'] = checkbox('제목을 랜덤 단어 조합으로 자동 입력'){
4522
+ @data['포스트설정']['제목내용설정'] = checkbox('내용의 문장을 제목으로 설정'){
4438
4523
  top 6
4439
4524
  left 0
4525
+ on_toggled{
4526
+ if @data['포스트설정']['제목내용설정'].checked? == true
4527
+ if @data['포스트설정']['제목을랜덤'].checked?
4528
+ @data['포스트설정']['제목을랜덤'].checked = false
4529
+ end
4530
+ end
4531
+ }
4440
4532
  }
4441
4533
  @data['포스트설정']['내용키워드삽입'] = checkbox('내용 키워드 삽입'){
4442
4534
  top 7
4443
4535
  left 0
4536
+ on_toggled {
4537
+ if @data['포스트설정']['내용키워드삽입'].checked?
4538
+ @data['포스트설정']['키워드삽입'].enabled = true # '내용투명' 활성화
4539
+ @data['포스트설정']['키워드삽입시링크'].enabled = true # '내용투명' 활성화
4540
+ else
4541
+ @data['포스트설정']['키워드삽입'].checked = false # 체크 해제
4542
+ @data['포스트설정']['키워드삽입'].enabled = false # 비활성화
4543
+ @data['포스트설정']['키워드삽입시링크'].text = 'URL' # 기본 텍스트 설정
4544
+ @data['포스트설정']['키워드삽입시링크'].enabled = false # 비활성화
4545
+ end
4546
+ }
4444
4547
  }
4445
4548
  @data['포스트설정']['키워드삽입시작숫자'] = entry(){
4446
4549
  top 7
4447
4550
  left 1
4551
+
4448
4552
  text '최소수량'
4449
4553
  }
4450
4554
  label('~'){
@@ -4465,55 +4569,51 @@ class Wordpress
4465
4569
  left 1
4466
4570
  text 'URL'
4467
4571
  }
4468
- @data['포스트설정']['내용을자동생성'] = checkbox('내용을 키워드 기반으로 자동 생성해서 포스팅'){
4572
+ @data['포스트설정']['내용을자동생성'] = checkbox('키워드기반 생성으로만 등록(GPT 사용시 자체 생성)'){
4469
4573
  top 9
4470
4574
  left 0
4471
4575
  on_toggled{
4472
4576
  if @data['포스트설정']['내용을자동생성'].checked?
4473
- if @data['포스트설정']['내용과자동생성'].checked?
4474
- @data['포스트설정']['내용과자동생성'].checked = false
4475
- end
4577
+ @data['포스트설정']['내용과자동생성'].checked = false
4578
+ @data['포스트설정']['내용투명'].checked = false
4579
+ @data['포스트설정']['자동글 수식에 입력'].checked = false
4580
+
4476
4581
  end
4477
4582
  }
4478
4583
  }
4479
4584
 
4480
- @data['포스트설정']['gpt'] = checkbox('내용을 키워드 기반의 GPT로 생성해서 포스팅'){
4481
- top 10
4482
- left 0
4483
- }
4484
-
4485
- @data['포스트설정']['api_key'] = entry(){
4486
- top 10
4487
- left 1
4488
- text 'api key'
4489
- }
4490
-
4491
- @data['포스트설정']['gpt상단'] = checkbox('원고내용 위에 넣기'){
4492
- top 10
4493
- left 3
4494
- }
4585
+
4495
4586
 
4496
- @data['포스트설정']['gpt하단'] = checkbox('원고내용 아래에 넣기'){
4497
- top 11
4498
- left 3
4499
- }
4500
4587
 
4501
4588
  aa1 = 2
4502
- @data['포스트설정']['내용과자동생성'] = checkbox('내용을 내용 파일 + 자동 생성 조합으로 포스팅'){
4589
+ @data['포스트설정']['내용과자동생성'] = checkbox('내용파일+키워드기반 생성 등록(GPT 사용시 자체 생성)') {
4503
4590
  top 10 + aa1
4504
4591
  left 0
4505
- on_toggled{
4506
- if @data['포스트설정']['내용과자동생성'].checked?
4507
- if @data['포스트설정']['내용을자동생성'].checked?
4508
- @data['포스트설정']['내용을자동생성'].checked = false
4509
- end
4510
- end
4592
+ on_toggled {
4593
+ if @data['포스트설정']['내용과자동생성'].checked?
4594
+ @data['포스트설정']['내용을자동생성'].checked = false
4595
+ @data['포스트설정']['내용투명'].enabled = true # '내용투명' 활성화
4596
+ @data['포스트설정']['자동글 수식에 입력'].enabled = true # '내용투명' 활성화
4597
+ else
4598
+ @data['포스트설정']['내용투명'].checked = false # 체크 해제
4599
+ @data['포스트설정']['내용투명'].enabled = false # 비활성화
4600
+ @data['포스트설정']['자동글 수식에 입력'].checked = false # 체크 해제
4601
+ @data['포스트설정']['자동글 수식에 입력'].enabled = false # 비활성화
4602
+ end
4511
4603
  }
4512
- }
4513
- @data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리'){
4514
- top 11+ aa1
4604
+ }
4605
+
4606
+ @data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리') {
4607
+ top 11 + aa1
4515
4608
  left 0
4516
- }
4609
+ enabled false # 기본적으로 비활성화
4610
+ on_toggled {
4611
+ if @data['포스트설정']['내용투명'].checked?
4612
+ @data['포스트설정']['내용을자동생성'].checked = false
4613
+ @data['포스트설정']['자동글 수식에 입력'].checked = false
4614
+ end
4615
+ }
4616
+ }
4517
4617
  @data['포스트설정']['내용자동변경'] = checkbox('내용에 단어들을 자동 변경'){
4518
4618
  top 12+ aa1
4519
4619
  left 0
@@ -4541,6 +4641,18 @@ class Wordpress
4541
4641
  @data['포스트설정']['내용사진자동삽입'] = checkbox('내용 사진 자동 삽입'){
4542
4642
  top 13+ aa1
4543
4643
  left 0
4644
+ #enabled false # 기본적으로 비활성화
4645
+ on_toggled {
4646
+ if @data['포스트설정']['내용사진자동삽입'].checked?
4647
+ @data['포스트설정']['내용사진링크'].enabled = true # '내용투명' 활성화
4648
+ @data['포스트설정']['내용사진링크값'].enabled = true # '내용투명' 활성화
4649
+ else
4650
+ @data['포스트설정']['내용사진링크'].checked = false # 체크 해제
4651
+ @data['포스트설정']['내용사진링크'].enabled = false # 비활성화
4652
+ @data['포스트설정']['내용사진링크값'].text = 'URL' # 기본 텍스트 설정
4653
+ @data['포스트설정']['내용사진링크값'].enabled = false # 비활성화
4654
+ end
4655
+ }
4544
4656
  }
4545
4657
  @data['포스트설정']['내용사진자동삽입시작숫자'] = entry(){
4546
4658
  top 13+ aa1
@@ -4558,15 +4670,28 @@ class Wordpress
4558
4670
  }
4559
4671
 
4560
4672
  @data['포스트설정']['내용사진링크'] = checkbox('내용 사진 자동 삽입시 링크 삽입'){
4673
+ enabled false # 기본적으로 비활성화
4561
4674
  top 14+ aa1
4562
4675
  left 0
4563
4676
  }
4564
4677
 
4565
4678
  @data['포스트설정']['내용사진링크값'] = entry(){
4679
+ enabled false # 기본적으로 비활성화
4566
4680
  top 14+ aa1
4567
4681
  left 1
4568
4682
  text 'URL'
4569
4683
  }
4684
+
4685
+ @data['포스트설정']['ChatGPT사용'] = checkbox('Chat GPT 사용하기'){
4686
+ top 15+ aa1
4687
+ left 0
4688
+ }
4689
+
4690
+ @data['포스트설정']['api_key'] = entry(){
4691
+ top 15+ aa1
4692
+ left 1
4693
+ text 'api key 입력 필수!!'
4694
+ }
4570
4695
  }
4571
4696
  }
4572
4697
 
@@ -4757,6 +4882,22 @@ class Wordpress
4757
4882
  @data['포스트설정']['막글삽입'] = checkbox('내용 하단에 막글 삽입'){
4758
4883
  top 6
4759
4884
  left 0
4885
+ #enabled false # 기본적으로 비활성화
4886
+ on_toggled {
4887
+ if @data['포스트설정']['막글삽입'].checked?
4888
+ @data['포스트설정']['막글투명'].enabled = true # '내용투명' 활성화
4889
+ @data['포스트설정']['막글그대로'].enabled = true # '내용투명' 활성화
4890
+ @data['포스트설정']['막글 수식에 입력'].enabled = true # '내용투명' 활성화
4891
+
4892
+ else
4893
+ @data['포스트설정']['막글투명'].checked = false # 체크 해제
4894
+ @data['포스트설정']['막글투명'].enabled = false # 비활성화
4895
+ @data['포스트설정']['막글그대로'].checked = false # 체크 해제
4896
+ @data['포스트설정']['막글그대로'].enabled = false # 비활성화
4897
+ @data['포스트설정']['막글 수식에 입력'].checked = false # 체크 해제
4898
+ @data['포스트설정']['막글 수식에 입력'].enabled = false # 비활성화
4899
+ end
4900
+ }
4760
4901
  }
4761
4902
  @data['포스트설정']['막글삽입시작숫자'] = entry{
4762
4903
  top 6
@@ -4786,10 +4927,12 @@ class Wordpress
4786
4927
  @data['포스트설정']['막글투명'] = checkbox('막글 안보이게 처리'){
4787
4928
  top 7
4788
4929
  left 0
4930
+ enabled false # 기본적으로 비활성화
4789
4931
  }
4790
4932
  @data['포스트설정']['막글그대로'] = checkbox('막글 그대로 입력'){
4791
4933
  top 7
4792
4934
  left 1
4935
+ enabled false # 기본적으로 비활성화
4793
4936
  }
4794
4937
 
4795
4938
  @data['포스트설정']['태그삽입1'] = checkbox('태그삽입'){
@@ -4814,11 +4957,19 @@ class Wordpress
4814
4957
  @data['포스트설정']['자동글 수식에 입력'] = checkbox('자동글 수식에 입력'){
4815
4958
  top 9
4816
4959
  left 0
4960
+ enabled false # 기본적으로 비활성화
4961
+ on_toggled {
4962
+ if @data['포스트설정']['자동글 수식에 입력'].checked?
4963
+ @data['포스트설정']['내용을자동생성'].checked = false
4964
+ @data['포스트설정']['내용투명'].checked = false
4965
+ end
4966
+ }
4817
4967
  }
4818
4968
 
4819
4969
  @data['포스트설정']['막글 수식에 입력'] = checkbox('막글 수식에 입력'){
4820
4970
  top 9
4821
4971
  left 1
4972
+ enabled false # 기본적으로 비활성화
4822
4973
  }
4823
4974
 
4824
4975
 
@@ -4901,10 +5052,22 @@ class Wordpress
4901
5052
  @data['포스트설정']['테더링'] = checkbox('테더링 IP 사용'){
4902
5053
  top 15
4903
5054
  left 0
5055
+ on_toggled{
5056
+ if @data['포스트설정']['테더링'].checked?
5057
+ @data['포스트설정']['프록시'].checked = false
5058
+
5059
+ end
5060
+ }
4904
5061
  }
4905
5062
  @data['포스트설정']['프록시'] = checkbox('프록시 IP 사용'){
4906
5063
  top 15
4907
5064
  left 1
5065
+ on_toggled{
5066
+ if @data['포스트설정']['프록시'].checked?
5067
+ @data['포스트설정']['테더링'].checked = false
5068
+
5069
+ end
5070
+ }
4908
5071
  }
4909
5072
  button('프록시 IP 파일 불러오기'){
4910
5073
  top 15