cafe_buy 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.
- checksums.yaml +4 -4
- data/lib/cafe_buy.rb +163 -151
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bd4d5c209712a7d96344cc3cf3031390cea225c4ecd7b2e8f58844fbfe5d754
|
4
|
+
data.tar.gz: d4da7b507c9d2bf63a73395bd2c9517b2c0680521a92d5b114ad434bf4a6ca97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 816a33a357e901b2f1e81d9bb11e91d52159942130a558d211fcb1d2a9bc6c105123ff5c43b40e33dc23446913d3de9edb5057b53c24a7cc8c7995bc6976457c
|
7
|
+
data.tar.gz: 58b4cd5d406e817c45f1299888e7e7d9260278bae7c7a364fb98f1a541d21985f49d259f10a5ae6a697352626eb244f745aee7a21bb712687603b9024c446713
|
data/lib/cafe_buy.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
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
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
|
-
|
1100
|
-
|
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, '//*[@
|
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.
|
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.
|
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
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
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
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
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
|
-
|
1189
|
-
|
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
|
-
|
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
|
-
|
1195
|
-
end
|
1196
|
+
|
1196
1197
|
|
1197
|
-
|
1198
|
-
|
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
|
-
|
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
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
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
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
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
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
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
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
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-
|
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
|