nblog_zon 0.0.37 → 0.0.50

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 +67 -68
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d90482a851c06f415f4fe8d880a577b4e35a0d1f239aefeb65514288dfebbb3
4
- data.tar.gz: 9901fe01810997833caed83d318c5949e21a9b57a9a6d83f799b5406dd25d8c5
3
+ metadata.gz: cd0b063aef7d699d816c762fabe1b27088d4f9eff60c1bc9e646f503d0fb70bb
4
+ data.tar.gz: bd057c6c711c426a0a4fcdcdd3d886b43516cb8388d5cbe4acd78279c0d3bca6
5
5
  SHA512:
6
- metadata.gz: 277e352a6eaf160f5386a9916342995efa2ddd6a005601439fb6537d17f197371a7adb08af621093b5fa5adfd6eae1105a22e9cd2bd867c7f138a5dc2c7b8263
7
- data.tar.gz: 68c85f206fae56642d4f60b93a0c4ae31184bfdda167f8695a9572078ddd88458c103db13d19846d4366d233aa1c9eec8e50bb5cc4a64d175d16d5960495e2e8
6
+ metadata.gz: 077aac45a197f2e838ff30017648878ef15428f439fa32270b90d54b920d9c679ef402e61945e84754f631a8071bdd34fce73dae8cd27e3c89f7b2488e26db92
7
+ data.tar.gz: 80b6c004997cdce23830a2f9b9ffd5b9f73713a7a48e5994118ce250ce335498572067304a0102a95163ee818763c82fa7ddfb64671aa41bcaa677a2357d5f7c
data/lib/nblog_zon.rb CHANGED
@@ -214,71 +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
217
  if proxy == ''
219
- begin
220
- # webdrivers Gem이 크롬 드라이버 자동 다운로드 및 설정을 관리함
221
- options = Selenium::WebDriver::Chrome::Options.new
222
- options.page_load_strategy = :normal
223
- options.timeouts = { page_load: 20_000 }
224
- options.page_load_strategy = 'none'
225
- options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
226
-
227
-
228
-
229
- options.add_argument('--remote-debugging-port=9222')
230
- options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
231
-
232
- # :capabilities에 options를 배열로 전달
233
- capabilities = [options]
234
-
235
- # Selenium WebDriver에서 options를 capabilities로 전달
236
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
237
- rescue
238
- # 예외 발생 시 다른 방법으로 셀레니움 실행
239
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
240
- end
241
- else
242
- begin
243
- # Proxy를 사용하는 경우
244
- options = Selenium::WebDriver::Chrome::Options.new
245
- options.add_argument '--proxy-server=' + proxy.to_s.force_encoding('utf-8')
246
- options.page_load_strategy = :normal
247
- options.timeouts = { page_load: 20_000 }
248
- options.page_load_strategy = 'none'
249
- options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
250
-
251
- options.add_argument('--remote-debugging-port=9222')
252
- options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
253
-
254
- # :capabilities에 options를 배열로 전달
255
- capabilities = [options]
256
-
257
- # Selenium WebDriver에서 options를 capabilities로 전달
258
- @driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
259
- rescue => e
260
- puts 'proxy error...'
261
218
  begin
262
- # Proxy가 실패할 경우 예외 처리
263
- options = Selenium::WebDriver::Chrome::Options.new
264
- options.page_load_strategy = :normal
265
- options.timeouts = { page_load: 20_000 }
266
- options.page_load_strategy = 'none'
267
- options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
268
- options.add_argument('--remote-debugging-port=9222')
269
- options.add_argument("user-data-dir=#{naver_cookie_dir}/#{user_id}")
270
-
271
- # :capabilities options를 배열로 전달
272
- capabilities = [options]
273
-
274
- @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)
275
229
  rescue
276
- # 예외 발생 다른 방법으로 셀레니움 실행
277
- @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
278
269
  end
279
- end
280
270
  end
281
- end
271
+ end
282
272
 
283
273
 
284
274
 
@@ -1444,60 +1434,69 @@ class Naver
1444
1434
  puts '카테고리 error'
1445
1435
  puts e33
1446
1436
  end
1447
- sleep(2)
1437
+ sleep(1)
1448
1438
  tags2 = option['tag'].to_s
1449
1439
  tag_mm2 = Array.new
1450
1440
  tags2.split(',').each do |tag_value|
1451
1441
  tag_mm2 << ''+tag_value
1452
1442
  end
1453
1443
  @driver.find_element(:xpath, '//*[@id="tag-input"]').send_keys(tag_mm2.join("\n")+"\n")
1454
- sleep(2)
1444
+ sleep(1)
1455
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=="}'
1456
1446
  if option['공개'] == '2'
1457
1447
  @driver.find_element(:xpath ,'//*[@for="open_public"]').click #공개버튼
1448
+ sleep(1)
1458
1449
  elsif option['공개'] == '3'
1459
1450
  @driver.find_element(:xpath, '//*[@for="open_both_neighbor"]').click #서이웃 공개
1451
+ sleep(1)
1460
1452
  elsif option['공개'] == '0'
1461
1453
  @driver.find_element(:xpath, '//*[@for="open_private"]').click #비공개
1454
+ sleep(1)
1462
1455
  else
1463
1456
  @driver.find_element(:xpath, '//*[@for="open_neighbor"]').click #이웃공개
1457
+ sleep(1)
1464
1458
  end
1465
1459
 
1466
- sleep(1)
1460
+
1467
1461
  if option['댓글허용'] == 'true'
1468
1462
 
1469
1463
  else
1470
1464
  @driver.find_element(:xpath, '//*[@for="publish-option-comment"]').click
1465
+ sleep(1)
1471
1466
  end
1472
- sleep(1)
1467
+
1473
1468
 
1474
1469
  if option['검색허용'] == 'true'
1475
1470
 
1476
1471
  else
1477
1472
  @driver.find_element(:xpath, '//*[@for="publish-option-search"]').click
1473
+ sleep(1)
1478
1474
  end
1479
- sleep(1)
1475
+
1480
1476
 
1481
1477
  if option['공감허용'] == 'true'
1482
1478
 
1483
1479
  else
1484
1480
  @driver.find_element(:xpath, '//*[@for="publish-option-sympathy"]').click
1481
+ sleep(1)
1485
1482
  end
1486
- sleep(1)
1483
+
1487
1484
 
1488
1485
  if option['블로그공유'] == '2'
1489
1486
 
1490
1487
  else
1491
1488
  @driver.find_element(:xpath, '//*[@for="publish-option-scrap"]').click
1489
+ sleep(1)
1492
1490
  end
1493
- sleep(1)
1491
+
1494
1492
 
1495
1493
  if option['외부공유허용'] == 'true'
1496
1494
  @driver.find_element(:xpath, '//*[@for="publish-option-outside"]').click
1495
+ sleep(1)
1497
1496
  else
1498
1497
 
1499
1498
  end
1500
- sleep(1)
1499
+
1501
1500
  # puts data['documentModel'] = data['documentModel'].to_json
1502
1501
 
1503
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.37
4
+ version: 0.0.50
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-06 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