posting_duo 0.0.20 → 0.0.21

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 +91 -107
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e469ebd49b2afedc9471484dc2952dbc1fac647c7039b535a2747e581640b584
4
- data.tar.gz: 5e7d4890c4ca08b7665f486cdf1bdcf9d79a521d6f1f96de8b4c2332ed4a8cf2
3
+ metadata.gz: 3a1d381bbdbc9f2b7f47c779694e7bf555d824faaf288f75877428c0d993ae51
4
+ data.tar.gz: 437b85885d99f819903f2385d99184d0bf224299958c06d21a8b13664686c74e
5
5
  SHA512:
6
- metadata.gz: 4e1f8d270d1d2d6554d217f1b6b4171bdb08418514b0a98df4008a3967670b36c2a0750d61849013411183ba78fa36ec0c43f66e4a6f9b1a165cbdd988651408
7
- data.tar.gz: 51107cf0930ef09d2807d415b23151551512bbcc0eb9bc7314ebe5caa68133da36ad50842c2bc71f74766dc003de1adf0d9ca519a44d6a14b74b668296c3be06
6
+ metadata.gz: 6cf241441a31cffd7c61599b7b8cac0bfef025e576aa50506169ad66ad8698af04e873fab9008447d57662fe73add1a644112d1e998b9bbc73f44fac806d9ca9
7
+ data.tar.gz: a3609720dbad0294d129b9b68be21f583c28457ef4d839de644122a69c6eb6f5c5d79f9f42bd054d6e031814beb05e72f4c43e4af08eed2d864f89de7b333db9
data/lib/posting_duo.rb CHANGED
@@ -30,116 +30,100 @@ 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')
33
+ def chrome_start(proxy, chromedriver_path = './chromedriver.exe')
34
+ # 지정된 ChromeDriver 경로
35
+ chromedriver_path ||= './chromedriver.exe' # 기본값은 './chromedriver.exe'
36
+
37
+ if proxy == ''
38
+ begin
39
+ # ChromeDriver 경로 설정
40
+ Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
42
41
 
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
-
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
42
+ options = Selenium::WebDriver::Chrome::Options.new
43
+ options.add_extension('./crx/free.crx')
44
+ options.add_extension('./crx/app.crx')
45
+
46
+ options.add_argument('--start-maximized')
47
+ 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
+ options.add_argument('--disable-blink-features=AutomationControlled')
49
+ options.add_argument('--ignore-certificate-errors')
50
+ options.add_argument('--disable-web-security')
51
+ options.add_argument('--allow-running-insecure-content')
52
+ options.add_argument('--no-sandbox')
53
+
54
+ # 자동화된 테스트 제거
55
+ options.exclude_switches = ['enable-automation']
56
+
57
+ options.add_preference("profile.password_manager_enabled", false)
58
+ options.add_preference("credentials_enable_service", false)
59
+ options.add_preference("profile.default_content_setting_values.notifications", 2)
60
+ options.add_argument("--disable-save-password-bubble")
61
+
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}"
69
+ capabilities = [options]
70
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
71
+ end
72
+ else
73
+ begin
74
+ puts '프록시 연결합니다.......'.magenta
75
+ options = Selenium::WebDriver::Chrome::Options.new
76
+ options.add_argument '--proxy-server=' + proxy.to_s.force_encoding('utf-8').to_s
77
+ options.add_extension('./crx/free.crx')
78
+ options.add_extension('./crx/app.crx')
79
+
80
+ options.add_argument('--start-maximized')
81
+ 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
+ options.add_argument('--disable-blink-features=AutomationControlled')
83
+ options.add_argument('--ignore-certificate-errors')
84
+ options.add_argument('--disable-web-security')
85
+ options.add_argument('--allow-running-insecure-content')
86
+ options.add_argument('--no-sandbox')
87
+
88
+ # 자동화된 테스트 제거
89
+ options.exclude_switches = ['enable-automation']
90
+
91
+ options.add_preference("profile.password_manager_enabled", false)
92
+ options.add_preference("credentials_enable_service", false)
93
+ options.add_preference("profile.default_content_setting_values.notifications", 2)
94
+ options.add_argument("--disable-save-password-bubble")
95
+
96
+ capabilities = [options]
97
+
98
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
99
+ rescue => e
100
+ puts "Proxy error: #{e.message}"
101
+ # ChromeDriver 경로를 수동으로 설정하여 다시 시도
102
+ Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
103
+
104
+ options.add_extension('./crx/free.crx')
105
+ options.add_extension('./crx/app.crx')
106
+
107
+ options.add_argument('--start-maximized')
108
+ 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
+ options.add_argument('--disable-blink-features=AutomationControlled')
110
+ options.add_argument('--ignore-certificate-errors')
111
+ options.add_argument('--disable-web-security')
112
+ options.add_argument('--allow-running-insecure-content')
113
+ options.add_argument('--no-sandbox')
114
+
115
+ options.exclude_switches = ['enable-automation']
116
+ options.add_preference("profile.password_manager_enabled", false)
117
+ options.add_preference("credentials_enable_service", false)
118
+ options.add_preference("profile.default_content_setting_values.notifications", 2)
119
+ options.add_argument("--disable-save-password-bubble")
120
+
121
+ capabilities = [options]
122
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
141
123
  end
124
+ end
142
125
  end
126
+ end
143
127
 
144
128
 
145
129
 
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.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon