zon_cafe_comment 0.0.23 → 0.0.27
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/zon_cafe_comment.rb +108 -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: 41456b5d8395c1d5ff70796edecb54da776885a2b3243908533481e80baddea5
|
4
|
+
data.tar.gz: 9c5c2bcfa6c172739c5502316fe8aa1aef7ecb0015827381847be67f2a01d874
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 212c16c3debf8104e981823677a87e0bc1407cf60d1b439f19be2e15599d5d88c432a7443c06c92af063b7396fa6d04c44ff2cc0a9e27098d7021ae54b3b91d6
|
7
|
+
data.tar.gz: dc01a064f8efe3c8d36a4bcd9daad1ea6b4a505d2f9cc7334fda4dcdaa1cc31cdcddba03188ba9074c854b55bf83839649d92d87a40c83b924a9382785ad534a
|
data/lib/zon_cafe_comment.rb
CHANGED
@@ -278,38 +278,78 @@ class Naver
|
|
278
278
|
begin
|
279
279
|
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
280
280
|
# 요소가 나타날 때까지 기다립니다.
|
281
|
-
wait.until { @driver.find_element(:xpath, '//*[@
|
282
|
-
@driver.find_element(:xpath, '//*[@
|
283
|
-
rescue
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
281
|
+
wait.until { @driver.find_element(:xpath, '//*[@aria-controls="tab_cafe"]') }
|
282
|
+
@driver.find_element(:xpath, '//*[@aria-controls="tab_cafe"]').click
|
283
|
+
rescue
|
284
|
+
begin
|
285
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
286
|
+
# 요소가 나타날 때까지 기다립니다.
|
287
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="gm-tcol-t"]') }
|
288
|
+
@driver.find_element(:xpath, '//*[@class="gm-tcol-t"]').click
|
289
|
+
rescue
|
290
|
+
begin
|
291
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
292
|
+
# 요소가 나타날 때까지 기다립니다.
|
293
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="tit-info-on"]') }
|
294
|
+
@driver.find_element(:xpath, '//*[@class="tit-info-on"]').click
|
295
|
+
rescue => e
|
296
|
+
puts '-[√] 인터넷 로딩 지연 접속실패!!.......'.red
|
297
|
+
@driver.window_handles.each do |handle|
|
298
|
+
@driver.switch_to.window(handle)
|
299
|
+
begin
|
300
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
301
|
+
@driver.close
|
302
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
303
|
+
puts "Failed to close tab: #{e.message}"
|
304
|
+
end
|
305
|
+
end
|
306
|
+
return 0
|
307
|
+
@driver.quit
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
296
311
|
end
|
312
|
+
|
313
|
+
|
297
314
|
|
298
315
|
################################################################################ 프로그램에 설정한 이미지랑 글까지 등록
|
299
316
|
if option['닉네임변경'] == 'true'
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
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
|
330
|
+
|
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
|
305
351
|
|
306
|
-
|
307
|
-
wait.until { @driver.find_element(:link_text, '프로필 변경하기') }
|
308
|
-
# "프로필 변경하기" 링크 찾기
|
309
|
-
element = @driver.find_element(:link_text, '프로필 변경하기')
|
310
|
-
# Action을 이용하여 컨트롤 키를 누르고 클릭
|
311
|
-
@driver.action.key_down(:control).click(element).key_up(:control).perform
|
312
|
-
sleep(1)
|
352
|
+
|
313
353
|
|
314
354
|
# 두 번째 탭으로 전환
|
315
355
|
@driver.switch_to.window(@driver.window_handles[1])
|
@@ -318,7 +358,7 @@ class Naver
|
|
318
358
|
wait.until { @driver.find_element(:xpath, '//*[@class="btn_delete"]') }
|
319
359
|
@driver.find_element(:xpath, '//*[@class="btn_delete"]').click
|
320
360
|
sleep(1)
|
321
|
-
@driver.find_element(:xpath, '
|
361
|
+
@driver.find_element(:xpath, '/html/body/div/div/div[2]/div[2]/div[1]/div[1]/textarea').click
|
322
362
|
@nickname = nickname
|
323
363
|
@driver.find_element(:xpath, '//*[@id="app"]/div/div[2]/div[2]/div[1]/div[1]/textarea').send_keys(nickname)
|
324
364
|
sleep(1)
|
@@ -352,12 +392,19 @@ class Naver
|
|
352
392
|
|
353
393
|
|
354
394
|
begin
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
395
|
+
begin
|
396
|
+
# 아이프레임 요소가 나타날 때까지 기다립니다.
|
397
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5) # 아이프레임 선택
|
398
|
+
wait.until { @driver.find_element(:xpath, '//*[@id="cafe_content"]') } # 아이프레임 선택
|
399
|
+
sleep(1)
|
400
|
+
rescue
|
401
|
+
# 아이프레임 요소가 나타날 때까지 기다립니다.
|
402
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5) # 아이프레임 선택
|
403
|
+
wait.until { @driver.find_element(:xpath, '//*[@id="cafe_main"]') } # 아이프레임 선택
|
404
|
+
sleep(1)
|
405
|
+
@driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="cafe_main"]')) # 아이프레임 선택
|
406
|
+
@in_iframe = true
|
407
|
+
end
|
361
408
|
|
362
409
|
# 한 페이지에 게시글이 15개씩 있다고 가정
|
363
410
|
articles_per_page = 15
|
@@ -396,7 +443,13 @@ class Naver
|
|
396
443
|
current_page += 1
|
397
444
|
end
|
398
445
|
# 수집한 URL 출력
|
399
|
-
|
446
|
+
|
447
|
+
if @in_iframe
|
448
|
+
@driver.switch_to.default_content
|
449
|
+
@in_iframe = false
|
450
|
+
puts "프레임에서 default_content로 자동 복귀"
|
451
|
+
end
|
452
|
+
|
400
453
|
puts "수집한 URL들: #{collected_urls}"
|
401
454
|
|
402
455
|
|
@@ -844,11 +897,19 @@ class Naver
|
|
844
897
|
sleep(1)
|
845
898
|
|
846
899
|
begin
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
900
|
+
begin
|
901
|
+
# 아이프레임 요소가 나타날 때까지 기다립니다.
|
902
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5) # 아이프레임 선택
|
903
|
+
wait.until { @driver.find_element(:xpath, '//*[@id="cafe_content"]') } # 아이프레임 선택
|
904
|
+
sleep(1)
|
905
|
+
rescue
|
906
|
+
# 아이프레임 요소가 나타날 때까지 기다립니다.
|
907
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5) # 아이프레임 선택
|
908
|
+
wait.until { @driver.find_element(:xpath, '//*[@id="cafe_main"]') } # 아이프레임 선택
|
909
|
+
sleep(1)
|
910
|
+
@driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="cafe_main"]')) # 아이프레임 선택
|
911
|
+
@in_iframe = true
|
912
|
+
end
|
852
913
|
|
853
914
|
|
854
915
|
# 한 페이지에 게시글이 15개씩 있다고 가정
|
@@ -891,7 +952,13 @@ class Naver
|
|
891
952
|
current_page += 1
|
892
953
|
end
|
893
954
|
# 수집한 URL 출력
|
894
|
-
|
955
|
+
|
956
|
+
if @in_iframe
|
957
|
+
@driver.switch_to.default_content
|
958
|
+
@in_iframe = false
|
959
|
+
puts "프레임에서 default_content로 자동 복귀"
|
960
|
+
end
|
961
|
+
|
895
962
|
puts "수집한 URL들: #{collected_urls}"
|
896
963
|
|
897
964
|
|
metadata
CHANGED
@@ -1,14 +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.
|
4
|
+
version: 0.0.27
|
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: []
|