cafe_buy 0.0.78 → 0.1.30
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 +95 -116
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a81adfdb6db38c7c18c803598e6765f8051ec7accbc45c322caaa886fdfaff7
|
4
|
+
data.tar.gz: 1c15e95def1d4c4a7bf955210898f20c964ce22fcbba62a7b6d19c37265b8d0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd664c0ee759c0b525b02908d6c7fd57f8d106052dc41ee645ca568685d9042c1565ea8ed91e488abf8c627f5407a16d703d2c6fa1408e10439f75559c6d0eae
|
7
|
+
data.tar.gz: 3ef6cb65abd99bb36b7143b05dcc9f0aa5efd389d6d1e557b58c0b2653a59e1d3c24f57638377f8e08f1b000396994360aa5aba8b4bcd167091d96191889dbeb
|
data/lib/cafe_buy.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'glimmer-dsl-libui'
|
2
2
|
require 'selenium-webdriver'
|
3
|
-
|
3
|
+
require 'webdrivers'
|
4
4
|
require 'iconv'
|
5
5
|
require 'nokogiri'
|
6
6
|
require 'http'
|
@@ -241,15 +241,39 @@ end
|
|
241
241
|
class Naver
|
242
242
|
def initialize
|
243
243
|
@seed = 1
|
244
|
+
|
245
|
+
begin
|
246
|
+
# 웹드라이버가 사용자의 Chrome 버전에 맞는 chromedriver 다운로드 시도
|
247
|
+
Webdrivers.cache_time = 86_400 # 하루로 설정 (기본값: 86_400초)
|
248
|
+
Webdrivers.install_dir = "./" # 크롬드라이버를 수동으로 설치할 경로를 설정
|
249
|
+
|
250
|
+
# 크롬드라이버 자동 업데이트 시도
|
251
|
+
Webdrivers::Chromedriver.update
|
252
|
+
puts "chromedriver 자동 다운로드 성공"
|
253
|
+
rescue => e
|
254
|
+
puts "chromedriver 자동 다운로드 실패: #{e.message}"
|
255
|
+
puts "폴더내 크롬드라이버를 사용합니다."
|
256
|
+
puts "크롬드라이버가 오래된 경우 오류 발생될 수 있으며, 만일 오류 발생시 아래 지침을 따라주세요."
|
257
|
+
puts "1.크롬 업데이트 2.프로그램 폴더 내부에 ★tip★-시작시-크롬창이....파일을 열어 드라이버를 교체하세요."
|
258
|
+
chromedriver_path = './chromedriver.exe' # 수동 경로를 인스턴스 변수로 설정
|
259
|
+
Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
|
260
|
+
end
|
261
|
+
|
262
|
+
|
244
263
|
end
|
245
|
-
|
264
|
+
|
265
|
+
|
246
266
|
def chrome_setup(user_id, proxy)
|
247
267
|
naver_cookie_dir = "C:/naver_cookie"
|
248
268
|
FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
|
249
269
|
if proxy == ''
|
270
|
+
|
250
271
|
system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --no-first-run --no-default-browser-check --disable-sync})
|
272
|
+
|
251
273
|
else
|
274
|
+
|
252
275
|
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} --no-first-run --no-default-browser-check --disable-sync})
|
276
|
+
|
253
277
|
end
|
254
278
|
end
|
255
279
|
def chrome_start(proxy, user_id)
|
@@ -257,7 +281,6 @@ class Naver
|
|
257
281
|
FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
|
258
282
|
if proxy == ''
|
259
283
|
begin
|
260
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
261
284
|
options = Selenium::WebDriver::Chrome::Options.new
|
262
285
|
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
263
286
|
#options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
@@ -273,10 +296,10 @@ class Naver
|
|
273
296
|
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
274
297
|
# 'capabilities'과 'options' 배열로 설정
|
275
298
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
276
|
-
capabilities["goog:chromeOptions"] = options.as_json
|
299
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
277
300
|
|
278
|
-
# Selenium 4
|
279
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
301
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
302
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
280
303
|
|
281
304
|
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
282
305
|
|
@@ -285,7 +308,7 @@ class Naver
|
|
285
308
|
end
|
286
309
|
else
|
287
310
|
begin
|
288
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
311
|
+
#Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
289
312
|
options = Selenium::WebDriver::Chrome::Options.new
|
290
313
|
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
291
314
|
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
@@ -312,7 +335,7 @@ class Naver
|
|
312
335
|
puts e
|
313
336
|
puts 'proxy error...'
|
314
337
|
begin
|
315
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
338
|
+
#Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
316
339
|
options = Selenium::WebDriver::Chrome::Options.new
|
317
340
|
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
318
341
|
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
@@ -2289,20 +2312,27 @@ class Wordpress
|
|
2289
2312
|
|
2290
2313
|
def save_image
|
2291
2314
|
if @data['이미지설정']['이미지'].length == 0
|
2292
|
-
|
2315
|
+
return
|
2316
|
+
end
|
2317
|
+
|
2318
|
+
if @data['이미지설정']['순서사용'].checked?
|
2319
|
+
image_path = @data['이미지설정']['이미지'][@image_counter][2]
|
2320
|
+
@image_counter += 1
|
2321
|
+
if @image_counter > @data['이미지설정']['이미지'].length - 1
|
2322
|
+
@image_counter = 0
|
2323
|
+
end
|
2293
2324
|
else
|
2294
|
-
|
2295
|
-
|
2296
|
-
|
2297
|
-
|
2298
|
-
@image_counter = 0
|
2299
|
-
end
|
2300
|
-
else
|
2301
|
-
image_path = @data['이미지설정']['이미지'].sample[2]
|
2325
|
+
# 초기화가 안됐거나 다 썼으면 새롭게 섞는다
|
2326
|
+
@shuffled_images ||= []
|
2327
|
+
if @shuffled_images.empty?
|
2328
|
+
@shuffled_images = @data['이미지설정']['이미지'].shuffle
|
2302
2329
|
end
|
2303
|
-
|
2304
|
-
|
2330
|
+
|
2331
|
+
image_path = @shuffled_images.shift[2]
|
2305
2332
|
end
|
2333
|
+
|
2334
|
+
img = Magick::Image.read(image_path).first
|
2335
|
+
img.write('./image/memory.png')
|
2306
2336
|
end
|
2307
2337
|
|
2308
2338
|
def change_image_size(w)
|
@@ -3090,128 +3120,77 @@ class Wordpress
|
|
3090
3120
|
puts '내용사진자동삽입...'
|
3091
3121
|
sn = @data['포스트설정']['내용사진자동삽입시작숫자'].text.to_s.force_encoding('utf-8').to_i
|
3092
3122
|
en = @data['포스트설정']['내용사진자동삽입끝숫자'].text.to_s.force_encoding('utf-8').to_i
|
3123
|
+
|
3093
3124
|
begin
|
3094
3125
|
cn = rand(sn..en)
|
3095
3126
|
rescue
|
3096
3127
|
cn = 0
|
3097
3128
|
puts 'cn = rand(sn..en) error cn = 1'
|
3098
3129
|
end
|
3099
|
-
|
3130
|
+
|
3100
3131
|
if cn != 0
|
3101
|
-
|
3132
|
+
# content5 구성 및 위치 배열 생성
|
3102
3133
|
if @data['포스트설정']['내용과자동생성'].checked?
|
3103
|
-
if @data['포스트설정']['자동글 수식에 입력'].checked?
|
3104
|
-
for n in 1..cn
|
3105
|
-
position << rand(0..(content.split("(자동생성글)")[0].split("\n").length-1))
|
3106
|
-
sleep(2)
|
3107
|
-
end
|
3108
|
-
else
|
3109
|
-
for n in 1..cn
|
3110
|
-
position << rand(0..(content.split("(자동생성글)")[0].split("\n").length-1))
|
3111
|
-
sleep(2)
|
3112
|
-
end
|
3113
|
-
end
|
3114
|
-
# position.pop
|
3115
|
-
else
|
3116
|
-
for n in 1..cn
|
3117
|
-
position << rand(0..(content.split("\n").length-2))
|
3118
|
-
sleep(2)
|
3119
|
-
end
|
3120
|
-
end
|
3121
|
-
|
3122
|
-
if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
3123
3134
|
if @data['포스트설정']['자동글 수식에 입력'].checked?
|
3124
3135
|
content5 = content.split("(자동생성글)")[0].to_s.split("\n")
|
3125
3136
|
content55 = content.split("(자동생성글)")[1].to_s
|
3137
|
+
position = content5.length.times.to_a.sample(cn).sort.reverse
|
3126
3138
|
else
|
3127
3139
|
content5 = content.split("(자동생성글)")[0].to_s.split("\n")
|
3128
3140
|
content55 = content.split("(자동생성글)")[1].to_s
|
3141
|
+
position = content5.length.times.to_a.sample(cn).sort.reverse
|
3129
3142
|
end
|
3143
|
+
elsif @data['포스트설정']['gpt키워드'].checked?
|
3144
|
+
content5 = content.split("(자동생성글)")[1].to_s.split("\n")
|
3145
|
+
content_prefix = content.split("(자동생성글)")[0].to_s
|
3146
|
+
content55 = ''
|
3147
|
+
position = content5.length.times.to_a.sample(cn).sort.reverse
|
3130
3148
|
else
|
3149
|
+
content5 = content.split("\n")
|
3131
3150
|
content55 = ''
|
3132
|
-
|
3151
|
+
position = content5.length.times.to_a.sample(cn).sort.reverse
|
3133
3152
|
end
|
3134
|
-
|
3135
|
-
|
3136
|
-
puts content55
|
3137
|
-
p position
|
3138
|
-
|
3153
|
+
|
3154
|
+
# 중복 필터링 로직
|
3139
3155
|
while true
|
3140
3156
|
check11 = 0
|
3141
|
-
|
3142
|
-
if content5[
|
3157
|
+
position.each_with_index do |pos, idx|
|
3158
|
+
if content5[pos].to_s.include?('style') || content5[pos].to_s.include?('<') || content5[pos].to_s.include?('>')
|
3143
3159
|
check11 = 1
|
3144
|
-
position[
|
3160
|
+
position[idx] += 4
|
3145
3161
|
end
|
3146
3162
|
end
|
3147
|
-
if check11 == 0
|
3148
|
-
break
|
3149
|
-
end
|
3163
|
+
break if check11 == 0
|
3150
3164
|
end
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3154
|
-
|
3155
|
-
|
3156
|
-
|
3157
|
-
|
3158
|
-
|
3159
|
-
|
3160
|
-
|
3161
|
-
|
3162
|
-
# puts '사진넣는위치 => '+i.to_s
|
3163
|
-
# if @data['포스트설정']['내용사진링크'].checked?
|
3164
|
-
# image_memory << ""+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')+'"><img src="'+image_url+'" alt="'+keyword.force_encoding('utf-8')+'"></a>'+""
|
3165
|
-
# content5.insert(i, '**image**')
|
3166
|
-
# else
|
3167
|
-
# image_memory << ""+'<img src="'+image_url+'" alt="'+keyword+'" class="aligncenter size-full">'+""
|
3168
|
-
# content5.insert(i, '**image**')
|
3169
|
-
# end
|
3170
|
-
# end
|
3171
|
-
|
3172
|
-
# if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
3173
|
-
# content = content5.join("\n")+'(자동생성글)'+content55
|
3174
|
-
# iconv = Iconv.new('UTF-8', 'ASCII-8BIT')
|
3175
|
-
# content = iconv.iconv(content)
|
3176
|
-
# content = content.encode('UTF-8', 'binary', invalid: :replace, replace: '')
|
3177
|
-
# puts content
|
3178
|
-
# image_url = image_url22
|
3179
|
-
|
3180
|
-
# if @data['포스트설정']['자동글 수식에 입력'].checked?
|
3181
|
-
|
3182
|
-
# else
|
3183
|
-
# if @data['포스트설정']['내용사진링크'].checked?
|
3184
|
-
# content = content.split('(자동생성글)')[0]+""+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8')+'"><img src="'+image_url+'" alt="'+keyword+'"></a>'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
|
3185
|
-
# else
|
3186
|
-
# content = content.split('(자동생성글)')[0]+""+'<img src="'+image_url+'" alt="'+keyword+'" >'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
|
3187
|
-
# end
|
3188
|
-
# end
|
3189
|
-
###여기까지 이미지 순서대로 안되서 변경##-------------------------------------------------------------------------------
|
3190
|
-
|
3191
|
-
##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
|
3192
|
-
if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
3165
|
+
|
3166
|
+
if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
|
3167
|
+
sleep(2)
|
3168
|
+
puts '이미지 자동 세탁 중 · · · '
|
3169
|
+
end
|
3170
|
+
|
3171
|
+
p content5
|
3172
|
+
puts content55
|
3173
|
+
p position
|
3174
|
+
|
3193
3175
|
sleep(2)
|
3194
|
-
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
content5.insert(i, '**image**')
|
3204
|
-
else
|
3205
|
-
image_memory << ""+'<img src="'+image_url22+'" alt="'+keyword+'" class="aligncenter size-full">'+""
|
3206
|
-
content5.insert(i, '**image**')
|
3176
|
+
position.each do |i|
|
3177
|
+
image_url22 = get_image_file().force_encoding('utf-8')
|
3178
|
+
if @data['포스트설정']['내용사진링크'].checked?
|
3179
|
+
image_tag = '<a href="' + @data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8') +
|
3180
|
+
'"><img src="' + image_url22 + '" alt="' + keyword.force_encoding('utf-8') + '" class="aligncenter size-full"></a>'
|
3181
|
+
else
|
3182
|
+
image_tag = '<img src="' + image_url22 + '" alt="' + keyword + '" class="aligncenter size-full">'
|
3183
|
+
end
|
3184
|
+
content5.insert(i, image_tag)
|
3207
3185
|
end
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3186
|
+
|
3187
|
+
sleep(2)
|
3188
|
+
puts '이미지 자동 세탁 완료 · · · '
|
3189
|
+
|
3190
|
+
if @data['포스트설정']['내용과자동생성'].checked?
|
3191
|
+
content = content5.join("\n") + '(자동생성글)' + content55
|
3192
|
+
elsif @data['포스트설정']['gpt키워드'].checked?
|
3193
|
+
content = content_prefix + "(자동생성글)" + content5.join("\n")
|
3215
3194
|
else
|
3216
3195
|
content = content5.join("\n")
|
3217
3196
|
end
|
@@ -3679,7 +3658,7 @@ class Wordpress
|
|
3679
3658
|
@data['포스트설정']['막글'] = ''
|
3680
3659
|
@data['포스트설정']['프록시리스트'] = Array.new
|
3681
3660
|
@data['포스트설정']['인용구'] = Array.new
|
3682
|
-
@user_login_ok = "
|
3661
|
+
@user_login_ok = "1"
|
3683
3662
|
window('카페 상품 게시판 등록기', 800, 570) {
|
3684
3663
|
margined true
|
3685
3664
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_buy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
10
|
+
date: 2025-04-17 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
12
|
description: File to Clipboard gem
|
14
13
|
email: mymin26@naver.com
|
@@ -21,7 +20,6 @@ homepage: ''
|
|
21
20
|
licenses:
|
22
21
|
- zon
|
23
22
|
metadata: {}
|
24
|
-
post_install_message:
|
25
23
|
rdoc_options: []
|
26
24
|
require_paths:
|
27
25
|
- lib
|
@@ -36,8 +34,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
34
|
- !ruby/object:Gem::Version
|
37
35
|
version: '0'
|
38
36
|
requirements: []
|
39
|
-
rubygems_version: 3.
|
40
|
-
signing_key:
|
37
|
+
rubygems_version: 3.6.7
|
41
38
|
specification_version: 4
|
42
39
|
summary: file to clipboard
|
43
40
|
test_files: []
|