zon_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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/zon_cafe_comment.rb +57 -28
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41456b5d8395c1d5ff70796edecb54da776885a2b3243908533481e80baddea5
4
- data.tar.gz: 9c5c2bcfa6c172739c5502316fe8aa1aef7ecb0015827381847be67f2a01d874
3
+ metadata.gz: e3df121936007aa3ea59398752de6e0258e63af1b9ecd20a3d863e9aee139435
4
+ data.tar.gz: b7ab53519e61c95390ffb129bdbaf1ed49c0e7842d31bd9f97a0613f1eed2c94
5
5
  SHA512:
6
- metadata.gz: 212c16c3debf8104e981823677a87e0bc1407cf60d1b439f19be2e15599d5d88c432a7443c06c92af063b7396fa6d04c44ff2cc0a9e27098d7021ae54b3b91d6
7
- data.tar.gz: dc01a064f8efe3c8d36a4bcd9daad1ea6b4a505d2f9cc7334fda4dcdaa1cc31cdcddba03188ba9074c854b55bf83839649d92d87a40c83b924a9382785ad534a
6
+ metadata.gz: 5260bd8c78a53c1b964ce02eafd0827fa077b570d5be2c1282365a4fbc5e899b67819f1c97ff4989f26feadff91deb80b253293af8966e54aa08414c4e4bb88f
7
+ data.tar.gz: a7ed615d14f376b4313285d9a14b07d64376c7f7d651de26df87c3686f7dcb261609318a0ec5d7b2982d26c7744d6caafced0d3329443e91d914c827c691987c
@@ -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,6 @@ class Naver
259
258
  end
260
259
  end
261
260
 
262
- def create_id
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
268
261
 
269
262
  def update(content,board_url,nickname,image,option,counts_number,keyword,api_key)
270
263
  @board_url = board_url
@@ -404,7 +397,18 @@ class Naver
404
397
  sleep(1)
405
398
  @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="cafe_main"]')) # 아이프레임 선택
406
399
  @in_iframe = true
407
- end
400
+ end
401
+
402
+ begin
403
+ # 아이프레임 요소가 나타날 때까지 기다립니다.
404
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5)
405
+ wait.until { @driver.find_element(:xpath, '//*[@class="FormInputCheck"]') }
406
+ sleep(1)
407
+ @driver.find_element(:xpath, '//*[@class="FormInputCheck"]').click
408
+ sleep(2)
409
+ rescue
410
+
411
+ end
408
412
 
409
413
  # 한 페이지에 게시글이 15개씩 있다고 가정
410
414
  articles_per_page = 15
@@ -431,17 +435,28 @@ class Naver
431
435
  # 페이지 넘기기: 다음 페이지로 이동 (class="prev-next" 아래의 페이지 링크 클릭)
432
436
 
433
437
  begin
434
- next_page_button = @driver.find_element(:xpath, "//div[@class='prev-next']/a[contains(text(), 'Next')]")
435
- next_page_button.click
436
- sleep(2) # 페이지가 로드되도록 대기
437
- rescue Selenium::WebDriver::Error::NoSuchElementError
438
- puts "더 이상 페이지가 없습니다."
439
- break # 이상 페이지가 없다면 종료
438
+ next_page_number = (current_page + 1).to_s
439
+
440
+ # 페이지 번호 버튼들 찾기
441
+ pagination_buttons = @driver.find_elements(:css, 'div.Pagination button.btn.number')
442
+
443
+ # 텍스트가 다음 페이지 숫자와 같은 버튼 찾기
444
+ next_button = pagination_buttons.find { |btn| btn.text == next_page_number }
445
+
446
+ if next_button
447
+ next_button.click
448
+ sleep(2) # 페이지가 로드되도록 대기
449
+ current_page += 1
450
+ else
451
+ puts "다음 페이지 버튼을 찾을 수 없습니다. 현재 페이지: #{current_page}"
452
+ break
453
+ end
454
+
455
+ rescue => e
456
+ puts "페이지 넘김 중 오류 발생: #{e.message}"
457
+ break
440
458
  end
441
-
442
- # 페이지 번호 갱신
443
- current_page += 1
444
- end
459
+ end
445
460
  # 수집한 URL 출력
446
461
 
447
462
  if @in_iframe
@@ -911,6 +926,9 @@ class Naver
911
926
  @in_iframe = true
912
927
  end
913
928
 
929
+
930
+
931
+
914
932
 
915
933
  # 한 페이지에 게시글이 15개씩 있다고 가정
916
934
  articles_per_page = 15
@@ -940,16 +958,27 @@ class Naver
940
958
  # 페이지 넘기기: 다음 페이지로 이동 (class="prev-next" 아래의 페이지 링크 클릭)
941
959
 
942
960
  begin
943
- next_page_button = @driver.find_element(:xpath, "//div[@class='prev-next']/a[contains(text(), 'Next')]")
944
- next_page_button.click
945
- sleep(2) # 페이지가 로드되도록 대기
946
- rescue Selenium::WebDriver::Error::NoSuchElementError
947
- puts "더 이상 페이지가 없습니다."
948
- break # 이상 페이지가 없다면 종료
949
- end
961
+ next_page_number = (current_page + 1).to_s
962
+
963
+ # 페이지 번호 버튼들 찾기
964
+ pagination_buttons = @driver.find_elements(:css, 'div.Pagination button.btn.number')
965
+
966
+ # 텍스트가 다음 페이지 숫자와 같은 버튼 찾기
967
+ next_button = pagination_buttons.find { |btn| btn.text == next_page_number }
950
968
 
951
- # 페이지 번호 갱신
952
- current_page += 1
969
+ if next_button
970
+ next_button.click
971
+ sleep(2) # 페이지가 로드되도록 대기
972
+ current_page += 1
973
+ else
974
+ puts "다음 페이지 버튼을 찾을 수 없습니다. 현재 페이지: #{current_page}"
975
+ break
976
+ end
977
+
978
+ rescue => e
979
+ puts "페이지 넘김 중 오류 발생: #{e.message}"
980
+ break
981
+ end
953
982
  end
954
983
  # 수집한 URL 출력
955
984
 
@@ -2223,7 +2252,7 @@ end
2223
2252
  }
2224
2253
 
2225
2254
  text_column('게시판/글URL LIST'){
2226
-
2255
+ editable true
2227
2256
  }
2228
2257
 
2229
2258
  cell_rows @data['게시판설정']['게시판']
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zon_cafe_comment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
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-14 00:00:00.000000000 Z
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