tg_send_duo 0.0.37 → 0.0.50
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/tg_send_duo.rb +41 -11
- 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: 22d0e018da798d6137cece99213b25fdce3c42464e55bd14a325a6dd049cce61
|
4
|
+
data.tar.gz: 2286a3cb9f34852e8c6c92c7da10786457bfc9d671357d83039f2ea6da824d80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ff49a03026eee5f9dfb5f6122f377df8f23ff23a471fc60e8b7b82aa4388913cde66f964f32b61aaf721367944803f3b34112b52d9c0a04c4cf7c2cc5d9ec13
|
7
|
+
data.tar.gz: 2ad9b50bab5923c3917d8a4653a2d5cbe76531c105539681c7121dec1eff01f7c0d19f8b115c562e48028609fa0597a3226e1e1ed0960305f08bb77d0122467e
|
data/lib/tg_send_duo.rb
CHANGED
@@ -18,11 +18,14 @@ class Naver
|
|
18
18
|
def initialize
|
19
19
|
@seed = 1
|
20
20
|
end
|
21
|
-
def chrome_setup(telegram_number)
|
21
|
+
def chrome_setup(telegram_number,proxy)
|
22
22
|
telegram_cookie_dir = "C:/telegram_cookie"
|
23
23
|
FileUtils.mkdir_p(telegram_cookie_dir) unless File.exist?(telegram_cookie_dir)
|
24
|
+
if proxy == ''
|
24
25
|
system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://web.telegram.org/a/ --remote-debugging-port=9222 --user-data-dir=C:/telegram_cookie/#{telegram_number}})
|
25
|
-
|
26
|
+
else
|
27
|
+
system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://web.telegram.org/a/ --remote-debugging-port=9222 --user-data-dir=C:/telegram_cookie/#{telegram_number} --proxy-server=#{proxy.to_s.force_encoding('utf-8').to_s}})
|
28
|
+
end
|
26
29
|
end
|
27
30
|
|
28
31
|
def chrome_start(proxy,telegram_number)
|
@@ -32,7 +35,8 @@ class Naver
|
|
32
35
|
begin
|
33
36
|
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
34
37
|
options = Selenium::WebDriver::Chrome::Options.new
|
35
|
-
|
38
|
+
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
39
|
+
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
36
40
|
options.add_argument('--headless') # 브라우저 UI 없이 실행
|
37
41
|
options.add_argument('--disable-gpu') # GPU 가속을 비활성화 (헤드리스에서 필요할 수 있음)
|
38
42
|
options.add_argument('--no-sandbox')
|
@@ -46,7 +50,14 @@ class Naver
|
|
46
50
|
options.add_argument('user-data-dir=C:/telegram_cookie/' + telegram_number)
|
47
51
|
|
48
52
|
|
49
|
-
|
53
|
+
# 'capabilities'과 'options' 배열로 설정
|
54
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
55
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
56
|
+
|
57
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
58
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
59
|
+
|
60
|
+
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
50
61
|
|
51
62
|
|
52
63
|
|
@@ -68,12 +79,14 @@ class Naver
|
|
68
79
|
@driver.switch_to.window(first_window)
|
69
80
|
|
70
81
|
rescue
|
71
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
82
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
72
83
|
end
|
73
84
|
else
|
74
85
|
begin
|
75
86
|
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
76
87
|
options = Selenium::WebDriver::Chrome::Options.new
|
88
|
+
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
89
|
+
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
77
90
|
options.add_argument('--headless') # 브라우저 UI 없이 실행
|
78
91
|
options.add_argument('--disable-gpu') # GPU 가속을 비활성화 (헤드리스에서 필요할 수 있음)
|
79
92
|
options.add_argument('--no-sandbox')
|
@@ -85,7 +98,15 @@ class Naver
|
|
85
98
|
options.add_argument('--disable-notifications')
|
86
99
|
options.add_argument('--remote-debugging-port=9222')
|
87
100
|
options.add_argument('user-data-dir=C:/telegram_cookie/' + telegram_number)
|
88
|
-
|
101
|
+
# 'capabilities'과 'options' 배열로 설정
|
102
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
103
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
104
|
+
|
105
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
106
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
107
|
+
|
108
|
+
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
109
|
+
|
89
110
|
rescue => e
|
90
111
|
puts e
|
91
112
|
puts 'proxy error...'
|
@@ -96,15 +117,25 @@ class Naver
|
|
96
117
|
options.timeouts = {page_load: 20_000}
|
97
118
|
options.page_load_strategy = 'none'
|
98
119
|
options.add_argument('--disable-notifications')
|
120
|
+
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
121
|
+
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
99
122
|
options.add_argument('--headless') # 브라우저 UI 없이 실행
|
100
123
|
options.add_argument('--disable-gpu') # GPU 가속을 비활성화 (헤드리스에서 필요할 수 있음)
|
101
124
|
options.add_argument('--no-sandbox')
|
102
125
|
options.add_argument('--disable-popup-blocking')
|
103
126
|
options.add_argument('--remote-debugging-port=9222')
|
104
127
|
options.add_argument('user-data-dir=C:/telegram_cookie/' + telegram_number)
|
105
|
-
|
128
|
+
# 'capabilities'과 'options' 배열로 설정
|
129
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
130
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
131
|
+
|
132
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
133
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
134
|
+
|
135
|
+
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
136
|
+
|
106
137
|
rescue
|
107
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
138
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
108
139
|
end
|
109
140
|
end
|
110
141
|
end
|
@@ -127,10 +158,9 @@ class Naver
|
|
127
158
|
end
|
128
159
|
|
129
160
|
# 새로운 스레드 생성 및 실행
|
130
|
-
Thread.new { chrome_setup(telegram_number) }
|
161
|
+
Thread.new { chrome_setup(telegram_number, proxy) }
|
131
162
|
sleep(1)
|
132
|
-
|
133
|
-
|
163
|
+
|
134
164
|
chrome_start(proxy, telegram_number)
|
135
165
|
@driver.manage.window.resize_to(1000, 800)
|
136
166
|
#sleep(1)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tg_send_duo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.50
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|