cafe_buy_duo 0.0.13 → 0.0.17
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_duo.rb +114 -68
- 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: 5c84a17a17b46b73b6fe00583cd20cd2f883899767c4c9d710c7fc62b84feae3
|
4
|
+
data.tar.gz: 4a7a591bd2e0332cdfb687d45c718bc20c0e950bcdea2502ff32778686ca931d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30188cfdc3e2afc3809eed75168a25f571e6926eebae2f90abe0fb33a7192a4abd19b2bfe2f1f6b2de42d40e2707e657676a19771492133e78c898aee8a4b54b
|
7
|
+
data.tar.gz: 405ace79597e148618b647c1ef685e152665e1128ea99102a6be0077e286039da1da49089454e657ce27d31b3666a3f8fa7242186771db35bcbbb33fb22702e0
|
data/lib/cafe_buy_duo.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'
|
@@ -219,55 +219,71 @@ class Naver
|
|
219
219
|
def chrome_start(proxy, user_id)
|
220
220
|
naver_cookie_dir = "C:/naver_cookie"
|
221
221
|
FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
|
222
|
+
|
222
223
|
if proxy == ''
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
224
|
+
begin
|
225
|
+
# webdrivers Gem이 크롬 드라이버 자동 다운로드 및 설정을 관리함
|
226
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
227
|
+
options.page_load_strategy = :normal
|
228
|
+
options.timeouts = { page_load: 20_000 }
|
229
|
+
options.page_load_strategy = 'none'
|
230
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
options.add_argument('--remote-debugging-port=9222')
|
235
|
+
options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
|
236
|
+
|
237
|
+
# :capabilities에 options를 배열로 전달
|
238
|
+
capabilities = [options]
|
239
|
+
|
240
|
+
# Selenium WebDriver에서 options를 capabilities로 전달
|
241
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
242
|
+
rescue
|
243
|
+
# 예외 발생 시 다른 방법으로 셀레니움 실행
|
244
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
245
|
+
end
|
235
246
|
else
|
247
|
+
begin
|
248
|
+
# Proxy를 사용하는 경우
|
249
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
250
|
+
options.add_argument '--proxy-server=' + proxy.to_s.force_encoding('utf-8')
|
251
|
+
options.page_load_strategy = :normal
|
252
|
+
options.timeouts = { page_load: 20_000 }
|
253
|
+
options.page_load_strategy = 'none'
|
254
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
255
|
+
|
256
|
+
options.add_argument('--remote-debugging-port=9222')
|
257
|
+
options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
|
258
|
+
|
259
|
+
# :capabilities에 options를 배열로 전달
|
260
|
+
capabilities = [options]
|
261
|
+
|
262
|
+
# Selenium WebDriver에서 options를 capabilities로 전달
|
263
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
264
|
+
rescue => e
|
265
|
+
puts 'proxy error...'
|
236
266
|
begin
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
rescue => e
|
254
|
-
puts e
|
255
|
-
puts 'proxy error...'
|
256
|
-
begin
|
257
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
258
|
-
options = Selenium::WebDriver::Chrome::Options.new
|
259
|
-
options.page_load_strategy = :normal
|
260
|
-
options.timeouts = {page_load: 20_000}
|
261
|
-
options.page_load_strategy = 'none'
|
262
|
-
options.add_argument('--remote-debugging-port=9222')
|
263
|
-
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
264
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
265
|
-
rescue
|
266
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
267
|
-
end
|
267
|
+
# Proxy가 실패할 경우 예외 처리
|
268
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
269
|
+
options.page_load_strategy = :normal
|
270
|
+
options.timeouts = { page_load: 20_000 }
|
271
|
+
options.page_load_strategy = 'none'
|
272
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
273
|
+
options.add_argument('--remote-debugging-port=9222')
|
274
|
+
options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
|
275
|
+
|
276
|
+
# :capabilities에 options를 배열로 전달
|
277
|
+
capabilities = [options]
|
278
|
+
|
279
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
280
|
+
rescue
|
281
|
+
# 예외 발생 시 다른 방법으로 셀레니움 실행
|
282
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
268
283
|
end
|
284
|
+
end
|
269
285
|
end
|
270
|
-
|
286
|
+
end
|
271
287
|
|
272
288
|
|
273
289
|
|
@@ -1057,21 +1073,23 @@ end
|
|
1057
1073
|
|
1058
1074
|
|
1059
1075
|
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1076
|
+
if option['사진타이틀'] == 'true'
|
1077
|
+
begin
|
1078
|
+
@driver.action.key_down(:up).key_up(:up).perform
|
1079
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
1080
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
1081
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]') }
|
1082
|
+
sleep(1)
|
1083
|
+
@driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
|
1084
|
+
sleep(1)
|
1085
|
+
@driver.action.send_keys(title).perform
|
1086
|
+
sleep(1)
|
1087
|
+
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
1088
|
+
sleep(1)
|
1089
|
+
rescue
|
1090
|
+
@driver.action.key_down(:down).key_up(:down).perform
|
1091
|
+
end
|
1092
|
+
end
|
1075
1093
|
|
1076
1094
|
|
1077
1095
|
if i2.to_s.split('href="')[1] != nil
|
@@ -1951,10 +1969,18 @@ class Wordpress
|
|
1951
1969
|
|
1952
1970
|
def get_naver_text(q)
|
1953
1971
|
begin
|
1954
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1955
|
-
|
1972
|
+
#Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1973
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
1974
|
+
capabilities = [options]
|
1975
|
+
|
1976
|
+
# Selenium WebDriver에서 options를 capabilities로 전달
|
1977
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1956
1978
|
rescue
|
1957
|
-
|
1979
|
+
# :capabilities에 options를 배열로 전달
|
1980
|
+
capabilities = [options]
|
1981
|
+
|
1982
|
+
# Selenium WebDriver에서 options를 capabilities로 전달
|
1983
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1958
1984
|
end
|
1959
1985
|
@driver.get('https://search.naver.com/search.naver?display=15&f=&filetype=0&page=3&query='+q.to_s+'&research_url=&sm=tab_pge&start=16&where=web')
|
1960
1986
|
noko = Nokogiri::HTML(@driver.page_source)
|
@@ -1984,10 +2010,18 @@ class Wordpress
|
|
1984
2010
|
|
1985
2011
|
def get_naver_text2(keyword)
|
1986
2012
|
begin
|
1987
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1988
|
-
|
2013
|
+
#Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
2014
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
2015
|
+
capabilities = [options]
|
2016
|
+
|
2017
|
+
# Selenium WebDriver에서 options를 capabilities로 전달
|
2018
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1989
2019
|
rescue
|
1990
|
-
|
2020
|
+
# :capabilities에 options를 배열로 전달
|
2021
|
+
capabilities = [options]
|
2022
|
+
|
2023
|
+
# Selenium WebDriver에서 options를 capabilities로 전달
|
2024
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1991
2025
|
end
|
1992
2026
|
@driver.get('https://search.naver.com/search.naver?ssc=tab.blog.all&sm=tab_jum&query='+keyword.to_s)
|
1993
2027
|
for n3 in 1..10
|
@@ -2024,6 +2058,7 @@ class Wordpress
|
|
2024
2058
|
|
2025
2059
|
|
2026
2060
|
|
2061
|
+
|
2027
2062
|
#def chrome_start(url, user_id, user_pw)
|
2028
2063
|
# @url = url
|
2029
2064
|
# @user_id = user_id
|
@@ -3243,6 +3278,12 @@ class Wordpress
|
|
3243
3278
|
option['CCL사용'] = 'false'
|
3244
3279
|
end
|
3245
3280
|
|
3281
|
+
if @data['포스트설정']['사진타이틀'].checked?
|
3282
|
+
option['사진타이틀'] = 'true'
|
3283
|
+
else
|
3284
|
+
option['사진타이틀'] = 'false'
|
3285
|
+
end
|
3286
|
+
|
3246
3287
|
|
3247
3288
|
if @data['포스트설정']['내용첫줄제목에입력'].checked?
|
3248
3289
|
title = content.split("\n")[0]
|
@@ -4774,13 +4815,18 @@ class Wordpress
|
|
4774
4815
|
text 'URL'
|
4775
4816
|
}
|
4776
4817
|
|
4777
|
-
@data['포스트설정']['
|
4818
|
+
@data['포스트설정']['사진타이틀'] = checkbox('사진 등록시 사진 하단에 제목 넣기'){
|
4778
4819
|
top 15+ aa1
|
4779
4820
|
left 0
|
4780
4821
|
}
|
4822
|
+
|
4823
|
+
@data['포스트설정']['ChatGPT사용'] = checkbox('Chat GPT 사용하기'){
|
4824
|
+
top 16+ aa1
|
4825
|
+
left 0
|
4826
|
+
}
|
4781
4827
|
|
4782
4828
|
@data['포스트설정']['api_key'] = entry(){
|
4783
|
-
top
|
4829
|
+
top 16+ aa1
|
4784
4830
|
left 1
|
4785
4831
|
text 'api key 입력 필수!!'
|
4786
4832
|
}
|
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.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|