cafe_buy 0.0.23 → 0.0.29
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 +106 -32
- 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: f40a2270d9ead90dda0119a5d6eaea524e08211da8ca4824c3fbb39d381a82f2
|
4
|
+
data.tar.gz: df26a2cbc98f8c1799c9ac508f27815d288581b17568172c118e80779e6f8ae8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da3b0fdc581d34f811c036c4209796e224179dd1ffcfadfea10a9637b68263170ada2615eb476b43be39ef4ec4e0750b4d821ab44684decfd85fc8e65becadbc
|
7
|
+
data.tar.gz: 1606f67d1cb9536335e683cdbf4201efd0914c9e5409a0352ad8f0e9efe434b83cbe46613647b59feebb8de35a661c6c98d1ce748ad5b44a52ba1c8468ffc96d
|
data/lib/cafe_buy.rb
CHANGED
@@ -210,11 +210,14 @@ class Naver
|
|
210
210
|
def initialize
|
211
211
|
@seed = 1
|
212
212
|
end
|
213
|
-
def chrome_setup(user_id)
|
213
|
+
def chrome_setup(user_id, proxy)
|
214
214
|
naver_cookie_dir = "C:/naver_cookie"
|
215
215
|
FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
|
216
|
+
if proxy == ''
|
216
217
|
system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id}})
|
217
|
-
|
218
|
+
else
|
219
|
+
system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" "https://naver.com/" --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --proxy-server=#{proxy.to_s.force_encoding('utf-8').to_s}})
|
220
|
+
end
|
218
221
|
end
|
219
222
|
def chrome_start(proxy, user_id)
|
220
223
|
naver_cookie_dir = "C:/naver_cookie"
|
@@ -295,7 +298,7 @@ class Naver
|
|
295
298
|
end
|
296
299
|
|
297
300
|
# 새로운 스레드 생성 및 실행
|
298
|
-
Thread.new { chrome_setup(user_id) }
|
301
|
+
Thread.new { chrome_setup(user_id, proxy) }
|
299
302
|
sleep(3)
|
300
303
|
|
301
304
|
|
@@ -1046,10 +1049,18 @@ end
|
|
1046
1049
|
if i2.to_s.include?('<img')
|
1047
1050
|
path = i2.to_s.split('src="')[1].split('"')[0]
|
1048
1051
|
path = URI.decode_www_form(path)[0][0]
|
1052
|
+
|
1053
|
+
@driver.execute_script(<<~JS)
|
1054
|
+
window.URL.createObjectURL = function() {};
|
1055
|
+
HTMLInputElement.prototype.click = function() {
|
1056
|
+
console.log("File dialog suppressed");
|
1057
|
+
};
|
1058
|
+
JS
|
1059
|
+
sleep(1)
|
1049
1060
|
# 이미지 등록 버튼 클릭
|
1050
1061
|
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[1]/button').click
|
1051
1062
|
sleep(3)
|
1052
|
-
key_stroke('escape')
|
1063
|
+
#key_stroke('escape')
|
1053
1064
|
|
1054
1065
|
# 파일 경로 변환 (슬래시 -> 백슬래시)
|
1055
1066
|
file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
|
@@ -1060,9 +1071,43 @@ end
|
|
1060
1071
|
# send_keys로 파일 경로를 직접 입력하여 파일 업로드
|
1061
1072
|
file_input.send_keys(file_path)
|
1062
1073
|
sleep(3)
|
1063
|
-
|
1064
1074
|
|
1065
|
-
|
1075
|
+
@driver.action.key_down(:up).key_up(:up).perform
|
1076
|
+
sleep(1)
|
1077
|
+
|
1078
|
+
begin
|
1079
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
1080
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
1081
|
+
wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]') }
|
1082
|
+
sleep(1)
|
1083
|
+
@driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]').click
|
1084
|
+
|
1085
|
+
sleep(1)
|
1086
|
+
begin
|
1087
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
1088
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
1089
|
+
wait.until { @driver.find_element(:xpath, '//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//button[@class="se-custom-layer-resizing-reset-button"]') }
|
1090
|
+
sleep(1)
|
1091
|
+
@driver.find_element(:xpath, '//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//button[@class="se-custom-layer-resizing-reset-button"]').click
|
1092
|
+
sleep(1)
|
1093
|
+
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
1094
|
+
sleep(1)
|
1095
|
+
rescue
|
1096
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
1097
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
1098
|
+
wait.until { @driver.find_element(:xpath, '//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]') }
|
1099
|
+
sleep(1)
|
1100
|
+
@driver.find_element(:xpath, '//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
|
1107
|
+
|
1108
|
+
end
|
1109
|
+
|
1110
|
+
|
1066
1111
|
if option['사진타이틀'] == 'true'
|
1067
1112
|
begin
|
1068
1113
|
@driver.action.key_down(:up).key_up(:up).perform
|
@@ -1079,7 +1124,7 @@ end
|
|
1079
1124
|
rescue
|
1080
1125
|
@driver.action.key_down(:down).key_up(:down).perform
|
1081
1126
|
end
|
1082
|
-
end
|
1127
|
+
end
|
1083
1128
|
|
1084
1129
|
|
1085
1130
|
if i2.to_s.split('href="')[1] != nil
|
@@ -1100,38 +1145,67 @@ end
|
|
1100
1145
|
elsif i2.to_s.include?('<video')
|
1101
1146
|
path = i2.to_s.split('src="')[1].split('"')[0]
|
1102
1147
|
path = URI.decode_www_form(path)[0][0]
|
1103
|
-
|
1148
|
+
|
1104
1149
|
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[3]/button').click
|
1105
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
|
+
# 파일 업로드 버튼 클릭 (이제 파일 선택 창이 뜨지 않음)
|
1106
1161
|
@driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/fieldset/div[1]/button[1]').click
|
1107
1162
|
sleep(3)
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1163
|
+
|
1164
|
+
file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
|
1165
|
+
# 파일 입력 필드 찾기 (input[type="file"])
|
1166
|
+
file_input = @driver.find_element(:id, "hidden-input")
|
1167
|
+
|
1168
|
+
# send_keys로 파일 경로를 직접 입력하여 파일 업로드
|
1169
|
+
file_input.send_keys(file_path)
|
1170
|
+
|
1113
1171
|
sleep(3)
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1172
|
+
begin
|
1173
|
+
@driver.find_element(:xpath, '//*[@id="nvu_inp_box_title"]').send_keys(title)
|
1174
|
+
sleep(1)
|
1175
|
+
rescue
|
1176
|
+
end
|
1177
|
+
|
1178
|
+
begin
|
1179
|
+
@driver.find_element(:xpath, '//*[@id="nvu_inp_box_description"]').send_keys(title)
|
1180
|
+
sleep(1)
|
1181
|
+
rescue
|
1182
|
+
end
|
1183
|
+
|
1184
|
+
begin
|
1121
1185
|
@driver.find_element(:xpath, '//*[@id="nvu_inp_box_tag"]').send_keys(title)
|
1122
|
-
|
1186
|
+
sleep(1)
|
1187
|
+
rescue
|
1188
|
+
end
|
1123
1189
|
|
1124
1190
|
for n in 1..10
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1191
|
+
begin
|
1192
|
+
puts @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text
|
1193
|
+
if @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text == '업로드 완료'
|
1194
|
+
break
|
1195
|
+
end
|
1196
|
+
sleep(10)
|
1197
|
+
rescue
|
1198
|
+
end
|
1130
1199
|
end
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1200
|
+
|
1201
|
+
begin
|
1202
|
+
@driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[3]/button/span').click
|
1203
|
+
sleep(3)
|
1204
|
+
@driver.action.key_down(:up).key_up(:up).perform #x탭
|
1205
|
+
sleep(1)
|
1206
|
+
rescue
|
1207
|
+
end
|
1208
|
+
|
1135
1209
|
begin
|
1136
1210
|
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
1137
1211
|
#요소가 나타날 때까지 60초 동안 기다립니다.
|
@@ -1146,7 +1220,7 @@ end
|
|
1146
1220
|
rescue
|
1147
1221
|
@driver.action.key_down(:down).key_up(:down).perform
|
1148
1222
|
end
|
1149
|
-
|
1223
|
+
|
1150
1224
|
elsif i2.to_s.include?('<inyonggoo')
|
1151
1225
|
if i2.text == ''
|
1152
1226
|
|
@@ -2408,7 +2482,7 @@ class Wordpress
|
|
2408
2482
|
@data['table'] << []
|
2409
2483
|
@data['table'].pop
|
2410
2484
|
#포스팅 get 데이터 가저오기#############################
|
2411
|
-
proxy = table[
|
2485
|
+
proxy = table[6].to_s
|
2412
2486
|
user_id = table[1].to_s
|
2413
2487
|
user_pw = table[2].to_s
|
2414
2488
|
naver = Naver.new
|
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.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|