nblog_duo 0.0.37 → 0.0.50
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/nblog_duo.rb +76 -110
- 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: 8730b02b7d9d9879b13776f04af6df27652945ead3b83fd8ee89915b3f16245e
|
4
|
+
data.tar.gz: 6f0fc908293c01a1030e551b0ab353177883bceeba405451bd604649d1535dba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cb86c0c0f3160e03a6320358cadc8dd8f5963c8de6c6f38981659614606927895a34f0932f294a1bd9a4ad2d23f4767ad2e9fb1a328beced58f0d170965ac54
|
7
|
+
data.tar.gz: fe2c268db2cb118d8943e520e1b12cd68ee756764d196a3c5aab8a6eeb47080d30004a95b67cf2a7d535953099a6fbe4f683772c6b851b133ec95467128afafe
|
data/lib/nblog_duo.rb
CHANGED
@@ -214,71 +214,61 @@ class Naver
|
|
214
214
|
def chrome_start(proxy, user_id)
|
215
215
|
naver_cookie_dir = "C:/naver_cookie"
|
216
216
|
FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
|
217
|
-
|
218
217
|
if proxy == ''
|
219
|
-
begin
|
220
|
-
# webdrivers Gem이 크롬 드라이버 자동 다운로드 및 설정을 관리함
|
221
|
-
options = Selenium::WebDriver::Chrome::Options.new
|
222
|
-
options.page_load_strategy = :normal
|
223
|
-
options.timeouts = { page_load: 20_000 }
|
224
|
-
options.page_load_strategy = 'none'
|
225
|
-
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
options.add_argument('--remote-debugging-port=9222')
|
230
|
-
options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
|
231
|
-
|
232
|
-
# :capabilities에 options를 배열로 전달
|
233
|
-
capabilities = [options]
|
234
|
-
|
235
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
236
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
237
|
-
rescue
|
238
|
-
# 예외 발생 시 다른 방법으로 셀레니움 실행
|
239
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
240
|
-
end
|
241
|
-
else
|
242
|
-
begin
|
243
|
-
# Proxy를 사용하는 경우
|
244
|
-
options = Selenium::WebDriver::Chrome::Options.new
|
245
|
-
options.add_argument '--proxy-server=' + proxy.to_s.force_encoding('utf-8')
|
246
|
-
options.page_load_strategy = :normal
|
247
|
-
options.timeouts = { page_load: 20_000 }
|
248
|
-
options.page_load_strategy = 'none'
|
249
|
-
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
250
|
-
|
251
|
-
options.add_argument('--remote-debugging-port=9222')
|
252
|
-
options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
|
253
|
-
|
254
|
-
# :capabilities에 options를 배열로 전달
|
255
|
-
capabilities = [options]
|
256
|
-
|
257
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
258
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
259
|
-
rescue => e
|
260
|
-
puts 'proxy error...'
|
261
218
|
begin
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
capabilities = [options]
|
273
|
-
|
274
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
219
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
220
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
221
|
+
options.page_load_strategy = :normal
|
222
|
+
options.timeouts = {page_load: 20_000}
|
223
|
+
options.page_load_strategy = 'none'
|
224
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
225
|
+
options.add_argument('--disable-gpu')
|
226
|
+
options.add_argument('--remote-debugging-port=9222')
|
227
|
+
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
228
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
275
229
|
rescue
|
276
|
-
|
277
|
-
|
230
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
231
|
+
end
|
232
|
+
else
|
233
|
+
begin
|
234
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
235
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
236
|
+
# profile = Selenium::WebDriver::Chrome::Profile.new
|
237
|
+
# profile['network.proxy.type'] = 1
|
238
|
+
# profile['network.proxy.http'] = proxy.split(':')[0]
|
239
|
+
# profile['network.proxy.http_port'] = proxy.split(':')[1].to_i
|
240
|
+
# options = Selenium::WebDriver::Chrome::Options.new
|
241
|
+
# options.profile = profile
|
242
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
243
|
+
options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
|
244
|
+
options.page_load_strategy = :normal
|
245
|
+
options.timeouts = {page_load: 20_000}
|
246
|
+
options.page_load_strategy = 'none'
|
247
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
248
|
+
options.add_argument('--disable-gpu')
|
249
|
+
options.add_argument('--remote-debugging-port=9222')
|
250
|
+
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
251
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
252
|
+
rescue => e
|
253
|
+
puts e
|
254
|
+
puts 'proxy error...'
|
255
|
+
begin
|
256
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
257
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
258
|
+
options.page_load_strategy = :normal
|
259
|
+
options.timeouts = {page_load: 20_000}
|
260
|
+
options.page_load_strategy = 'none'
|
261
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
262
|
+
options.add_argument('--disable-gpu')
|
263
|
+
options.add_argument('--remote-debugging-port=9222')
|
264
|
+
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
265
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
266
|
+
rescue
|
267
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
268
|
+
end
|
278
269
|
end
|
279
|
-
end
|
280
270
|
end
|
281
|
-
|
271
|
+
end
|
282
272
|
|
283
273
|
|
284
274
|
|
@@ -1443,63 +1433,71 @@ class Naver
|
|
1443
1433
|
puts '카테고리 error'
|
1444
1434
|
puts e33
|
1445
1435
|
end
|
1446
|
-
sleep(
|
1436
|
+
sleep(1)
|
1447
1437
|
tags2 = option['tag'].to_s
|
1448
1438
|
tag_mm2 = Array.new
|
1449
1439
|
tags2.split(',').each do |tag_value|
|
1450
1440
|
tag_mm2 << ''+tag_value
|
1451
1441
|
end
|
1452
1442
|
@driver.find_element(:xpath, '//*[@id="tag-input"]').send_keys(tag_mm2.join("\n")+"\n")
|
1453
|
-
sleep(
|
1443
|
+
sleep(1)
|
1454
1444
|
# 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=="}'
|
1455
1445
|
if option['공개'] == '2'
|
1456
1446
|
@driver.find_element(:xpath ,'//*[@for="open_public"]').click #공개버튼
|
1447
|
+
sleep(1)
|
1457
1448
|
elsif option['공개'] == '3'
|
1458
1449
|
@driver.find_element(:xpath, '//*[@for="open_both_neighbor"]').click #서이웃 공개
|
1450
|
+
sleep(1)
|
1459
1451
|
elsif option['공개'] == '0'
|
1460
1452
|
@driver.find_element(:xpath, '//*[@for="open_private"]').click #비공개
|
1453
|
+
sleep(1)
|
1461
1454
|
else
|
1462
1455
|
@driver.find_element(:xpath, '//*[@for="open_neighbor"]').click #이웃공개
|
1456
|
+
sleep(1)
|
1463
1457
|
end
|
1464
1458
|
|
1465
|
-
|
1459
|
+
|
1466
1460
|
if option['댓글허용'] == 'true'
|
1467
1461
|
|
1468
1462
|
else
|
1469
1463
|
@driver.find_element(:xpath, '//*[@for="publish-option-comment"]').click
|
1464
|
+
sleep(1)
|
1470
1465
|
end
|
1471
|
-
|
1466
|
+
|
1472
1467
|
|
1473
1468
|
if option['검색허용'] == 'true'
|
1474
1469
|
|
1475
1470
|
else
|
1476
1471
|
@driver.find_element(:xpath, '//*[@for="publish-option-search"]').click
|
1472
|
+
sleep(1)
|
1477
1473
|
end
|
1478
|
-
|
1474
|
+
|
1479
1475
|
|
1480
1476
|
if option['공감허용'] == 'true'
|
1481
1477
|
|
1482
1478
|
else
|
1483
1479
|
@driver.find_element(:xpath, '//*[@for="publish-option-sympathy"]').click
|
1480
|
+
sleep(1)
|
1484
1481
|
end
|
1485
|
-
|
1482
|
+
|
1486
1483
|
|
1487
1484
|
if option['블로그공유'] == '2'
|
1488
1485
|
|
1489
1486
|
else
|
1490
1487
|
@driver.find_element(:xpath, '//*[@for="publish-option-scrap"]').click
|
1488
|
+
sleep(1)
|
1491
1489
|
end
|
1492
|
-
|
1490
|
+
|
1493
1491
|
|
1494
1492
|
if option['외부공유허용'] == 'true'
|
1495
1493
|
@driver.find_element(:xpath, '//*[@for="publish-option-outside"]').click
|
1494
|
+
sleep(1)
|
1496
1495
|
else
|
1497
1496
|
|
1498
1497
|
end
|
1499
|
-
|
1498
|
+
|
1500
1499
|
# puts data['documentModel'] = data['documentModel'].to_json
|
1501
1500
|
|
1502
|
-
|
1503
1501
|
if option['발행'] == '2' #저장
|
1504
1502
|
sleep(dd_time.to_i)
|
1505
1503
|
@driver.find_element(:xpath, '//*[@class="save_btn__bzc5B"]').click
|
@@ -1702,18 +1700,10 @@ class Wordpress
|
|
1702
1700
|
|
1703
1701
|
def get_naver_text(q)
|
1704
1702
|
begin
|
1705
|
-
|
1706
|
-
|
1707
|
-
capabilities = [options]
|
1708
|
-
|
1709
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1710
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1703
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1704
|
+
@driver = Selenium::WebDriver.for :chrome
|
1711
1705
|
rescue
|
1712
|
-
|
1713
|
-
capabilities = [options]
|
1714
|
-
|
1715
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1716
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1706
|
+
@driver = Selenium::WebDriver.for :chrome
|
1717
1707
|
end
|
1718
1708
|
@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')
|
1719
1709
|
noko = Nokogiri::HTML(@driver.page_source)
|
@@ -1743,18 +1733,10 @@ class Wordpress
|
|
1743
1733
|
|
1744
1734
|
def get_naver_text2(keyword)
|
1745
1735
|
begin
|
1746
|
-
|
1747
|
-
|
1748
|
-
capabilities = [options]
|
1749
|
-
|
1750
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1751
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1736
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1737
|
+
@driver = Selenium::WebDriver.for :chrome
|
1752
1738
|
rescue
|
1753
|
-
|
1754
|
-
capabilities = [options]
|
1755
|
-
|
1756
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1757
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1739
|
+
@driver = Selenium::WebDriver.for :chrome
|
1758
1740
|
end
|
1759
1741
|
@driver.get('https://search.naver.com/search.naver?ssc=tab.blog.all&sm=tab_jum&query='+keyword.to_s)
|
1760
1742
|
for n3 in 1..10
|
@@ -1796,26 +1778,10 @@ class Wordpress
|
|
1796
1778
|
@user_id = user_id
|
1797
1779
|
@user_pw = user_pw
|
1798
1780
|
begin
|
1799
|
-
|
1800
|
-
|
1801
|
-
options.page_load_strategy = :normal
|
1802
|
-
options.timeouts = {page_load: 20_000}
|
1803
|
-
options.page_load_strategy = 'none'
|
1804
|
-
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
1805
|
-
|
1806
|
-
options.add_argument('--remote-debugging-port=9222')
|
1807
|
-
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
1808
|
-
# :capabilities에 options를 배열로 전달
|
1809
|
-
capabilities = [options]
|
1810
|
-
|
1811
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1812
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1781
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1782
|
+
@driver = Selenium::WebDriver.for :chrome
|
1813
1783
|
rescue
|
1814
|
-
|
1815
|
-
capabilities = [options]
|
1816
|
-
|
1817
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1818
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1784
|
+
@driver = Selenium::WebDriver.for :chrome
|
1819
1785
|
end
|
1820
1786
|
end
|
1821
1787
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nblog_duo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.50
|
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
|