tizdppd 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/tizdppd.rb +72 -12
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7f60635d2491a03b93c7953acb54eaa0a2fa6d1caab3d2ad15fc1e0e94438a9
4
- data.tar.gz: 71ae5b9e3fa03bba44667b9fad11149892ea30a31f8bba93495ded1e0a3f1923
3
+ metadata.gz: 3fa19fd66a24f283edafe9b07ceebf7ee60c75a99fdf3b8d419abe30cb50f84c
4
+ data.tar.gz: d3bb9c23585a45da772ea1be93d7292f6a70bfca2c302121376ecfd930742ccc
5
5
  SHA512:
6
- metadata.gz: cd26a654fb67e5ca8fdf7cbd66fc004c212c2a10ae5518879e6545628d81395ea2c84448020d6302fd7ddbe9c917c66ad13dd6df1100989d27eeda127044f410
7
- data.tar.gz: b5bd5cb682a7266147c90c3834d0874fa837f7275f45296a0fd0482a60a12ecca9ce4afd6ce979a3762478fea35c0d2f3d6c967f90adb22b30ab4625785c8fe9
6
+ metadata.gz: 6728711f5d7040de2e4da4381c45409faf05378fd0664a414a9462e249b8fbcebc50160e9fccef96f5b1dcc4f973854a5a2cc0ab256b1e2504f58f4e82e54825
7
+ data.tar.gz: b4f3114eb8223f1af8fa84b1958ae67277825bb1b658c0a3e3ad757409e901fbcedac10add36152e9145433a80ec9575d6ce64baf53d381c55b20a2db9b81aaf
data/lib/tizdppd.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)
@@ -594,11 +624,15 @@ class Naver
594
624
  # 팔로우
595
625
  if option['팔로우'] == 'true'
596
626
  begin
597
- wait.until { @driver.find_element(:xpath, '//*[@data-e2e="feed-follow" and @shape="capsule"]') }
627
+ wait.until { @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]') }
598
628
  sleep(1)
599
- @driver.find_element(:xpath, '//*[@data-e2e="feed-follow" and @shape="capsule"]').click
629
+ follow_button = @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]')
630
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", follow_button)
631
+ sleep(2)
632
+ @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]').click
600
633
  follow_success = true
601
634
  puts "[#{index + 1}] 팔로우 완료!"
635
+ sleep(1)
602
636
  rescue
603
637
  follow_success = false
604
638
  end
@@ -610,9 +644,13 @@ class Naver
610
644
  begin
611
645
  wait.until { @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]') }
612
646
  sleep(1)
647
+ like_button = @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]')
648
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", like_button)
649
+ sleep(2)
613
650
  @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]').click
614
651
  like_success = true
615
- puts "[#{index + 1}] 좋아요 완료!"
652
+ puts "[#{tagg}] 좋아요 완료!"
653
+ sleep(1)
616
654
  rescue
617
655
  like_success = false
618
656
  end
@@ -649,7 +687,9 @@ class Naver
649
687
  else
650
688
  # 중복 체크 비활성화 시 실행할 코드가 있다면 여기에 작성
651
689
  end
652
-
690
+ comment_text_button = @driver.find_element(:xpath, '//*[@data-e2e="comment-text"]')
691
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", comment_text_button)
692
+ sleep(2)
653
693
  @driver.find_element(:xpath, '//*[@data-e2e="comment-text"]').click
654
694
  sleep(1)
655
695
  Clipboard.copy(content)
@@ -799,11 +839,15 @@ class Naver
799
839
  # 팔로우
800
840
  if option['팔로우'] == 'true'
801
841
  begin
802
- wait.until { @driver.find_element(:xpath, '//*[@data-e2e="feed-follow" and @shape="capsule"]') }
842
+ wait.until { @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]') }
803
843
  sleep(1)
804
- @driver.find_element(:xpath, '//*[@data-e2e="feed-follow" and @shape="capsule"]').click
844
+ follow_button = @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]')
845
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", follow_button)
846
+ sleep(2)
847
+ @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]').click
805
848
  follow_success = true
806
849
  puts "[#{index + 1}] 팔로우 완료!"
850
+ sleep(1)
807
851
  rescue
808
852
  follow_success = false
809
853
  end
@@ -815,9 +859,13 @@ class Naver
815
859
  begin
816
860
  wait.until { @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]') }
817
861
  sleep(1)
862
+ like_button = @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]')
863
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", like_button)
864
+ sleep(2)
818
865
  @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]').click
819
866
  like_success = true
820
- puts "[#{index + 1}] 좋아요 완료!"
867
+ puts "[#{tagg}] 좋아요 완료!"
868
+ sleep(1)
821
869
  rescue
822
870
  like_success = false
823
871
  end
@@ -854,7 +902,9 @@ class Naver
854
902
  else
855
903
  # 중복 체크 비활성화 시 실행할 코드가 있다면 여기에 작성
856
904
  end
857
-
905
+ comment_text_button = @driver.find_element(:xpath, '//*[@data-e2e="comment-text"]')
906
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", comment_text_button)
907
+ sleep(2)
858
908
  @driver.find_element(:xpath, '//*[@data-e2e="comment-text"]').click
859
909
  sleep(1)
860
910
  Clipboard.copy(content)
@@ -983,11 +1033,15 @@ class Naver
983
1033
  # 팔로우
984
1034
  if option['팔로우'] == 'true'
985
1035
  begin
986
- wait.until { @driver.find_element(:xpath, '//*[@data-e2e="feed-follow" and @shape="capsule"]') }
1036
+ wait.until { @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]') }
987
1037
  sleep(1)
988
- @driver.find_element(:xpath, '//*[@data-e2e="feed-follow" and @shape="capsule"]').click
1038
+ follow_button = @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]')
1039
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", follow_button)
1040
+ sleep(2)
1041
+ @driver.find_element(:xpath, '//*[@data-e2e="browse-follow"]').click
989
1042
  follow_success = true
990
- puts "[#{tagg}] 팔로우 완료!"
1043
+ puts "[#{index + 1}] 팔로우 완료!"
1044
+ sleep(1)
991
1045
  rescue
992
1046
  follow_success = false
993
1047
  end
@@ -999,9 +1053,13 @@ class Naver
999
1053
  begin
1000
1054
  wait.until { @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]') }
1001
1055
  sleep(1)
1056
+ like_button = @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]')
1057
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", like_button)
1058
+ sleep(2)
1002
1059
  @driver.find_element(:xpath, '//*[@data-e2e="like-icon"]').click
1003
1060
  like_success = true
1004
1061
  puts "[#{tagg}] 좋아요 완료!"
1062
+ sleep(1)
1005
1063
  rescue
1006
1064
  like_success = false
1007
1065
  end
@@ -1038,7 +1096,9 @@ class Naver
1038
1096
  else
1039
1097
  # 중복 체크 비활성화 시 실행할 코드가 있다면 여기에 작성
1040
1098
  end
1041
-
1099
+ comment_text_button = @driver.find_element(:xpath, '//*[@data-e2e="comment-text"]')
1100
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", comment_text_button)
1101
+ sleep(2)
1042
1102
  @driver.find_element(:xpath, '//*[@data-e2e="comment-text"]').click
1043
1103
  sleep(1)
1044
1104
  Clipboard.copy(content)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tizdppd
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