duo_blog_comment 0.0.17 → 0.0.20

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/duo_blog_comment.rb +381 -76
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eae83b3fa95cf79f89e1d1d6c6e7f11f2ab9348b05b31ce553ca16c86348adc5
4
- data.tar.gz: be6cc70db9ecd9b3af989e1161d6900c73fbca41c68a6dc0ddd086d33e4a6736
3
+ metadata.gz: de3d418762e74f3d05c7dd648634de8bf5fe5adc780a870c1307ff40d8d2444c
4
+ data.tar.gz: b2450f9605c94d0bbfbc785254d1901bdc6f09ed7e0eb5bfe7bcb662ff303c59
5
5
  SHA512:
6
- metadata.gz: d3dff53c12b058eff0f4a65f57f1aaf301a47e5ee2df914b100ecb52f4819f21b2ea2cfa55e64f8bd5cb8d73665fdf8d40a92f68caa2727b8ec3c4d1abb29820
7
- data.tar.gz: 0b3e7473d3cda82a73fb10228c1965eaca8f6a6f65fc0fda216c6c859109082e23415ce34d69aea625b0fb2c65496b7132af9a186afc0c7d5129f6505ee24275
6
+ metadata.gz: 831a9a36f60cc00be2122fe4ce0bae5349dfdbedb35b7535722d251d18f22ed0250ad452b2a6dcf62065db91ef3fc2497a3d2821fbaa4c8aaf8b80945c8e702f
7
+ data.tar.gz: 2d6e4dc8656057a13f81e9ace13b0fc9bb70993502697d057efe19429e0814a2d1d56aa9082bb8740a5d5806de50746f84ade809b665103acf6fc6a720961cee
@@ -232,12 +232,13 @@ class Naver
232
232
  return answer
233
233
  end
234
234
 
235
- def update(content,image,option,counts_number,keyword,api_key)
235
+ def update(content,image,option,counts_number,keyword,blog_url,api_key)
236
236
 
237
237
  @keyword = keyword
238
238
  @content = content
239
239
  @api_key = api_key
240
-
240
+ @blog_url = blog_url
241
+
241
242
 
242
243
 
243
244
 
@@ -415,12 +416,114 @@ class Naver
415
416
 
416
417
  page_no = rand(1..100)
417
418
  end
419
+
420
+
421
+ elsif option['타겟블로그'] == 'true'
422
+ @driver.get(blog_url)
423
+
424
+ wait = Selenium::WebDriver::Wait.new(:timeout => 20) # 아이프레임 선택
425
+ wait.until { @driver.find_element(:xpath, '//*[@id="mainFrame"]') } # 아이프레임 선택
426
+ sleep(1)
427
+ @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="mainFrame"]')) # 아이프레임 선택
428
+ sleep(1)
429
+
430
+ @driver.find_element(:xpath, '//*[@id="toplistSpanBlind"]').click
431
+ sleep(1)
432
+ element = @driver.find_element(:xpath, '//*[@class="aline"]')
433
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element)#크롤 이동
434
+ sleep(2)
435
+ element = @driver.find_element(:xpath, '//*[@class="aline"]').click
436
+ sleep(1)
437
+ @driver.find_element(:xpath, '//div[@id="changeListCount"]//a[@data-value="30"]').click
438
+
439
+ @driver.switch_to.default_content
440
+
441
+
442
+ wait = Selenium::WebDriver::Wait.new(:timeout => 20) # 아이프레임 선택
443
+ wait.until { @driver.find_element(:xpath, '//*[@id="mainFrame"]') } # 아이프레임 선택
444
+ sleep(1)
445
+ @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="mainFrame"]')) # 아이프레임 선택
446
+ sleep(1)
447
+
448
+ # 수집된 URL을 저장할 배열
449
+ collected_urls = []
450
+
451
+ # 현재 페이지에서 수집할 링크 개수
452
+ remaining_count = counts_number
453
+
454
+ # 페이지 번호
455
+ page_number = 1
456
+
457
+ # 페이지가 끝날 때까지 반복
458
+ while remaining_count > 0
459
+ # 요소가 로드될 때까지 대기
460
+ wait = Selenium::WebDriver::Wait.new(:timeout => 10)
461
+ wait.until { @driver.find_element(:xpath, '//form[@name="listTopForm"]//tbody//tr//td[@class="title"]//div[@class="wrap_td"]//span[@class="ell2 pcol2"]//a[@href]') }
462
+
463
+ # 현재 페이지에서 링크 수집 (form 태그 내에서 a 태그를 찾음)
464
+ links = @driver.find_elements(:xpath, '//form[@name="listTopForm"]//tbody//tr//td[@class="title"]//div[@class="wrap_td"]//span[@class="ell2 pcol2"]//a[@href]') # 정확한 XPath 경로로 a 태그 찾기
465
+
466
+ links.each do |link|
467
+ post_url = link.attribute('href')
468
+ if post_url && collected_urls.length < counts_number
469
+ # 기존 URL에서 blogId와 logNo를 추출하여 변형
470
+ if post_url.include?("blog.naver.com/PostView.naver")
471
+ # URL에서 blogId와 logNo 추출
472
+ blog_id = post_url.split("blogId=")[1].split("&")[0]
473
+ log_no = post_url.split("logNo=")[1].split("&")[0]
474
+
475
+ # 변형된 URL 생성
476
+ new_url = "https://blog.naver.com/#{blog_id}/#{log_no}"
477
+
478
+ # 변형된 URL을 배열에 추가
479
+ collected_urls << new_url
480
+ remaining_count -= 1
481
+ end
482
+ end
483
+ end
484
+
485
+ # 수집된 개수가 요구한 수에 도달하면 종료
486
+ break if collected_urls.length >= counts_number
487
+
488
+ # 10페이지까지 수집되었고, 다음 페이지가 있으면 "다음" 버튼 클릭하여 계속 수집
489
+ if page_number % 10 == 0
490
+ begin
491
+ # "다음" 링크 찾기 (다음 페이지 링크)
492
+ next_page_link = @driver.find_element(:xpath, "//a[text()='다음']")
493
+ next_page_link.click
494
+ page_number += 1 # 페이지 번호 증가
495
+ sleep(2) # 페이지가 로드되기 전에 잠시 대기
496
+ # 페이지가 변경될 때까지 대기
497
+ wait.until { @driver.find_element(:xpath, '//form[@name="listTopForm"]//tbody//tr//td[@class="title"]//div[@class="wrap_td"]//span[@class="ell2 pcol2"]//a[@href]') }
498
+ rescue Selenium::WebDriver::Error::NoSuchElementError
499
+ # 만약 "다음" 버튼이 없으면 종료
500
+ break
501
+ end
502
+ else
503
+ # 페이지 번호가 더 있으면 다음 페이지로 이동
504
+ begin
505
+ next_page_link = @driver.find_element(:xpath, "//a[text()='#{page_number + 1}']")
506
+ next_page_link.click
507
+ page_number += 1
508
+ sleep(2)
509
+ # 페이지가 변경될 때까지 대기
510
+ wait.until { @driver.find_element(:xpath, '//form[@name="listTopForm"]//tbody//tr//td[@class="title"]//div[@class="wrap_td"]//span[@class="ell2 pcol2"]//a[@href]') }
511
+ rescue Selenium::WebDriver::Error::NoSuchElementError
512
+ # 만약 다음 페이지 링크가 없으면 종료
513
+ break
514
+ end
515
+ end
516
+ end
517
+
518
+ @driver.switch_to.default_content
418
519
  end
520
+
521
+
419
522
 
420
523
  collected_urls.each do |url|
421
524
  # 각 post-url로 이동
422
525
  @driver.get(url)
423
-
526
+
424
527
  wait = Selenium::WebDriver::Wait.new(:timeout => 20) # 아이프레임 선택
425
528
  wait.until { @driver.find_element(:xpath, '//*[@id="mainFrame"]') } # 아이프레임 선택
426
529
  sleep(1)
@@ -780,7 +883,7 @@ class Naver
780
883
  # 댓글 입력
781
884
  element = @driver.find_element(:xpath, '//*[@class="u_ico _icon pcol3"]')
782
885
  @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element)#크롤 이동
783
- sleep(1)
886
+ sleep(2)
784
887
 
785
888
  # 좋아요 버튼을 찾기
786
889
  like_button = @driver.find_element(:xpath, '//div[@class="u_likeit_list_module _reactionModule"]//a[@role="button"]')
@@ -893,7 +996,7 @@ class Naver
893
996
  @driver.find_element(:xpath, '//*[@class="u_cbox_guide"]').click
894
997
  sleep(1)
895
998
  Clipboard.copy(answer)
896
- sleep(0.5)
999
+ sleep(1)
897
1000
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
898
1001
  sleep(1)
899
1002
  else
@@ -901,7 +1004,7 @@ class Naver
901
1004
  @driver.find_element(:xpath, '//*[@class="u_cbox_guide"]').click
902
1005
  sleep(1)
903
1006
  Clipboard.copy(content)
904
- sleep(0.5)
1007
+ sleep(1)
905
1008
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
906
1009
  rescue
907
1010
  end
@@ -914,67 +1017,94 @@ class Naver
914
1017
  # '이모티콘' 버튼 클릭
915
1018
  @driver.find_element(:xpath, '//*[@data-action="write#beforeToggleSticker"]').click
916
1019
  sleep(1)
917
-
918
-
919
-
920
-
921
- # 1. 'data-id' 속성에 따라 랜덤으로 요소 클릭
922
- data_ids = ["motion2d_01", "motion3d_02", "cafe_004", "cafe_005", "cafe_001", "cafe_002"]
923
-
924
- # 랜덤으로 data-id 선택
925
- selected_data_id = data_ids.sample
926
-
927
- # 선택된 data-id에 해당하는 요소를 찾기
928
- selected_element = @driver.find_element(:xpath, "//li[@data-id='#{selected_data_id}']")
929
-
930
- # 해당 요소 클릭
931
- selected_element.click
932
- #puts "클릭된 이data-id: #{selected_data_id}"
933
-
934
- sleep(1.5)
935
-
936
- # 2. data-id에 해당하는 data-param을 찾고 랜덤으로 클릭
937
- case selected_data_id
938
- when "cafe_005"
939
- data_params = ["cafe_005-1", "cafe_005-2", "cafe_005-3", "cafe_005-4", "cafe_005-5", "cafe_005-6", "cafe_005-7", "cafe_005-8", "cafe_005-9"]
940
- when "cafe_001"
941
- data_params = ["cafe_001-1", "cafe_001-2", "cafe_001-3", "cafe_001-5", "cafe_001-6", "cafe_001-7", "cafe_001-8", "cafe_001-9"]
942
- when "motion2d_01"
943
- data_params = ["motion2d_01-1", "motion2d_01-2", "motion2d_01-3", "motion2d_01-4", "motion2d_01-5", "motion2d_01-6", "motion2d_01-7", "motion2d_01-8", "motion2d_01-9"]
944
- when "motion3d_02"
945
- data_params = ["motion3d_02-1", "motion3d_02-2", "motion3d_02-3", "motion3d_02-4", "motion3d_02-5", "motion3d_02-6", "motion3d_02-7", "motion3d_02-8", "motion3d_02-9"]
946
- when "cafe_004"
947
- data_params = ["cafe_004-1", "cafe_004-2", "cafe_004-3", "cafe_004-4", "cafe_004-5", "cafe_004-6", "cafe_004-7", "cafe_004-8", "cafe_004-9"]
948
- when "cafe_002"
949
- data_params = ["cafe_002-1", "cafe_002-2", "cafe_002-3", "cafe_002-4", "cafe_002-5", "cafe_002-6", "cafe_002-7", "cafe_002-8", "cafe_002-9"]
950
- else
951
- data_params = []
1020
+
1021
+ actions = [
1022
+ lambda {
1023
+ begin
1024
+ @driver.find_element(:xpath, '//*[@data-param="motion2d_01"]').click
1025
+ sleep(2)
1026
+
1027
+ random_number = (1..24).to_a.sample
1028
+ @driver.find_element(:xpath, '//div[@class="u_cbox_sticker_area"]//ul[@data-id="motion2d_01"]//li[@class="u_cbox_sticker_item"]//button[@data-param="motion2d_01-'+random_number.to_s+'"]').click
1029
+ sleep(2)
1030
+
1031
+ rescue
952
1032
  end
1033
+ },
1034
+ lambda {
953
1035
 
954
- # 3. 이제 선택된 data-id에 해당하는 'data-param'을 가진 버튼을 찾아 랜덤으로 클릭하기
955
- if data_params.any?
956
- # 모든 'u_cbox_sticker_area' 요소를 찾기
957
- areas = @driver.find_elements(:xpath, '//*[@class="u_cbox_sticker_area"]')
958
-
959
- # 각 'u_cbox_sticker_area' 내에서 랜덤으로 data-param을 찾기
960
- areas.each do |area|
961
- # 각 area 내에서 해당 data-id를 가진 button 찾기
962
- buttons = area.find_elements(:xpath, ".//button[contains(@data-param, '#{selected_data_id}')]")
963
-
964
- # 해당 버튼이 있다면
965
- if buttons.any?
966
- # data-param에 해당하는 버튼을 랜덤으로 클릭
967
- button_to_click = buttons.sample
968
- button_to_click.click
1036
+ begin
1037
+ @driver.find_element(:xpath, '//*[@data-param="motion3d_02"]').click
969
1038
  sleep(2)
970
- #puts "클릭된 data-param: #{button_to_click.attribute('data-param')}"
971
- break # 클릭 후 루프 종료
972
- end
1039
+
1040
+ random_number = (1..24).to_a.sample
1041
+ @driver.find_element(:xpath, '//div[@class="u_cbox_sticker_area"]//ul[@data-id="motion3d_02"]//li[@class="u_cbox_sticker_item"]//button[@data-param="motion3d_02-'+random_number.to_s+'"]').click
1042
+ sleep(1)
1043
+ @driver.action.key_down(:enter).key_up(:enter).perform
1044
+ sleep(2)
1045
+
1046
+
1047
+ rescue
973
1048
  end
974
- else
975
- #puts "해당 data-id에 대한 data-param이 없습니다."
1049
+ },
1050
+ lambda {
1051
+
1052
+ begin
1053
+ @driver.find_element(:xpath, '//*[@data-param="cafe_004"]').click
1054
+ sleep(2)
1055
+
1056
+ random_number = (1..28).to_a.sample
1057
+ @driver.find_element(:xpath, '//div[@class="u_cbox_sticker_area"]//ul[@data-id="cafe_004"]//li[@class="u_cbox_sticker_item"]//button[@data-param="cafe_004-'+random_number.to_s+'"]').click
1058
+ sleep(2)
1059
+
1060
+ rescue
976
1061
  end
1062
+ },
1063
+ lambda {
1064
+
1065
+ begin
1066
+ @driver.find_element(:xpath, '//*[@data-param="cafe_005"]').click
1067
+ sleep(2)
1068
+
1069
+ random_number = (1..26).to_a.sample
1070
+ @driver.find_element(:xpath, '//div[@class="u_cbox_sticker_area"]//ul[@data-id="cafe_005"]//li[@class="u_cbox_sticker_item"]//button[@data-param="cafe_005-'+random_number.to_s+'"]').click
1071
+ sleep(2)
1072
+
1073
+ rescue
1074
+ end
1075
+ },
1076
+ lambda {
977
1077
 
1078
+ begin
1079
+ @driver.find_element(:xpath, '//*[@data-param="cafe_001"]').click
1080
+ sleep(2)
1081
+
1082
+ random_number = (1..24).to_a.sample
1083
+ @driver.find_element(:xpath, '//div[@class="u_cbox_sticker_area"]//ul[@data-id="cafe_001"]//li[@class="u_cbox_sticker_item"]//button[@data-param="cafe_001-'+random_number.to_s+'"]').click
1084
+ sleep(1)
1085
+ @driver.action.key_down(:enter).key_up(:enter).perform
1086
+ sleep(2)
1087
+
1088
+ rescue
1089
+ end
1090
+ },
1091
+ lambda {
1092
+
1093
+ begin
1094
+ @driver.find_element(:xpath, '//*[@data-param="cafe_002"]').click
1095
+ sleep(2)
1096
+
1097
+ random_number = (1..24).to_a.sample
1098
+ @driver.find_element(:xpath, '//div[@class="u_cbox_sticker_area"]//ul[@data-id="cafe_002"]//li[@class="u_cbox_sticker_item"]//button[@data-param="cafe_002-'+random_number.to_s+'"]').click
1099
+ sleep(1)
1100
+ @driver.action.key_down(:enter).key_up(:enter).perform
1101
+ sleep(2)
1102
+ rescue
1103
+ end
1104
+ }
1105
+ ]
1106
+ actions.sample.call
1107
+
978
1108
 
979
1109
  elsif option['이미지자동삽입'] == 'true'
980
1110
  begin
@@ -992,6 +1122,7 @@ class Naver
992
1122
  sleep(1)
993
1123
  element = @driver.find_element(:xpath, '//*[@data-uiselector="writeButton"]')
994
1124
  @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element) # 크롤 이동
1125
+ sleep(2)
995
1126
  @driver.find_element(:xpath, '//*[@data-uiselector="writeButton"]').click #등록버튼
996
1127
  posting_url = @driver.current_url
997
1128
  puts "#{posting_url} [댓글 작성 완료 !!]".cyan
@@ -1180,7 +1311,7 @@ class Wordpress
1180
1311
  content_soon = 0
1181
1312
  @my_ip = 'init'
1182
1313
  image_soon = 0
1183
-
1314
+ blog_url_soon = 0
1184
1315
  keyword_soon = 0
1185
1316
  @inumber2 = 0
1186
1317
  @video = Array.new
@@ -1364,6 +1495,25 @@ class Wordpress
1364
1495
  @data['table'] << []
1365
1496
  @data['table'].pop
1366
1497
 
1498
+
1499
+
1500
+ if @data['블로그설정']['블로그'].length == 0
1501
+ blog_url = ''
1502
+ else
1503
+ if @data['블로그설정']['랜덤사용'].checked?
1504
+ blog_url = @data['블로그설정']['블로그'].sample[1]
1505
+ else
1506
+ blog_url = @data['블로그설정']['블로그'][blog_url_soon][1]
1507
+ blog_url_soon += 1
1508
+ if blog_url_soon > @data['블로그설정']['블로그'].length-1
1509
+ blog_url_soon = 0
1510
+ end
1511
+ end
1512
+ end
1513
+
1514
+ @data['table'][index][-1] = 25
1515
+ @data['table'] << []
1516
+ @data['table'].pop
1367
1517
 
1368
1518
  #포스팅 get 데이터 가저오기#############################
1369
1519
 
@@ -1456,6 +1606,13 @@ class Wordpress
1456
1606
  else
1457
1607
  option['블로그무작위'] = 'false'
1458
1608
  end
1609
+
1610
+ if @data['포스트설정']['타겟블로그'].checked?
1611
+ option['타겟블로그'] = 'true'
1612
+ else
1613
+ option['타겟블로그'] = 'false'
1614
+ end
1615
+
1459
1616
  @data['table'][index][-1] = 70
1460
1617
  @data['table'] << []
1461
1618
  @data['table'].pop
@@ -1543,7 +1700,7 @@ class Wordpress
1543
1700
  # 댓글 설정 수 카운트
1544
1701
  counts_number = @data['table'][index][6].to_i
1545
1702
  api_key = @data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8')
1546
- naver.update(content,image,option,counts_number,keyword,api_key)
1703
+ naver.update(content,image,option,counts_number,keyword,blog_url,api_key)
1547
1704
 
1548
1705
 
1549
1706
 
@@ -1587,8 +1744,8 @@ class Wordpress
1587
1744
  @data['게시판설정']['게시판'] = [[false, '']]
1588
1745
  @data['키워드설정'] = Hash.new
1589
1746
  @data['키워드설정']['키워드'] = [[false, '']]
1590
- @data['닉네임설정'] = Hash.new
1591
- @data['닉네임설정']['닉네임'] = [[false, '']]
1747
+ @data['블로그설정'] = Hash.new
1748
+ @data['블로그설정']['블로그'] = [[false, '']]
1592
1749
  @data['내용설정'] = Hash.new
1593
1750
  @data['내용설정']['내용'] = [[false, '']]
1594
1751
  @data['이미지설정'] = Hash.new
@@ -1735,11 +1892,11 @@ class Wordpress
1735
1892
  end
1736
1893
 
1737
1894
  while true
1738
- if @data['게시판설정']['게시판'].length == 0
1895
+ if @data['블로그설정']['블로그'].length == 0
1739
1896
  break
1740
1897
  end
1741
1898
 
1742
- @data['게시판설정']['게시판'].pop
1899
+ @data['블로그설정']['블로그'].pop
1743
1900
  end
1744
1901
 
1745
1902
  while true
@@ -2216,8 +2373,145 @@ class Wordpress
2216
2373
  }
2217
2374
  }
2218
2375
 
2376
+
2377
+ horizontal_box{
2378
+ stretchy false
2379
+ button('   블로그불러오기  '){
2380
+ on_clicked{
2381
+ file = open_file
2382
+ if file != nil
2383
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
2384
+ file_data.split("\n").each do |blog_url|
2385
+ if blog_url.split(' ').join('').length < 2
2386
+
2387
+ else
2388
+ @data['블로그설정']['블로그'] << [false, blog_url]
2389
+ @data['블로그설정']['블로그'] << [false, blog_url]
2390
+ @data['블로그설정']['블로그'].pop
2391
+ end
2392
+ end
2393
+ end
2394
+ }
2395
+ }
2396
+ }
2397
+
2398
+ horizontal_box{
2399
+ stretchy false
2400
+ grid{
2401
+ button(' 전체선택 '){
2402
+ top 1
2403
+ left 0
2404
+ on_clicked{
2405
+ for n in 0..@data['블로그설정']['블로그'].length-1
2406
+ @data['블로그설정']['블로그'][n][0] = true
2407
+ @data['블로그설정']['블로그'] << []
2408
+ @data['블로그설정']['블로그'].pop
2409
+ end
2410
+ }
2411
+ }
2412
+ button(' 선택해제 '){
2413
+ top 1
2414
+ left 1
2415
+ on_clicked{
2416
+ for n in 0..@data['블로그설정']['블로그'].length-1
2417
+ @data['블로그설정']['블로그'][n][0] = false
2418
+ @data['블로그설정']['블로그'] << []
2419
+ @data['블로그설정']['블로그'].pop
2420
+ end
2421
+ }
2422
+ }
2423
+ button(' 삭제하기 '){
2424
+ top 1
2425
+ left 2
2426
+ on_clicked{
2427
+ m = Array.new
2428
+ for n in 0..@data['블로그설정']['블로그'].length-1
2429
+ if @data['블로그설정']['블로그'][n][0] == true
2430
+ m << n
2431
+ end
2432
+ end
2433
+
2434
+ m.reverse.each do |i|
2435
+ @data['블로그설정']['블로그'].delete_at(i)
2436
+ end
2437
+ @data['블로그설정']['블로그'].delete(nil)
2438
+ }
2439
+ }
2440
+ }
2441
+
2442
+ horizontal_box{
2443
+ stretchy false
2444
+ @data['블로그설정']['순서사용'] = checkbox('순서사용'){
2445
+ stretchy false
2446
+ on_toggled{ |c|
2447
+ if c.checked?
2448
+ @data['블로그설정']['랜덤사용'].checked = false
2449
+ end
2450
+ }
2451
+ }
2452
+ @data['블로그설정']['랜덤사용'] = checkbox('랜덤사용'){
2453
+ stretchy false
2454
+ on_toggled{ |c|
2455
+ if c.checked?
2456
+ @data['블로그설정']['순서사용'].checked = false
2457
+ end
2458
+ }
2459
+ }
2460
+ }
2219
2461
  }
2220
-
2462
+
2463
+ table{
2464
+ checkbox_column('선택'){
2465
+ editable true
2466
+ }
2467
+
2468
+ text_column('블로그url'){
2469
+
2470
+ }
2471
+
2472
+ cell_rows @data['블로그설정']['블로그']
2473
+ }
2474
+ horizontal_box{
2475
+ stretchy false
2476
+ @data['내용설정']['폴더경로'] = entry{
2477
+ enabled false
2478
+ text "폴더경로 ex)C:\\내용\\폴더1"
2479
+ }
2480
+ button(' 폴더째로 불러오기 '){
2481
+ enabled false
2482
+ on_clicked{
2483
+ begin
2484
+ path = @data['내용설정']['폴더경로'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
2485
+
2486
+ if Dir.exists?(path) # 경로가 존재하는지 확인
2487
+ Dir.entries(path).each do |file|
2488
+ # '.'과 '..'을 제외한 파일들만 처리
2489
+ if file != '.' and file != '..'
2490
+ begin
2491
+ file_data = File.open(path+'/'+file, 'r', encoding: 'utf-8').read()
2492
+ @data['내용설정']['내용'] << [false, file, file_data]
2493
+ rescue => e
2494
+ # 파일 열기 오류 처리
2495
+ puts "파일 '#{file}'을 열 수 없습니다: #{e.message}"
2496
+ end
2497
+ end
2498
+ end
2499
+ @data['내용설정']['내용'] << []
2500
+ @data['내용설정']['내용'].pop
2501
+ else
2502
+ # 경로가 없으면 경고 메시지 출력
2503
+ puts "경로 '#{path}'이 존재하지 않습니다."
2504
+ end
2505
+ rescue => e
2506
+ # 경로 처리 중 발생한 오류 처리
2507
+ puts "오류 발생: #{e.message}"
2508
+ end
2509
+ }
2510
+ }
2511
+ }
2512
+
2513
+ }
2514
+
2221
2515
  vertical_separator{
2222
2516
  stretchy false
2223
2517
  }
@@ -2323,7 +2617,7 @@ class Wordpress
2323
2617
  stretchy false
2324
2618
  @data['내용설정']['폴더경로'] = entry{
2325
2619
  enabled false
2326
- text "내용폴더경로 ex)C:\\내용\\폴더1"
2620
+ text "폴더경로 ex)C:\\내용\\폴더1"
2327
2621
  }
2328
2622
  button(' 폴더째로 불러오기 '){
2329
2623
  enabled false
@@ -2358,13 +2652,7 @@ class Wordpress
2358
2652
  }
2359
2653
  }
2360
2654
 
2361
- }
2362
-
2363
-
2364
- vertical_separator{
2365
- stretchy false
2366
- }
2367
- vertical_box{
2655
+
2368
2656
  horizontal_box{
2369
2657
  stretchy false
2370
2658
 
@@ -2608,6 +2896,7 @@ class Wordpress
2608
2896
  if @data['포스트설정']['블로그키워드검색최신순'].checked?
2609
2897
  @data['포스트설정']['블로그키워드검색인기순'].checked = false
2610
2898
  @data['포스트설정']['블로그무작위'].checked = false
2899
+ @data['포스트설정']['타겟블로그'].checked = false
2611
2900
  end
2612
2901
  }
2613
2902
  }
@@ -2619,6 +2908,7 @@ class Wordpress
2619
2908
  if @data['포스트설정']['블로그키워드검색인기순'].checked?
2620
2909
  @data['포스트설정']['블로그키워드검색최신순'].checked = false
2621
2910
  @data['포스트설정']['블로그무작위'].checked = false
2911
+ @data['포스트설정']['타겟블로그'].checked = false
2622
2912
  end
2623
2913
  }
2624
2914
  }
@@ -2632,10 +2922,23 @@ class Wordpress
2632
2922
  if @data['포스트설정']['블로그무작위'].checked?
2633
2923
  @data['포스트설정']['블로그키워드검색최신순'].checked = false
2634
2924
  @data['포스트설정']['블로그키워드검색인기순'].checked = false
2925
+ @data['포스트설정']['타겟블로그'].checked = false
2635
2926
  end
2636
2927
  }
2637
2928
  }
2638
2929
 
2930
+ @data['포스트설정']['타겟블로그'] = checkbox('타겟 블로그 작업 (블로그 게시글 URL이 아닌 블로그URL를 세팅해주세요.)'){
2931
+ top 1
2932
+ left 3
2933
+
2934
+ on_toggled {
2935
+ if @data['포스트설정']['타겟블로그'].checked?
2936
+ @data['포스트설정']['블로그키워드검색최신순'].checked = false
2937
+ @data['포스트설정']['블로그키워드검색인기순'].checked = false
2938
+ @data['포스트설정']['블로그무작위'].checked = false
2939
+ end
2940
+ }
2941
+ }
2639
2942
 
2640
2943
  @data['포스트설정']['이웃추가'] = checkbox('이웃추가'){
2641
2944
  top 2
@@ -2776,9 +3079,11 @@ class Wordpress
2776
3079
  @data['키워드설정']['키워드'].shift
2777
3080
  @data['이미지설정']['이미지'].shift
2778
3081
  @data['내용설정']['내용'].shift
3082
+ @data['블로그설정']['블로그'].shift
2779
3083
  @data['키워드설정']['랜덤사용'].checked = true
2780
3084
  @data['이미지설정']['랜덤사용'].checked = true
2781
3085
  @data['내용설정']['랜덤사용'].checked = true
3086
+ @data['블로그설정']['랜덤사용'].checked = true
2782
3087
 
2783
3088
 
2784
3089
  }.show
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duo_blog_comment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-21 00:00:00.000000000 Z
11
+ date: 2025-02-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com