nblog_zon 0.0.39 → 0.0.51

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 +68 -86
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ab911e4f459ffa2c826c80a3352a4323f02564758de4bac5aa1f8910938ddf0
4
- data.tar.gz: 32933e515ae9ce444e824a30dbe11459e1d05aeee16b80a70dbb79813a1dcd7a
3
+ metadata.gz: 9a19858111ad3bada5d417c70f3f0690e8182bb4d559431c8289b65796dfc6ff
4
+ data.tar.gz: 76d77623a63c8a330d775735a3f5f3f6c68fe96aaa7d0b12242d9842a8456e4a
5
5
  SHA512:
6
- metadata.gz: '068e79acff717dedeecf847dc1e629c0f2a4dc92f27c160b2815bc17b6024e2fa9f0ad6fd2229347c17169c9c54f2215fb5d7f28a3b11a0c7bb5edfa0822be83'
7
- data.tar.gz: c89a2fa936113c3b2dc9c2106143d23c02ff9825d8c62451ccbf32102edba1c28c1a173622e12bdb92e414e4b2bc1b14e08e645a55aca40704e5318d729aef78
6
+ metadata.gz: bbdc3255da938fb1aa6cdf9f9de06f99652e75cf5b31f712f0fdf65a6cc21f21e18d4c264f6c7374b0b2ff60a1b5e7b6aaa4fb1a466366092afef343d49934ac
7
+ data.tar.gz: 3cd4d3b7268ced3e87c59b894f64ab5b454ae6fd3ef0e135401cb8904fafcb290b18e148ff48c7f733eedc4a428c9a7fb95c3039f90a8bd211a675b670958409
data/lib/nblog_zon.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'glimmer-dsl-libui'
2
2
  require 'selenium-webdriver'
3
- require 'webdrivers'
3
+ # require 'webdrivers'
4
4
  require 'iconv'
5
5
  require 'nokogiri'
6
6
  require 'http'
@@ -214,88 +214,61 @@ class Naver
214
214
  def chrome_start(proxy, user_id)
215
215
  naver_cookie_dir = "C:/naver_cookie"
216
216
  FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
217
-
218
- chromedriver_path = './chromedriver.exe'
219
-
220
- # 웹드라이버 자동 업데이트 시도
221
- begin
222
- # webdrivers가 사용자의 Chrome 버전에 맞는 chromedriver 다운로드 시도
223
- Webdrivers::Chromedriver.update # 자동 업데이트 시도
224
- rescue => e
225
- puts "webdrivers에서 chromedriver 다운로드 실패: #{e.message}"
226
- puts "자동으로 chromedriver.exe 사용합니다."
227
- puts "만일 프로그램 폴더안에 chromedriver.exe 버전이 맞지 않거나 없는 경우 인터넷창이 깜빡하고 닫히거나 열리지 않는경우에만 아래 안내를 따라주세요."
228
- puts "https://storage.googleapis.com/chrome-for-testing-public/사용자크롬버전/win32/chromedriver-win32.zip 링크를 복사 후 복사 된 링크 중(사용자크롬버전) 부분을 크롬 사용자의 버전(예:131.0.6778.264)으로 수정 후 주소입력 부분에 넣어 엔터 후 다운로드 하고 압축을 풀고 chromedriver.exe 파일만 프로그램 폴더안에 넣어주세요."
229
- puts "인터넷 창이 열리고 작업을 한다면 위 항목은 패스해주세요."
230
- # 예외가 발생하면 수동 경로 사용
231
- Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
232
- end
233
-
234
217
  if proxy == ''
235
- begin
236
- # webdrivers Gem이 크롬 드라이버 자동 다운로드 및 설정을 관리함
237
- options = Selenium::WebDriver::Chrome::Options.new
238
- options.page_load_strategy = :normal
239
- options.timeouts = { page_load: 20_000 }
240
- options.page_load_strategy = 'none'
241
- options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
242
- options.add_argument('--disable-gpu')
243
-
244
-
245
- options.add_argument('--remote-debugging-port=9222')
246
- options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
247
-
248
- # :capabilities에 options를 배열로 전달
249
- capabilities = [options]
250
-
251
- # Selenium WebDriver에서 options를 capabilities로 전달
252
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
253
- rescue
254
- # 예외 발생 시 다른 방법으로 셀레니움 실행
255
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
256
- end
257
- else
258
- begin
259
- # Proxy를 사용하는 경우
260
- options = Selenium::WebDriver::Chrome::Options.new
261
- options.add_argument '--proxy-server=' + proxy.to_s.force_encoding('utf-8')
262
- options.page_load_strategy = :normal
263
- options.timeouts = { page_load: 20_000 }
264
- options.page_load_strategy = 'none'
265
- options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
266
- options.add_argument('--disable-gpu')
267
- options.add_argument('--remote-debugging-port=9222')
268
- options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
269
-
270
- # :capabilities에 options를 배열로 전달
271
- capabilities = [options]
272
-
273
- # Selenium WebDriver에서 options를 capabilities로 전달
274
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
275
- rescue => e
276
- puts 'proxy error...'
277
218
  begin
278
- # Proxy가 실패할 경우 예외 처리
279
- options = Selenium::WebDriver::Chrome::Options.new
280
- options.page_load_strategy = :normal
281
- options.timeouts = { page_load: 20_000 }
282
- options.page_load_strategy = 'none'
283
- options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
284
- options.add_argument('--disable-gpu')
285
- options.add_argument('--remote-debugging-port=9222')
286
- options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
287
-
288
- # :capabilities에 options를 배열로 전달
289
- capabilities = [options]
290
-
291
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
219
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
220
+ options = Selenium::WebDriver::Chrome::Options.new
221
+ options.page_load_strategy = :normal
222
+ options.timeouts = {page_load: 20_000}
223
+ options.page_load_strategy = 'none'
224
+ options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
225
+ options.add_argument('--disable-gpu')
226
+ options.add_argument('--remote-debugging-port=9222')
227
+ options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
228
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
292
229
  rescue
293
- # 예외 발생 다른 방법으로 셀레니움 실행
294
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
230
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
231
+ end
232
+ else
233
+ begin
234
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
235
+ options = Selenium::WebDriver::Chrome::Options.new
236
+ # profile = Selenium::WebDriver::Chrome::Profile.new
237
+ # profile['network.proxy.type'] = 1
238
+ # profile['network.proxy.http'] = proxy.split(':')[0]
239
+ # profile['network.proxy.http_port'] = proxy.split(':')[1].to_i
240
+ # options = Selenium::WebDriver::Chrome::Options.new
241
+ # options.profile = profile
242
+ options = Selenium::WebDriver::Chrome::Options.new
243
+ options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
244
+ options.page_load_strategy = :normal
245
+ options.timeouts = {page_load: 20_000}
246
+ options.page_load_strategy = 'none'
247
+ options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
248
+ options.add_argument('--disable-gpu')
249
+ options.add_argument('--remote-debugging-port=9222')
250
+ options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
251
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
252
+ rescue => e
253
+ puts e
254
+ puts 'proxy error...'
255
+ begin
256
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
257
+ options = Selenium::WebDriver::Chrome::Options.new
258
+ options.page_load_strategy = :normal
259
+ options.timeouts = {page_load: 20_000}
260
+ options.page_load_strategy = 'none'
261
+ options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
262
+ options.add_argument('--disable-gpu')
263
+ options.add_argument('--remote-debugging-port=9222')
264
+ options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
265
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
266
+ rescue
267
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
268
+ end
295
269
  end
296
- end
297
270
  end
298
- end
271
+ end
299
272
 
300
273
 
301
274
 
@@ -1461,60 +1434,69 @@ class Naver
1461
1434
  puts '카테고리 error'
1462
1435
  puts e33
1463
1436
  end
1464
- sleep(2)
1437
+ sleep(1)
1465
1438
  tags2 = option['tag'].to_s
1466
1439
  tag_mm2 = Array.new
1467
1440
  tags2.split(',').each do |tag_value|
1468
1441
  tag_mm2 << ''+tag_value
1469
1442
  end
1470
1443
  @driver.find_element(:xpath, '//*[@id="tag-input"]').send_keys(tag_mm2.join("\n")+"\n")
1471
- sleep(2)
1444
+ sleep(1)
1472
1445
  # data['populationParams'] = '{"configuration":{"openType":'+option['공개']+',"commentYn":'+option['댓글허용']+',"searchYn":'+option['검색허용']+',"sympathyYn":'+option['공감허용']+',"scrapType":'+option['블로그공유']+',"outSideAllowYn":'+option['외부공유허용']+',"twitterPostingYn":false,"facebookPostingYn":false,"cclYn":false},"populationMeta":{"categoryId":'+category_value+',"logNo":null,"directorySeq":0,"directoryDetail":null,"mrBlogTalkCode":null,"postWriteTimeType":"now","tags":"'+tags2+'","moviePanelParticipation":false,"greenReviewBannerYn":false,"continueSaved":false,"noticePostYn":false,"autoByCategoryYn":false,"postLocationSupportYn":false,"postLocationJson":null,"prePostDate":null,"thisDayPostInfo":null,"scrapYn":false,"autoSaveNo":'+(Time.now.to_f.round(3)*1000).to_i.to_s+'},"editorSource":"AbZmtbYiAmhrzPJyhPXNWg=="}'
1473
1446
  if option['공개'] == '2'
1474
1447
  @driver.find_element(:xpath ,'//*[@for="open_public"]').click #공개버튼
1448
+ sleep(1)
1475
1449
  elsif option['공개'] == '3'
1476
1450
  @driver.find_element(:xpath, '//*[@for="open_both_neighbor"]').click #서이웃 공개
1451
+ sleep(1)
1477
1452
  elsif option['공개'] == '0'
1478
1453
  @driver.find_element(:xpath, '//*[@for="open_private"]').click #비공개
1454
+ sleep(1)
1479
1455
  else
1480
1456
  @driver.find_element(:xpath, '//*[@for="open_neighbor"]').click #이웃공개
1457
+ sleep(1)
1481
1458
  end
1482
1459
 
1483
- sleep(1)
1460
+
1484
1461
  if option['댓글허용'] == 'true'
1485
1462
 
1486
1463
  else
1487
1464
  @driver.find_element(:xpath, '//*[@for="publish-option-comment"]').click
1465
+ sleep(1)
1488
1466
  end
1489
- sleep(1)
1467
+
1490
1468
 
1491
1469
  if option['검색허용'] == 'true'
1492
1470
 
1493
1471
  else
1494
1472
  @driver.find_element(:xpath, '//*[@for="publish-option-search"]').click
1473
+ sleep(1)
1495
1474
  end
1496
- sleep(1)
1475
+
1497
1476
 
1498
1477
  if option['공감허용'] == 'true'
1499
1478
 
1500
1479
  else
1501
1480
  @driver.find_element(:xpath, '//*[@for="publish-option-sympathy"]').click
1481
+ sleep(1)
1502
1482
  end
1503
- sleep(1)
1483
+
1504
1484
 
1505
1485
  if option['블로그공유'] == '2'
1506
1486
 
1507
1487
  else
1508
1488
  @driver.find_element(:xpath, '//*[@for="publish-option-scrap"]').click
1489
+ sleep(1)
1509
1490
  end
1510
- sleep(1)
1491
+
1511
1492
 
1512
1493
  if option['외부공유허용'] == 'true'
1513
1494
  @driver.find_element(:xpath, '//*[@for="publish-option-outside"]').click
1495
+ sleep(1)
1514
1496
  else
1515
1497
 
1516
1498
  end
1517
- sleep(1)
1499
+
1518
1500
  # puts data['documentModel'] = data['documentModel'].to_json
1519
1501
 
1520
1502
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nblog_zon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.39
4
+ version: 0.0.51
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-10 00:00:00.000000000 Z
11
+ date: 2025-01-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: rnjstnswp123@naver.com