nblog_zon 111.120.011 → 111.120.016

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/nblog_zon.rb +59 -39
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bf25a52968bb8e5c71a26e6f91d7b76573bdacd848adfed459107aaf06b97c2
4
- data.tar.gz: 8f837cb7e5f4196d36faeb8bb37f9c5b3a3ddce23977a9d1b468eb6375e1566a
3
+ metadata.gz: bba824d346cd60ce08c326c05b68363e9a5fe4089d65c6511d132a32f8526851
4
+ data.tar.gz: 24cb0ef776b434b6a2c127b0a98aff3b7b024195066e8b30001ff7df647fbff0
5
5
  SHA512:
6
- metadata.gz: e51b8b7ec64e77adcd135473ee25ab2ecda9ac81e662989cabc52f200067dbb8911a4ad4566ec7d9b5015b0ee770be75bc1919437d75d3b455e68e11d9e42e14
7
- data.tar.gz: 2836a99783639fa8535676b485b5e758fd45d5eb0d2cf196cb29fc06a6e162495520e33523e66da70d62395779a6a038ec6a2eb39b02bb50da9d6e7b13f3c335
6
+ metadata.gz: 391272b8f5d443d184426e5be5ec0173bb721619fd659922c279777db0ac5cdd56c949111c6f0a4aca400c40a2beaa4ca3ffb8184f6edd61df53a3cf796072ab
7
+ data.tar.gz: 718749a8f8e179da044794783307d00e8e5c28df5b6b93c681767f2078a893f72974c7b08e87d7f8ebc5b5bc66b0ec85240502e07fffac4a70ad3d3acd1b27c9
data/lib/nblog_zon.rb CHANGED
@@ -1,6 +1,5 @@
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'
@@ -18,7 +17,7 @@ require 'digest'
18
17
  require 'auto_click'
19
18
  require 'rainbow/refinement'
20
19
  require 'httpclient'
21
- #require 'win32ole'
20
+ require 'win32ole'
22
21
  include AutoClickMethods
23
22
  using Rainbow
24
23
  include Glimmer
@@ -269,56 +268,35 @@ class Chat_content
269
268
  end
270
269
 
271
270
 
271
+
272
+
272
273
  #############################################gpt############################################
273
274
 
274
275
  class Naver
275
276
  def initialize
276
277
  @seed = 1
277
- #kill_selenium_chrome #기존 창 모두 닫는 명령
278
- #sleep(1)
279
278
  end
280
-
281
- #def kill_selenium_chrome #기존 창 모두 닫는 코드
282
- # wmi = WIN32OLE.connect("winmgmts://")
283
- # chrome_procs = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chrome.exe'")
284
-
285
- # chrome_procs.each do |proc|
286
- # cmd = proc.CommandLine
287
- # if cmd && cmd.include?("user-data-dir=C:/naver_cookie")
288
- # puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
289
- # begin
290
- # proc.Terminate
291
- # rescue
292
- #puts "→ 이미 종료된 프로세스: #{proc.ProcessId}"
293
- # end
294
- # end
295
- # end
296
-
297
- # chromedriver도 같이 종료
298
- # chromedrivers = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chromedriver.exe'")
299
- # chromedrivers.each do |proc|
300
- # puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
301
- # begin
302
- # proc.Terminate
303
- # rescue
304
- #puts "→ 이미 종료된 chromedriver: #{proc.ProcessId}"
305
- # end
306
- # end
307
- #end
308
-
279
+
309
280
  def chrome_setup(user_id, proxy)
310
281
  naver_cookie_dir = "C:/naver_cookie"
311
282
  FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
312
- if proxy == ''
313
-
314
- 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})
315
283
 
316
- else
317
-
318
- 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})
284
+ chrome_path = if File.exist?("C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe")
285
+ "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
286
+ elsif File.exist?("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe")
287
+ "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
288
+ else
289
+ puts "Chrome not found"; exit
290
+ end
319
291
 
292
+ if proxy == ''
293
+ 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})
294
+ else
295
+ 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})
320
296
  end
297
+
321
298
  end
299
+
322
300
  def chrome_start(proxy, user_id)
323
301
  naver_cookie_dir = "C:/naver_cookie"
324
302
  FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
@@ -513,6 +491,18 @@ class Naver
513
491
  sleep(1.5)
514
492
  @driver.find_element(:xpath, '//*[@type="submit" and @class="btn_check next_step" and @id="submit_btn"]').click
515
493
  sleep(2.5)
494
+ begin
495
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
496
+ #요소가 나타날 때까지 3초 동안 기다립니다.
497
+ wait.until { @driver.find_element(:xpath, '//button[@ype="button" and @id="new.save" and @class="btn_check nlog-click"]') } #기기 확인 버튼 확인
498
+ #wait.until { @driver.find_element(:xpath, '//button[@ype="button" and @id="new.dontsave" and @class="btn_white nlog-click"]') } #기기 취소 버튼 확인
499
+ sleep(1.5)
500
+ @driver.find_element(:xpath, '//button[@ype="button" and @id="new.save" and @class="btn_check nlog-click"]').click
501
+ #@driver.find_element(:xpath, '//button[@ype="button" and @id="new.dontsave" and @class="btn_white nlog-click"]') #기기 취소 버튼 클릭
502
+ rescue
503
+ end
504
+
505
+
516
506
  rescue => e
517
507
  puts '-[√] 로딩 지연 접속 실패.......'.red
518
508
  @driver.window_handles.each do |handle|
@@ -6290,6 +6280,7 @@ class Wordpress
6290
6280
  begin
6291
6281
  @start.exit
6292
6282
  @start = 0
6283
+ kill_selenium_chrome
6293
6284
  rescue
6294
6285
  puts '작업정지 error pass'
6295
6286
  end
@@ -6321,6 +6312,35 @@ class Wordpress
6321
6312
  @data['포스트설정']['gpt35'].checked = true
6322
6313
  }.show
6323
6314
  end
6315
+
6316
+ def kill_selenium_chrome #기존 창 모두 닫는 코드
6317
+ wmi = WIN32OLE.connect("winmgmts://")
6318
+ chrome_procs = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chrome.exe'")
6319
+
6320
+ chrome_procs.each do |proc|
6321
+ cmd = proc.CommandLine
6322
+ if cmd && cmd.include?("user-data-dir=C:/naver_cookie")
6323
+ #puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
6324
+ begin
6325
+ proc.Terminate
6326
+ rescue
6327
+ #puts "→ 이미 종료된 프로세스: #{proc.ProcessId}"
6328
+ end
6329
+ end
6330
+ end
6331
+
6332
+ # chromedriver도 같이 종료
6333
+ chromedrivers = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chromedriver.exe'")
6334
+ chromedrivers.each do |proc|
6335
+ #puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
6336
+ begin
6337
+ proc.Terminate
6338
+ rescue
6339
+ #puts "→ 이미 종료된 chromedriver: #{proc.ProcessId}"
6340
+ end
6341
+ end
6342
+ end
6343
+
6324
6344
  end
6325
6345
 
6326
6346
  word = Wordpress.new.launch
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nblog_zon
3
3
  version: !ruby/object:Gem::Version
4
- version: 111.120.011
4
+ version: 111.120.016
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-07-15 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: rnjstnswp123@naver.com