posting_duo 0.0.22 → 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/posting_duo.rb +43 -21
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6639fa7199457678f6b456143918acb91db92f3e2fef2ec93fce985ffa58b68
|
4
|
+
data.tar.gz: 9dded0877cf24889bf0e883dcb13b3c9c378cd44824e90e7183a07c715b4591b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e17c835fe119cf03a1cbfef260eebd0242ff09234381319a2ce0bb85ed8771af930f4b58fb8251a1d1742151ad04f3aaad0f8cb2a2e7dc05bf6bea42bf56daa
|
7
|
+
data.tar.gz: 5f84c62e6ca5588a96df1cd909b1611c510cb7bf23018dd708749558c672259771b58898a7587eaab22d948300b1f14f7de34c64118fae29a665fe287790fd20
|
data/lib/posting_duo.rb
CHANGED
@@ -30,15 +30,50 @@ require 'watir'
|
|
30
30
|
#driver.find_element(:class_name, 'highlight-java')
|
31
31
|
|
32
32
|
class Naver
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
|
34
|
+
def chrome_start(proxy)
|
35
|
+
# ChromeDriver 경로 수동 지정
|
36
|
+
chromedriver_path = './chromedriver.exe'
|
37
|
+
|
38
|
+
# 웹드라이버 자동 업데이트 시도
|
39
|
+
begin
|
40
|
+
# webdrivers가 사용자의 Chrome 버전에 맞는 chromedriver 다운로드 시도
|
41
|
+
Webdrivers::Chromedriver.update # 자동 업데이트 시도
|
42
|
+
rescue => e
|
43
|
+
puts "webdrivers에서 chromedriver 다운로드 실패: #{e.message}"
|
44
|
+
puts "수동으로 './chromedriver.exe' 사용하도록 설정합니다."
|
45
|
+
# 예외가 발생하면 수동 경로 사용
|
46
|
+
Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
|
47
|
+
end
|
48
|
+
|
37
49
|
if proxy == ''
|
38
50
|
begin
|
39
|
-
#
|
51
|
+
# Chrome 옵션 설정
|
52
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
53
|
+
options.add_extension('./crx/free.crx')
|
54
|
+
options.add_extension('./crx/app.crx')
|
55
|
+
|
56
|
+
options.add_argument('--start-maximized')
|
57
|
+
options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.59 Safari/537.36') # user-agent 위조
|
58
|
+
options.add_argument('--disable-blink-features=AutomationControlled') # 자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
59
|
+
options.add_argument('--ignore-certificate-errors') # SSL 인증서 오류 무시
|
60
|
+
options.add_argument('--disable-web-security') # 웹 보안 비활성화
|
61
|
+
options.add_argument('--allow-running-insecure-content') # HTTPS 사이트에서 HTTP 컨텐츠 실행 허용
|
62
|
+
options.add_argument('--no-sandbox') # 샌드박스 모드 비활성화
|
63
|
+
|
64
|
+
options.exclude_switches = ['enable-automation'] # 자동화 테스트 제거
|
65
|
+
options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
|
66
|
+
options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
|
67
|
+
options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
|
68
|
+
options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
|
69
|
+
|
70
|
+
# 드라이버 초기화
|
71
|
+
capabilities = [options]
|
72
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
73
|
+
rescue => e
|
74
|
+
puts "Error during initialization: #{e.message}"
|
75
|
+
# 예외 발생 시, 수동으로 chromedriver 경로 설정
|
40
76
|
Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
|
41
|
-
|
42
77
|
options = Selenium::WebDriver::Chrome::Options.new
|
43
78
|
options.add_extension('./crx/free.crx')
|
44
79
|
options.add_extension('./crx/app.crx')
|
@@ -51,21 +86,13 @@ class Naver
|
|
51
86
|
options.add_argument('--allow-running-insecure-content')
|
52
87
|
options.add_argument('--no-sandbox')
|
53
88
|
|
54
|
-
# 자동화된 테스트 제거
|
55
89
|
options.exclude_switches = ['enable-automation']
|
56
|
-
|
57
90
|
options.add_preference("profile.password_manager_enabled", false)
|
58
91
|
options.add_preference("credentials_enable_service", false)
|
59
92
|
options.add_preference("profile.default_content_setting_values.notifications", 2)
|
60
93
|
options.add_argument("--disable-save-password-bubble")
|
61
94
|
|
62
|
-
|
63
|
-
|
64
|
-
# 드라이버 초기화 (capabilities 사용)
|
65
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
66
|
-
|
67
|
-
rescue => e
|
68
|
-
puts "Error during initialization: #{e.message}"
|
95
|
+
# 드라이버 초기화
|
69
96
|
capabilities = [options]
|
70
97
|
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
71
98
|
end
|
@@ -85,22 +112,18 @@ class Naver
|
|
85
112
|
options.add_argument('--allow-running-insecure-content')
|
86
113
|
options.add_argument('--no-sandbox')
|
87
114
|
|
88
|
-
# 자동화된 테스트 제거
|
89
115
|
options.exclude_switches = ['enable-automation']
|
90
|
-
|
91
116
|
options.add_preference("profile.password_manager_enabled", false)
|
92
117
|
options.add_preference("credentials_enable_service", false)
|
93
118
|
options.add_preference("profile.default_content_setting_values.notifications", 2)
|
94
119
|
options.add_argument("--disable-save-password-bubble")
|
95
120
|
|
96
121
|
capabilities = [options]
|
97
|
-
|
98
122
|
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
99
123
|
rescue => e
|
100
124
|
puts "Proxy error: #{e.message}"
|
101
|
-
#
|
125
|
+
# 예외 발생 시 수동으로 chromedriver 경로 설정
|
102
126
|
Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
|
103
|
-
|
104
127
|
options.add_extension('./crx/free.crx')
|
105
128
|
options.add_extension('./crx/app.crx')
|
106
129
|
|
@@ -125,7 +148,6 @@ class Naver
|
|
125
148
|
end
|
126
149
|
|
127
150
|
|
128
|
-
|
129
151
|
|
130
152
|
|
131
153
|
def login(proxy)
|