nblog_duo 0.0.90 → 0.0.95

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_duo.rb +37 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfd2b0809846f63aeb22cf4514f862ce929334aab682d344f8a42e8dd3f62fd3
4
- data.tar.gz: 4973fefc22f326598c49f4235ad261f86d9fe16c31d4c1b8035b05728a010f19
3
+ metadata.gz: f88597202922bff68a8c8fd9f4e0691af3c1f62284f2b780a2923a12d6d75eaa
4
+ data.tar.gz: 37748fb4d77fb92f93038d3dfcb885d89e0503017fddba7b400182140ebd1e8c
5
5
  SHA512:
6
- metadata.gz: 8178cfc9537488957b3c3046ce3ae7ef74a3e6c8b4016dee9b12cc7878fe84a5332a2cfce099873db9a542c43e3e77cbd2d20bed501a1a4c2029037777183be9
7
- data.tar.gz: 8cba1035a567b52a8a55c2694f1f3391833710b235b507959ecb5ab6515e9afbadb0a387494b925b17d2e7e69fe45cd52d7a17fa5ef2ca5f82f2ec3269a198c4
6
+ metadata.gz: 05c6f3cf39bda7d39b293b78a001288214db0819072866148060cbe243afd50cb0f062edbdc109da974f6cc172b8153bde416bdb2c542eb74acc2b975d955282
7
+ data.tar.gz: 3871676d62236637acdddc1000e10710a05c51b85f86a7a6a71bb9677e5f2095b6349fa9b9cccb4e50302c4776d060b1e1ce5f93bf25316d25f37a8cfece9aa0
data/lib/nblog_duo.rb CHANGED
@@ -179,8 +179,8 @@ class Chat_content
179
179
  end
180
180
 
181
181
  def message(content)
182
- puts 'Sending request to GPT...(내용 변형 중...)'
183
182
  puts '주의:GPT 특성상 원고 길이가 공백 포함 4천자를 넘기면 오류가 발생할 수 있습니다.'
183
+ puts 'Sending request to GPT...(내용 변형 중...)'
184
184
  # "키워드 기반 글 생성 중..." 메시지를 별도 스레드로 처리
185
185
  thread = Thread.new do
186
186
  while true
@@ -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'
@@ -373,13 +386,20 @@ class Naver
373
386
  puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
374
387
  sleep(2.5)
375
388
  rescue
376
- wait = Selenium::WebDriver::Wait.new(:timeout => 7)
377
- #요소가 나타날 때까지 3초 동안 기다립니다.
378
- wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]') }
379
- sleep(1.5)
380
- @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]').click
381
- check_cookie_login = 0
382
- 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
383
403
  end
384
404
 
385
405
  if check_cookie_login == 0
@@ -414,8 +434,8 @@ class Naver
414
434
  puts "Failed to close tab: #{e.message}"
415
435
  end
416
436
  end
417
- return 0
418
437
  @driver.quit
438
+ return 0
419
439
  end
420
440
 
421
441
  else
@@ -438,9 +458,9 @@ class Naver
438
458
  puts "Failed to close tab: #{e.message}"
439
459
  end
440
460
  end
441
- return 0
442
461
  @driver.quit
443
- end
462
+ return 0
463
+ end
444
464
  end
445
465
 
446
466
  def create_id
@@ -756,8 +776,9 @@ class Naver
756
776
  puts "Failed to close tab: #{e.message}"
757
777
  end
758
778
  end
759
- return 0
760
779
  @driver.quit
780
+ return 0
781
+
761
782
  end
762
783
 
763
784
  ele = @driver.find_element(:xpath, '//*[@draggable="false"]')
@@ -1662,8 +1683,9 @@ class Naver
1662
1683
  puts "Failed to close tab: #{e.message}"
1663
1684
  end
1664
1685
  end
1665
- return 0
1666
1686
  @driver.quit
1687
+ return 0
1688
+
1667
1689
  end
1668
1690
 
1669
1691
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nblog_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.90
4
+ version: 0.0.95
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon