posting_duo 0.0.21 → 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/posting_duo.rb +43 -21
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a1d381bbdbc9f2b7f47c779694e7bf555d824faaf288f75877428c0d993ae51
4
- data.tar.gz: 437b85885d99f819903f2385d99184d0bf224299958c06d21a8b13664686c74e
3
+ metadata.gz: b6639fa7199457678f6b456143918acb91db92f3e2fef2ec93fce985ffa58b68
4
+ data.tar.gz: 9dded0877cf24889bf0e883dcb13b3c9c378cd44824e90e7183a07c715b4591b
5
5
  SHA512:
6
- metadata.gz: 6cf241441a31cffd7c61599b7b8cac0bfef025e576aa50506169ad66ad8698af04e873fab9008447d57662fe73add1a644112d1e998b9bbc73f44fac806d9ca9
7
- data.tar.gz: a3609720dbad0294d129b9b68be21f583c28457ef4d839de644122a69c6eb6f5c5d79f9f42bd054d6e031814beb05e72f4c43e4af08eed2d864f89de7b333db9
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
- def chrome_start(proxy, chromedriver_path = './chromedriver.exe')
34
- # 지정된 ChromeDriver 경로
35
- chromedriver_path ||= './chromedriver.exe' # 기본값은 './chromedriver.exe'
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
- # ChromeDriver 경로 설정
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
- capabilities = [options]
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
- # ChromeDriver 경로를 수동으로 설정하여 다시 시도
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
 
@@ -123,7 +146,6 @@ class Naver
123
146
  end
124
147
  end
125
148
  end
126
- end
127
149
 
128
150
 
129
151
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posting_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
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-09 00:00:00.000000000 Z
11
+ date: 2025-01-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com