cafe_basics 0.0.31 → 0.0.32
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/cafe_basics.rb +163 -151
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fcdb4c34e5496f836951e76190096f36257b2f2f4159126dc45eac6e8fdf79e
|
4
|
+
data.tar.gz: 0d0ca80b13f393e2ebbdba90098e86ce77fd9af897413230b3907b19a3cd868a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62324a38a3d5452c556189c51cbe2da4dc68d09be622ffd4c174c4fe2c1f61158d4a91e637dec82c35671c0eca15430f09a6c8a1b672fbda639f4b1c49eb6564
|
7
|
+
data.tar.gz: 86d1aff31c0374ff05e08ac7515845de33053e5ef5185f43c13d9e0917befe7dcbb953d95df14c55b1c9d3a5136f9e25c8caa768303f18aca08cff56138df8b8
|
data/lib/cafe_basics.rb
CHANGED
@@ -738,182 +738,194 @@ class Naver
|
|
738
738
|
};
|
739
739
|
JS
|
740
740
|
sleep(1)
|
741
|
-
# 이미지 등록 버튼 클릭
|
742
|
-
# 기다릴 시간 설정
|
743
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
744
|
-
# 요소가 나타날 때까지 기다립니다.
|
745
|
-
wait.until { @driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]') }
|
746
|
-
# 해당 버튼을 찾고 클릭
|
747
|
-
image_button = @driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]')
|
748
|
-
@driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", image_button) # 크롤 이동
|
749
|
-
sleep(1)
|
750
|
-
@driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]').click
|
751
|
-
sleep(1)
|
752
|
-
|
753
|
-
# 파일 경로 변환 (슬래시 -> 백슬래시)
|
754
|
-
file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
|
755
|
-
sleep(1)
|
756
|
-
# 파일 입력 필드 찾기 (input[type="file"])
|
757
|
-
file_input = @driver.find_element(:id, 'hidden-file')
|
758
|
-
sleep(1)
|
759
|
-
# send_keys로 파일 경로를 직접 입력하여 파일 업로드
|
760
|
-
file_input.send_keys(file_path)
|
761
|
-
sleep(3)
|
762
|
-
|
763
|
-
@driver.action.key_down(:up).key_up(:up).perform
|
764
|
-
sleep(1)
|
765
|
-
|
766
741
|
begin
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
742
|
+
# 이미지 등록 버튼 클릭
|
743
|
+
# 기다릴 시간 설정
|
744
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
745
|
+
# 요소가 나타날 때까지 기다립니다.
|
746
|
+
wait.until { @driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]') }
|
747
|
+
# 해당 버튼을 찾고 클릭
|
748
|
+
image_button = @driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]')
|
749
|
+
@driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", image_button) # 크롤 이동
|
750
|
+
sleep(1)
|
751
|
+
@driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]').click
|
752
|
+
sleep(1)
|
753
|
+
|
754
|
+
# 파일 경로 변환 (슬래시 -> 백슬래시)
|
755
|
+
file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
|
756
|
+
sleep(1)
|
757
|
+
# 파일 입력 필드 찾기 (input[type="file"])
|
758
|
+
file_input = @driver.find_element(:id, 'hidden-file')
|
759
|
+
sleep(1)
|
760
|
+
# send_keys로 파일 경로를 직접 입력하여 파일 업로드
|
761
|
+
file_input.send_keys(file_path)
|
762
|
+
sleep(3)
|
779
763
|
|
780
|
-
|
781
|
-
|
782
|
-
#요소가 나타날 때까지 60초 동안 기다립니다.
|
783
|
-
wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]') }
|
784
|
-
sleep(1)
|
785
|
-
@driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]').click
|
786
|
-
sleep(1)
|
787
|
-
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
788
|
-
sleep(1)
|
789
|
-
rescue
|
790
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
791
|
-
#요소가 나타날 때까지 60초 동안 기다립니다.
|
792
|
-
wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]') }
|
793
|
-
sleep(1)
|
794
|
-
@driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]').click
|
795
|
-
sleep(1)
|
796
|
-
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
797
|
-
sleep(1)
|
798
|
-
end
|
799
|
-
rescue
|
800
|
-
@driver.action.key_down(:down).key_up(:down).perform
|
764
|
+
@driver.action.key_down(:up).key_up(:up).perform
|
765
|
+
sleep(1)
|
801
766
|
|
802
|
-
end
|
803
|
-
|
804
|
-
|
805
|
-
if option['사진타이틀'] == 'true'
|
806
767
|
begin
|
768
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
769
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
770
|
+
wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]') }
|
771
|
+
element = @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]')
|
772
|
+
@driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element) # 크롤 이동
|
773
|
+
sleep(1)
|
774
|
+
aria_expanded = element.attribute('aria-expanded')
|
775
|
+
if aria_expanded == 'false'
|
776
|
+
element.click
|
777
|
+
sleep(1) # 클릭 후 잠시 대기
|
778
|
+
else
|
779
|
+
end
|
780
|
+
|
781
|
+
begin
|
782
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
783
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
784
|
+
wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]') }
|
785
|
+
sleep(1)
|
786
|
+
@driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]').click
|
787
|
+
sleep(1)
|
788
|
+
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
789
|
+
sleep(1)
|
790
|
+
rescue
|
791
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
792
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
793
|
+
wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]') }
|
794
|
+
sleep(1)
|
795
|
+
@driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]').click
|
796
|
+
sleep(1)
|
797
|
+
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
798
|
+
sleep(1)
|
799
|
+
end
|
800
|
+
rescue
|
801
|
+
@driver.action.key_down(:down).key_up(:down).perform
|
802
|
+
end
|
803
|
+
|
804
|
+
|
805
|
+
if option['사진타이틀'] == 'true'
|
806
|
+
begin
|
807
|
+
@driver.action.key_down(:up).key_up(:up).perform
|
808
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
809
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
810
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]') }
|
811
|
+
sleep(1)
|
812
|
+
@driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
|
813
|
+
sleep(1)
|
814
|
+
@driver.action.send_keys(title).perform
|
815
|
+
sleep(1)
|
816
|
+
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
817
|
+
sleep(1)
|
818
|
+
rescue
|
819
|
+
@driver.action.key_down(:down).key_up(:down).perform
|
820
|
+
end
|
821
|
+
end
|
822
|
+
|
823
|
+
|
824
|
+
if i2.to_s.split('href="')[1] != nil
|
825
|
+
href2 = i2.to_s.split('href="')[1].split('"')[0]
|
807
826
|
@driver.action.key_down(:up).key_up(:up).perform
|
808
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
809
|
-
#요소가 나타날 때까지 60초 동안 기다립니다.
|
810
|
-
wait.until { @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]') }
|
811
827
|
sleep(1)
|
812
|
-
@driver.find_element(:xpath, '//*[@
|
828
|
+
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/button').click
|
813
829
|
sleep(1)
|
814
|
-
@driver.
|
830
|
+
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/div/input').send_keys(href2)
|
815
831
|
sleep(1)
|
816
|
-
@driver.
|
832
|
+
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/div/button').click
|
817
833
|
sleep(1)
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
@driver.action.key_down(:up).key_up(:up).perform
|
827
|
-
sleep(1)
|
828
|
-
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/button').click
|
829
|
-
sleep(1)
|
830
|
-
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/div/input').send_keys(href2)
|
831
|
-
sleep(1)
|
832
|
-
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[7]/div/div/button').click
|
833
|
-
sleep(1)
|
834
|
-
@driver.action.key_down(:enter).key_up(:enter).perform
|
835
|
-
#key_stroke('enter')
|
836
|
-
sleep(1)
|
834
|
+
@driver.action.key_down(:enter).key_up(:enter).perform
|
835
|
+
#key_stroke('enter')
|
836
|
+
sleep(1)
|
837
|
+
end
|
838
|
+
rescue => e
|
839
|
+
@driver.close
|
840
|
+
puts '이미지 등록실패! 인터넷 접속 불량 및 로딩 지연 다음 작업을 실행합니다.'
|
841
|
+
return 0
|
837
842
|
end
|
838
843
|
|
839
844
|
elsif i2.to_s.include?('<video')
|
840
845
|
path = i2.to_s.split('src="')[1].split('"')[0]
|
841
846
|
path = URI.decode_www_form(path)[0][0]
|
847
|
+
begin
|
848
|
+
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[3]/button').click
|
849
|
+
sleep(3)
|
842
850
|
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
console.log("File dialog suppressed");
|
851
|
-
};
|
852
|
-
JS
|
853
|
-
sleep(1)
|
854
|
-
# 파일 업로드 버튼 클릭 (이제 파일 선택 창이 뜨지 않음)
|
855
|
-
@driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/fieldset/div[1]/button[1]').click
|
856
|
-
sleep(3)
|
857
|
-
|
858
|
-
file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
|
859
|
-
sleep(1)
|
860
|
-
# 파일 입력 필드 찾기 (input[type="file"])
|
861
|
-
file_input = @driver.find_element(:id, "hidden-input")
|
862
|
-
sleep(1)
|
863
|
-
# send_keys로 파일 경로를 직접 입력하여 파일 업로드
|
864
|
-
file_input.send_keys(file_path)
|
865
|
-
sleep(3)
|
866
|
-
begin
|
867
|
-
@driver.find_element(:xpath, '//*[@id="nvu_inp_box_title"]').send_keys(title)
|
851
|
+
|
852
|
+
@driver.execute_script(<<~JS)
|
853
|
+
window.URL.createObjectURL = function() {};
|
854
|
+
HTMLInputElement.prototype.click = function() {
|
855
|
+
console.log("File dialog suppressed");
|
856
|
+
};
|
857
|
+
JS
|
868
858
|
sleep(1)
|
869
|
-
|
870
|
-
|
859
|
+
# 파일 업로드 버튼 클릭 (이제 파일 선택 창이 뜨지 않음)
|
860
|
+
@driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/fieldset/div[1]/button[1]').click
|
861
|
+
sleep(3)
|
871
862
|
|
872
|
-
|
863
|
+
file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
|
864
|
+
sleep(1)
|
865
|
+
# 파일 입력 필드 찾기 (input[type="file"])
|
866
|
+
file_input = @driver.find_element(:id, "hidden-input")
|
867
|
+
sleep(1)
|
868
|
+
# send_keys로 파일 경로를 직접 입력하여 파일 업로드
|
869
|
+
file_input.send_keys(file_path)
|
870
|
+
sleep(3)
|
871
|
+
|
872
|
+
@driver.find_element(:xpath, '//*[@id="nvu_inp_box_title"]').send_keys(title)
|
873
|
+
sleep(1)
|
874
|
+
|
873
875
|
@driver.find_element(:xpath, '//*[@id="nvu_inp_box_description"]').send_keys(title)
|
874
876
|
sleep(1)
|
875
|
-
|
876
|
-
end
|
877
|
+
|
877
878
|
|
878
|
-
|
879
|
-
|
879
|
+
|
880
|
+
|
881
|
+
tags2 = option['tag'].to_s
|
882
|
+
tag_mm2 = Array.new
|
883
|
+
tags2.split(',').each do |tag_value|
|
884
|
+
tag_mm2 << ''+tag_value
|
885
|
+
end
|
886
|
+
@driver.find_element(:xpath, '//*[@id="nvu_inp_box_tag"]').click
|
887
|
+
@driver.find_element(:xpath, '//*[@id="nvu_inp_box_tag"]').send_keys(tag_mm2.join("\n")+"\n")
|
880
888
|
sleep(1)
|
881
|
-
rescue
|
882
|
-
end
|
883
889
|
|
884
|
-
|
890
|
+
for n in 1..10
|
891
|
+
begin
|
892
|
+
puts @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text
|
893
|
+
if @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text == '업로드 완료'
|
894
|
+
break
|
895
|
+
end
|
896
|
+
sleep(10)
|
897
|
+
rescue
|
898
|
+
end
|
899
|
+
end
|
900
|
+
|
885
901
|
begin
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
end
|
893
|
-
end
|
902
|
+
@driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[3]/button/span').click
|
903
|
+
sleep(3)
|
904
|
+
@driver.action.key_down(:up).key_up(:up).perform #x탭
|
905
|
+
sleep(1)
|
906
|
+
rescue
|
907
|
+
end
|
894
908
|
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
909
|
+
begin
|
910
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
911
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
912
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]') }
|
913
|
+
sleep(1)
|
914
|
+
@driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
|
915
|
+
sleep(1)
|
916
|
+
@driver.action.send_keys(title).perform
|
917
|
+
sleep(1)
|
918
|
+
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
919
|
+
sleep(1)
|
920
|
+
rescue
|
921
|
+
@driver.action.key_down(:down).key_up(:down).perform
|
922
|
+
end
|
902
923
|
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
@driver.find_element(:xpath, '//*[@class="se-placeholder __se_placeholder se-ff-system se-fs13"]').click
|
909
|
-
sleep(1)
|
910
|
-
@driver.action.send_keys(title).perform
|
911
|
-
sleep(1)
|
912
|
-
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
913
|
-
sleep(1)
|
914
|
-
rescue
|
915
|
-
@driver.action.key_down(:down).key_up(:down).perform
|
916
|
-
end
|
924
|
+
rescue => e
|
925
|
+
@driver.close
|
926
|
+
puts '동영상 등록실패! 인터넷 접속 불량 및 로딩 지연 다음 작업을 실행합니다.'
|
927
|
+
return 0
|
928
|
+
end
|
917
929
|
|
918
930
|
elsif i2.to_s.include?('<inyonggoo')
|
919
931
|
if i2.text == ''
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_basics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|