nblog_zon 111.113.777 → 111.115.779
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.
- checksums.yaml +4 -4
- data/lib/nblog_zon.rb +142 -66
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6f2c441d7cfe974b89ba6f8e7901d9cf833a31fbbcf68bce6b267781818944d
|
4
|
+
data.tar.gz: 72480bf7945e6e183b4587ca094c353fb0009526f1160c67f9b8f11bb892c175
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17d12511ac2cf7d50b1f6d02cf3f654f0e856ebbe5974b0be1e477c7f35aca14c29e9c4348bb78ca545d72b4985018ce868340c97cb3fbf3fa57caf728bfb17a
|
7
|
+
data.tar.gz: c04d5f5b542d761ed299cef4dff7b73c803107a295d550d2344fc6a4fcd59dc065b265286e5391a701546f144daaf6d2ebb577c64a3b47eff5332f5e8a4ecbaa
|
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'
|
@@ -241,25 +241,6 @@ end
|
|
241
241
|
class Naver
|
242
242
|
def initialize
|
243
243
|
@seed = 1
|
244
|
-
|
245
|
-
begin
|
246
|
-
# webdrivers가 사용자의 Chrome 버전에 맞는 chromedriver 다운로드 시도
|
247
|
-
|
248
|
-
# Webdrivers가 드라이버를 다운로드할 경로를 설정
|
249
|
-
Webdrivers.cache_time = 86_400 # 하루로 설정 (기본값: 86_400초)
|
250
|
-
Webdrivers.install_dir = "./" # 크롬드라이버를 수동으로 설치할 경로를 설정
|
251
|
-
# 크롬드라이버 자동 업데이트 시도
|
252
|
-
Webdrivers::Chromedriver.update
|
253
|
-
puts "chromedriver 자동 다운로드 성공"
|
254
|
-
rescue => e
|
255
|
-
puts "chromedriver 자동 다운로드 실패: #{e.message}"
|
256
|
-
puts "폴더내 크롬드라이버를 사용합니다."
|
257
|
-
puts "크롬드라이버가 오래된 경우 오류 발생될 수 있으며, 만일 오류 발생시 아래 지침을 따라주세요."
|
258
|
-
puts "1.크롬 업데이트 2.프로그램 폴더 내부에 ★tip★-시작시-크롬창이....파일을 열어 드라이버를 교체하세요."
|
259
|
-
chromedriver_path = './chromedriver.exe' # 수동 경로를 인스턴스 변수로 설정
|
260
|
-
Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
|
261
|
-
end
|
262
|
-
|
263
244
|
end
|
264
245
|
|
265
246
|
|
@@ -281,6 +262,18 @@ class Naver
|
|
281
262
|
FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
|
282
263
|
if proxy == ''
|
283
264
|
begin
|
265
|
+
begin
|
266
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
267
|
+
rescue => e
|
268
|
+
puts "chromedriver 버전 불일치!!"
|
269
|
+
puts "아래 지침을 따라주세요."
|
270
|
+
puts "1.프로그램 종료!"
|
271
|
+
puts "2.크롬 업데이트!"
|
272
|
+
puts "3.프로그램 폴더 내부에 ★tip★-시작시-크롬창이....파일 실행"
|
273
|
+
puts "4.안내된 방식으로 크롬 드라이버 교체"
|
274
|
+
puts "5.재 시작"
|
275
|
+
exit 1
|
276
|
+
end
|
284
277
|
options = Selenium::WebDriver::Chrome::Options.new
|
285
278
|
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
286
279
|
#options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
@@ -308,7 +301,18 @@ class Naver
|
|
308
301
|
end
|
309
302
|
else
|
310
303
|
begin
|
311
|
-
|
304
|
+
begin
|
305
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
306
|
+
rescue => e
|
307
|
+
puts "chromedriver 버전 불일치!!"
|
308
|
+
puts "아래 지침을 따라주세요."
|
309
|
+
puts "1.프로그램 종료!"
|
310
|
+
puts "2.크롬 업데이트!"
|
311
|
+
puts "3.프로그램 폴더 내부에 ★tip★-시작시-크롬창이....파일 실행"
|
312
|
+
puts "4.안내된 방식으로 크롬 드라이버 교체"
|
313
|
+
puts "5.재 시작"
|
314
|
+
exit 1
|
315
|
+
end
|
312
316
|
options = Selenium::WebDriver::Chrome::Options.new
|
313
317
|
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
314
318
|
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
@@ -335,7 +339,18 @@ class Naver
|
|
335
339
|
puts e
|
336
340
|
puts 'proxy error...'
|
337
341
|
begin
|
338
|
-
|
342
|
+
begin
|
343
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
344
|
+
rescue => e
|
345
|
+
puts "chromedriver 버전 불일치!!"
|
346
|
+
puts "아래 지침을 따라주세요."
|
347
|
+
puts "1.프로그램 종료!"
|
348
|
+
puts "2.크롬 업데이트!"
|
349
|
+
puts "3.프로그램 폴더 내부에 ★tip★-시작시-크롬창이....파일 실행"
|
350
|
+
puts "4.안내된 방식으로 크롬 드라이버 교체"
|
351
|
+
puts "5.재 시작"
|
352
|
+
exit 1
|
353
|
+
end
|
339
354
|
options = Selenium::WebDriver::Chrome::Options.new
|
340
355
|
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
341
356
|
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
@@ -2735,6 +2750,22 @@ class Wordpress
|
|
2735
2750
|
@data['table'].pop
|
2736
2751
|
#제목끝
|
2737
2752
|
# content = " #{content} "
|
2753
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
2754
|
+
gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
|
2755
|
+
gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
|
2756
|
+
chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
|
2757
|
+
gpt_text = chat.message(keyword)
|
2758
|
+
#content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2759
|
+
content = content.to_s + "(자동생성글)" + gpt_text.to_s
|
2760
|
+
elsif @data['포스트설정']['내용을자동생성'].checked?
|
2761
|
+
content = auto_text
|
2762
|
+
elsif @data['포스트설정']['내용과자동생성'].checked?
|
2763
|
+
#content = content + "\n(자동생성글)\n" + auto_text
|
2764
|
+
content = content + "(자동생성글)" + auto_text
|
2765
|
+
end
|
2766
|
+
@data['table'][index][-1] = 45
|
2767
|
+
@data['table'] << []
|
2768
|
+
@data['table'].pop
|
2738
2769
|
|
2739
2770
|
if @data['포스트설정']['특정단어굵기'].checked?
|
2740
2771
|
content2 = ''
|
@@ -2774,7 +2805,7 @@ class Wordpress
|
|
2774
2805
|
content = content2
|
2775
2806
|
end
|
2776
2807
|
end
|
2777
|
-
@data['table'][index][-1] =
|
2808
|
+
@data['table'][index][-1] = 50
|
2778
2809
|
@data['table'] << []
|
2779
2810
|
@data['table'].pop
|
2780
2811
|
if @data['포스트설정']['단어크기변경'].checked?
|
@@ -2795,19 +2826,7 @@ class Wordpress
|
|
2795
2826
|
@data['table'][index][-1] = 50
|
2796
2827
|
@data['table'] << []
|
2797
2828
|
@data['table'].pop
|
2798
|
-
|
2799
|
-
gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
|
2800
|
-
gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
|
2801
|
-
chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
|
2802
|
-
gpt_text = chat.message(keyword)
|
2803
|
-
#content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2804
|
-
content = content.to_s + "(자동생성글)" + gpt_text.to_s
|
2805
|
-
elsif @data['포스트설정']['내용을자동생성'].checked?
|
2806
|
-
content = auto_text
|
2807
|
-
elsif @data['포스트설정']['내용과자동생성'].checked?
|
2808
|
-
#content = content + "\n(자동생성글)\n" + auto_text
|
2809
|
-
content = content + "(자동생성글)" + auto_text
|
2810
|
-
end
|
2829
|
+
|
2811
2830
|
|
2812
2831
|
if @data['포스트설정']['내용키워드삽입'].checked?
|
2813
2832
|
puts '내용키워드삽입...'
|
@@ -3079,6 +3098,15 @@ class Wordpress
|
|
3079
3098
|
content_memory = content.split('(자동생성글)')
|
3080
3099
|
content = content_memory[0]
|
3081
3100
|
content_end = content_memory[1].to_s
|
3101
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
3102
|
+
if @data['포스트설정']['gpt상단'].checked?
|
3103
|
+
content = "(자동생성글)\n" + content_end + "\n" + content
|
3104
|
+
else
|
3105
|
+
content = content + "\n(자동생성글)\n" + content_end
|
3106
|
+
end
|
3107
|
+
else
|
3108
|
+
content = content + "\n(자동생성글)\n" + content_end
|
3109
|
+
end
|
3082
3110
|
|
3083
3111
|
if @data['포스트설정']['특정단어키워드로변경'].checked?
|
3084
3112
|
@data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8').split(',').each do |i|
|
@@ -3167,8 +3195,8 @@ class Wordpress
|
|
3167
3195
|
slide_names_only = slide_images.map { |pair| pair[1] }.join(' ')
|
3168
3196
|
|
3169
3197
|
# 각각 <slide>와 <slide1> 태그로 감싸기
|
3170
|
-
|
3171
|
-
|
3198
|
+
slide_html_full = "\n<slide>" + slide_full_paths + "</slide>\n"
|
3199
|
+
slide_html_names = "\n<slide1>" + slide_names_only + "</slide1>\n"
|
3172
3200
|
|
3173
3201
|
# 두 태그를 content에 추가
|
3174
3202
|
content[index3] = content[index3] + slide_html_full
|
@@ -3244,36 +3272,79 @@ class Wordpress
|
|
3244
3272
|
# end
|
3245
3273
|
#end
|
3246
3274
|
if @data['포스트설정']['지도로변경'].checked?
|
3247
|
-
# 지도 주소와 사용자 설정 단어들을 가져옵니다.
|
3248
3275
|
map_address = @data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8')
|
3249
|
-
|
3250
|
-
# 여러 단어로 설정된 '지도로변경단어'를 분리하여 배열로 저장
|
3251
3276
|
change_words = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',')
|
3252
3277
|
|
3253
|
-
# content를 각 줄로 분할
|
3254
3278
|
content_lines = content.split("\n")
|
3279
|
+
new_lines = []
|
3280
|
+
|
3281
|
+
content_lines.each do |line|
|
3282
|
+
# 이미 처리된 줄은 건너뜀
|
3283
|
+
if line.include?("<koreamap>")
|
3284
|
+
new_lines << line
|
3285
|
+
next
|
3286
|
+
end
|
3287
|
+
|
3288
|
+
processed = false
|
3255
3289
|
|
3256
|
-
content_lines.each_with_index do |line, index|
|
3257
|
-
# 각 단어에 대해 처리
|
3258
3290
|
change_words.each do |change_word|
|
3259
|
-
#
|
3260
|
-
if line.
|
3261
|
-
|
3262
|
-
if
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
#
|
3268
|
-
|
3291
|
+
# 1. [단어][주소] 패턴 처리: 분리 + 출력
|
3292
|
+
if line =~ /#{Regexp.escape(change_word)}\[(.*?)\]/
|
3293
|
+
match_data = line.match(/(.*)#{Regexp.escape(change_word)}\[(.*?)\](.*)/)
|
3294
|
+
if match_data
|
3295
|
+
before = match_data[1]
|
3296
|
+
address = match_data[2]
|
3297
|
+
after = match_data[3]
|
3298
|
+
|
3299
|
+
# 태그 추출
|
3300
|
+
open_tag = before[/<p[^>]*?>/i] || ""
|
3301
|
+
close_tag = after[/<\/p>/i] || ""
|
3302
|
+
|
3303
|
+
# 텍스트 정리
|
3304
|
+
before_text = before.sub(open_tag, '')
|
3305
|
+
after_text = after.sub(close_tag, '')
|
3306
|
+
|
3307
|
+
# 줄 분리
|
3308
|
+
new_lines << "#{open_tag}#{before_text}</p>" unless before_text.strip.empty?
|
3309
|
+
new_lines << "<koreamap>#{address}</koreamap>"
|
3310
|
+
new_lines << "#{open_tag}#{after_text}#{close_tag}" unless after_text.strip.empty?
|
3311
|
+
|
3312
|
+
processed = true
|
3313
|
+
break
|
3269
3314
|
end
|
3270
3315
|
end
|
3316
|
+
|
3317
|
+
# 2. 일반 단어 처리 (한 줄에만 등장하는 경우)
|
3318
|
+
if !processed && line.include?(change_word)
|
3319
|
+
parts = line.split(change_word, 2)
|
3320
|
+
prefix = parts[0]
|
3321
|
+
suffix = parts[1]
|
3322
|
+
|
3323
|
+
open_tag = prefix[/<p[^>]*?>/i] || ""
|
3324
|
+
close_tag = suffix[/<\/p>/i] || ""
|
3325
|
+
|
3326
|
+
prefix_text = prefix.sub(open_tag, '')
|
3327
|
+
suffix_text = suffix.sub(close_tag, '')
|
3328
|
+
|
3329
|
+
new_lines << "#{open_tag}#{prefix_text}</p>" unless prefix_text.strip.empty?
|
3330
|
+
new_lines << "<koreamap>#{map_address}</koreamap>"
|
3331
|
+
new_lines << "#{open_tag}#{suffix_text}#{close_tag}" unless suffix_text.strip.empty?
|
3332
|
+
|
3333
|
+
processed = true
|
3334
|
+
break
|
3335
|
+
end
|
3271
3336
|
end
|
3337
|
+
|
3338
|
+
# 변경이 없었으면 원래 줄 추가
|
3339
|
+
new_lines << line unless processed
|
3272
3340
|
end
|
3273
3341
|
|
3274
|
-
|
3275
|
-
content = content_lines.join("\n")
|
3342
|
+
content = new_lines.join("\n")
|
3276
3343
|
end
|
3344
|
+
|
3345
|
+
|
3346
|
+
|
3347
|
+
|
3277
3348
|
|
3278
3349
|
if @data['포스트설정']['인용구변경'].checked?
|
3279
3350
|
if @data['포스트설정']['인용구문구설정'].checked?
|
@@ -3311,21 +3382,26 @@ class Wordpress
|
|
3311
3382
|
@data['table'] << []
|
3312
3383
|
@data['table'].pop
|
3313
3384
|
|
3385
|
+
|
3386
|
+
parts = content.split('(자동생성글)', 2)
|
3387
|
+
content_main = parts[0].strip
|
3388
|
+
content_end = parts[1].to_s.strip
|
3389
|
+
|
3314
3390
|
soosick_1 = ''
|
3315
3391
|
soosick_2 = ''
|
3316
3392
|
if @data['포스트설정']['자동글 수식에 입력'].checked?
|
3317
|
-
|
3318
|
-
|
3393
|
+
content = content_main
|
3394
|
+
soosick_1 = content_end
|
3319
3395
|
else
|
3320
|
-
|
3321
|
-
|
3322
|
-
|
3323
|
-
else
|
3324
|
-
content = content+"\n"+content_end+"\n"
|
3325
|
-
end
|
3396
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
3397
|
+
if @data['포스트설정']['gpt상단'].checked?
|
3398
|
+
content = content_end + "\n" + content_main + "\n"
|
3326
3399
|
else
|
3327
|
-
|
3400
|
+
content = content_main + "\n" + content_end + "\n"
|
3328
3401
|
end
|
3402
|
+
else
|
3403
|
+
content = content_main + "\n" + content_end + "\n"
|
3404
|
+
end
|
3329
3405
|
end
|
3330
3406
|
|
3331
3407
|
if @data['포스트설정']['막글삽입'].checked?
|
@@ -3495,7 +3571,7 @@ class Wordpress
|
|
3495
3571
|
dd_time = @data['table'][index][10].to_s.force_encoding('utf-8').to_i
|
3496
3572
|
#template_no = @data['table'][index][7].to_s.force_encoding('utf-8').to_i
|
3497
3573
|
naver.update(title,content,option,soosick_1,soosick_2, dd_time)
|
3498
|
-
|
3574
|
+
|
3499
3575
|
|
3500
3576
|
# if @data['포스트설정']['태그삽입2'].checked?
|
3501
3577
|
# snumber = @data['포스트설정']['태그삽입2시작숫자'].text.to_s.force_encoding('utf-8').to_i
|
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.
|
4
|
+
version: 111.115.779
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-05-22 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: File to Clipboard gem
|
13
13
|
email: rnjstnswp123@naver.com
|