duo_cafe_comment 0.0.27 → 0.0.31
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/duo_cafe_comment.rb +58 -28
- 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: 69b2fe62d17583dad3433c1ace064428d5f61e11372e4d113a7e0b624eeb848b
|
4
|
+
data.tar.gz: '048aae9923e0a0b3b729814ee77c1d4f3c0884856639254da8d3ac1ed1452bff'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aab4d22d1043a5c18377bae7f67c9ca302250bffa6c43593b63858f0baf8dce5468c407ad27184d01752bcf4101a2be5d1eddc67169a3bc60d4039bd656a503c
|
7
|
+
data.tar.gz: f0fc64e88c5284ba701effa4efb02cd895d7bf3fa138af1667aa51779593a27b9dcb2e513202d4eabb0d2a1ec6fb6af9cb866caf4eeefcaa51d94ec8b071101c
|
data/lib/duo_cafe_comment.rb
CHANGED
@@ -14,7 +14,6 @@ require 'clipboard'
|
|
14
14
|
require 'crack'
|
15
15
|
require 'uri'
|
16
16
|
require 'cgi'
|
17
|
-
require 'digest'
|
18
17
|
require 'auto_click'
|
19
18
|
require 'rainbow/refinement'
|
20
19
|
include AutoClickMethods
|
@@ -259,12 +258,7 @@ class Naver
|
|
259
258
|
end
|
260
259
|
end
|
261
260
|
|
262
|
-
|
263
|
-
@seed += 1
|
264
|
-
hash = Digest::SHA256.hexdigest((Time.now.to_i+@seed).to_s).to_s
|
265
|
-
answer = "SE-#{hash[0..7]}-#{hash[8..11]}-#{hash[12..15]}-#{hash[16..19]}-#{hash[20..31]}"
|
266
|
-
return answer
|
267
|
-
end
|
261
|
+
|
268
262
|
|
269
263
|
def update(content,board_url,nickname,image,option,counts_number,keyword,api_key)
|
270
264
|
@board_url = board_url
|
@@ -404,7 +398,18 @@ class Naver
|
|
404
398
|
sleep(1)
|
405
399
|
@driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="cafe_main"]')) # 아이프레임 선택
|
406
400
|
@in_iframe = true
|
407
|
-
end
|
401
|
+
end
|
402
|
+
|
403
|
+
begin
|
404
|
+
# 아이프레임 요소가 나타날 때까지 기다립니다.
|
405
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
406
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="FormInputCheck"]') }
|
407
|
+
sleep(1)
|
408
|
+
@driver.find_element(:xpath, '//*[@class="FormInputCheck"]').click
|
409
|
+
sleep(2)
|
410
|
+
rescue
|
411
|
+
|
412
|
+
end
|
408
413
|
|
409
414
|
# 한 페이지에 게시글이 15개씩 있다고 가정
|
410
415
|
articles_per_page = 15
|
@@ -431,17 +436,28 @@ class Naver
|
|
431
436
|
# 페이지 넘기기: 다음 페이지로 이동 (class="prev-next" 아래의 페이지 링크 클릭)
|
432
437
|
|
433
438
|
begin
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
439
|
+
next_page_number = (current_page + 1).to_s
|
440
|
+
|
441
|
+
# 페이지 번호 버튼들 찾기
|
442
|
+
pagination_buttons = @driver.find_elements(:css, 'div.Pagination button.btn.number')
|
443
|
+
|
444
|
+
# 텍스트가 다음 페이지 숫자와 같은 버튼 찾기
|
445
|
+
next_button = pagination_buttons.find { |btn| btn.text == next_page_number }
|
446
|
+
|
447
|
+
if next_button
|
448
|
+
next_button.click
|
449
|
+
sleep(2) # 페이지가 로드되도록 대기
|
450
|
+
current_page += 1
|
451
|
+
else
|
452
|
+
puts "다음 페이지 버튼을 찾을 수 없습니다. 현재 페이지: #{current_page}"
|
453
|
+
break
|
454
|
+
end
|
455
|
+
|
456
|
+
rescue => e
|
457
|
+
puts "페이지 넘김 중 오류 발생: #{e.message}"
|
458
|
+
break
|
440
459
|
end
|
441
|
-
|
442
|
-
# 페이지 번호 갱신
|
443
|
-
current_page += 1
|
444
|
-
end
|
460
|
+
end
|
445
461
|
# 수집한 URL 출력
|
446
462
|
|
447
463
|
if @in_iframe
|
@@ -911,6 +927,9 @@ class Naver
|
|
911
927
|
@in_iframe = true
|
912
928
|
end
|
913
929
|
|
930
|
+
|
931
|
+
|
932
|
+
|
914
933
|
|
915
934
|
# 한 페이지에 게시글이 15개씩 있다고 가정
|
916
935
|
articles_per_page = 15
|
@@ -940,16 +959,27 @@ class Naver
|
|
940
959
|
# 페이지 넘기기: 다음 페이지로 이동 (class="prev-next" 아래의 페이지 링크 클릭)
|
941
960
|
|
942
961
|
begin
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
puts "더 이상 페이지가 없습니다."
|
948
|
-
break # 더 이상 페이지가 없다면 종료
|
949
|
-
end
|
962
|
+
next_page_number = (current_page + 1).to_s
|
963
|
+
|
964
|
+
# 페이지 번호 버튼들 찾기
|
965
|
+
pagination_buttons = @driver.find_elements(:css, 'div.Pagination button.btn.number')
|
950
966
|
|
951
|
-
|
952
|
-
|
967
|
+
# 텍스트가 다음 페이지 숫자와 같은 버튼 찾기
|
968
|
+
next_button = pagination_buttons.find { |btn| btn.text == next_page_number }
|
969
|
+
|
970
|
+
if next_button
|
971
|
+
next_button.click
|
972
|
+
sleep(2) # 페이지가 로드되도록 대기
|
973
|
+
current_page += 1
|
974
|
+
else
|
975
|
+
puts "다음 페이지 버튼을 찾을 수 없습니다. 현재 페이지: #{current_page}"
|
976
|
+
break
|
977
|
+
end
|
978
|
+
|
979
|
+
rescue => e
|
980
|
+
puts "페이지 넘김 중 오류 발생: #{e.message}"
|
981
|
+
break
|
982
|
+
end
|
953
983
|
end
|
954
984
|
# 수집한 URL 출력
|
955
985
|
|
@@ -2298,7 +2328,7 @@ class Wordpress
|
|
2298
2328
|
}
|
2299
2329
|
|
2300
2330
|
text_column('게시판/글URL LIST'){
|
2301
|
-
|
2331
|
+
editable true
|
2302
2332
|
}
|
2303
2333
|
|
2304
2334
|
cell_rows @data['게시판설정']['게시판']
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duo_cafe_comment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-30 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: File to Clipboard gem
|
13
13
|
email: mymin26@naver.com
|