zon_cafe_comment 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/zon_cafe_comment.rb +44 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fcc382cbfd37e1369db043d0970a3f36f1188230880506876b80e11505fcdb4a
4
- data.tar.gz: baaab6060bfc85245c6f2c29d827bc53b7aecfbfa73692e81e8d8883a09bab74
3
+ metadata.gz: e1a42fab1da9b6e1c059159be2bf35db52738c1f2e8ba6789050c0781acd37dd
4
+ data.tar.gz: 55b42ee59e0c13a6414030d59ff61fc1f2297f6f564554ba0826d36ab648e7ad
5
5
  SHA512:
6
- metadata.gz: fa4480faa2f98f36717f6fd901c5c2282fa9a9bec8d30654df85bed15c1b20c954b760c7fcfd12faa3c229c69dbc7601b8f543e2ec23a4fe4cb0f70f7142f168
7
- data.tar.gz: d675ca19d2c55015647ce2e9c2d453483a1cf746337cf1e23669ffc2dc4da1bec650b77b1b1eaf331482bd1c841cf0564737e3797f1ef9293e0c4fcf93320eb0
6
+ metadata.gz: 851dcdaf1c585eb2cd38c58c06663b7f248dbb9da9fc29e003406c342abaa4b70a1323cfd4382291d55841afebae24c7b35e611d9875f872dbbbae904154c166
7
+ data.tar.gz: 360f5b8d3e9562e271243d1b8e801e37d34d2a0e44f22c740bb1fe8a370a55425a0bd9783c638b1c39339776e29cc022abc51a5d9e8bd209de8ccb2fe1a3b14a
@@ -1,12 +1,10 @@
1
1
  require 'glimmer-dsl-libui'
2
2
  require 'selenium-webdriver'
3
- #require 'webdrivers'
4
3
  require 'iconv'
5
4
  require 'nokogiri'
6
5
  require 'http'
7
6
  require 'json'
8
7
  require 'down'
9
- require 'rmagick'
10
8
  require 'fileutils'
11
9
  require 'rest-client'
12
10
  require 'open3'
@@ -16,6 +14,7 @@ require 'uri'
16
14
  require 'cgi'
17
15
  require 'auto_click'
18
16
  require 'rainbow/refinement'
17
+ require 'win32ole'
19
18
  include AutoClickMethods
20
19
  using Rainbow
21
20
  include Glimmer
@@ -30,16 +29,23 @@ class Naver
30
29
  def chrome_setup(user_id, proxy)
31
30
  naver_cookie_dir = "C:/naver_cookie"
32
31
  FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
33
- if proxy == ''
34
-
35
- system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://my.naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --no-first-run --no-default-browser-check --disable-sync})
36
32
 
37
- else
38
-
39
- system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://my.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})
33
+ chrome_path = if File.exist?("C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe")
34
+ "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
35
+ elsif File.exist?("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe")
36
+ "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
37
+ else
38
+ puts "Chrome not found"; exit
39
+ end
40
40
 
41
+ if proxy == ''
42
+ system(%{"#{chrome_path}" https://my.naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --no-first-run --no-default-browser-check --disable-sync})
43
+ else
44
+ system(%{"#{chrome_path}" https://my.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})
41
45
  end
46
+
42
47
  end
48
+
43
49
  def chrome_start(proxy, user_id)
44
50
  naver_cookie_dir = "C:/naver_cookie"
45
51
  FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
@@ -4817,6 +4823,7 @@ end
4817
4823
  begin
4818
4824
  @start.exit
4819
4825
  @start = 0
4826
+ kill_selenium_chrome
4820
4827
  rescue
4821
4828
  puts '작업정지 error pass'
4822
4829
  end
@@ -4842,6 +4849,35 @@ end
4842
4849
  }.show
4843
4850
 
4844
4851
  end
4852
+
4853
+ def kill_selenium_chrome #기존 창 모두 닫는 코드
4854
+ wmi = WIN32OLE.connect("winmgmts://")
4855
+ chrome_procs = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chrome.exe'")
4856
+
4857
+ chrome_procs.each do |proc|
4858
+ cmd = proc.CommandLine
4859
+ if cmd && cmd.include?("user-data-dir=C:/naver_cookie")
4860
+ #puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
4861
+ begin
4862
+ proc.Terminate
4863
+ rescue
4864
+ #puts "→ 이미 종료된 프로세스: #{proc.ProcessId}"
4865
+ end
4866
+ end
4867
+ end
4868
+
4869
+ # chromedriver도 같이 종료
4870
+ chromedrivers = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chromedriver.exe'")
4871
+ chromedrivers.each do |proc|
4872
+ #puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
4873
+ begin
4874
+ proc.Terminate
4875
+ rescue
4876
+ #puts "→ 이미 종료된 chromedriver: #{proc.ProcessId}"
4877
+ end
4878
+ end
4879
+ end
4880
+
4845
4881
  end
4846
4882
 
4847
4883
  word = Wordpress.new.launch
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zon_cafe_comment
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
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-07-16 00:00:00.000000000 Z
10
+ date: 2025-07-24 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: File to Clipboard gem
13
13
  email: mymin26@naver.com