duo_blog_cafe_comment 0.0.37 → 0.0.39

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_cafe_comment.rb +51 -19
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e21fccc9307baa64613e778c80d18d8137ab0821fb6827cd29b909f8912aa492
4
- data.tar.gz: 98a4eb3b3946b5b6ff9e90b43a40302fe7a66f93fd2ec2945e938f654fcc08b6
3
+ metadata.gz: 6898383e56ecfff90040a9a2a4979486003698e7635cba0107880fba64a635ff
4
+ data.tar.gz: 90bf4ac3602715f1e514a822322aea9d53c0008cf1ddd5553abc536897771d87
5
5
  SHA512:
6
- metadata.gz: 4c6ad21e7c37d7b80f16466e9743ce1ca586cdd72c7de638e631edd17c277cff9d13d590b4f521ad90d4467ad822181fd9d44750745cffa9d82f9372ba8e3378
7
- data.tar.gz: b54a10df56230c15382e7ec8f98dc893e9c024c67640e764268e81586dd04662c68ea94d2eec1d3f54110c6ab5936832a77dfa5acf3033493303e755bb380027
6
+ metadata.gz: 9a0e9cba35c29cf928b90c54330680910362bcc58a1d57111fa36bcf8d478e8b917888bc494f26d108b7802f3b99b473b649645accacd36e587a250f2a6f918c
7
+ data.tar.gz: 150dfcb5f9e69533eb3d9bea4c315c1ac30665a88d9d659eb295b011eb90ddf3142a1200cf813db22c6cae0495b41a550b2fe637e9d844c56ee0bdae5c64a6bf
@@ -404,6 +404,16 @@ class Naver
404
404
  @in_iframe = true
405
405
  end
406
406
 
407
+ begin
408
+ # 아이프레임 요소가 나타날 때까지 기다립니다.
409
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5)
410
+ wait.until { @driver.find_element(:xpath, '//*[@class="FormInputCheck"]') }
411
+ sleep(1)
412
+ @driver.find_element(:xpath, '//*[@class="FormInputCheck"]').click
413
+ sleep(2)
414
+ rescue
415
+
416
+ end
407
417
 
408
418
  # 한 페이지에 게시글이 15개씩 있다고 가정
409
419
  articles_per_page = 15
@@ -430,17 +440,28 @@ class Naver
430
440
  # 페이지 넘기기: 다음 페이지로 이동 (class="prev-next" 아래의 페이지 링크 클릭)
431
441
 
432
442
  begin
433
- next_page_button = @driver.find_element(:xpath, "//div[@class='prev-next']/a[contains(text(), 'Next')]")
434
- next_page_button.click
435
- sleep(2) # 페이지가 로드되도록 대기
436
- rescue Selenium::WebDriver::Error::NoSuchElementError
437
- puts "더 이상 페이지가 없습니다."
438
- break # 이상 페이지가 없다면 종료
443
+ next_page_number = (current_page + 1).to_s
444
+
445
+ # 페이지 번호 버튼들 찾기
446
+ pagination_buttons = @driver.find_elements(:css, 'div.Pagination button.btn.number')
447
+
448
+ # 텍스트가 다음 페이지 숫자와 같은 버튼 찾기
449
+ next_button = pagination_buttons.find { |btn| btn.text == next_page_number }
450
+
451
+ if next_button
452
+ next_button.click
453
+ sleep(2) # 페이지가 로드되도록 대기
454
+ current_page += 1
455
+ else
456
+ puts "다음 페이지 버튼을 찾을 수 없습니다. 현재 페이지: #{current_page}"
457
+ break
458
+ end
459
+
460
+ rescue => e
461
+ puts "페이지 넘김 중 오류 발생: #{e.message}"
462
+ break
439
463
  end
440
-
441
- # 페이지 번호 갱신
442
- current_page += 1
443
- end
464
+ end
444
465
  # 수집한 URL 출력
445
466
 
446
467
  if @in_iframe
@@ -939,16 +960,27 @@ class Naver
939
960
  # 페이지 넘기기: 다음 페이지로 이동 (class="prev-next" 아래의 페이지 링크 클릭)
940
961
 
941
962
  begin
942
- next_page_button = @driver.find_element(:xpath, "//div[@class='prev-next']/a[contains(text(), 'Next')]")
943
- next_page_button.click
944
- sleep(2) # 페이지가 로드되도록 대기
945
- rescue Selenium::WebDriver::Error::NoSuchElementError
946
- puts "더 이상 페이지가 없습니다."
947
- break # 더 이상 페이지가 없다면 종료
948
- end
963
+ next_page_number = (current_page + 1).to_s
964
+
965
+ # 페이지 번호 버튼들 찾기
966
+ pagination_buttons = @driver.find_elements(:css, 'div.Pagination button.btn.number')
949
967
 
950
- # 페이지 번호 갱신
951
- current_page += 1
968
+ # 텍스트가 다음 페이지 숫자와 같은 버튼 찾기
969
+ next_button = pagination_buttons.find { |btn| btn.text == next_page_number }
970
+
971
+ if next_button
972
+ next_button.click
973
+ sleep(2) # 페이지가 로드되도록 대기
974
+ current_page += 1
975
+ else
976
+ puts "다음 페이지 버튼을 찾을 수 없습니다. 현재 페이지: #{current_page}"
977
+ break
978
+ end
979
+
980
+ rescue => e
981
+ puts "페이지 넘김 중 오류 발생: #{e.message}"
982
+ break
983
+ end
952
984
  end
953
985
  # 수집한 URL 출력
954
986
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duo_blog_cafe_comment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.37
4
+ version: 0.0.39
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