cafe_buy 0.0.30 → 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 +162 -137
- 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,169 +1057,194 @@ end
|
|
1057
1057
|
};
|
1058
1058
|
JS
|
1059
1059
|
sleep(1)
|
1060
|
-
# 이미지 등록 버튼 클릭
|
1061
|
-
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[1]/button').click
|
1062
|
-
sleep(3)
|
1063
|
-
#key_stroke('escape')
|
1064
|
-
|
1065
|
-
# 파일 경로 변환 (슬래시 -> 백슬래시)
|
1066
|
-
file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
|
1067
|
-
|
1068
|
-
# 파일 입력 필드 찾기 (input[type="file"])
|
1069
|
-
file_input = @driver.find_element(:id, 'hidden-file')
|
1070
|
-
|
1071
|
-
# send_keys로 파일 경로를 직접 입력하여 파일 업로드
|
1072
|
-
file_input.send_keys(file_path)
|
1073
|
-
sleep(3)
|
1074
|
-
|
1075
|
-
@driver.action.key_down(:up).key_up(:up).perform
|
1076
|
-
sleep(1)
|
1077
|
-
|
1078
1060
|
begin
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
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)
|
1084
1072
|
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
#요소가 나타날 때까지 60초 동안 기다립니다.
|
1098
|
-
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()="초기화"]') }
|
1099
|
-
sleep(1)
|
1100
|
-
@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
|
1101
|
-
sleep(1)
|
1102
|
-
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
1103
|
-
sleep(1)
|
1104
|
-
end
|
1105
|
-
rescue
|
1106
|
-
@driver.action.key_down(:down).key_up(:down).perform
|
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)
|
1082
|
+
|
1083
|
+
@driver.action.key_down(:up).key_up(:up).perform
|
1084
|
+
sleep(1)
|
1107
1085
|
|
1108
|
-
end
|
1109
|
-
|
1110
|
-
|
1111
|
-
if option['사진타이틀'] == 'true'
|
1112
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]
|
1113
1145
|
@driver.action.key_down(:up).key_up(:up).perform
|
1114
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
1115
|
-
#요소가 나타날 때까지 60초 동안 기다립니다.
|
1116
|
-
wait.until { @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]') }
|
1117
1146
|
sleep(1)
|
1118
|
-
@driver.find_element(:xpath, '//*[@
|
1147
|
+
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/button').click
|
1119
1148
|
sleep(1)
|
1120
|
-
@driver.
|
1149
|
+
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/div/input').send_keys(href2)
|
1121
1150
|
sleep(1)
|
1122
|
-
@driver.
|
1151
|
+
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/div/button').click
|
1123
1152
|
sleep(1)
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
@driver.action.key_down(:up).key_up(:up).perform
|
1133
|
-
sleep(1)
|
1134
|
-
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/button').click
|
1135
|
-
sleep(1)
|
1136
|
-
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/div/input').send_keys(href2)
|
1137
|
-
sleep(1)
|
1138
|
-
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/div/button').click
|
1139
|
-
sleep(1)
|
1140
|
-
@driver.action.key_down(:enter).key_up(:enter).perform
|
1141
|
-
#key_stroke('enter')
|
1142
|
-
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
|
1143
1161
|
end
|
1144
1162
|
|
1145
1163
|
elsif i2.to_s.include?('<video')
|
1146
1164
|
path = i2.to_s.split('src="')[1].split('"')[0]
|
1147
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)
|
1148
1169
|
|
1149
|
-
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[3]/button').click
|
1150
|
-
sleep(3)
|
1151
|
-
|
1152
|
-
|
1153
|
-
@driver.execute_script(<<~JS)
|
1154
|
-
window.URL.createObjectURL = function() {};
|
1155
|
-
HTMLInputElement.prototype.click = function() {
|
1156
|
-
console.log("File dialog suppressed");
|
1157
|
-
};
|
1158
|
-
JS
|
1159
|
-
sleep(1)
|
1160
|
-
# 파일 업로드 버튼 클릭 (이제 파일 선택 창이 뜨지 않음)
|
1161
|
-
@driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/fieldset/div[1]/button[1]').click
|
1162
|
-
sleep(3)
|
1163
|
-
|
1164
|
-
file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
|
1165
|
-
# 파일 입력 필드 찾기 (input[type="file"])
|
1166
|
-
file_input = @driver.find_element(:id, "hidden-input")
|
1167
1170
|
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1171
|
+
@driver.execute_script(<<~JS)
|
1172
|
+
window.URL.createObjectURL = function() {};
|
1173
|
+
HTMLInputElement.prototype.click = function() {
|
1174
|
+
console.log("File dialog suppressed");
|
1175
|
+
};
|
1176
|
+
JS
|
1174
1177
|
sleep(1)
|
1175
|
-
|
1176
|
-
|
1178
|
+
# 파일 업로드 버튼 클릭 (이제 파일 선택 창이 뜨지 않음)
|
1179
|
+
@driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/fieldset/div[1]/button[1]').click
|
1180
|
+
sleep(3)
|
1177
1181
|
|
1178
|
-
|
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
|
+
|
1179
1194
|
@driver.find_element(:xpath, '//*[@id="nvu_inp_box_description"]').send_keys(title)
|
1180
1195
|
sleep(1)
|
1181
|
-
|
1182
|
-
end
|
1196
|
+
|
1183
1197
|
|
1184
|
-
|
1185
|
-
|
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")
|
1186
1207
|
sleep(1)
|
1187
|
-
rescue
|
1188
|
-
end
|
1189
1208
|
|
1190
|
-
|
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
|
+
|
1191
1220
|
begin
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
end
|
1199
|
-
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
|
1200
1227
|
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
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
|
1208
1242
|
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
@driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
|
1215
|
-
sleep(1)
|
1216
|
-
@driver.action.send_keys(title).perform
|
1217
|
-
sleep(1)
|
1218
|
-
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
1219
|
-
sleep(1)
|
1220
|
-
rescue
|
1221
|
-
@driver.action.key_down(:down).key_up(:down).perform
|
1222
|
-
end
|
1243
|
+
rescue => e
|
1244
|
+
@driver.close
|
1245
|
+
puts '동영상 등록실패! 인터넷 접속 불량 및 로딩 지연 다음 작업을 실행합니다.'
|
1246
|
+
return 0
|
1247
|
+
end
|
1223
1248
|
|
1224
1249
|
elsif i2.to_s.include?('<inyonggoo')
|
1225
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
|