posting_zon 0.0.20 → 0.0.27

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_zon.rb +116 -107
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 803c059efe6512bfdbdef05938844737d3dca5b9c62ffb8fa0125cdeef9fb634
4
- data.tar.gz: e9cee93045e8b3a55c3a1118ce7ecef9c27c3de6b33f45600498d1fd0e3995cd
3
+ metadata.gz: 80aa6a04418a61ac2f863743a18a59f1afc3f2c1f2e25f7862348f5d5f7a2afb
4
+ data.tar.gz: 1593612b895f5f99d9084660ee3f3969a543033d5bbd1fef232de3d69bde5cbb
5
5
  SHA512:
6
- metadata.gz: 9f1991df25a5b8feefde4a13ad844c5a112fb2e8459b62ffa7f51c99694f30fa6285355ba92708a70cc2efed58ab499f12a6eb00487983e077654cee4051cee0
7
- data.tar.gz: 72530855f775bdc9d7c21595b88764c007789e5c353f5f33eb69355aeecce891974b42d4ba5c3d034cee7818e8570982a257e0d25eb102bcca18e40b385141a1
6
+ metadata.gz: ddc203732bb8fd06ff1dc77df7dfba4ef6cd18c18bd8bd82c96518069f0e2667140ad4135925f953e2a2065173e7be765829da5cac67bbfed54b18b1221bcd86
7
+ data.tar.gz: 59beba6ce2474ad5669a9e9a44c8b39dc0b35f46568402ee338ce8bf92adfcd34d474f1bbe107b737731ab1681005b434b815f7c5be4c7b5e2b011b221ad12c6
data/lib/posting_zon.rb CHANGED
@@ -30,115 +30,124 @@ require 'watir'
30
30
  #driver.find_element(:class_name, 'highlight-java')
31
31
 
32
32
  class Naver
33
-
34
- def chrome_start(proxy)
35
- if proxy == ''
36
- begin
37
- #Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
38
-
39
- options = Selenium::WebDriver::Chrome::Options.new #(options: {"excludeSwitches" => ["enable-automation"]}) #자동화된 테스트...제거(options: {"excludeSwitches" => ["enable-automation"]})
40
- options.add_extension('./crx/free.crx')
41
- options.add_extension('./crx/app.crx')
42
-
43
- options.add_argument('--start-maximized')
44
- 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 위조
45
- options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
46
- options.add_argument('--ignore-certificate-errors') #SSL 인증서 오류를 무시하도록 설정합니다
47
- options.add_argument('--disable-web-security') #웹 보안을 비활성화합니다
48
- options.add_argument('--allow-running-insecure-content') #HTTPS 사이트에서 HTTP 컨텐츠를 실행할 수 있도록 허용합니다.
49
- options.add_argument('--no-sandbox') #Chrome에서 샌드박스 모드를 비활성화합니다.
50
-
51
- # 자동화된 테스트 제거
52
- options.exclude_switches = ['enable-automation']
53
-
54
- options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
55
- options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
56
- #options.add_preference("profile.managed_default_content_settings.cookies", 2) # 쿠키 관련 팝업 차단
57
- options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
58
- options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
59
- # `capabilities` 사용
60
- capabilities = [options]
61
-
62
- # 드라이버 초기화 (capabilities 사용)
63
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
64
-
65
- rescue
66
- # `capabilities` 사용
67
- capabilities = [options]
68
33
 
69
- # 드라이버 초기화 (capabilities 사용)
70
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
71
- end
72
- else
73
- begin
74
- puts '프록시 연결합니다.......'.magenta
75
- puts '프록시 연결시 프록시 서버에 의해 인터넷속도가 낮아질수있어.......'.magenta
76
- puts '원활한 작업이 되지않을수있습니다.......'.magenta
77
- #Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
78
- options = Selenium::WebDriver::Chrome::Options.new
79
- options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
80
- options.add_extension('./crx/free.crx')
81
- options.add_extension('./crx/app.crx')
82
-
83
- options.add_argument('--start-maximized')
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') # user-agent 위조
85
- options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
86
- options.add_argument('--ignore-certificate-errors') #SSL 인증서 오류를 무시하도록 설정합니다
87
- options.add_argument('--disable-web-security') #웹 보안을 비활성화합니다
88
- options.add_argument('--allow-running-insecure-content') #HTTPS 사이트에서 HTTP 컨텐츠를 실행할 수 있도록 허용합니다.
89
- options.add_argument('--no-sandbox') #Chrome에서 샌드박스 모드를 비활성화합니다.
90
-
91
- # 자동화된 테스트 제거
92
- options.exclude_switches = ['enable-automation']
93
-
94
- options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
95
- options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
96
- #options.add_preference("profile.managed_default_content_settings.cookies", 2) # 쿠키 관련 팝업 차단
97
- options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
98
- options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
99
- # `capabilities` 사용
100
- capabilities = [options]
101
-
102
- # 드라이버 초기화 (capabilities 사용)
103
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
104
- rescue => e
105
- puts e
106
- puts 'proxy error...'
107
- begin
108
- #Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
109
- options.add_extension('./crx/free.crx')
110
- options.add_extension('./crx/app.crx')
111
-
112
- options.add_argument('--start-maximized')
113
- 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 위조
114
- options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
115
- options.add_argument('--ignore-certificate-errors') #SSL 인증서 오류를 무시하도록 설정합니다
116
- options.add_argument('--disable-web-security') #웹 보안을 비활성화합니다
117
- options.add_argument('--allow-running-insecure-content') #HTTPS 사이트에서 HTTP 컨텐츠를 실행할 수 있도록 허용합니다.
118
- options.add_argument('--no-sandbox') #Chrome에서 샌드박스 모드를 비활성화합니다.
119
-
120
- # 자동화된 테스트 제거
121
- options.exclude_switches = ['enable-automation']
122
-
123
- options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
124
- options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
125
- #options.add_preference("profile.managed_default_content_settings.cookies", 2) # 쿠키 관련 팝업 차단
126
- options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
127
- options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
128
- # `capabilities` 사용
129
- capabilities = [options]
130
-
131
- # 드라이버 초기화 (capabilities 사용)
132
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
133
- rescue
134
- # `capabilities` 사용
135
- capabilities = [options]
136
-
137
- # 드라이버 초기화 (capabilities 사용)
138
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
139
- end
140
- end
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
+ puts "인터넷 창이 열리고 작업을 한다면 위 항목은 패스해주세요."
48
+ # 예외가 발생하면 수동 경로 사용
49
+ Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
50
+ end
51
+
52
+ if proxy == ''
53
+ begin
54
+ # Chrome 옵션 설정
55
+ options = Selenium::WebDriver::Chrome::Options.new
56
+ options.add_extension('./crx/free.crx')
57
+ options.add_extension('./crx/app.crx')
58
+ options.add_argument('--disable-gpu')
59
+ options.add_argument('--start-maximized')
60
+ 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 위조
61
+ options.add_argument('--disable-blink-features=AutomationControlled') # 자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
62
+ options.add_argument('--ignore-certificate-errors') # SSL 인증서 오류 무시
63
+ options.add_argument('--disable-web-security') # 보안 비활성화
64
+ options.add_argument('--allow-running-insecure-content') # HTTPS 사이트에서 HTTP 컨텐츠 실행 허용
65
+ options.add_argument('--no-sandbox') # 샌드박스 모드 비활성화
66
+
67
+ options.exclude_switches = ['enable-automation'] # 자동화 테스트 제거
68
+ options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
69
+ options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
70
+ options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
71
+ options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
72
+
73
+ # 드라이버 초기화
74
+ capabilities = [options]
75
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
76
+ rescue => e
77
+ puts "Error during initialization: #{e.message}"
78
+ # 예외 발생 시, 수동으로 chromedriver 경로 설정
79
+ Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
80
+ options = Selenium::WebDriver::Chrome::Options.new
81
+ options.add_extension('./crx/free.crx')
82
+ options.add_extension('./crx/app.crx')
83
+ options.add_argument('--disable-gpu')
84
+ options.add_argument('--start-maximized')
85
+ 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')
86
+ options.add_argument('--disable-blink-features=AutomationControlled')
87
+ options.add_argument('--ignore-certificate-errors')
88
+ options.add_argument('--disable-web-security')
89
+ options.add_argument('--allow-running-insecure-content')
90
+ options.add_argument('--no-sandbox')
91
+
92
+ options.exclude_switches = ['enable-automation']
93
+ options.add_preference("profile.password_manager_enabled", false)
94
+ options.add_preference("credentials_enable_service", false)
95
+ options.add_preference("profile.default_content_setting_values.notifications", 2)
96
+ options.add_argument("--disable-save-password-bubble")
97
+
98
+ # 드라이버 초기화
99
+ capabilities = [options]
100
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
141
101
  end
102
+ else
103
+ begin
104
+ puts '프록시 연결합니다.......'.magenta
105
+ options = Selenium::WebDriver::Chrome::Options.new
106
+ options.add_argument '--proxy-server=' + proxy.to_s.force_encoding('utf-8').to_s
107
+ options.add_extension('./crx/free.crx')
108
+ options.add_extension('./crx/app.crx')
109
+ options.add_argument('--disable-gpu')
110
+ options.add_argument('--start-maximized')
111
+ 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')
112
+ options.add_argument('--disable-blink-features=AutomationControlled')
113
+ options.add_argument('--ignore-certificate-errors')
114
+ options.add_argument('--disable-web-security')
115
+ options.add_argument('--allow-running-insecure-content')
116
+ options.add_argument('--no-sandbox')
117
+
118
+ options.exclude_switches = ['enable-automation']
119
+ options.add_preference("profile.password_manager_enabled", false)
120
+ options.add_preference("credentials_enable_service", false)
121
+ options.add_preference("profile.default_content_setting_values.notifications", 2)
122
+ options.add_argument("--disable-save-password-bubble")
123
+
124
+ capabilities = [options]
125
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
126
+ rescue => e
127
+ puts "Proxy error: #{e.message}"
128
+ # 예외 발생 시 수동으로 chromedriver 경로 설정
129
+ Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
130
+ options.add_extension('./crx/free.crx')
131
+ options.add_extension('./crx/app.crx')
132
+ options.add_argument('--disable-gpu')
133
+ options.add_argument('--start-maximized')
134
+ 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')
135
+ options.add_argument('--disable-blink-features=AutomationControlled')
136
+ options.add_argument('--ignore-certificate-errors')
137
+ options.add_argument('--disable-web-security')
138
+ options.add_argument('--allow-running-insecure-content')
139
+ options.add_argument('--no-sandbox')
140
+
141
+ options.exclude_switches = ['enable-automation']
142
+ options.add_preference("profile.password_manager_enabled", false)
143
+ options.add_preference("credentials_enable_service", false)
144
+ options.add_preference("profile.default_content_setting_values.notifications", 2)
145
+ options.add_argument("--disable-save-password-bubble")
146
+
147
+ capabilities = [options]
148
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
149
+ end
150
+ end
142
151
  end
143
152
 
144
153
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posting_zon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.27
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: posting app
14
14
  email: mymin26@naver.com