tizdppz 0.0.3 → 0.0.6

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/tizdppz.rb +72 -12
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48e51bf5b38c1f0e0cc9fb1e7e628a17bae1f334250af9fba168bd949f72ae53
4
- data.tar.gz: ad28043a564db167cfcc6d14d676b186ab31a444e7ecd474a2a1e9c298991208
3
+ metadata.gz: b91ab10b36066aea801bd1d72f06487b4bae3fef40e141875e85608b52e228b3
4
+ data.tar.gz: 1733b06ee4bcf9f26bfe86335c520485dc3c4d226ced604543c4c77b8fb2fff9
5
5
  SHA512:
6
- metadata.gz: aaf96d1c2ad4cd6ecb6934fca7d7a1f39d42ae5cd511c1ce2086c20431b8f9036ce709e646ffae01b24407bb9d0f50a2c28cd8aa65c28c3dc6fb49272435e2d6
7
- data.tar.gz: 7fef59f972689e6669aacab70a7dd434bab1fcf2fda07c924c8e3564fff1cd44d812bca9240f97cb362cfccba9014c970e3ce1be93bbcc79d182de8527199fdb
6
+ metadata.gz: 69ee1e92f70abb32c6c28d4caa61ba56e7ada0845e55a64fc5facb16709f3a59162f38bfc6cbbd8406031c53f19c63724ce7107affaa9b3161365900b08c5b95
7
+ data.tar.gz: c51ca197e5d17032482ced0549ec45df7adbc018e0bfeb629609742114f6ef0e3cb020865ab1c7e9ff63d2586bfee3860973e2bfec2c3a81c7c1ad12e0746e4e
data/lib/tizdppz.rb CHANGED
@@ -22,7 +22,37 @@ class Naver
22
22
  def initialize(data)
23
23
  @data = data # Wordpress에서 전달된 data 저장
24
24
  @seed = 1
25
+ kill_selenium_chrome #기존 창 모두 닫는 명령
26
+ sleep(1)
25
27
  end
28
+
29
+ def kill_selenium_chrome #기존 창 모두 닫는 코드
30
+ wmi = WIN32OLE.connect("winmgmts://")
31
+ chrome_procs = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chrome.exe'")
32
+
33
+ chrome_procs.each do |proc|
34
+ cmd = proc.CommandLine
35
+ if cmd && cmd.include?("user-data-dir=C:/tiktok_cookie")
36
+ puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
37
+ begin
38
+ proc.Terminate
39
+ rescue
40
+ #puts "→ 이미 종료된 프로세스: #{proc.ProcessId}"
41
+ end
42
+ end
43
+ end
44
+
45
+ # chromedriver도 같이 종료
46
+ chromedrivers = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chromedriver.exe'")
47
+ chromedrivers.each do |proc|
48
+ puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
49
+ begin
50
+ proc.Terminate
51
+ rescue
52
+ #puts "→ 이미 종료된 chromedriver: #{proc.ProcessId}"
53
+ end
54
+ end
55
+ end
26
56
 
27
57
 
28
58
  def chrome_setup(user_id, proxy)
@@ -590,11 +620,15 @@ class Naver
590
620
  # 팔로우
591
621
  if option['팔로우'] == 'true'
592
622
  begin
593
- wait.until { @driver.find_element(:xpath, '//*[@data-e2e="feed-follow" and @shape="capsule"]') }
623
+ wait.until { @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]') }
594
624
  sleep(1)
595
- @driver.find_element(:xpath, '//*[@data-e2e="feed-follow" and @shape="capsule"]').click
625
+ follow_button = @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]')
626
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", follow_button)
627
+ sleep(2)
628
+ @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]').click
596
629
  follow_success = true
597
630
  puts "[#{index + 1}] 팔로우 완료!"
631
+ sleep(1)
598
632
  rescue
599
633
  follow_success = false
600
634
  end
@@ -606,9 +640,13 @@ class Naver
606
640
  begin
607
641
  wait.until { @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]') }
608
642
  sleep(1)
643
+ like_button = @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]')
644
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", like_button)
645
+ sleep(2)
609
646
  @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]').click
610
647
  like_success = true
611
- puts "[#{index + 1}] 좋아요 완료!"
648
+ puts "[#{tagg}] 좋아요 완료!"
649
+ sleep(1)
612
650
  rescue
613
651
  like_success = false
614
652
  end
@@ -645,7 +683,9 @@ class Naver
645
683
  else
646
684
  # 중복 체크 비활성화 시 실행할 코드가 있다면 여기에 작성
647
685
  end
648
-
686
+ comment_text_button = @driver.find_element(:xpath, '//*[@data-e2e="comment-text"]')
687
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", comment_text_button)
688
+ sleep(2)
649
689
  @driver.find_element(:xpath, '//*[@data-e2e="comment-text"]').click
650
690
  sleep(1)
651
691
  Clipboard.copy(content)
@@ -795,11 +835,15 @@ class Naver
795
835
  # 팔로우
796
836
  if option['팔로우'] == 'true'
797
837
  begin
798
- wait.until { @driver.find_element(:xpath, '//*[@data-e2e="feed-follow" and @shape="capsule"]') }
838
+ wait.until { @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]') }
799
839
  sleep(1)
800
- @driver.find_element(:xpath, '//*[@data-e2e="feed-follow" and @shape="capsule"]').click
840
+ follow_button = @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]')
841
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", follow_button)
842
+ sleep(2)
843
+ @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]').click
801
844
  follow_success = true
802
845
  puts "[#{index + 1}] 팔로우 완료!"
846
+ sleep(1)
803
847
  rescue
804
848
  follow_success = false
805
849
  end
@@ -811,9 +855,13 @@ class Naver
811
855
  begin
812
856
  wait.until { @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]') }
813
857
  sleep(1)
858
+ like_button = @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]')
859
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", like_button)
860
+ sleep(2)
814
861
  @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]').click
815
862
  like_success = true
816
- puts "[#{index + 1}] 좋아요 완료!"
863
+ puts "[#{tagg}] 좋아요 완료!"
864
+ sleep(1)
817
865
  rescue
818
866
  like_success = false
819
867
  end
@@ -850,7 +898,9 @@ class Naver
850
898
  else
851
899
  # 중복 체크 비활성화 시 실행할 코드가 있다면 여기에 작성
852
900
  end
853
-
901
+ comment_text_button = @driver.find_element(:xpath, '//*[@data-e2e="comment-text"]')
902
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", comment_text_button)
903
+ sleep(2)
854
904
  @driver.find_element(:xpath, '//*[@data-e2e="comment-text"]').click
855
905
  sleep(1)
856
906
  Clipboard.copy(content)
@@ -979,11 +1029,15 @@ class Naver
979
1029
  # 팔로우
980
1030
  if option['팔로우'] == 'true'
981
1031
  begin
982
- wait.until { @driver.find_element(:xpath, '//*[@data-e2e="feed-follow" and @shape="capsule"]') }
1032
+ wait.until { @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]') }
983
1033
  sleep(1)
984
- @driver.find_element(:xpath, '//*[@data-e2e="feed-follow" and @shape="capsule"]').click
1034
+ follow_button = @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]')
1035
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", follow_button)
1036
+ sleep(2)
1037
+ @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]').click
985
1038
  follow_success = true
986
- puts "[#{tagg}] 팔로우 완료!"
1039
+ puts "[#{index + 1}] 팔로우 완료!"
1040
+ sleep(1)
987
1041
  rescue
988
1042
  follow_success = false
989
1043
  end
@@ -995,9 +1049,13 @@ class Naver
995
1049
  begin
996
1050
  wait.until { @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]') }
997
1051
  sleep(1)
1052
+ like_button = @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]')
1053
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", like_button)
1054
+ sleep(2)
998
1055
  @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]').click
999
1056
  like_success = true
1000
1057
  puts "[#{tagg}] 좋아요 완료!"
1058
+ sleep(1)
1001
1059
  rescue
1002
1060
  like_success = false
1003
1061
  end
@@ -1034,7 +1092,9 @@ class Naver
1034
1092
  else
1035
1093
  # 중복 체크 비활성화 시 실행할 코드가 있다면 여기에 작성
1036
1094
  end
1037
-
1095
+ comment_text_button = @driver.find_element(:xpath, '//*[@data-e2e="comment-text"]')
1096
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", comment_text_button)
1097
+ sleep(2)
1038
1098
  @driver.find_element(:xpath, '//*[@data-e2e="comment-text"]').click
1039
1099
  sleep(1)
1040
1100
  Clipboard.copy(content)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tizdppz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-01 00:00:00.000000000 Z
10
+ date: 2025-05-29 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: File to Clipboard gem
13
13
  email: mymin26@naver.com