njongto_duo 0.0.7 → 0.0.30
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/njongto_duo.rb +55 -101
- 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: 757c4b20c244d01bf8faa8b57f4c83744a9960b1a439235227ca8822f72464a8
|
4
|
+
data.tar.gz: d4dca6482b460da6223cd97aab43704ad373b25f61b07e3104d22a83f4f39c18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32762708020522233b41c37c1e04c54d46f95ad24daf4c0ce361bf36fe4bc689cb3fb1ef307db5672c60ca135d3be8761ca8af1f56d06de469868fdaddf7a411
|
7
|
+
data.tar.gz: 9bb8263673b63595900509ef7e3a38c20bc899ace8f126d2df3c9b1181524ca7f27f2a656951e6379570ec575ea31171899fc89cbaf113b7d12a32a0071699f0
|
data/lib/njongto_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'
|
@@ -21,6 +21,7 @@ include AutoClickMethods
|
|
21
21
|
using Rainbow
|
22
22
|
include Glimmer
|
23
23
|
|
24
|
+
|
24
25
|
class Naver
|
25
26
|
def initialize
|
26
27
|
@seed = 1
|
@@ -34,91 +35,61 @@ class Naver
|
|
34
35
|
def chrome_start(proxy, user_id)
|
35
36
|
naver_cookie_dir = "C:/naver_cookie"
|
36
37
|
FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
|
37
|
-
# ChromeDriver 경로 수동 지정
|
38
|
-
chromedriver_path = './chromedriver.exe'
|
39
|
-
|
40
|
-
# 웹드라이버 자동 업데이트 시도
|
41
|
-
begin
|
42
|
-
# webdrivers가 사용자의 Chrome 버전에 맞는 chromedriver 다운로드 시도
|
43
|
-
Webdrivers::Chromedriver.update # 자동 업데이트 시도
|
44
|
-
rescue => e
|
45
|
-
puts "webdrivers에서 chromedriver 다운로드 실패: #{e.message}"
|
46
|
-
puts "자동으로 chromedriver.exe 사용합니다."
|
47
|
-
puts "만일 프로그램 폴더안에 chromedriver.exe 버전이 맞지 않거나 없는 경우 인터넷창이 깜빡하고 닫히거나 열리지 않는경우에만 아래 안내를 따라주세요."
|
48
|
-
puts "https://storage.googleapis.com/chrome-for-testing-public/사용자크롬버전/win32/chromedriver-win32.zip 링크를 복사 후 복사 된 링크 중(사용자크롬버전) 부분을 크롬 사용자의 버전(예:131.0.6778.264)으로 수정 후 주소입력 부분에 넣어 엔터 후 다운로드 하고 압축을 풀고 chromedriver.exe 파일만 프로그램 폴더안에 넣어주세요."
|
49
|
-
puts "인터넷 창이 열리고 작업을 한다면 위 항목은 패스해주세요."
|
50
|
-
# 예외가 발생하면 수동 경로 사용
|
51
|
-
Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
|
52
|
-
end
|
53
|
-
|
54
38
|
if proxy == ''
|
55
|
-
begin
|
56
|
-
# webdrivers Gem이 크롬 드라이버 자동 다운로드 및 설정을 관리함
|
57
|
-
options = Selenium::WebDriver::Chrome::Options.new
|
58
|
-
options.page_load_strategy = :normal
|
59
|
-
options.timeouts = { page_load: 20_000 }
|
60
|
-
options.page_load_strategy = 'none'
|
61
|
-
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
options.add_argument('--remote-debugging-port=9222')
|
66
|
-
options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
|
67
|
-
|
68
|
-
# :capabilities에 options를 배열로 전달
|
69
|
-
capabilities = [options]
|
70
|
-
|
71
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
72
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
73
|
-
rescue
|
74
|
-
options = Selenium::WebDriver::Chrome::Options.new
|
75
|
-
capabilities = [options]
|
76
|
-
# 예외 발생 시 다른 방법으로 셀레니움 실행
|
77
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
78
|
-
end
|
79
|
-
else
|
80
|
-
begin
|
81
|
-
# Proxy를 사용하는 경우
|
82
|
-
options = Selenium::WebDriver::Chrome::Options.new
|
83
|
-
options.add_argument '--proxy-server=' + proxy.to_s.force_encoding('utf-8')
|
84
|
-
options.page_load_strategy = :normal
|
85
|
-
options.timeouts = { page_load: 20_000 }
|
86
|
-
options.page_load_strategy = 'none'
|
87
|
-
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
88
|
-
|
89
|
-
options.add_argument('--remote-debugging-port=9222')
|
90
|
-
options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
|
91
|
-
|
92
|
-
# :capabilities에 options를 배열로 전달
|
93
|
-
capabilities = [options]
|
94
|
-
|
95
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
96
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
97
|
-
rescue => e
|
98
|
-
puts 'proxy error...'
|
99
39
|
begin
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
capabilities = [options]
|
111
|
-
|
112
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
40
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
41
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
42
|
+
options.page_load_strategy = :normal
|
43
|
+
options.timeouts = {page_load: 20_000}
|
44
|
+
options.page_load_strategy = 'none'
|
45
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
46
|
+
options.add_argument('--disable-gpu')
|
47
|
+
options.add_argument('--remote-debugging-port=9222')
|
48
|
+
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
49
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
113
50
|
rescue
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
51
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
52
|
+
end
|
53
|
+
else
|
54
|
+
begin
|
55
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
56
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
57
|
+
# profile = Selenium::WebDriver::Chrome::Profile.new
|
58
|
+
# profile['network.proxy.type'] = 1
|
59
|
+
# profile['network.proxy.http'] = proxy.split(':')[0]
|
60
|
+
# profile['network.proxy.http_port'] = proxy.split(':')[1].to_i
|
61
|
+
# options = Selenium::WebDriver::Chrome::Options.new
|
62
|
+
# options.profile = profile
|
63
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
64
|
+
options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
|
65
|
+
options.page_load_strategy = :normal
|
66
|
+
options.timeouts = {page_load: 20_000}
|
67
|
+
options.page_load_strategy = 'none'
|
68
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
69
|
+
options.add_argument('--disable-gpu')
|
70
|
+
options.add_argument('--remote-debugging-port=9222')
|
71
|
+
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
72
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
73
|
+
rescue => e
|
74
|
+
puts e
|
75
|
+
puts 'proxy error...'
|
76
|
+
begin
|
77
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
78
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
79
|
+
options.page_load_strategy = :normal
|
80
|
+
options.timeouts = {page_load: 20_000}
|
81
|
+
options.page_load_strategy = 'none'
|
82
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
83
|
+
options.add_argument('--disable-gpu')
|
84
|
+
options.add_argument('--remote-debugging-port=9222')
|
85
|
+
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
86
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
87
|
+
rescue
|
88
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
89
|
+
end
|
118
90
|
end
|
119
|
-
end
|
120
91
|
end
|
121
|
-
|
92
|
+
end
|
122
93
|
|
123
94
|
|
124
95
|
|
@@ -456,27 +427,10 @@ class Wordpress
|
|
456
427
|
@user_id = user_id
|
457
428
|
@user_pw = user_pw
|
458
429
|
begin
|
459
|
-
|
460
|
-
|
461
|
-
options.page_load_strategy = :normal
|
462
|
-
options.timeouts = {page_load: 20_000}
|
463
|
-
options.page_load_strategy = 'none'
|
464
|
-
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
465
|
-
|
466
|
-
options.add_argument('--remote-debugging-port=9222')
|
467
|
-
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
468
|
-
# :capabilities에 options를 배열로 전달
|
469
|
-
capabilities = [options]
|
470
|
-
|
471
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
472
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
430
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
431
|
+
@driver = Selenium::WebDriver.for :chrome
|
473
432
|
rescue
|
474
|
-
|
475
|
-
# :capabilities에 options를 배열로 전달
|
476
|
-
capabilities = [options]
|
477
|
-
|
478
|
-
# Selenium WebDriver에서 options를 capabilities로 전달
|
479
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
433
|
+
@driver = Selenium::WebDriver.for :chrome
|
480
434
|
end
|
481
435
|
end
|
482
436
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: njongto_duo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.30
|
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
|