posting_duo 0.0.22 → 0.0.25

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 +48 -24
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac5c3dd637d4a407e0b6599a5cd7bca5a6c90237dfe187757575787e8e695098
4
- data.tar.gz: '09a40bd0c8e262a4ef5dd96ddf12302899e4a4d5c2e7dbc5af66e0b18c3b989e'
3
+ metadata.gz: a038985fd151a9a0d2c38da3d3c2896a1d5c278118ca5a844db6c28915bb2915
4
+ data.tar.gz: b4415e47d065865d8d56bc4d72c37fdf950412a061f10759f1f797ea9508561f
5
5
  SHA512:
6
- metadata.gz: 95d434879d98dbf939c4432bd2a120cfe0c55c1f943ad31551ad8bbea053c4ba2dcf7bdcba41bada522edfb305846e7884425ff9bde53efdbb9dbb6673aa32d2
7
- data.tar.gz: 0ef70cef3e64c6636f5a8071aee0b95e3a2bc5335baa186b9afdbe279580d6ada9aa6733f11ebd03fccdc975cc0938fab7e88bf748b7f5cc144e1de081dc61ee
6
+ metadata.gz: f93926eb1fc7c4f3fb90735b0b808669e830704ca88e8ec4a78bc92f148b8a28c04d1a69b492f44ea5e798fa62f94c06e1e3012db7702a1f055b4cb826f1caf9
7
+ data.tar.gz: 5a078af1f2522d833a209426913cc94a8208850dc5df77705d11e137c7340f850186416ffb1952e6a56eb68067c04738b4caa504bb1e108dca5b37954dcb83aa
data/lib/posting_duo.rb CHANGED
@@ -30,19 +30,56 @@ 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
+ puts "만일 프로그램 폴더안에 chromedriver.exe 버전이 맞지 않거나 없는 경우"
46
+ puts "https://storage.googleapis.com/chrome-for-testing-public/사용자크롬버전/win32/chromedriver-win32.zip 링크를 복사 후 복사 된 링크 중(사용자크롬버전) 부분을 크롬 사용자의 버전(예:131.0.6778.264)으로 수정 후 주소입력 부분에 넣어 엔터 후 다운로드 하고 압축을 풀고 chromedriver.exe 파일만 프로그램 폴더안에 넣어주세요."
47
+ # 예외가 발생하면 수동 경로 사용
48
+ Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
49
+ end
50
+
37
51
  if proxy == ''
38
52
  begin
39
- # ChromeDriver 경로 설정
40
- Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
41
-
53
+ # Chrome 옵션 설정
42
54
  options = Selenium::WebDriver::Chrome::Options.new
43
55
  options.add_extension('./crx/free.crx')
44
56
  options.add_extension('./crx/app.crx')
57
+ options.add_argument('--disable-gpu')
58
+ options.add_argument('--start-maximized')
59
+ 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 위조
60
+ options.add_argument('--disable-blink-features=AutomationControlled') # 자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
61
+ options.add_argument('--ignore-certificate-errors') # SSL 인증서 오류 무시
62
+ options.add_argument('--disable-web-security') # 웹 보안 비활성화
63
+ options.add_argument('--allow-running-insecure-content') # HTTPS 사이트에서 HTTP 컨텐츠 실행 허용
64
+ options.add_argument('--no-sandbox') # 샌드박스 모드 비활성화
65
+
66
+ options.exclude_switches = ['enable-automation'] # 자동화 테스트 제거
67
+ options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
68
+ options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
69
+ options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
70
+ options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
45
71
 
72
+ # 드라이버 초기화
73
+ capabilities = [options]
74
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
75
+ rescue => e
76
+ puts "Error during initialization: #{e.message}"
77
+ # 예외 발생 시, 수동으로 chromedriver 경로 설정
78
+ Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
79
+ options = Selenium::WebDriver::Chrome::Options.new
80
+ options.add_extension('./crx/free.crx')
81
+ options.add_extension('./crx/app.crx')
82
+ options.add_argument('--disable-gpu')
46
83
  options.add_argument('--start-maximized')
47
84
  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')
48
85
  options.add_argument('--disable-blink-features=AutomationControlled')
@@ -51,21 +88,13 @@ class Naver
51
88
  options.add_argument('--allow-running-insecure-content')
52
89
  options.add_argument('--no-sandbox')
53
90
 
54
- # 자동화된 테스트 제거
55
91
  options.exclude_switches = ['enable-automation']
56
-
57
92
  options.add_preference("profile.password_manager_enabled", false)
58
93
  options.add_preference("credentials_enable_service", false)
59
94
  options.add_preference("profile.default_content_setting_values.notifications", 2)
60
95
  options.add_argument("--disable-save-password-bubble")
61
96
 
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}"
97
+ # 드라이버 초기화
69
98
  capabilities = [options]
70
99
  @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
71
100
  end
@@ -76,7 +105,7 @@ class Naver
76
105
  options.add_argument '--proxy-server=' + proxy.to_s.force_encoding('utf-8').to_s
77
106
  options.add_extension('./crx/free.crx')
78
107
  options.add_extension('./crx/app.crx')
79
-
108
+ options.add_argument('--disable-gpu')
80
109
  options.add_argument('--start-maximized')
81
110
  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')
82
111
  options.add_argument('--disable-blink-features=AutomationControlled')
@@ -85,25 +114,21 @@ class Naver
85
114
  options.add_argument('--allow-running-insecure-content')
86
115
  options.add_argument('--no-sandbox')
87
116
 
88
- # 자동화된 테스트 제거
89
117
  options.exclude_switches = ['enable-automation']
90
-
91
118
  options.add_preference("profile.password_manager_enabled", false)
92
119
  options.add_preference("credentials_enable_service", false)
93
120
  options.add_preference("profile.default_content_setting_values.notifications", 2)
94
121
  options.add_argument("--disable-save-password-bubble")
95
122
 
96
123
  capabilities = [options]
97
-
98
124
  @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
99
125
  rescue => e
100
126
  puts "Proxy error: #{e.message}"
101
- # ChromeDriver 경로를 수동으로 설정하여 다시 시도
127
+ # 예외 발생 수동으로 chromedriver 경로 설정
102
128
  Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
103
-
104
129
  options.add_extension('./crx/free.crx')
105
130
  options.add_extension('./crx/app.crx')
106
-
131
+ options.add_argument('--disable-gpu')
107
132
  options.add_argument('--start-maximized')
108
133
  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')
109
134
  options.add_argument('--disable-blink-features=AutomationControlled')
@@ -125,7 +150,6 @@ class Naver
125
150
  end
126
151
 
127
152
 
128
-
129
153
 
130
154
 
131
155
  def login(proxy)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posting_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon