duo_blog_cafe_comment 0.0.33 → 0.0.37
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_blog_cafe_comment.rb +105 -41
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e21fccc9307baa64613e778c80d18d8137ab0821fb6827cd29b909f8912aa492
|
4
|
+
data.tar.gz: 98a4eb3b3946b5b6ff9e90b43a40302fe7a66f93fd2ec2945e938f654fcc08b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c6ad21e7c37d7b80f16466e9743ce1ca586cdd72c7de638e631edd17c277cff9d13d590b4f521ad90d4467ad822181fd9d44750745cffa9d82f9372ba8e3378
|
7
|
+
data.tar.gz: b54a10df56230c15382e7ec8f98dc893e9c024c67640e764268e81586dd04662c68ea94d2eec1d3f54110c6ab5936832a77dfa5acf3033493303e755bb380027
|
@@ -277,40 +277,77 @@ class Naver
|
|
277
277
|
|
278
278
|
@driver.get(board_url)
|
279
279
|
begin
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
puts '-[√] 인터넷 로딩 지연 접속실패!!.......'.red
|
286
|
-
@driver.window_handles.each do |handle|
|
287
|
-
@driver.switch_to.window(handle)
|
280
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
281
|
+
# 요소가 나타날 때까지 기다립니다.
|
282
|
+
wait.until { @driver.find_element(:xpath, '//*[@aria-controls="tab_cafe"]') }
|
283
|
+
@driver.find_element(:xpath, '//*[@aria-controls="tab_cafe"]').click
|
284
|
+
rescue
|
288
285
|
begin
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
286
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
287
|
+
# 요소가 나타날 때까지 기다립니다.
|
288
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="gm-tcol-t"]') }
|
289
|
+
@driver.find_element(:xpath, '//*[@class="gm-tcol-t"]').click
|
290
|
+
rescue
|
291
|
+
begin
|
292
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
293
|
+
# 요소가 나타날 때까지 기다립니다.
|
294
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="tit-info-on"]') }
|
295
|
+
@driver.find_element(:xpath, '//*[@class="tit-info-on"]').click
|
296
|
+
rescue => e
|
297
|
+
puts '-[√] 인터넷 로딩 지연 접속실패!!.......'.red
|
298
|
+
@driver.window_handles.each do |handle|
|
299
|
+
@driver.switch_to.window(handle)
|
300
|
+
begin
|
301
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
302
|
+
@driver.close
|
303
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
304
|
+
puts "Failed to close tab: #{e.message}"
|
305
|
+
end
|
306
|
+
end
|
307
|
+
return 0
|
308
|
+
@driver.quit
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
end
|
313
|
+
|
298
314
|
|
299
315
|
################################################################################ 프로그램에 설정한 이미지랑 글까지 등록
|
300
316
|
if option['닉네임변경'] == 'true'
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
317
|
+
begin
|
318
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
319
|
+
# 요소가 나타날 때까지 기다립니다.
|
320
|
+
wait.until { @driver.find_element(:xpath, '//button[@aria-controls="tab_my"]') }
|
321
|
+
@driver.find_element(:xpath, '//button[@aria-controls="tab_my"]').click
|
322
|
+
sleep(1)
|
323
|
+
rescue
|
324
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
325
|
+
# 요소가 나타날 때까지 기다립니다.
|
326
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="tit-action"]') }
|
327
|
+
@driver.find_element(:xpath, '//*[@class="tit-action"]').click
|
328
|
+
sleep(1)
|
329
|
+
end
|
306
330
|
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
begin
|
335
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
336
|
+
wait.until { @driver.find_element(:xpath, '//button[@title="내 프로필 변경하기"]') }
|
337
|
+
# "프로필 변경하기" 링크 찾기
|
338
|
+
element = @driver.find_element(:xpath, '//button[@title="내 프로필 변경하기"]')
|
339
|
+
# Action을 이용하여 컨트롤 키를 누르고 클릭
|
340
|
+
@driver.action.key_down(:control).click(element).key_up(:control).perform
|
341
|
+
sleep(1)
|
342
|
+
rescue
|
343
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
344
|
+
wait.until { @driver.find_element(:xpath, '//div[@class="prfl_thmb"]/a[@class="lab_thmb"]') }
|
345
|
+
# "프로필 변경하기" 링크 찾기
|
346
|
+
element = @driver.find_element(:xpath, '//div[@class="prfl_thmb"]/a[@class="lab_thmb"]')
|
347
|
+
# Action을 이용하여 컨트롤 키를 누르고 클릭
|
348
|
+
@driver.action.key_down(:control).click(element).key_up(:control).perform
|
349
|
+
sleep(1)
|
350
|
+
end
|
314
351
|
|
315
352
|
# 두 번째 탭으로 전환
|
316
353
|
@driver.switch_to.window(@driver.window_handles[1])
|
@@ -353,11 +390,19 @@ class Naver
|
|
353
390
|
|
354
391
|
|
355
392
|
begin
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
393
|
+
begin
|
394
|
+
# 아이프레임 요소가 나타날 때까지 기다립니다.
|
395
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5) # 아이프레임 선택
|
396
|
+
wait.until { @driver.find_element(:xpath, '//*[@id="cafe_content"]') } # 아이프레임 선택
|
397
|
+
sleep(1)
|
398
|
+
rescue
|
399
|
+
# 아이프레임 요소가 나타날 때까지 기다립니다.
|
400
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5) # 아이프레임 선택
|
401
|
+
wait.until { @driver.find_element(:xpath, '//*[@id="cafe_main"]') } # 아이프레임 선택
|
402
|
+
sleep(1)
|
403
|
+
@driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="cafe_main"]')) # 아이프레임 선택
|
404
|
+
@in_iframe = true
|
405
|
+
end
|
361
406
|
|
362
407
|
|
363
408
|
# 한 페이지에 게시글이 15개씩 있다고 가정
|
@@ -397,7 +442,13 @@ class Naver
|
|
397
442
|
current_page += 1
|
398
443
|
end
|
399
444
|
# 수집한 URL 출력
|
400
|
-
|
445
|
+
|
446
|
+
if @in_iframe
|
447
|
+
@driver.switch_to.default_content
|
448
|
+
@in_iframe = false
|
449
|
+
puts "프레임에서 default_content로 자동 복귀"
|
450
|
+
end
|
451
|
+
|
401
452
|
puts "수집한 URL들: #{collected_urls}"
|
402
453
|
|
403
454
|
|
@@ -845,11 +896,19 @@ class Naver
|
|
845
896
|
sleep(1)
|
846
897
|
|
847
898
|
begin
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
899
|
+
begin
|
900
|
+
# 아이프레임 요소가 나타날 때까지 기다립니다.
|
901
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5) # 아이프레임 선택
|
902
|
+
wait.until { @driver.find_element(:xpath, '//*[@id="cafe_content"]') } # 아이프레임 선택
|
903
|
+
sleep(1)
|
904
|
+
rescue
|
905
|
+
# 아이프레임 요소가 나타날 때까지 기다립니다.
|
906
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5) # 아이프레임 선택
|
907
|
+
wait.until { @driver.find_element(:xpath, '//*[@id="cafe_main"]') } # 아이프레임 선택
|
908
|
+
sleep(1)
|
909
|
+
@driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="cafe_main"]')) # 아이프레임 선택
|
910
|
+
@in_iframe = true
|
911
|
+
end
|
853
912
|
|
854
913
|
|
855
914
|
# 한 페이지에 게시글이 15개씩 있다고 가정
|
@@ -892,7 +951,12 @@ class Naver
|
|
892
951
|
current_page += 1
|
893
952
|
end
|
894
953
|
# 수집한 URL 출력
|
895
|
-
|
954
|
+
|
955
|
+
if @in_iframe
|
956
|
+
@driver.switch_to.default_content
|
957
|
+
@in_iframe = false
|
958
|
+
puts "프레임에서 default_content로 자동 복귀"
|
959
|
+
end
|
896
960
|
puts "수집한 URL들: #{collected_urls}"
|
897
961
|
|
898
962
|
|
metadata
CHANGED
@@ -1,14 +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.
|
4
|
+
version: 0.0.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
10
|
+
date: 2025-04-14 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
12
|
description: File to Clipboard gem
|
14
13
|
email: mymin26@naver.com
|
@@ -21,7 +20,6 @@ homepage: ''
|
|
21
20
|
licenses:
|
22
21
|
- zon
|
23
22
|
metadata: {}
|
24
|
-
post_install_message:
|
25
23
|
rdoc_options: []
|
26
24
|
require_paths:
|
27
25
|
- lib
|
@@ -36,8 +34,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
34
|
- !ruby/object:Gem::Version
|
37
35
|
version: '0'
|
38
36
|
requirements: []
|
39
|
-
rubygems_version: 3.
|
40
|
-
signing_key:
|
37
|
+
rubygems_version: 3.6.7
|
41
38
|
specification_version: 4
|
42
39
|
summary: file to clipboard
|
43
40
|
test_files: []
|