cafe_buy_duo 0.0.57 → 0.0.70
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_buy_duo.rb +72 -35
- 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: 2ae32a187971ba78459548a01dd78283355846baf7462283a0a71765aaa91b93
|
4
|
+
data.tar.gz: fe8fbb2c8a5280dc5353ae43d7697d5041fd7e04bc2209fa3797db94522a051d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c757e026173486ff9187c1b4fb27c62cd1619ee1cd9252b2eb41bd055c30d032687c3acf0099e8d815781822b63bbfe1a369d62889eafb3bac2f5820a18b401
|
7
|
+
data.tar.gz: 3c1c30b1741444d3687bb0b6248ecac95bdddfca66990a6f821165c4ec5f3b8be2622aff17b40972a1a46405bf2243c86bef7423d6d0aae7bab720aeb721a323
|
data/lib/cafe_buy_duo.rb
CHANGED
@@ -246,9 +246,13 @@ class Naver
|
|
246
246
|
naver_cookie_dir = "C:/naver_cookie"
|
247
247
|
FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
|
248
248
|
if proxy == ''
|
249
|
-
|
249
|
+
|
250
|
+
system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --no-first-run --no-default-browser-check --disable-sync})
|
251
|
+
|
250
252
|
else
|
251
|
-
|
253
|
+
|
254
|
+
system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --proxy-server=#{proxy.to_s.force_encoding('utf-8').to_s} --no-first-run --no-default-browser-check --disable-sync})
|
255
|
+
|
252
256
|
end
|
253
257
|
end
|
254
258
|
def chrome_start(proxy, user_id)
|
@@ -260,6 +264,9 @@ class Naver
|
|
260
264
|
options = Selenium::WebDriver::Chrome::Options.new
|
261
265
|
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
262
266
|
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
267
|
+
options.add_argument('--disable-sync') # Chrome 동기화 비활성화
|
268
|
+
options.add_argument('--disable-popup-blocking') # 팝업 방지 (로그인 창이 뜨는 경우 대비)
|
269
|
+
options.add_argument('--no-default-browser-check')
|
263
270
|
options.page_load_strategy = :normal
|
264
271
|
options.timeouts = {page_load: 20_000}
|
265
272
|
options.page_load_strategy = 'none'
|
@@ -285,6 +292,9 @@ class Naver
|
|
285
292
|
options = Selenium::WebDriver::Chrome::Options.new
|
286
293
|
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
287
294
|
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
295
|
+
options.add_argument('--disable-sync') # Chrome 동기화 비활성화
|
296
|
+
options.add_argument('--disable-popup-blocking') # 팝업 방지 (로그인 창이 뜨는 경우 대비)
|
297
|
+
options.add_argument('--no-default-browser-check')
|
288
298
|
options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
|
289
299
|
options.page_load_strategy = :normal
|
290
300
|
options.timeouts = {page_load: 20_000}
|
@@ -309,6 +319,9 @@ class Naver
|
|
309
319
|
options = Selenium::WebDriver::Chrome::Options.new
|
310
320
|
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
311
321
|
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
322
|
+
options.add_argument('--disable-sync') # Chrome 동기화 비활성화
|
323
|
+
options.add_argument('--disable-popup-blocking') # 팝업 방지 (로그인 창이 뜨는 경우 대비)
|
324
|
+
options.add_argument('--no-default-browser-check')
|
312
325
|
options.page_load_strategy = :normal
|
313
326
|
options.timeouts = {page_load: 20_000}
|
314
327
|
options.page_load_strategy = 'none'
|
@@ -334,6 +347,7 @@ class Naver
|
|
334
347
|
|
335
348
|
|
336
349
|
|
350
|
+
|
337
351
|
def login(user_id, user_pw, proxy)
|
338
352
|
@user_id = user_id
|
339
353
|
@user_id11 = user_id
|
@@ -372,13 +386,21 @@ class Naver
|
|
372
386
|
puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
|
373
387
|
sleep(2.5)
|
374
388
|
rescue
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
389
|
+
begin
|
390
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
391
|
+
# 요소가 나타날 때까지 기다립니다.
|
392
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]') }
|
393
|
+
sleep(1.5)
|
394
|
+
|
395
|
+
# 요소가 있으면 클릭
|
396
|
+
@driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]').click
|
397
|
+
check_cookie_login = 0
|
398
|
+
sleep(1)
|
399
|
+
rescue
|
400
|
+
|
401
|
+
return 0
|
402
|
+
@driver.quit
|
403
|
+
end
|
382
404
|
end
|
383
405
|
|
384
406
|
if check_cookie_login == 0
|
@@ -413,8 +435,9 @@ class Naver
|
|
413
435
|
puts "Failed to close tab: #{e.message}"
|
414
436
|
end
|
415
437
|
end
|
416
|
-
return 0
|
417
438
|
@driver.quit
|
439
|
+
return 0
|
440
|
+
|
418
441
|
end
|
419
442
|
|
420
443
|
else
|
@@ -437,8 +460,9 @@ class Naver
|
|
437
460
|
puts "Failed to close tab: #{e.message}"
|
438
461
|
end
|
439
462
|
end
|
440
|
-
return 0
|
441
463
|
@driver.quit
|
464
|
+
return 0
|
465
|
+
|
442
466
|
end
|
443
467
|
end
|
444
468
|
|
@@ -1077,8 +1101,9 @@ end
|
|
1077
1101
|
puts "Failed to close tab: #{e.message}"
|
1078
1102
|
end
|
1079
1103
|
end
|
1104
|
+
@driver.quit
|
1080
1105
|
return 0
|
1081
|
-
|
1106
|
+
|
1082
1107
|
end
|
1083
1108
|
|
1084
1109
|
|
@@ -1106,8 +1131,9 @@ end
|
|
1106
1131
|
puts "Failed to close tab: #{e.message}"
|
1107
1132
|
end
|
1108
1133
|
end
|
1109
|
-
return 0
|
1110
1134
|
@driver.quit
|
1135
|
+
return 0
|
1136
|
+
|
1111
1137
|
end
|
1112
1138
|
sleep(2)
|
1113
1139
|
@driver.action.key_down(:control).key_down('a').key_up('a').key_up(:control).perform
|
@@ -2578,7 +2604,7 @@ class Wordpress
|
|
2578
2604
|
puts 'Tethering IP change...'
|
2579
2605
|
|
2580
2606
|
stdout, stderr, status = Open3.capture3('./adb devices')
|
2581
|
-
|
2607
|
+
|
2582
2608
|
if status.success?
|
2583
2609
|
device_id = stdout.split("\n")[1].split("\t")[0]
|
2584
2610
|
puts device_id
|
@@ -2586,42 +2612,53 @@ class Wordpress
|
|
2586
2612
|
# ADB 서버 초기화
|
2587
2613
|
puts 'adb kill-server'
|
2588
2614
|
Open3.capture3('./adb kill-server')
|
2589
|
-
sleep(
|
2615
|
+
sleep(5) # ADB 서버가 안정될 시간을 충분히 주기
|
2590
2616
|
|
2591
2617
|
# 다시 ADB 서버 실행
|
2592
2618
|
puts 'adb start-server'
|
2593
2619
|
Open3.capture3('./adb start-server')
|
2594
|
-
sleep(
|
2620
|
+
sleep(5) # ADB 서버가 안정될 시간을 충분히 주기
|
2595
2621
|
|
2596
2622
|
# 데이터를 끄고 켜기
|
2597
2623
|
puts 'adb -s ' + device_id + ' shell svc data disable'
|
2598
|
-
stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
|
2599
|
-
|
2624
|
+
stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
|
2625
|
+
puts "stderr: #{stderr2}" unless status2.success? # 오류 출력
|
2626
|
+
sleep(5) # 네트워크가 안정될 시간을 더 줍니다.
|
2600
2627
|
puts 'adb -s ' + device_id + ' shell svc data enable'
|
2601
|
-
Open3.capture3('./adb -s '+device_id+' shell svc data enable')
|
2602
|
-
|
2628
|
+
stdout3, stderr3, status3 = Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
|
2629
|
+
puts "stderr: #{stderr3}" unless status3.success? # 오류 출력
|
2630
|
+
sleep(5) # 네트워크가 안정될 시간을 더 줍니다.
|
2603
2631
|
puts 'adb ok'
|
2604
2632
|
sleep(8)
|
2605
|
-
|
2633
|
+
|
2634
|
+
# IP 변경 확인을 위한 람다 함수
|
2606
2635
|
robot_ip = lambda do
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2610
|
-
|
2636
|
+
begin
|
2637
|
+
# IP 변경 확인
|
2638
|
+
http = HTTP.get('https://www.findip.kr/')
|
2639
|
+
noko = Nokogiri::HTML(http.to_s)
|
2640
|
+
|
2641
|
+
current_ip = noko.xpath('/html/body/header/h2').text.strip
|
2642
|
+
if current_ip != @my_ip
|
2643
|
+
@my_ip = current_ip
|
2611
2644
|
puts "IP 변경됨[ #{@my_ip} ]"
|
2612
|
-
|
2613
|
-
puts @my_ip
|
2614
|
-
puts '
|
2615
|
-
sleep(
|
2616
|
-
robot_ip[]
|
2645
|
+
else
|
2646
|
+
puts "현재 IP: #{@my_ip}"
|
2647
|
+
puts 'IP 변경이 감지되지 않았습니다. 다시 시도합니다...'
|
2648
|
+
sleep(5) # 여유롭게 대기 시간 증가
|
2649
|
+
robot_ip[] # 재시도
|
2650
|
+
end
|
2651
|
+
rescue HTTP::ConnectionError => e
|
2652
|
+
puts "네트워크 오류 발생: #{e.message}. 재시도 중..."
|
2653
|
+
sleep(5) # 재시도 간 여유 시간 추가
|
2654
|
+
retry # 재시도
|
2617
2655
|
end
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2656
|
+
end
|
2657
|
+
robot_ip[] # IP 확인 시작
|
2621
2658
|
else
|
2622
|
-
|
2659
|
+
puts "adb devices 명령어 실행 실패. stderr: #{stderr}"
|
2623
2660
|
end
|
2624
|
-
|
2661
|
+
end
|
2625
2662
|
|
2626
2663
|
|
2627
2664
|
check_success = 1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_buy_duo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.70
|
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-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|