cafe_buy_duo 0.0.17 → 0.0.20
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 +69 -89
- 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: 87786f441a7044cb3be9e2eaadef4cb4762ff6947d00f0eff69dfd3443579dbe
|
4
|
+
data.tar.gz: 5c96007b5042b03417c11f727ff94affe5427c42b54ceb66741ef9e8588b635f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cd86369bea1d10f0f2c00e882ddee9d9f16b2fe750cf71fcdc5bbbb0379bb0e8322dbef05de3976391ba2b07ddf74b7efec1f04b735fab969679e029aa2089e
|
7
|
+
data.tar.gz: 4bba76633573e654cc2463eaba7be9612ee98c1618b6328732293a22582b969a1181b3427a320d18a52eb68603a6e500383a8486141118a4dd58bdc97cb7cfbf
|
data/lib/cafe_buy_duo.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'glimmer-dsl-libui'
|
2
2
|
require 'selenium-webdriver'
|
3
|
-
require 'webdrivers'
|
3
|
+
# require 'webdrivers'
|
4
4
|
require 'iconv'
|
5
5
|
require 'nokogiri'
|
6
6
|
require 'http'
|
@@ -219,71 +219,61 @@ 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
|
-
|
223
222
|
if proxy == ''
|
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
|
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...'
|
266
223
|
begin
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
capabilities = [options]
|
278
|
-
|
279
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
224
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
225
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
226
|
+
options.page_load_strategy = :normal
|
227
|
+
options.timeouts = {page_load: 20_000}
|
228
|
+
options.page_load_strategy = 'none'
|
229
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
230
|
+
options.add_argument('--disable-gpu')
|
231
|
+
options.add_argument('--remote-debugging-port=9222')
|
232
|
+
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
233
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
280
234
|
rescue
|
281
|
-
|
282
|
-
|
235
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
236
|
+
end
|
237
|
+
else
|
238
|
+
begin
|
239
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
240
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
241
|
+
# profile = Selenium::WebDriver::Chrome::Profile.new
|
242
|
+
# profile['network.proxy.type'] = 1
|
243
|
+
# profile['network.proxy.http'] = proxy.split(':')[0]
|
244
|
+
# profile['network.proxy.http_port'] = proxy.split(':')[1].to_i
|
245
|
+
# options = Selenium::WebDriver::Chrome::Options.new
|
246
|
+
# options.profile = profile
|
247
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
248
|
+
options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
|
249
|
+
options.page_load_strategy = :normal
|
250
|
+
options.timeouts = {page_load: 20_000}
|
251
|
+
options.page_load_strategy = 'none'
|
252
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
253
|
+
options.add_argument('--disable-gpu')
|
254
|
+
options.add_argument('--remote-debugging-port=9222')
|
255
|
+
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
256
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
257
|
+
rescue => e
|
258
|
+
puts e
|
259
|
+
puts 'proxy error...'
|
260
|
+
begin
|
261
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
262
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
263
|
+
options.page_load_strategy = :normal
|
264
|
+
options.timeouts = {page_load: 20_000}
|
265
|
+
options.page_load_strategy = 'none'
|
266
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
267
|
+
options.add_argument('--disable-gpu')
|
268
|
+
options.add_argument('--remote-debugging-port=9222')
|
269
|
+
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
270
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
271
|
+
rescue
|
272
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
273
|
+
end
|
283
274
|
end
|
284
|
-
end
|
285
275
|
end
|
286
|
-
|
276
|
+
end
|
287
277
|
|
288
278
|
|
289
279
|
|
@@ -1693,28 +1683,31 @@ end
|
|
1693
1683
|
puts '댓글허용'
|
1694
1684
|
begin
|
1695
1685
|
@driver.find_element(:xpath, '/html/body/div[1]/div/div/section/div/div[2]/div[2]/div[3]/ul/li[1]/div/label').click
|
1686
|
+
sleep(1)
|
1696
1687
|
|
1697
1688
|
rescue
|
1698
1689
|
|
1699
1690
|
end
|
1700
1691
|
end
|
1701
1692
|
|
1702
|
-
|
1693
|
+
|
1703
1694
|
if option['블로그,카페 공유허용'] == 'true'
|
1704
1695
|
puts '블로그,카페 공유허용'
|
1705
1696
|
begin
|
1706
1697
|
@driver.find_element(:xpath, '/html/body/div[1]/div/div/section/div/div[2]/div[2]/div[3]/ul/li[2]/div[1]/label').click
|
1698
|
+
sleep(1)
|
1707
1699
|
rescue
|
1708
1700
|
|
1709
1701
|
end
|
1710
1702
|
end
|
1711
1703
|
|
1712
1704
|
|
1713
|
-
|
1705
|
+
|
1714
1706
|
if option['외부공유허용'] == 'true'
|
1715
1707
|
puts '외부공유허용'
|
1716
1708
|
begin
|
1717
1709
|
@driver.find_element(:xpath, '/html/body/div[1]/div/div/section/div/div[2]/div[2]/div[3]/ul/li[3]/div[1]/label').click
|
1710
|
+
sleep(1)
|
1718
1711
|
rescue
|
1719
1712
|
|
1720
1713
|
end
|
@@ -1726,38 +1719,41 @@ end
|
|
1726
1719
|
puts '복사,저장 허용'
|
1727
1720
|
begin
|
1728
1721
|
@driver.find_element(:xpath, '/html/body/div[1]/div/div/section/div/div[2]/div[2]/div[3]/ul/li[4]/div[1]/label').click
|
1722
|
+
sleep(1)
|
1729
1723
|
rescue
|
1730
1724
|
|
1731
1725
|
end
|
1732
1726
|
end
|
1733
1727
|
|
1734
|
-
|
1728
|
+
|
1735
1729
|
if option['자동출처 사용'] == 'true'
|
1736
1730
|
puts '자동출처 사용'
|
1737
1731
|
begin
|
1738
1732
|
@driver.find_element(:xpath, '/html/body/div[1]/div/div/section/div/div[2]/div[2]/div[3]/ul/li[5]/div[1]/label').click
|
1733
|
+
sleep(1)
|
1739
1734
|
rescue
|
1740
1735
|
|
1741
1736
|
end
|
1742
1737
|
end
|
1743
1738
|
|
1744
|
-
|
1739
|
+
|
1745
1740
|
|
1746
1741
|
if option['CCL 사용'] == 'true'
|
1747
1742
|
puts 'CCL 사용'
|
1748
1743
|
begin
|
1749
1744
|
@driver.find_element(:xpath, '/html/body/div[1]/div/div/section/div/div[2]/div[2]/div[3]/ul/li[6]/div[1]/label').click
|
1745
|
+
sleep(1)
|
1750
1746
|
rescue
|
1751
1747
|
|
1752
1748
|
end
|
1753
1749
|
end
|
1754
|
-
|
1750
|
+
|
1755
1751
|
# puts data['documentModel'] = data['documentModel'].to_json
|
1756
1752
|
sleep(2)
|
1757
1753
|
sleep(dd_time.to_i)
|
1758
1754
|
@driver.find_element(:xpath, '/html/body/div[1]/div/div/section/div/div[1]/div/a').click
|
1759
1755
|
|
1760
|
-
sleep(
|
1756
|
+
sleep(7)
|
1761
1757
|
|
1762
1758
|
|
1763
1759
|
begin
|
@@ -1969,18 +1965,10 @@ class Wordpress
|
|
1969
1965
|
|
1970
1966
|
def get_naver_text(q)
|
1971
1967
|
begin
|
1972
|
-
|
1973
|
-
|
1974
|
-
capabilities = [options]
|
1975
|
-
|
1976
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1977
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1968
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1969
|
+
@driver = Selenium::WebDriver.for :chrome
|
1978
1970
|
rescue
|
1979
|
-
|
1980
|
-
capabilities = [options]
|
1981
|
-
|
1982
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1983
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1971
|
+
@driver = Selenium::WebDriver.for :chrome
|
1984
1972
|
end
|
1985
1973
|
@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')
|
1986
1974
|
noko = Nokogiri::HTML(@driver.page_source)
|
@@ -2010,18 +1998,10 @@ class Wordpress
|
|
2010
1998
|
|
2011
1999
|
def get_naver_text2(keyword)
|
2012
2000
|
begin
|
2013
|
-
|
2014
|
-
|
2015
|
-
capabilities = [options]
|
2016
|
-
|
2017
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
2018
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
2001
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
2002
|
+
@driver = Selenium::WebDriver.for :chrome
|
2019
2003
|
rescue
|
2020
|
-
|
2021
|
-
capabilities = [options]
|
2022
|
-
|
2023
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
2024
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
2004
|
+
@driver = Selenium::WebDriver.for :chrome
|
2025
2005
|
end
|
2026
2006
|
@driver.get('https://search.naver.com/search.naver?ssc=tab.blog.all&sm=tab_jum&query='+keyword.to_s)
|
2027
2007
|
for n3 in 1..10
|
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.20
|
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-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|