cafe_buy_duo 0.0.19 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cafe_buy_duo.rb +70 -106
- 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: a08dd941b463ea6a2da44c03146dd90ac71e0c439781ae8181c83d432cb4e62d
|
4
|
+
data.tar.gz: 0d7a4327ef647325b75dde558eec5c67d29f0c07c6f5473bf473431086d5be72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 290fb53426a540f56ef48937d5923c2a87236c1c4e1eb81c203b8520415eac8323941f8b9aa182ed0d1fa06b8cf95c3ab511e24fe7bf47bff24644d816f04ca3
|
7
|
+
data.tar.gz: fca0e4c96bb6902c9c4e48100f668b531ceb30c12e3514bf0a8cefe9d6c8941e6009210cbbf305fe57fe3d7a5fe9da6b4fd65f6003cf47e68eacfacad7ec8d00
|
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,87 +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
|
-
chromedriver_path = './chromedriver.exe'
|
224
|
-
|
225
|
-
# 웹드라이버 자동 업데이트 시도
|
226
|
-
begin
|
227
|
-
# webdrivers가 사용자의 Chrome 버전에 맞는 chromedriver 다운로드 시도
|
228
|
-
Webdrivers::Chromedriver.update # 자동 업데이트 시도
|
229
|
-
rescue => e
|
230
|
-
puts "webdrivers에서 chromedriver 다운로드 실패: #{e.message}"
|
231
|
-
puts "자동으로 chromedriver.exe 사용합니다."
|
232
|
-
puts "만일 프로그램 폴더안에 chromedriver.exe 버전이 맞지 않거나 없는 경우 인터넷창이 깜빡하고 닫히거나 열리지 않는경우에만 아래 안내를 따라주세요."
|
233
|
-
puts "https://storage.googleapis.com/chrome-for-testing-public/사용자크롬버전/win32/chromedriver-win32.zip 링크를 복사 후 복사 된 링크 중(사용자크롬버전) 부분을 크롬 사용자의 버전(예:131.0.6778.264)으로 수정 후 주소입력 부분에 넣어 엔터 후 다운로드 하고 압축을 풀고 chromedriver.exe 파일만 프로그램 폴더안에 넣어주세요."
|
234
|
-
puts "인터넷 창이 열리고 작업을 한다면 위 항목은 패스해주세요."
|
235
|
-
# 예외가 발생하면 수동 경로 사용
|
236
|
-
Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
|
237
|
-
end
|
238
|
-
|
239
222
|
if proxy == ''
|
240
|
-
begin
|
241
|
-
# webdrivers Gem이 크롬 드라이버 자동 다운로드 및 설정을 관리함
|
242
|
-
options = Selenium::WebDriver::Chrome::Options.new
|
243
|
-
options.page_load_strategy = :normal
|
244
|
-
options.timeouts = { page_load: 20_000 }
|
245
|
-
options.page_load_strategy = 'none'
|
246
|
-
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
options.add_argument('--remote-debugging-port=9222')
|
251
|
-
options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
|
252
|
-
|
253
|
-
# :capabilities에 options를 배열로 전달
|
254
|
-
capabilities = [options]
|
255
|
-
|
256
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
257
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
258
|
-
rescue
|
259
|
-
# 예외 발생 시 다른 방법으로 셀레니움 실행
|
260
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
261
|
-
end
|
262
|
-
else
|
263
|
-
begin
|
264
|
-
# Proxy를 사용하는 경우
|
265
|
-
options = Selenium::WebDriver::Chrome::Options.new
|
266
|
-
options.add_argument '--proxy-server=' + proxy.to_s.force_encoding('utf-8')
|
267
|
-
options.page_load_strategy = :normal
|
268
|
-
options.timeouts = { page_load: 20_000 }
|
269
|
-
options.page_load_strategy = 'none'
|
270
|
-
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
271
|
-
|
272
|
-
options.add_argument('--remote-debugging-port=9222')
|
273
|
-
options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
|
274
|
-
|
275
|
-
# :capabilities에 options를 배열로 전달
|
276
|
-
capabilities = [options]
|
277
|
-
|
278
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
279
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
280
|
-
rescue => e
|
281
|
-
puts 'proxy error...'
|
282
223
|
begin
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
capabilities = [options]
|
294
|
-
|
295
|
-
@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)
|
296
234
|
rescue
|
297
|
-
|
298
|
-
|
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
|
299
274
|
end
|
300
|
-
end
|
301
275
|
end
|
302
|
-
|
276
|
+
end
|
303
277
|
|
304
278
|
|
305
279
|
|
@@ -1692,7 +1666,7 @@ end
|
|
1692
1666
|
tags2.split(',').each do |tag_value|
|
1693
1667
|
tag_mm2 << ''+tag_value
|
1694
1668
|
end
|
1695
|
-
@driver.find_element(:xpath, '//*[@
|
1669
|
+
@driver.find_element(:xpath, '//*[@placeholder="태그를 입력해주세요 (최대 10개)"]').send_keys(tag_mm2.join("\n")+"\n")
|
1696
1670
|
|
1697
1671
|
sleep(1)
|
1698
1672
|
# data['populationParams'] = '{"configuration":{"openType":'+option['공개']+',"commentYn":'+option['댓글허용']+',"searchYn":'+option['검색허용']+',"sympathyYn":'+option['공감허용']+',"scrapType":'+option['블로그공유']+',"outSideAllowYn":'+option['외부공유허용']+',"twitterPostingYn":false,"facebookPostingYn":false,"cclYn":false},"populationMeta":{"categoryId":'+category_value+',"logNo":null,"directorySeq":0,"directoryDetail":null,"mrBlogTalkCode":null,"postWriteTimeType":"now","tags":"'+tags2+'","moviePanelParticipation":false,"greenReviewBannerYn":false,"continueSaved":false,"noticePostYn":false,"autoByCategoryYn":false,"postLocationSupportYn":false,"postLocationJson":null,"prePostDate":null,"thisDayPostInfo":null,"scrapYn":false,"autoSaveNo":'+(Time.now.to_f.round(3)*1000).to_i.to_s+'},"editorSource":"AbZmtbYiAmhrzPJyhPXNWg=="}'
|
@@ -1709,28 +1683,31 @@ end
|
|
1709
1683
|
puts '댓글허용'
|
1710
1684
|
begin
|
1711
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)
|
1712
1687
|
|
1713
1688
|
rescue
|
1714
1689
|
|
1715
1690
|
end
|
1716
1691
|
end
|
1717
1692
|
|
1718
|
-
|
1693
|
+
|
1719
1694
|
if option['블로그,카페 공유허용'] == 'true'
|
1720
1695
|
puts '블로그,카페 공유허용'
|
1721
1696
|
begin
|
1722
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)
|
1723
1699
|
rescue
|
1724
1700
|
|
1725
1701
|
end
|
1726
1702
|
end
|
1727
1703
|
|
1728
1704
|
|
1729
|
-
|
1705
|
+
|
1730
1706
|
if option['외부공유허용'] == 'true'
|
1731
1707
|
puts '외부공유허용'
|
1732
1708
|
begin
|
1733
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)
|
1734
1711
|
rescue
|
1735
1712
|
|
1736
1713
|
end
|
@@ -1742,38 +1719,41 @@ end
|
|
1742
1719
|
puts '복사,저장 허용'
|
1743
1720
|
begin
|
1744
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)
|
1745
1723
|
rescue
|
1746
1724
|
|
1747
1725
|
end
|
1748
1726
|
end
|
1749
1727
|
|
1750
|
-
|
1728
|
+
|
1751
1729
|
if option['자동출처 사용'] == 'true'
|
1752
1730
|
puts '자동출처 사용'
|
1753
1731
|
begin
|
1754
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)
|
1755
1734
|
rescue
|
1756
1735
|
|
1757
1736
|
end
|
1758
1737
|
end
|
1759
1738
|
|
1760
|
-
|
1739
|
+
|
1761
1740
|
|
1762
1741
|
if option['CCL 사용'] == 'true'
|
1763
1742
|
puts 'CCL 사용'
|
1764
1743
|
begin
|
1765
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)
|
1766
1746
|
rescue
|
1767
1747
|
|
1768
1748
|
end
|
1769
1749
|
end
|
1770
|
-
|
1750
|
+
|
1771
1751
|
# puts data['documentModel'] = data['documentModel'].to_json
|
1772
1752
|
sleep(2)
|
1773
1753
|
sleep(dd_time.to_i)
|
1774
1754
|
@driver.find_element(:xpath, '/html/body/div[1]/div/div/section/div/div[1]/div/a').click
|
1775
1755
|
|
1776
|
-
sleep(
|
1756
|
+
sleep(7)
|
1777
1757
|
|
1778
1758
|
|
1779
1759
|
begin
|
@@ -1985,18 +1965,10 @@ class Wordpress
|
|
1985
1965
|
|
1986
1966
|
def get_naver_text(q)
|
1987
1967
|
begin
|
1988
|
-
|
1989
|
-
|
1990
|
-
capabilities = [options]
|
1991
|
-
|
1992
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1993
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1968
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1969
|
+
@driver = Selenium::WebDriver.for :chrome
|
1994
1970
|
rescue
|
1995
|
-
|
1996
|
-
capabilities = [options]
|
1997
|
-
|
1998
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1999
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1971
|
+
@driver = Selenium::WebDriver.for :chrome
|
2000
1972
|
end
|
2001
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')
|
2002
1974
|
noko = Nokogiri::HTML(@driver.page_source)
|
@@ -2026,18 +1998,10 @@ class Wordpress
|
|
2026
1998
|
|
2027
1999
|
def get_naver_text2(keyword)
|
2028
2000
|
begin
|
2029
|
-
|
2030
|
-
|
2031
|
-
capabilities = [options]
|
2032
|
-
|
2033
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
2034
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
2001
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
2002
|
+
@driver = Selenium::WebDriver.for :chrome
|
2035
2003
|
rescue
|
2036
|
-
|
2037
|
-
capabilities = [options]
|
2038
|
-
|
2039
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
2040
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
2004
|
+
@driver = Selenium::WebDriver.for :chrome
|
2041
2005
|
end
|
2042
2006
|
@driver.get('https://search.naver.com/search.naver?ssc=tab.blog.all&sm=tab_jum&query='+keyword.to_s)
|
2043
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.21
|
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
|