zon_cafe_comment 0.0.27 → 0.0.30

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 -21
  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: bf361e7bb7ca0da6f07c4c51d68fc75c592e0a575abb6d40d12eaa0e0ebba87b
4
+ data.tar.gz: 9474e2940280eba9783b048842d2d3c3e9a681a871499d3a3f2b12545d132d3c
5
5
  SHA512:
6
- metadata.gz: 212c16c3debf8104e981823677a87e0bc1407cf60d1b439f19be2e15599d5d88c432a7443c06c92af063b7396fa6d04c44ff2cc0a9e27098d7021ae54b3b91d6
7
- data.tar.gz: dc01a064f8efe3c8d36a4bcd9daad1ea6b4a505d2f9cc7334fda4dcdaa1cc31cdcddba03188ba9074c854b55bf83839649d92d87a40c83b924a9382785ad534a
6
+ metadata.gz: ab2ca40ba3296246c4e86812348b9298246340b9665ea8341e68e13fc4e1ad9971518e1b456d85be55560dd83b16e9382fb79bb71d0f05615f9d517812e45fc6
7
+ data.tar.gz: 6a09f38bbd36cf77c4f758bbb98ad1275bc171f269ff2e6bfb95f7a0350fa685485d4a815d6baa118e2e13b6dfe7ada809e346095a105327cba55284f324a940
@@ -404,7 +404,18 @@ class Naver
404
404
  sleep(1)
405
405
  @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="cafe_main"]')) # 아이프레임 선택
406
406
  @in_iframe = true
407
- end
407
+ end
408
+
409
+ begin
410
+ # 아이프레임 요소가 나타날 때까지 기다립니다.
411
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5)
412
+ wait.until { @driver.find_element(:xpath, '//*[@class="FormInputCheck"]') }
413
+ sleep(1)
414
+ @driver.find_element(:xpath, '//*[@class="FormInputCheck"]').click
415
+ sleep(2)
416
+ rescue
417
+
418
+ end
408
419
 
409
420
  # 한 페이지에 게시글이 15개씩 있다고 가정
410
421
  articles_per_page = 15
@@ -431,17 +442,28 @@ class Naver
431
442
  # 페이지 넘기기: 다음 페이지로 이동 (class="prev-next" 아래의 페이지 링크 클릭)
432
443
 
433
444
  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 # 이상 페이지가 없다면 종료
445
+ next_page_number = (current_page + 1).to_s
446
+
447
+ # 페이지 번호 버튼들 찾기
448
+ pagination_buttons = @driver.find_elements(:css, 'div.Pagination button.btn.number')
449
+
450
+ # 텍스트가 다음 페이지 숫자와 같은 버튼 찾기
451
+ next_button = pagination_buttons.find { |btn| btn.text == next_page_number }
452
+
453
+ if next_button
454
+ next_button.click
455
+ sleep(2) # 페이지가 로드되도록 대기
456
+ current_page += 1
457
+ else
458
+ puts "다음 페이지 버튼을 찾을 수 없습니다. 현재 페이지: #{current_page}"
459
+ break
460
+ end
461
+
462
+ rescue => e
463
+ puts "페이지 넘김 중 오류 발생: #{e.message}"
464
+ break
440
465
  end
441
-
442
- # 페이지 번호 갱신
443
- current_page += 1
444
- end
466
+ end
445
467
  # 수집한 URL 출력
446
468
 
447
469
  if @in_iframe
@@ -911,6 +933,9 @@ class Naver
911
933
  @in_iframe = true
912
934
  end
913
935
 
936
+
937
+
938
+
914
939
 
915
940
  # 한 페이지에 게시글이 15개씩 있다고 가정
916
941
  articles_per_page = 15
@@ -940,16 +965,27 @@ class Naver
940
965
  # 페이지 넘기기: 다음 페이지로 이동 (class="prev-next" 아래의 페이지 링크 클릭)
941
966
 
942
967
  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
968
+ next_page_number = (current_page + 1).to_s
969
+
970
+ # 페이지 번호 버튼들 찾기
971
+ pagination_buttons = @driver.find_elements(:css, 'div.Pagination button.btn.number')
950
972
 
951
- # 페이지 번호 갱신
952
- current_page += 1
973
+ # 텍스트가 다음 페이지 숫자와 같은 버튼 찾기
974
+ next_button = pagination_buttons.find { |btn| btn.text == next_page_number }
975
+
976
+ if next_button
977
+ next_button.click
978
+ sleep(2) # 페이지가 로드되도록 대기
979
+ current_page += 1
980
+ else
981
+ puts "다음 페이지 버튼을 찾을 수 없습니다. 현재 페이지: #{current_page}"
982
+ break
983
+ end
984
+
985
+ rescue => e
986
+ puts "페이지 넘김 중 오류 발생: #{e.message}"
987
+ break
988
+ end
953
989
  end
954
990
  # 수집한 URL 출력
955
991
 
@@ -2223,7 +2259,7 @@ end
2223
2259
  }
2224
2260
 
2225
2261
  text_column('게시판/글URL LIST'){
2226
-
2262
+ editable true
2227
2263
  }
2228
2264
 
2229
2265
  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.30
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-16 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: File to Clipboard gem
13
13
  email: mymin26@naver.com