cafe_buy_duo 0.0.31 → 0.0.32

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 +163 -151
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc3b65495b2607fbe1774e5ef7dd3ccedf12f6e8bf17757fad8c3d0fe8c3fb73
4
- data.tar.gz: 6f25dfa33f3df92b0461bb5d2c611ec998cf0b400622643925b8df7a08b19fd6
3
+ metadata.gz: 0abc1d1b1d758e484fb3c97482f18b405df645ab79df23375a2189ba1ab0d5bf
4
+ data.tar.gz: c8e2d9ab7bab1e737d64bb0a106a46102b536521f9c6df01a839d86d8f9908a5
5
5
  SHA512:
6
- metadata.gz: 99f17dde80db4cfa1a5cda6718af3ba645ad3b545b23f368c907228d8c11b40768db1c81820fd57b12839085925549d2857a181c54d501761bf8a846eff0d37e
7
- data.tar.gz: 0b0c6283b3fca08a655aa4cdbcda26922e6b3c98f036675b091f3dd9c92d69b6cd6e4abd0389a82d95e54469573e985620b715535b23424a196a08f9eb368d32
6
+ metadata.gz: 78823fcaecd1155f42dfbf8949f7276e01cc9c48a4d000dc68ceecad3d7949c9255bf69f34256c52638d17b9f5f31cc6656fb515a01373b82aba7cc7f1ab41fd
7
+ data.tar.gz: 317b0bbe61ca2314482d521cebd2a170fde2a1153d6e4cf5dad98cde36fd1cef1134e9e355d2bfb47a479b028e0ba06a818dab88fcf7aff8cf19cd9b63054911
data/lib/cafe_buy_duo.rb CHANGED
@@ -1057,182 +1057,194 @@ end
1057
1057
  };
1058
1058
  JS
1059
1059
  sleep(1)
1060
- # 이미지 등록 버튼 클릭
1061
- # 기다릴 시간 설정
1062
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1063
- # 요소가 나타날 때까지 기다립니다.
1064
- wait.until { @driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]') }
1065
- # 해당 버튼을 찾고 클릭
1066
- image_button = @driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]')
1067
- @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", image_button) # 크롤 이동
1068
- sleep(1)
1069
- @driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]').click
1070
- sleep(1)
1071
-
1072
- # 파일 경로 변환 (슬래시 -> 백슬래시)
1073
- file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
1074
- sleep(1)
1075
- # 파일 입력 필드 찾기 (input[type="file"])
1076
- file_input = @driver.find_element(:id, 'hidden-file')
1077
- sleep(1)
1078
- # send_keys로 파일 경로를 직접 입력하여 파일 업로드
1079
- file_input.send_keys(file_path)
1080
- sleep(3)
1081
-
1082
- @driver.action.key_down(:up).key_up(:up).perform
1083
- sleep(1)
1084
-
1085
1060
  begin
1086
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1087
- #요소가 나타날 때까지 60초 동안 기다립니다.
1088
- wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]') }
1089
- element = @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]')
1090
- @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element) # 크롤 이동
1091
- sleep(1)
1092
- aria_expanded = element.attribute('aria-expanded')
1093
- if aria_expanded == 'false'
1094
- element.click
1095
- sleep(1) # 클릭 잠시 대기
1096
- else
1097
- end
1061
+ # 이미지 등록 버튼 클릭
1062
+ # 기다릴 시간 설정
1063
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1064
+ # 요소가 나타날 때까지 기다립니다.
1065
+ wait.until { @driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]') }
1066
+ # 해당 버튼을 찾고 클릭
1067
+ image_button = @driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]')
1068
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", image_button) # 크롤 이동
1069
+ sleep(1)
1070
+ @driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]').click
1071
+ sleep(1)
1072
+
1073
+ # 파일 경로 변환 (슬래시 -> 백슬래시)
1074
+ file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
1075
+ sleep(1)
1076
+ # 파일 입력 필드 찾기 (input[type="file"])
1077
+ file_input = @driver.find_element(:id, 'hidden-file')
1078
+ sleep(1)
1079
+ # send_keys로 파일 경로를 직접 입력하여 파일 업로드
1080
+ file_input.send_keys(file_path)
1081
+ sleep(3)
1098
1082
 
1099
- begin
1100
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1101
- #요소가 나타날 때까지 60초 동안 기다립니다.
1102
- wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]') }
1103
- sleep(1)
1104
- @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]').click
1105
- sleep(1)
1106
- @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1107
- sleep(1)
1108
- rescue
1109
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1110
- #요소가 나타날 때까지 60초 동안 기다립니다.
1111
- wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]') }
1112
- sleep(1)
1113
- @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]').click
1114
- sleep(1)
1115
- @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1116
- sleep(1)
1117
- end
1118
- rescue
1119
- @driver.action.key_down(:down).key_up(:down).perform
1083
+ @driver.action.key_down(:up).key_up(:up).perform
1084
+ sleep(1)
1120
1085
 
1121
- end
1122
-
1123
-
1124
- if option['사진타이틀'] == 'true'
1125
1086
  begin
1087
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1088
+ #요소가 나타날 때까지 60초 동안 기다립니다.
1089
+ wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]') }
1090
+ element = @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]')
1091
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element) # 크롤 이동
1092
+ sleep(1)
1093
+ aria_expanded = element.attribute('aria-expanded')
1094
+ if aria_expanded == 'false'
1095
+ element.click
1096
+ sleep(1) # 클릭 후 잠시 대기
1097
+ else
1098
+ end
1099
+
1100
+ begin
1101
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1102
+ #요소가 나타날 때까지 60초 동안 기다립니다.
1103
+ wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]') }
1104
+ sleep(1)
1105
+ @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]').click
1106
+ sleep(1)
1107
+ @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1108
+ sleep(1)
1109
+ rescue
1110
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1111
+ #요소가 나타날 때까지 60초 동안 기다립니다.
1112
+ wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]') }
1113
+ sleep(1)
1114
+ @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]').click
1115
+ sleep(1)
1116
+ @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1117
+ sleep(1)
1118
+ end
1119
+ rescue
1120
+ @driver.action.key_down(:down).key_up(:down).perform
1121
+ end
1122
+
1123
+
1124
+ if option['사진타이틀'] == 'true'
1125
+ begin
1126
+ @driver.action.key_down(:up).key_up(:up).perform
1127
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1128
+ #요소가 나타날 때까지 60초 동안 기다립니다.
1129
+ wait.until { @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]') }
1130
+ sleep(1)
1131
+ @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
1132
+ sleep(1)
1133
+ @driver.action.send_keys(title).perform
1134
+ sleep(1)
1135
+ @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1136
+ sleep(1)
1137
+ rescue
1138
+ @driver.action.key_down(:down).key_up(:down).perform
1139
+ end
1140
+ end
1141
+
1142
+
1143
+ if i2.to_s.split('href="')[1] != nil
1144
+ href2 = i2.to_s.split('href="')[1].split('"')[0]
1126
1145
  @driver.action.key_down(:up).key_up(:up).perform
1127
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1128
- #요소가 나타날 때까지 60초 동안 기다립니다.
1129
- wait.until { @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]') }
1130
1146
  sleep(1)
1131
- @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
1147
+ @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/button').click
1132
1148
  sleep(1)
1133
- @driver.action.send_keys(title).perform
1149
+ @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/div/input').send_keys(href2)
1134
1150
  sleep(1)
1135
- @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1151
+ @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/div/button').click
1136
1152
  sleep(1)
1137
- rescue
1138
- @driver.action.key_down(:down).key_up(:down).perform
1139
- end
1140
- end
1141
-
1142
-
1143
- if i2.to_s.split('href="')[1] != nil
1144
- href2 = i2.to_s.split('href="')[1].split('"')[0]
1145
- @driver.action.key_down(:up).key_up(:up).perform
1146
- sleep(1)
1147
- @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/button').click
1148
- sleep(1)
1149
- @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/div/input').send_keys(href2)
1150
- sleep(1)
1151
- @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/div/button').click
1152
- sleep(1)
1153
- @driver.action.key_down(:enter).key_up(:enter).perform
1154
- #key_stroke('enter')
1155
- sleep(1)
1153
+ @driver.action.key_down(:enter).key_up(:enter).perform
1154
+ #key_stroke('enter')
1155
+ sleep(1)
1156
+ end
1157
+ rescue => e
1158
+ @driver.close
1159
+ puts '이미지 등록실패! 인터넷 접속 불량 및 로딩 지연 다음 작업을 실행합니다.'
1160
+ return 0
1156
1161
  end
1157
1162
 
1158
1163
  elsif i2.to_s.include?('<video')
1159
1164
  path = i2.to_s.split('src="')[1].split('"')[0]
1160
1165
  path = URI.decode_www_form(path)[0][0]
1166
+ begin
1167
+ @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[3]/button').click
1168
+ sleep(3)
1161
1169
 
1162
- @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[3]/button').click
1163
- sleep(3)
1164
-
1165
-
1166
- @driver.execute_script(<<~JS)
1167
- window.URL.createObjectURL = function() {};
1168
- HTMLInputElement.prototype.click = function() {
1169
- console.log("File dialog suppressed");
1170
- };
1171
- JS
1172
- sleep(1)
1173
- # 파일 업로드 버튼 클릭 (이제 파일 선택 창이 뜨지 않음)
1174
- @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/fieldset/div[1]/button[1]').click
1175
- sleep(3)
1176
-
1177
- file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
1178
- sleep(1)
1179
- # 파일 입력 필드 찾기 (input[type="file"])
1180
- file_input = @driver.find_element(:id, "hidden-input")
1181
- sleep(1)
1182
- # send_keys로 파일 경로를 직접 입력하여 파일 업로드
1183
- file_input.send_keys(file_path)
1184
- sleep(3)
1185
- begin
1186
- @driver.find_element(:xpath, '//*[@id="nvu_inp_box_title"]').send_keys(title)
1170
+
1171
+ @driver.execute_script(<<~JS)
1172
+ window.URL.createObjectURL = function() {};
1173
+ HTMLInputElement.prototype.click = function() {
1174
+ console.log("File dialog suppressed");
1175
+ };
1176
+ JS
1187
1177
  sleep(1)
1188
- rescue
1189
- end
1178
+ # 파일 업로드 버튼 클릭 (이제 파일 선택 창이 뜨지 않음)
1179
+ @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/fieldset/div[1]/button[1]').click
1180
+ sleep(3)
1190
1181
 
1191
- begin
1182
+ file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
1183
+ sleep(1)
1184
+ # 파일 입력 필드 찾기 (input[type="file"])
1185
+ file_input = @driver.find_element(:id, "hidden-input")
1186
+ sleep(1)
1187
+ # send_keys로 파일 경로를 직접 입력하여 파일 업로드
1188
+ file_input.send_keys(file_path)
1189
+ sleep(3)
1190
+
1191
+ @driver.find_element(:xpath, '//*[@id="nvu_inp_box_title"]').send_keys(title)
1192
+ sleep(1)
1193
+
1192
1194
  @driver.find_element(:xpath, '//*[@id="nvu_inp_box_description"]').send_keys(title)
1193
1195
  sleep(1)
1194
- rescue
1195
- end
1196
+
1196
1197
 
1197
- begin
1198
- @driver.find_element(:xpath, '//*[@id="nvu_inp_box_tag"]').send_keys(title)
1198
+
1199
+
1200
+ tags2 = option['tag'].to_s
1201
+ tag_mm2 = Array.new
1202
+ tags2.split(',').each do |tag_value|
1203
+ tag_mm2 << ''+tag_value
1204
+ end
1205
+ @driver.find_element(:xpath, '//*[@id="nvu_inp_box_tag"]').click
1206
+ @driver.find_element(:xpath, '//*[@id="nvu_inp_box_tag"]').send_keys(tag_mm2.join("\n")+"\n")
1199
1207
  sleep(1)
1200
- rescue
1201
- end
1202
1208
 
1203
- for n in 1..10
1209
+ for n in 1..10
1210
+ begin
1211
+ puts @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text
1212
+ if @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text == '업로드 완료'
1213
+ break
1214
+ end
1215
+ sleep(10)
1216
+ rescue
1217
+ end
1218
+ end
1219
+
1204
1220
  begin
1205
- puts @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text
1206
- if @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text == '업로드 완료'
1207
- break
1208
- end
1209
- sleep(10)
1210
- rescue
1211
- end
1212
- end
1221
+ @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[3]/button/span').click
1222
+ sleep(3)
1223
+ @driver.action.key_down(:up).key_up(:up).perform #x탭
1224
+ sleep(1)
1225
+ rescue
1226
+ end
1213
1227
 
1214
- begin
1215
- @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[3]/button/span').click
1216
- sleep(3)
1217
- @driver.action.key_down(:up).key_up(:up).perform #x탭
1218
- sleep(1)
1219
- rescue
1220
- end
1228
+ begin
1229
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1230
+ #요소가 나타날 때까지 60초 동안 기다립니다.
1231
+ wait.until { @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]') }
1232
+ sleep(1)
1233
+ @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
1234
+ sleep(1)
1235
+ @driver.action.send_keys(title).perform
1236
+ sleep(1)
1237
+ @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1238
+ sleep(1)
1239
+ rescue
1240
+ @driver.action.key_down(:down).key_up(:down).perform
1241
+ end
1221
1242
 
1222
- begin
1223
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1224
- #요소가 나타날 때까지 60초 동안 기다립니다.
1225
- wait.until { @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]') }
1226
- sleep(1)
1227
- @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
1228
- sleep(1)
1229
- @driver.action.send_keys(title).perform
1230
- sleep(1)
1231
- @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1232
- sleep(1)
1233
- rescue
1234
- @driver.action.key_down(:down).key_up(:down).perform
1235
- end
1243
+ rescue => e
1244
+ @driver.close
1245
+ puts '동영상 등록실패! 인터넷 접속 불량 및 로딩 지연 다음 작업을 실행합니다.'
1246
+ return 0
1247
+ end
1236
1248
 
1237
1249
  elsif i2.to_s.include?('<inyonggoo')
1238
1250
  if i2.text == ''
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_buy_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.31
4
+ version: 0.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-04 00:00:00.000000000 Z
11
+ date: 2025-02-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com