cafe_buy 0.0.13 → 0.0.15
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 +84 -51
- 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: 5f6e252546c4944ed1df4d05c1ff3001acb312806aae569aad9c662fecb66270
|
4
|
+
data.tar.gz: 32fadd8fcde2f80a988008f70ce1eb943b12b2cd934f252001d07fc272c4ca47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9c9974b9fb1c7827846afe3e434b21200e38c44410508fb1b21a906a77a1b19456ded5da43dbaeb9019e21dbf552cec1b5c8eb2ded7ba05cb08362bc4180573
|
7
|
+
data.tar.gz: c35a66d0270356ec4229513bf1e56399a6960dfcbfe999c2e3443bbbde371e43735a3c884acc6e4bc829acbe4f32ad1801978aa23a009a64ce28545e58294c4d
|
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'
|
@@ -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
|
|
@@ -1882,10 +1898,18 @@ class Wordpress
|
|
1882
1898
|
|
1883
1899
|
def get_naver_text(q)
|
1884
1900
|
begin
|
1885
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1886
|
-
|
1901
|
+
#Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1902
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
1903
|
+
capabilities = [options]
|
1904
|
+
|
1905
|
+
# Selenium WebDriver에서 options를 capabilities로 전달
|
1906
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1887
1907
|
rescue
|
1888
|
-
|
1908
|
+
# :capabilities에 options를 배열로 전달
|
1909
|
+
capabilities = [options]
|
1910
|
+
|
1911
|
+
# Selenium WebDriver에서 options를 capabilities로 전달
|
1912
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1889
1913
|
end
|
1890
1914
|
@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')
|
1891
1915
|
noko = Nokogiri::HTML(@driver.page_source)
|
@@ -1915,10 +1939,18 @@ class Wordpress
|
|
1915
1939
|
|
1916
1940
|
def get_naver_text2(keyword)
|
1917
1941
|
begin
|
1918
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1919
|
-
|
1942
|
+
#Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1943
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
1944
|
+
capabilities = [options]
|
1945
|
+
|
1946
|
+
# Selenium WebDriver에서 options를 capabilities로 전달
|
1947
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1920
1948
|
rescue
|
1921
|
-
|
1949
|
+
# :capabilities에 options를 배열로 전달
|
1950
|
+
capabilities = [options]
|
1951
|
+
|
1952
|
+
# Selenium WebDriver에서 options를 capabilities로 전달
|
1953
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1922
1954
|
end
|
1923
1955
|
@driver.get('https://search.naver.com/search.naver?ssc=tab.blog.all&sm=tab_jum&query='+keyword.to_s)
|
1924
1956
|
for n3 in 1..10
|
@@ -1956,6 +1988,7 @@ class Wordpress
|
|
1956
1988
|
|
1957
1989
|
|
1958
1990
|
|
1991
|
+
|
1959
1992
|
#def chrome_start(url, user_id, user_pw)
|
1960
1993
|
# @url = url
|
1961
1994
|
# @user_id = user_id
|
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.15
|
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-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|