cafe_buy 0.0.17 → 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 -142
- 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,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
|
|
@@ -1574,11 +1564,11 @@ end
|
|
1574
1564
|
end
|
1575
1565
|
end
|
1576
1566
|
end
|
1577
|
-
sleep(
|
1567
|
+
sleep(0.5)
|
1578
1568
|
@driver.action.key_down(:end).key_up(:end).perform
|
1579
|
-
sleep(
|
1569
|
+
sleep(0.5)
|
1580
1570
|
@driver.action.key_down(:enter).key_up(:enter).perform
|
1581
|
-
sleep(
|
1571
|
+
sleep(0.5)
|
1582
1572
|
# if check_image == 0
|
1583
1573
|
# if value_data['nodes'].length == 0
|
1584
1574
|
# value_data['nodes'][0] = {
|
@@ -1676,88 +1666,100 @@ end
|
|
1676
1666
|
tags2.split(',').each do |tag_value|
|
1677
1667
|
tag_mm2 << ''+tag_value
|
1678
1668
|
end
|
1679
|
-
@driver.find_element(:xpath, '//*[@
|
1669
|
+
@driver.find_element(:xpath, '//*[@placeholder="태그를 입력해주세요 (최대 10개)"]').send_keys(tag_mm2.join("\n")+"\n")
|
1680
1670
|
|
1681
1671
|
sleep(1)
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
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
|
+
|
1692
1695
|
if option['댓글허용'] == 'true'
|
1693
1696
|
puts '댓글허용'
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1697
|
+
begin
|
1698
|
+
@driver.find_element(:xpath, '//*[@for="coment"]').click
|
1699
|
+
rescue
|
1700
|
+
end
|
1701
|
+
sleep(1)
|
1699
1702
|
end
|
1700
|
-
end
|
1701
1703
|
|
1702
|
-
|
1704
|
+
|
1703
1705
|
if option['블로그,카페 공유허용'] == 'true'
|
1704
1706
|
puts '블로그,카페 공유허용'
|
1705
1707
|
begin
|
1706
|
-
@driver.find_element(:xpath, '
|
1707
|
-
|
1708
|
-
|
1708
|
+
@driver.find_element(:xpath, '//*[@for="blog_sharing"]').click
|
1709
|
+
rescue
|
1710
|
+
end
|
1711
|
+
sleep(1)
|
1709
1712
|
end
|
1710
|
-
end
|
1711
1713
|
|
1712
1714
|
|
1713
|
-
|
1715
|
+
|
1714
1716
|
if option['외부공유허용'] == 'true'
|
1715
1717
|
puts '외부공유허용'
|
1716
1718
|
begin
|
1717
|
-
@driver.find_element(:xpath, '
|
1718
|
-
|
1719
|
-
|
1719
|
+
@driver.find_element(:xpath, '//*[@for="external_sharing"]').click
|
1720
|
+
rescue
|
1721
|
+
end
|
1722
|
+
sleep(1)
|
1720
1723
|
end
|
1721
|
-
end
|
1722
1724
|
|
1723
|
-
|
1725
|
+
|
1724
1726
|
|
1725
1727
|
if option['복사,저장 허용'] == 'true'
|
1726
1728
|
puts '복사,저장 허용'
|
1727
1729
|
begin
|
1728
|
-
@driver.find_element(:xpath, '
|
1729
|
-
|
1730
|
-
|
1730
|
+
@driver.find_element(:xpath, '//*[@for="copy"]').click
|
1731
|
+
rescue
|
1732
|
+
end
|
1733
|
+
sleep(1)
|
1731
1734
|
end
|
1732
|
-
end
|
1733
1735
|
|
1734
|
-
|
1736
|
+
|
1735
1737
|
if option['자동출처 사용'] == 'true'
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
end
|
1738
|
+
puts '자동출처 사용'
|
1739
|
+
begin
|
1740
|
+
@driver.find_element(:xpath, '//*[@for="automatic_source"]').click
|
1741
|
+
rescue
|
1742
|
+
end
|
1743
|
+
sleep(1)
|
1744
|
+
end
|
1743
1745
|
|
1744
|
-
|
1746
|
+
|
1745
1747
|
|
1746
1748
|
if option['CCL 사용'] == 'true'
|
1747
1749
|
puts 'CCL 사용'
|
1748
1750
|
begin
|
1749
|
-
@driver.find_element(:xpath, '
|
1750
|
-
|
1751
|
-
|
1751
|
+
@driver.find_element(:xpath, '//*[@for="ccl"]').click
|
1752
|
+
rescue
|
1753
|
+
end
|
1754
|
+
sleep(1)
|
1752
1755
|
end
|
1753
|
-
|
1754
|
-
sleep(1)
|
1756
|
+
|
1755
1757
|
# puts data['documentModel'] = data['documentModel'].to_json
|
1756
|
-
|
1758
|
+
|
1757
1759
|
sleep(dd_time.to_i)
|
1758
|
-
@driver.find_element(:xpath, '
|
1760
|
+
@driver.find_element(:xpath, '//*[@class="BaseButton BaseButton--skinGreen size_default"]').click
|
1759
1761
|
|
1760
|
-
sleep(
|
1762
|
+
sleep(7)
|
1761
1763
|
|
1762
1764
|
|
1763
1765
|
begin
|
@@ -1900,18 +1902,10 @@ class Wordpress
|
|
1900
1902
|
|
1901
1903
|
def get_naver_text(q)
|
1902
1904
|
begin
|
1903
|
-
|
1904
|
-
|
1905
|
-
capabilities = [options]
|
1906
|
-
|
1907
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1908
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1905
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1906
|
+
@driver = Selenium::WebDriver.for :chrome
|
1909
1907
|
rescue
|
1910
|
-
|
1911
|
-
capabilities = [options]
|
1912
|
-
|
1913
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1914
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1908
|
+
@driver = Selenium::WebDriver.for :chrome
|
1915
1909
|
end
|
1916
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')
|
1917
1911
|
noko = Nokogiri::HTML(@driver.page_source)
|
@@ -1941,18 +1935,10 @@ class Wordpress
|
|
1941
1935
|
|
1942
1936
|
def get_naver_text2(keyword)
|
1943
1937
|
begin
|
1944
|
-
|
1945
|
-
|
1946
|
-
capabilities = [options]
|
1947
|
-
|
1948
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1949
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1938
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1939
|
+
@driver = Selenium::WebDriver.for :chrome
|
1950
1940
|
rescue
|
1951
|
-
|
1952
|
-
capabilities = [options]
|
1953
|
-
|
1954
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1955
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1941
|
+
@driver = Selenium::WebDriver.for :chrome
|
1956
1942
|
end
|
1957
1943
|
@driver.get('https://search.naver.com/search.naver?ssc=tab.blog.all&sm=tab_jum&query='+keyword.to_s)
|
1958
1944
|
for n3 in 1..10
|
@@ -3164,14 +3150,17 @@ class Wordpress
|
|
3164
3150
|
option['배달'] = [@data['포스트설정']['직거래'].checked?, @data['포스트설정']['택배 거래'].checked?, @data['포스트설정']['온라인전송'].checked?]
|
3165
3151
|
option['직 거래 카테고리'] = product_category1
|
3166
3152
|
option['결제'] = payment
|
3153
|
+
|
3167
3154
|
if @data['포스트설정']['전체공개'].checked?
|
3168
|
-
option['
|
3169
|
-
|
3170
|
-
|
3171
|
-
|
3172
|
-
|
3155
|
+
option['전체공개'] = 'true'
|
3156
|
+
else
|
3157
|
+
option['전체공개'] = 'false'
|
3158
|
+
end
|
3159
|
+
|
3160
|
+
if @data['포스트설정']['멤버공개'].checked?
|
3161
|
+
option['멤버공개'] = 'true'
|
3173
3162
|
else
|
3174
|
-
option['
|
3163
|
+
option['멤버공개'] = 'false'
|
3175
3164
|
end
|
3176
3165
|
|
3177
3166
|
if @data['포스트설정']['댓글허용'].checked?
|
@@ -5114,7 +5103,7 @@ class Wordpress
|
|
5114
5103
|
end
|
5115
5104
|
}
|
5116
5105
|
}
|
5117
|
-
@data['포스트설정']['멤버공개'] = checkbox('
|
5106
|
+
@data['포스트설정']['멤버공개'] = checkbox('멤버공개'){
|
5118
5107
|
top 10
|
5119
5108
|
left 1
|
5120
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
|