tblog_zon 0.0.33 → 0.0.37
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/tblog_zon.rb +67 -68
- 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: bf47eedcd16d949cc26c11e1df7774a35d204fe3be1b4dce0fa9552ecb15f573
|
4
|
+
data.tar.gz: d878d55c3c9a52193dd4ed1aab77d21ef04213862783826f1d5afebf79dd35ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e68d89074b522b6a31c8988126d1d8c295df50d6b9e63daac3f4fcdcdcdd4c1f78e4564833d7f18706fcac0c94aa86aca02d9bb976c2013be0c3f2b545c2c91
|
7
|
+
data.tar.gz: 967c9982ee5fc281c395908199f6e69cb579e62b7eab213de0a990669c8af3a6c67cda28aa4abc257c05e211242381d38484bd0a02709620e255c3ba11d1b979
|
data/lib/tblog_zon.rb
CHANGED
@@ -248,80 +248,79 @@ class Naver
|
|
248
248
|
end
|
249
249
|
|
250
250
|
def chrome_start(proxy)
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
251
|
+
# 공통 옵션 설정
|
252
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
253
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
254
|
+
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
255
|
+
options.add_extension('./crx/app.crx') # 확장 프로그램을 첫 번째 탭에 추가
|
256
|
+
options.add_argument('--disable-blink-features=AutomationControlled')
|
257
|
+
options.add_argument('--disable-popup-blocking')
|
258
|
+
options.add_argument('--dns-prefetch-disable')
|
259
|
+
options.add_argument('--disable-dev-shm-usage')
|
260
|
+
options.add_argument('--disable-software-rasterizer')
|
261
|
+
options.add_argument('--ignore-certificate-errors')
|
262
|
+
options.add_argument('--disable-gpu') # GPU 가속 끄기
|
263
|
+
options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36') # user-agent 위조
|
264
|
+
options.add_argument('--disable-web-security')
|
265
|
+
options.add_argument('--allow-running-insecure-content')
|
266
|
+
options.add_argument('--allow-insecure-localhost')
|
267
|
+
options.add_argument('--no-sandbox')
|
268
|
+
options.add_argument('--disable-translate')
|
269
|
+
options.add_argument('--disable-extensions-file-access-check')
|
270
|
+
options.add_argument('--disable-impl-side-painting')
|
271
|
+
|
272
|
+
# 자동화된 테스트 제거
|
273
|
+
options.exclude_switches = ['enable-automation']
|
272
274
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
275
|
+
options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
|
276
|
+
options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
|
277
|
+
#options.add_preference("profile.managed_default_content_settings.cookies", 2) # 쿠키 관련 팝업 차단
|
278
|
+
options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
|
279
|
+
options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
|
280
|
+
|
281
|
+
|
282
|
+
# Proxy 설정
|
283
|
+
if proxy != ''
|
284
|
+
options.add_argument('--proxy-server=' + proxy.to_s.force_encoding('utf-8'))
|
285
|
+
end
|
281
286
|
|
287
|
+
# 브라우저 실행
|
288
|
+
begin
|
289
|
+
# 'capabilities'과 'options' 배열로 설정
|
290
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
291
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
282
292
|
|
283
|
-
|
284
|
-
|
285
|
-
options.add_argument('--proxy-server=' + proxy.to_s.force_encoding('utf-8'))
|
286
|
-
end
|
293
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
294
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
287
295
|
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
sleep(1)
|
296
|
+
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
297
|
+
|
298
|
+
sleep(1)
|
299
|
+
# 두 번째 탭에서 로그인 페이지 열기
|
300
|
+
@driver.get('https://www.tistory.com/auth/login')
|
301
|
+
sleep(1)
|
302
|
+
|
303
|
+
rescue => e
|
304
|
+
|
305
|
+
puts "Error: #{e.message}"
|
306
|
+
puts 'Using default Chrome driver without proxy'
|
307
|
+
# 'capabilities'과 'options' 배열로 설정
|
308
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
309
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
303
310
|
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
# 첫 번째 탭에서 확장 프로그램을 로드
|
318
|
-
#@driver.get("chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html")
|
319
|
-
sleep(1)
|
320
|
-
# 두 번째 탭에서 로그인 페이지 열기
|
321
|
-
@driver.get('https://www.tistory.com/auth/login')
|
322
|
-
sleep(1)
|
311
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
312
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
313
|
+
|
314
|
+
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
315
|
+
|
316
|
+
# 첫 번째 탭에서 확장 프로그램을 로드
|
317
|
+
#@driver.get("chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html")
|
318
|
+
sleep(1)
|
319
|
+
# 두 번째 탭에서 로그인 페이지 열기
|
320
|
+
@driver.get('https://www.tistory.com/auth/login')
|
321
|
+
sleep(1)
|
322
|
+
end
|
323
323
|
end
|
324
|
-
end
|
325
324
|
|
326
325
|
def login(user_id, user_pw, proxy, captcha_api_key)
|
327
326
|
chrome_start(proxy)
|