cafe_basics_duo 0.0.19 → 0.0.21
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_basics_duo.rb +81 -120
- 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: 679b20ad6abad03f4d7fe1678328d1b47d20236fe017a44adaa5b01f0d4015af
|
4
|
+
data.tar.gz: 481550c7b0decb19d722cdfde237929ba0d1e9b8e540a1188a0a66905cca53b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce479dc58f5a40f48f51d67387968159f4302a71f35a78c690aec05025f9eff10efc990c72ce899dcf63773be1380f80db175fa511543b0d1f32a72dba083541
|
7
|
+
data.tar.gz: bf5eb2bf7640dd95936a05b15b545b6c3430a4762983fdf5c07543c4357d1d79f2c9ce72955bc3e2675059aaf7a9305bf386c13193969863d38c3d267147ca92
|
data/lib/cafe_basics_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
|
|
@@ -1375,8 +1349,7 @@ class Naver
|
|
1375
1349
|
tags2.split(',').each do |tag_value|
|
1376
1350
|
tag_mm2 << ''+tag_value
|
1377
1351
|
end
|
1378
|
-
@driver.find_element(:xpath, '//*[@
|
1379
|
-
|
1352
|
+
@driver.find_element(:xpath, '//*[@placeholder="태그를 입력해주세요 (최대 10개)"]').send_keys(tag_mm2.join("\n")+"\n")
|
1380
1353
|
sleep(1)
|
1381
1354
|
# 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=="}'
|
1382
1355
|
# if option['공개'] == '2'
|
@@ -1390,15 +1363,16 @@ class Naver
|
|
1390
1363
|
# end
|
1391
1364
|
if option['댓글허용'] == 'true'
|
1392
1365
|
puts '댓글허용'
|
1366
|
+
|
1393
1367
|
begin
|
1394
1368
|
@driver.find_element(:xpath, '/html/body/div[1]/div/div/section/div/div[2]/div[2]/div[3]/ul/li[1]/div/label').click
|
1395
|
-
|
1369
|
+
sleep(1)
|
1396
1370
|
rescue
|
1397
1371
|
|
1398
1372
|
end
|
1399
1373
|
end
|
1400
1374
|
|
1401
|
-
|
1375
|
+
|
1402
1376
|
if option['블로그,카페 공유허용'] == 'true'
|
1403
1377
|
puts '블로그,카페 공유허용'
|
1404
1378
|
begin
|
@@ -1409,54 +1383,57 @@ class Naver
|
|
1409
1383
|
end
|
1410
1384
|
|
1411
1385
|
|
1412
|
-
|
1386
|
+
|
1413
1387
|
if option['외부공유허용'] == 'true'
|
1414
1388
|
puts '외부공유허용'
|
1415
1389
|
begin
|
1416
1390
|
@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
|
1391
|
+
sleep(1)
|
1417
1392
|
rescue
|
1418
1393
|
|
1419
1394
|
end
|
1420
1395
|
end
|
1421
1396
|
|
1422
|
-
|
1397
|
+
|
1423
1398
|
|
1424
1399
|
if option['복사,저장 허용'] == 'true'
|
1425
1400
|
puts '복사,저장 허용'
|
1426
1401
|
begin
|
1427
1402
|
@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
|
1428
|
-
|
1403
|
+
sleep(1)
|
1404
|
+
rescue
|
1429
1405
|
|
1406
|
+
end
|
1430
1407
|
end
|
1431
|
-
end
|
1432
1408
|
|
1433
|
-
|
1409
|
+
|
1434
1410
|
if option['자동출처 사용'] == 'true'
|
1435
1411
|
puts '자동출처 사용'
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1412
|
+
begin
|
1413
|
+
@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
|
1414
|
+
sleep(1)
|
1415
|
+
rescue
|
1439
1416
|
|
1440
|
-
|
1441
|
-
end
|
1442
|
-
|
1443
|
-
sleep(1)
|
1417
|
+
end
|
1418
|
+
end
|
1419
|
+
|
1444
1420
|
|
1445
1421
|
if option['CCL 사용'] == 'true'
|
1446
1422
|
puts 'CCL 사용'
|
1447
1423
|
begin
|
1448
1424
|
@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
|
1449
|
-
|
1450
|
-
|
1425
|
+
sleep(1)
|
1426
|
+
rescue
|
1427
|
+
|
1428
|
+
end
|
1451
1429
|
end
|
1452
|
-
|
1453
|
-
sleep(1)
|
1430
|
+
|
1454
1431
|
# puts data['documentModel'] = data['documentModel'].to_json
|
1455
1432
|
|
1456
1433
|
sleep(dd_time.to_i)
|
1457
1434
|
@driver.find_element(:xpath, '/html/body/div[1]/div/div/section/div/div[1]/div/a').click
|
1458
1435
|
|
1459
|
-
sleep(
|
1436
|
+
sleep(7)
|
1460
1437
|
|
1461
1438
|
|
1462
1439
|
begin
|
@@ -1671,18 +1648,10 @@ class Wordpress
|
|
1671
1648
|
|
1672
1649
|
def get_naver_text(q)
|
1673
1650
|
begin
|
1674
|
-
|
1675
|
-
|
1676
|
-
capabilities = [options]
|
1677
|
-
|
1678
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1679
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1651
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1652
|
+
@driver = Selenium::WebDriver.for :chrome
|
1680
1653
|
rescue
|
1681
|
-
|
1682
|
-
capabilities = [options]
|
1683
|
-
|
1684
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1685
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1654
|
+
@driver = Selenium::WebDriver.for :chrome
|
1686
1655
|
end
|
1687
1656
|
@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')
|
1688
1657
|
noko = Nokogiri::HTML(@driver.page_source)
|
@@ -1712,18 +1681,10 @@ class Wordpress
|
|
1712
1681
|
|
1713
1682
|
def get_naver_text2(keyword)
|
1714
1683
|
begin
|
1715
|
-
|
1716
|
-
|
1717
|
-
capabilities = [options]
|
1718
|
-
|
1719
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1720
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1684
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
1685
|
+
@driver = Selenium::WebDriver.for :chrome
|
1721
1686
|
rescue
|
1722
|
-
|
1723
|
-
capabilities = [options]
|
1724
|
-
|
1725
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
1726
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
1687
|
+
@driver = Selenium::WebDriver.for :chrome
|
1727
1688
|
end
|
1728
1689
|
@driver.get('https://search.naver.com/search.naver?ssc=tab.blog.all&sm=tab_jum&query='+keyword.to_s)
|
1729
1690
|
for n3 in 1..10
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_basics_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
|