cafe_buy 0.0.19 → 0.0.23
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 +131 -158
- 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: 859484ea08e31a60b002a4af5cfd7dae3c580986991b8d7d666d5337bbb9af87
|
4
|
+
data.tar.gz: 1258dfaaba102713ec0e8223b81278def3334f68fb5c66dd430ab0f1750e3783
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff6ad27a089ed44c68e2962aa7344b170624575e02df71d589be552f35b358752c511d3b72b8a843308164a22bc60438cb8e6ba25fdac6e17270ee2f89ac252c
|
7
|
+
data.tar.gz: 47357b7f5e1dbd4348110a64fdfedaa7cc8020836093a50dba9698d1dbc575f28a2e4864670df78850ef9d746c1c16d0d2460569c264b812022f10d829a914ca
|
data/lib/cafe_buy.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
|
|
@@ -1590,11 +1564,11 @@ end
|
|
1590
1564
|
end
|
1591
1565
|
end
|
1592
1566
|
end
|
1593
|
-
sleep(
|
1567
|
+
sleep(0.5)
|
1594
1568
|
@driver.action.key_down(:end).key_up(:end).perform
|
1595
|
-
sleep(
|
1569
|
+
sleep(0.5)
|
1596
1570
|
@driver.action.key_down(:enter).key_up(:enter).perform
|
1597
|
-
sleep(
|
1571
|
+
sleep(0.5)
|
1598
1572
|
# if check_image == 0
|
1599
1573
|
# if value_data['nodes'].length == 0
|
1600
1574
|
# value_data['nodes'][0] = {
|
@@ -1692,88 +1666,100 @@ 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
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1672
|
+
|
1673
|
+
if option['전체공개'] == 'true'
|
1674
|
+
puts '전체공개'
|
1675
|
+
begin
|
1676
|
+
@driver.find_element(:xpath, '//*[@class="btn_open_set"]').click
|
1677
|
+
sleep(2)
|
1678
|
+
@driver.find_element(:xpath, '//*[@for="all"]').click
|
1679
|
+
rescue
|
1680
|
+
end
|
1681
|
+
sleep(1)
|
1682
|
+
end
|
1683
|
+
|
1684
|
+
if option['멤버공개'] == 'true'
|
1685
|
+
puts '멤버공개'
|
1686
|
+
begin
|
1687
|
+
@driver.find_element(:xpath, '//*[@class="btn_open_set"]').click
|
1688
|
+
sleep(2)
|
1689
|
+
@driver.find_element(:xpath, '//*[@for="member"]').click
|
1690
|
+
rescue
|
1691
|
+
end
|
1692
|
+
sleep(1)
|
1693
|
+
end
|
1694
|
+
|
1708
1695
|
if option['댓글허용'] == 'true'
|
1709
1696
|
puts '댓글허용'
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1697
|
+
begin
|
1698
|
+
@driver.find_element(:xpath, '//*[@for="coment"]').click
|
1699
|
+
rescue
|
1700
|
+
end
|
1701
|
+
sleep(1)
|
1715
1702
|
end
|
1716
|
-
end
|
1717
1703
|
|
1718
|
-
|
1704
|
+
|
1719
1705
|
if option['블로그,카페 공유허용'] == 'true'
|
1720
1706
|
puts '블로그,카페 공유허용'
|
1721
1707
|
begin
|
1722
|
-
@driver.find_element(:xpath, '
|
1723
|
-
|
1724
|
-
|
1708
|
+
@driver.find_element(:xpath, '//*[@for="blog_sharing"]').click
|
1709
|
+
rescue
|
1710
|
+
end
|
1711
|
+
sleep(1)
|
1725
1712
|
end
|
1726
|
-
end
|
1727
1713
|
|
1728
1714
|
|
1729
|
-
|
1715
|
+
|
1730
1716
|
if option['외부공유허용'] == 'true'
|
1731
1717
|
puts '외부공유허용'
|
1732
1718
|
begin
|
1733
|
-
@driver.find_element(:xpath, '
|
1734
|
-
|
1735
|
-
|
1719
|
+
@driver.find_element(:xpath, '//*[@for="external_sharing"]').click
|
1720
|
+
rescue
|
1721
|
+
end
|
1722
|
+
sleep(1)
|
1736
1723
|
end
|
1737
|
-
end
|
1738
1724
|
|
1739
|
-
|
1725
|
+
|
1740
1726
|
|
1741
1727
|
if option['복사,저장 허용'] == 'true'
|
1742
1728
|
puts '복사,저장 허용'
|
1743
1729
|
begin
|
1744
|
-
@driver.find_element(:xpath, '
|
1745
|
-
|
1746
|
-
|
1730
|
+
@driver.find_element(:xpath, '//*[@for="copy"]').click
|
1731
|
+
rescue
|
1732
|
+
end
|
1733
|
+
sleep(1)
|
1747
1734
|
end
|
1748
|
-
end
|
1749
1735
|
|
1750
|
-
|
1736
|
+
|
1751
1737
|
if option['자동출처 사용'] == 'true'
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
end
|
1738
|
+
puts '자동출처 사용'
|
1739
|
+
begin
|
1740
|
+
@driver.find_element(:xpath, '//*[@for="automatic_source"]').click
|
1741
|
+
rescue
|
1742
|
+
end
|
1743
|
+
sleep(1)
|
1744
|
+
end
|
1759
1745
|
|
1760
|
-
|
1746
|
+
|
1761
1747
|
|
1762
1748
|
if option['CCL 사용'] == 'true'
|
1763
1749
|
puts 'CCL 사용'
|
1764
1750
|
begin
|
1765
|
-
@driver.find_element(:xpath, '
|
1766
|
-
|
1767
|
-
|
1751
|
+
@driver.find_element(:xpath, '//*[@for="ccl"]').click
|
1752
|
+
rescue
|
1753
|
+
end
|
1754
|
+
sleep(1)
|
1768
1755
|
end
|
1769
|
-
|
1770
|
-
sleep(1)
|
1756
|
+
|
1771
1757
|
# puts data['documentModel'] = data['documentModel'].to_json
|
1772
|
-
|
1758
|
+
|
1773
1759
|
sleep(dd_time.to_i)
|
1774
|
-
@driver.find_element(:xpath, '
|
1760
|
+
@driver.find_element(:xpath, '//*[@class="BaseButton BaseButton--skinGreen size_default"]').click
|
1775
1761
|
|
1776
|
-
sleep(
|
1762
|
+
sleep(7)
|
1777
1763
|
|
1778
1764
|
|
1779
1765
|
begin
|
@@ -1916,18 +1902,10 @@ class Wordpress
|
|
1916
1902
|
|
1917
1903
|
def get_naver_text(q)
|
1918
1904
|
begin
|
1919
|
-
|
1920
|
-
|
1921
|
-
capabilities = [options]
|
1922
|
-
|
1923
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1924
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1905
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1906
|
+
@driver = Selenium::WebDriver.for :chrome
|
1925
1907
|
rescue
|
1926
|
-
|
1927
|
-
capabilities = [options]
|
1928
|
-
|
1929
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1930
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1908
|
+
@driver = Selenium::WebDriver.for :chrome
|
1931
1909
|
end
|
1932
1910
|
@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')
|
1933
1911
|
noko = Nokogiri::HTML(@driver.page_source)
|
@@ -1957,18 +1935,10 @@ class Wordpress
|
|
1957
1935
|
|
1958
1936
|
def get_naver_text2(keyword)
|
1959
1937
|
begin
|
1960
|
-
|
1961
|
-
|
1962
|
-
capabilities = [options]
|
1963
|
-
|
1964
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1965
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1938
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1939
|
+
@driver = Selenium::WebDriver.for :chrome
|
1966
1940
|
rescue
|
1967
|
-
|
1968
|
-
capabilities = [options]
|
1969
|
-
|
1970
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1971
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1941
|
+
@driver = Selenium::WebDriver.for :chrome
|
1972
1942
|
end
|
1973
1943
|
@driver.get('https://search.naver.com/search.naver?ssc=tab.blog.all&sm=tab_jum&query='+keyword.to_s)
|
1974
1944
|
for n3 in 1..10
|
@@ -3180,14 +3150,17 @@ class Wordpress
|
|
3180
3150
|
option['배달'] = [@data['포스트설정']['직거래'].checked?, @data['포스트설정']['택배 거래'].checked?, @data['포스트설정']['온라인전송'].checked?]
|
3181
3151
|
option['직 거래 카테고리'] = product_category1
|
3182
3152
|
option['결제'] = payment
|
3153
|
+
|
3183
3154
|
if @data['포스트설정']['전체공개'].checked?
|
3184
|
-
option['
|
3185
|
-
|
3186
|
-
|
3187
|
-
|
3188
|
-
|
3155
|
+
option['전체공개'] = 'true'
|
3156
|
+
else
|
3157
|
+
option['전체공개'] = 'false'
|
3158
|
+
end
|
3159
|
+
|
3160
|
+
if @data['포스트설정']['멤버공개'].checked?
|
3161
|
+
option['멤버공개'] = 'true'
|
3189
3162
|
else
|
3190
|
-
option['
|
3163
|
+
option['멤버공개'] = 'false'
|
3191
3164
|
end
|
3192
3165
|
|
3193
3166
|
if @data['포스트설정']['댓글허용'].checked?
|
@@ -5130,7 +5103,7 @@ class Wordpress
|
|
5130
5103
|
end
|
5131
5104
|
}
|
5132
5105
|
}
|
5133
|
-
@data['포스트설정']['멤버공개'] = checkbox('
|
5106
|
+
@data['포스트설정']['멤버공개'] = checkbox('멤버공개'){
|
5134
5107
|
top 10
|
5135
5108
|
left 1
|
5136
5109
|
on_toggled{
|
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.23
|
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
|