duo_blog_comment 0.0.26 → 0.0.29

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 +53 -62
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99450eb21aee3957fda6f13d44dbff353af0a0ff28acc4e6c4cb86ac2d5d2a1b
4
- data.tar.gz: e1b288b5abd2729fc3b413a9a8cb6b0ca65d82e798e749b49d80af7c91fe666f
3
+ metadata.gz: 6097dc6fea78c34bc744068fc231be73be5a5ee499eb77b86a1beacf1357e935
4
+ data.tar.gz: bc069f5abf2d8156d11aba8e41fa9b5435f261ad038073c1b424c8b22b7f2151
5
5
  SHA512:
6
- metadata.gz: 772c7c70b73a0624a0d4ff771edb3ce559b32226f6fd498cbdebe7f1e20ba92c9ab13ff37797a8cd6876a0f1c099fa8d3fdb8c8b584ad059930d50b9775b6875
7
- data.tar.gz: a38709a55698dd3157a6eceb3ee90019f1b368f3248ac2049054d20e93b4f1071c44a2ad72491787d8c7453dcdffa9541a5908394afd52f98a4e502cc66dc8f5
6
+ metadata.gz: fc11238ee3ef6152c5650594e33441367d2a7e417adfd8b3fa04c97e37c44dfb7f97e25eb35d20672500721ae3d5d1d697d51bde1229158f6eede93ce41ffd58
7
+ data.tar.gz: 6558f50f115fb431ca54b44d372c577bcc860e40b5dd9591b4a87c8ccfebef622c5ba6b461d8104616dc9c28a26d97e4e92fcbf49775172fb1003497afdfa241
@@ -453,68 +453,58 @@ class Naver
453
453
 
454
454
 
455
455
  elsif option['타겟블로그'] == 'true'
456
- @driver.get(blog_url)
457
- puts '-진행1.......'.red
458
- wait = Selenium::WebDriver::Wait.new(:timeout => 20) # 아이프레임 선택
459
- wait.until { @driver.find_element(:xpath, '//*[@id="mainFrame"]') } # 아이프레임 선택
460
- sleep(1)
461
- @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="mainFrame"]')) # 아이프레임 선택
462
- sleep(1)
463
- puts '-진행2.......'.red
464
- @driver.find_element(:xpath, '//*[@id="toplistSpanBlind"]').click
465
- sleep(2)
466
- puts '-진행3.......'.red
467
- begin
468
- element = @driver.find_element(:xpath, '//*[@class="aline"]')
469
- @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element)#크롤 이동
470
- sleep(2)
471
- element = @driver.find_element(:xpath, '//*[@class="aline"]').click
472
- sleep(1)
473
- puts '-진행4.......'.red
474
- rescue
475
- begin
476
- element = @driver.find_element(:xpath, '//*[@id="listCountToggle"]')
477
- @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element)#크롤 이동
478
- sleep(2)
479
- element = @driver.find_element(:xpath, '//*[@id="listCountToggle"]').click
480
- sleep(1)
481
- puts '-진행5.......'.red
482
- rescue
483
- begin
484
- element = @driver.find_element(:xpath, '//*[@id="listCountView"]')
485
- @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element)#크롤 이동
486
- sleep(2)
487
- element = @driver.find_element(:xpath, '//*[@id="listCountView"]').click
488
- sleep(1)
489
- puts '-진행6.......'.red
490
- rescue
491
- begin
492
- element = @driver.find_element(:xpath, '//i[@class="icon"]')
493
- @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element)#크롤 이동
494
- sleep(2)
495
- element = @driver.find_element(:xpath, '//i[@class="icon"]').click
496
- sleep(1)
497
- puts '-진행7.......'.red
498
- rescue
499
-
500
- end
501
- end
502
- end
503
- end
504
-
505
- puts '-진행8.......'.red
506
- @driver.find_element(:xpath, '//div[@id="changeListCount"]//a[@data-value="30"]').click
507
- puts '-진행9.......'.red
508
- @driver.switch_to.default_content
509
-
510
-
511
- wait = Selenium::WebDriver::Wait.new(:timeout => 20) # 아이프레임 선택
512
- wait.until { @driver.find_element(:xpath, '//*[@id="mainFrame"]') } # 아이프레임 선택
513
- sleep(1)
514
- @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="mainFrame"]')) # 아이프레임 선택
515
- sleep(1)
516
-
517
- # 수집된 URL을 저장할 배열
456
+ @driver.get(blog_url)
457
+ wait = Selenium::WebDriver::Wait.new(:timeout => 20) # 아이프레임 선택
458
+ wait.until { @driver.find_element(:xpath, '//*[@id="mainFrame"]') } # 아이프레임 선택
459
+ sleep(1)
460
+ @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="mainFrame"]')) # 아이프레임 선택
461
+ sleep(1)
462
+ @driver.find_element(:xpath, '//*[@id="toplistSpanBlind"]').click
463
+ sleep(2)
464
+
465
+ begin
466
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
467
+ wait.until { @driver.find_element(:xpath, '//*[@class="aline"]') }
468
+ element = @driver.find_element(:xpath, '//*[@class="aline"]')
469
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element)#크롤 이동
470
+ sleep(2)
471
+ element.send_keys(:return)
472
+ sleep(1)
473
+ rescue
474
+ begin
475
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
476
+ wait.until { @driver.find_element(:xpath, '//*[@id="listCountToggle"]') }
477
+ element = @driver.find_element(:xpath, '//*[@id="listCountToggle"]')
478
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element)#크롤 이동
479
+ sleep(2)
480
+ element.send_keys(:return)
481
+ sleep(1)
482
+ rescue
483
+ end
484
+ end
485
+
486
+
487
+ # WebDriverWait과 expected_conditions 가져오기
488
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5) # 10초 대기
489
+
490
+ # 요소가 화면에 보일 때까지 대기 후 바로 클릭
491
+ wait.until {
492
+ el = @driver.find_element(:xpath, '//div[@id="changeListCount"]//a[@data-value="30"]')
493
+ el.displayed? # 요소가 화면에 보이는지 확인
494
+ }
495
+ # 요소 클릭
496
+ @driver.find_element(:xpath, '//div[@id="changeListCount"]//a[@data-value="30"]').click
497
+ sleep(1)
498
+
499
+
500
+ @driver.switch_to.default_content
501
+ wait = Selenium::WebDriver::Wait.new(:timeout => 20) # 아이프레임 선택
502
+ wait.until { @driver.find_element(:xpath, '//*[@id="mainFrame"]') } # 아이프레임 선택
503
+ sleep(1)
504
+ @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="mainFrame"]')) # 아이프레임 선택
505
+ sleep(1)
506
+
507
+ # 수집된 URL을 저장할 배열
518
508
  collected_urls = []
519
509
 
520
510
  # 현재 페이지에서 수집할 링크 개수
@@ -549,6 +539,7 @@ class Naver
549
539
  remaining_count -= 1
550
540
  end
551
541
  end
542
+ sleep(1)
552
543
  end
553
544
 
554
545
  # 수집된 개수가 요구한 수에 도달하면 종료
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duo_blog_comment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon