cafe_basics 0.0.57 → 0.0.59

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/cafe_basics.rb +40 -14
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 413697731e6f1d536cb0e32d06785600e1b386049c32ce354120d547786247e2
4
- data.tar.gz: 1f00517e68e60acb8c777760452130ab35a29efa3d0f2a9e5f86cbe93925db7d
3
+ metadata.gz: b74c59b245711c7d5e8e414ca062140d6717cfaf0fc0902b342ebb674982f351
4
+ data.tar.gz: a4300f2d775db2439cdd411be954fd4d2344fbbd6ae3bb0fd866ac2a5a28e896
5
5
  SHA512:
6
- metadata.gz: 1381e6c1f2dd90abda39f6d93f505525ffb195b0bbd5715240c5dffaac53e2f34716956c13beb4d104ed625c6bf326abe26a77757aca078642d80a364b7b2e2d
7
- data.tar.gz: 635dc635902e5887325a61aee43bf494fb573f353bc117e834627dedfa81604616144ccef112fc166a94a9443f69c2e46b127cf6170d8b8840720932249f23bb
6
+ metadata.gz: 2855daf08a35e5350033cb2a090447ca36e288e722dac333f75598d4ad8970f294b41f8db605f913afbdc8668ffbc3c89fc479e4403ecc6f139397cb60142ee3
7
+ data.tar.gz: 6281eb245a94008e310d6cea369b1b0cc96b2057ea6b1401b9e03161e09423a169b6d131d31ee5e6e74d40c953a528948be59db10068ebf553ffcf694ff72ef4
data/lib/cafe_basics.rb CHANGED
@@ -246,9 +246,13 @@ class Naver
246
246
  naver_cookie_dir = "C:/naver_cookie"
247
247
  FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
248
248
  if proxy == ''
249
- system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id}})
249
+
250
+ system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --no-first-run --no-default-browser-check --disable-sync})
251
+
250
252
  else
251
- system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" "https://naver.com/" --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --proxy-server=#{proxy.to_s.force_encoding('utf-8').to_s}})
253
+
254
+ system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --proxy-server=#{proxy.to_s.force_encoding('utf-8').to_s} --no-first-run --no-default-browser-check --disable-sync})
255
+
252
256
  end
253
257
  end
254
258
  def chrome_start(proxy, user_id)
@@ -260,6 +264,9 @@ class Naver
260
264
  options = Selenium::WebDriver::Chrome::Options.new
261
265
  options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
262
266
  options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
267
+ options.add_argument('--disable-sync') # Chrome 동기화 비활성화
268
+ options.add_argument('--disable-popup-blocking') # 팝업 방지 (로그인 창이 뜨는 경우 대비)
269
+ options.add_argument('--no-default-browser-check')
263
270
  options.page_load_strategy = :normal
264
271
  options.timeouts = {page_load: 20_000}
265
272
  options.page_load_strategy = 'none'
@@ -285,6 +292,9 @@ class Naver
285
292
  options = Selenium::WebDriver::Chrome::Options.new
286
293
  options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
287
294
  options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
295
+ options.add_argument('--disable-sync') # Chrome 동기화 비활성화
296
+ options.add_argument('--disable-popup-blocking') # 팝업 방지 (로그인 창이 뜨는 경우 대비)
297
+ options.add_argument('--no-default-browser-check')
288
298
  options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
289
299
  options.page_load_strategy = :normal
290
300
  options.timeouts = {page_load: 20_000}
@@ -309,6 +319,9 @@ class Naver
309
319
  options = Selenium::WebDriver::Chrome::Options.new
310
320
  options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
311
321
  options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
322
+ options.add_argument('--disable-sync') # Chrome 동기화 비활성화
323
+ options.add_argument('--disable-popup-blocking') # 팝업 방지 (로그인 창이 뜨는 경우 대비)
324
+ options.add_argument('--no-default-browser-check')
312
325
  options.page_load_strategy = :normal
313
326
  options.timeouts = {page_load: 20_000}
314
327
  options.page_load_strategy = 'none'
@@ -333,6 +346,8 @@ class Naver
333
346
 
334
347
 
335
348
 
349
+
350
+
336
351
  def login(user_id, user_pw, proxy)
337
352
  @user_id = user_id
338
353
  @user_id11 = user_id
@@ -371,13 +386,20 @@ class Naver
371
386
  puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
372
387
  sleep(2.5)
373
388
  rescue
374
- wait = Selenium::WebDriver::Wait.new(:timeout => 7)
375
- #요소가 나타날 때까지 3초 동안 기다립니다.
376
- wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]') }
377
- sleep(1.5)
378
- @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]').click
379
- check_cookie_login = 0
380
- sleep(1)
389
+ begin
390
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
391
+ # 요소가 나타날 때까지 기다립니다.
392
+ wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]') }
393
+ sleep(1.5)
394
+
395
+ # 요소가 있으면 클릭
396
+ @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]').click
397
+ check_cookie_login = 0
398
+ sleep(1)
399
+ rescue
400
+ @driver.quit
401
+ return 0
402
+ end
381
403
  end
382
404
 
383
405
  if check_cookie_login == 0
@@ -412,8 +434,9 @@ class Naver
412
434
  puts "Failed to close tab: #{e.message}"
413
435
  end
414
436
  end
415
- return 0
416
437
  @driver.quit
438
+ return 0
439
+
417
440
  end
418
441
 
419
442
  else
@@ -436,8 +459,9 @@ class Naver
436
459
  puts "Failed to close tab: #{e.message}"
437
460
  end
438
461
  end
439
- return 0
440
462
  @driver.quit
463
+ return 0
464
+
441
465
  end
442
466
  end
443
467
 
@@ -763,8 +787,9 @@ class Naver
763
787
  puts "Failed to close tab: #{e.message}"
764
788
  end
765
789
  end
766
- return 0
767
- @driver.quit
790
+ @driver.quit
791
+ return 0
792
+
768
793
  end
769
794
 
770
795
 
@@ -792,8 +817,9 @@ class Naver
792
817
  puts "Failed to close tab: #{e.message}"
793
818
  end
794
819
  end
795
- return 0
796
820
  @driver.quit
821
+ return 0
822
+
797
823
  end
798
824
  sleep(2)
799
825
  @driver.action.key_down(:control).key_down('a').key_up('a').key_up(:control).perform
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_basics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.57
4
+ version: 0.0.59
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-13 00:00:00.000000000 Z
11
+ date: 2025-02-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com