tblog_duopack 0.0.2 → 0.0.5
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/tblog_duopack.rb +68 -70
- 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: 67aca1228ea382eedfe5cd4311bba5bac0f58c7086bab65742981b1fd94df259
|
4
|
+
data.tar.gz: 4d9399e4ca2201f9124d730528fad53e94d6ea74e140202e8510a70eb51dcd9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5bfde0b177e7c1ec89d2651af06931fd4e54ff71e7f4ee5de1486fcaddea5f90c51945b7ed2c61c80a3d31d253de780a9381e34414c4e0bd3c11717ca01f9f0
|
7
|
+
data.tar.gz: 04b37e0db153e7973c7b480e0affd256418358187bf51f02cfe105a280724d0e2352dc4ab900a053d945e0d829e70ffc906575cf70cb11e07acb45f3125acae2
|
data/lib/tblog_duopack.rb
CHANGED
@@ -1,4 +1,32 @@
|
|
1
1
|
|
2
|
+
require 'glimmer-dsl-libui'
|
3
|
+
require 'selenium-webdriver'
|
4
|
+
# require 'webdrivers'
|
5
|
+
require 'iconv'
|
6
|
+
require 'nokogiri'
|
7
|
+
require 'http'
|
8
|
+
require 'json'
|
9
|
+
require 'down'
|
10
|
+
require 'rmagick'
|
11
|
+
require 'fileutils'
|
12
|
+
require 'rest-client'
|
13
|
+
require 'open3'
|
14
|
+
require 'clipboard'
|
15
|
+
require 'crack'
|
16
|
+
require 'uri'
|
17
|
+
require 'cgi'
|
18
|
+
require 'digest'
|
19
|
+
require 'auto_click'
|
20
|
+
require 'rainbow/refinement'
|
21
|
+
require 'net/http'
|
22
|
+
require 'httparty'
|
23
|
+
include AutoClickMethods
|
24
|
+
using Rainbow
|
25
|
+
include Glimmer
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
2
30
|
class Chat
|
3
31
|
def initialize(api_key)
|
4
32
|
@api_key = api_key
|
@@ -2222,104 +2250,74 @@ class Wordpress
|
|
2222
2250
|
end
|
2223
2251
|
|
2224
2252
|
image_thum_ids = Array.new
|
2225
|
-
|
2226
2253
|
image_memory = Array.new
|
2227
|
-
|
2254
|
+
|
2228
2255
|
if @data['포스트설정']['내용사진자동삽입'].checked?
|
2229
2256
|
puts '내용사진자동삽입...'
|
2257
|
+
|
2230
2258
|
sn = @data['포스트설정']['내용사진자동삽입시작숫자'].text.to_s.force_encoding('utf-8').to_i
|
2231
2259
|
en = @data['포스트설정']['내용사진자동삽입끝숫자'].text.to_s.force_encoding('utf-8').to_i
|
2260
|
+
|
2232
2261
|
begin
|
2233
2262
|
cn = rand(sn..en)
|
2234
2263
|
rescue
|
2235
2264
|
cn = 0
|
2236
2265
|
puts 'cn = rand(sn..en) error cn = 1'
|
2237
2266
|
end
|
2238
|
-
|
2267
|
+
|
2239
2268
|
if cn != 0
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2243
|
-
|
2244
|
-
|
2245
|
-
|
2246
|
-
|
2247
|
-
|
2248
|
-
|
2249
|
-
|
2250
|
-
|
2251
|
-
|
2252
|
-
|
2253
|
-
|
2254
|
-
if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
2255
|
-
content5 = content.split("(자동생성글)")[0].to_s.split("\n")
|
2256
|
-
content55 = content.split("(자동생성글)")[1].to_s
|
2257
|
-
|
2258
|
-
else
|
2259
|
-
content55 = ''
|
2260
|
-
content5 = content.split("(자동생성글)")[0].to_s.split("\n")
|
2261
|
-
end
|
2262
|
-
|
2263
|
-
p content5
|
2264
|
-
puts content55
|
2265
|
-
p position
|
2266
|
-
|
2267
|
-
while true
|
2268
|
-
check11 = 0
|
2269
|
-
for nn in 0..position.length-1
|
2270
|
-
if content5[position[nn]].to_s.include?('style') or content5[position[nn]].to_s.include?('<') or content5[position[nn]].to_s.include?('>')
|
2271
|
-
check11 = 1
|
2272
|
-
position[nn] += 4
|
2273
|
-
end
|
2274
|
-
end
|
2275
|
-
if check11 == 0
|
2276
|
-
break
|
2269
|
+
# 내용 분할 (자동 생성 글과 텍스트)
|
2270
|
+
content5 = content.split("(자동생성글)")[0].to_s.split("\n")
|
2271
|
+
content55 = content.split("(자동생성글)")[1].to_s if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
|
2272
|
+
|
2273
|
+
# 빈 줄 찾기
|
2274
|
+
empty_positions = content5.each_with_index.select { |line, index| line.strip.empty? }.map { |line, index| index }
|
2275
|
+
|
2276
|
+
# 빈 줄이 부족하면 텍스트 끝에 빈 줄 추가
|
2277
|
+
if empty_positions.length < cn
|
2278
|
+
# 부족한 빈 줄의 수
|
2279
|
+
missing_empty_lines = cn - empty_positions.length
|
2280
|
+
missing_empty_lines.times do
|
2281
|
+
content5 << "" # 텍스트 마지막에 빈 줄 추가
|
2277
2282
|
end
|
2283
|
+
empty_positions = content5.each_with_index.select { |line, index| line.strip.empty? }.map { |line, index| index } # 다시 빈 줄 위치 계산
|
2278
2284
|
end
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2282
|
-
|
2285
|
+
|
2286
|
+
# 이미지 삽입할 위치를 지정 (빈 줄 위치에 삽입)
|
2287
|
+
position = empty_positions[0..cn-1]
|
2288
|
+
|
2289
|
+
# 이미지 URL 가져오기
|
2290
|
+
if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
|
2283
2291
|
image_url22 = get_image_file().force_encoding('utf-8')
|
2284
2292
|
end
|
2285
|
-
|
2293
|
+
|
2294
|
+
# 각 위치에 이미지를 하나씩만 삽입
|
2286
2295
|
position.each do |i|
|
2287
2296
|
image_url = get_image_file().force_encoding('utf-8')
|
2288
|
-
puts
|
2289
|
-
|
2290
|
-
|
2297
|
+
puts '사진넣는위치 => ' + i.to_s
|
2298
|
+
|
2299
|
+
# 링크가 있을 경우 링크 포함
|
2291
2300
|
if @data['포스트설정']['내용사진링크'].checked?
|
2292
|
-
image_memory << "
|
2293
|
-
content5
|
2301
|
+
image_memory << "<a href='" + @data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8') + "'><img src='" + image_url + "' alt='" + keyword.force_encoding('utf-8') + "'></a>"
|
2302
|
+
content5[i] = '**image**' # 빈 줄에 이미지를 삽입
|
2294
2303
|
else
|
2295
|
-
image_memory << "
|
2296
|
-
content5
|
2304
|
+
image_memory << "<img src='" + image_url + "' alt='" + keyword + "' class='aligncenter size-full'>"
|
2305
|
+
content5[i] = '**image**' # 빈 줄에 이미지를 삽입
|
2297
2306
|
end
|
2298
2307
|
end
|
2299
|
-
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2303
|
-
# content = iconv.iconv(content)
|
2304
|
-
# content = content.encode('UTF-8', 'binary', invalid: :replace, replace: '')
|
2305
|
-
puts content
|
2306
|
-
image_url = image_url22
|
2307
|
-
|
2308
|
-
# if @data['포스트설정']['자동글 수식에 입력'].checked?
|
2309
|
-
|
2310
|
-
# else
|
2311
|
-
# if @data['포스트설정']['내용사진링크'].checked?
|
2312
|
-
# content = content.split('(자동생성글)')[0]+""+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8')+'"><img src="'+image_url+'" alt="'+keyword+'"></a>'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
|
2313
|
-
# else
|
2314
|
-
# content = content.split('(자동생성글)')[0]+""+'<img src="'+image_url+'" alt="'+keyword+'" >'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
|
2315
|
-
# end
|
2316
|
-
# end
|
2308
|
+
|
2309
|
+
# 자동 생성된 내용과 합치기
|
2310
|
+
if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
|
2311
|
+
content = content5.join("\n") + '(자동생성글)' + content55
|
2317
2312
|
else
|
2318
2313
|
content = content5.join("\n")
|
2319
2314
|
end
|
2315
|
+
|
2316
|
+
puts content
|
2320
2317
|
end
|
2321
2318
|
end
|
2322
2319
|
|
2320
|
+
|
2323
2321
|
@data['table'][index][-1] = 70
|
2324
2322
|
@data['table'] << []
|
2325
2323
|
@data['table'].pop
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tblog_duopack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|