cafe_buy 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.rb +74 -36
- 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: 9f21c93d6014e668db4ff0b7edf914253e31a08d25a57ea9ccde05dc84407c91
|
4
|
+
data.tar.gz: a3173f5fc9b1f966b9c32fde08cae1446f01458534d8b303b6b67e0544fae3cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3009c57671b922b89087b7fd3e344fe8e24485ffafeed2598855688df7de68f349d482b78999b9b1f40cf769646f65ddc3f6cd9a3cb4278614c93ab4d5fbc833
|
7
|
+
data.tar.gz: '082f7bcf0b02e400d44c8ef51419884de23aa399234a35a942e813ee8abdeb116c76349c27cda6b2116de4237e67cfd07cdf6dab06b96446c92e5f0f6409b227'
|
data/lib/cafe_buy.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
|
1080
|
-
|
1081
|
-
|
1104
|
+
@driver.quit
|
1105
|
+
return 0
|
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
|
@@ -2061,6 +2087,7 @@ end
|
|
2061
2087
|
end
|
2062
2088
|
end
|
2063
2089
|
|
2090
|
+
|
2064
2091
|
class Wordpress
|
2065
2092
|
include Glimmer
|
2066
2093
|
def get_mac_address
|
@@ -2510,7 +2537,7 @@ class Wordpress
|
|
2510
2537
|
puts 'Tethering IP change...'
|
2511
2538
|
|
2512
2539
|
stdout, stderr, status = Open3.capture3('./adb devices')
|
2513
|
-
|
2540
|
+
|
2514
2541
|
if status.success?
|
2515
2542
|
device_id = stdout.split("\n")[1].split("\t")[0]
|
2516
2543
|
puts device_id
|
@@ -2518,42 +2545,53 @@ class Wordpress
|
|
2518
2545
|
# ADB 서버 초기화
|
2519
2546
|
puts 'adb kill-server'
|
2520
2547
|
Open3.capture3('./adb kill-server')
|
2521
|
-
sleep(
|
2548
|
+
sleep(5) # ADB 서버가 안정될 시간을 충분히 주기
|
2522
2549
|
|
2523
2550
|
# 다시 ADB 서버 실행
|
2524
2551
|
puts 'adb start-server'
|
2525
2552
|
Open3.capture3('./adb start-server')
|
2526
|
-
sleep(
|
2553
|
+
sleep(5) # ADB 서버가 안정될 시간을 충분히 주기
|
2527
2554
|
|
2528
2555
|
# 데이터를 끄고 켜기
|
2529
2556
|
puts 'adb -s ' + device_id + ' shell svc data disable'
|
2530
|
-
stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
|
2531
|
-
|
2557
|
+
stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
|
2558
|
+
puts "stderr: #{stderr2}" unless status2.success? # 오류 출력
|
2559
|
+
sleep(5) # 네트워크가 안정될 시간을 더 줍니다.
|
2532
2560
|
puts 'adb -s ' + device_id + ' shell svc data enable'
|
2533
|
-
Open3.capture3('./adb -s '+device_id+' shell svc data enable')
|
2534
|
-
|
2561
|
+
stdout3, stderr3, status3 = Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
|
2562
|
+
puts "stderr: #{stderr3}" unless status3.success? # 오류 출력
|
2563
|
+
sleep(5) # 네트워크가 안정될 시간을 더 줍니다.
|
2535
2564
|
puts 'adb ok'
|
2536
2565
|
sleep(8)
|
2537
|
-
|
2566
|
+
|
2567
|
+
# IP 변경 확인을 위한 람다 함수
|
2538
2568
|
robot_ip = lambda do
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2569
|
+
begin
|
2570
|
+
# IP 변경 확인
|
2571
|
+
http = HTTP.get('https://www.findip.kr/')
|
2572
|
+
noko = Nokogiri::HTML(http.to_s)
|
2573
|
+
|
2574
|
+
current_ip = noko.xpath('/html/body/header/h2').text.strip
|
2575
|
+
if current_ip != @my_ip
|
2576
|
+
@my_ip = current_ip
|
2543
2577
|
puts "IP 변경됨[ #{@my_ip} ]"
|
2544
|
-
|
2545
|
-
puts @my_ip
|
2546
|
-
puts '
|
2547
|
-
sleep(
|
2548
|
-
robot_ip[]
|
2578
|
+
else
|
2579
|
+
puts "현재 IP: #{@my_ip}"
|
2580
|
+
puts 'IP 변경이 감지되지 않았습니다. 다시 시도합니다...'
|
2581
|
+
sleep(5) # 여유롭게 대기 시간 증가
|
2582
|
+
robot_ip[] # 재시도
|
2583
|
+
end
|
2584
|
+
rescue HTTP::ConnectionError => e
|
2585
|
+
puts "네트워크 오류 발생: #{e.message}. 재시도 중..."
|
2586
|
+
sleep(5) # 재시도 간 여유 시간 추가
|
2587
|
+
retry # 재시도
|
2549
2588
|
end
|
2550
|
-
|
2551
|
-
|
2552
|
-
|
2589
|
+
end
|
2590
|
+
robot_ip[] # IP 확인 시작
|
2553
2591
|
else
|
2554
|
-
|
2592
|
+
puts "adb devices 명령어 실행 실패. stderr: #{stderr}"
|
2555
2593
|
end
|
2556
|
-
|
2594
|
+
end
|
2557
2595
|
|
2558
2596
|
check_success = 1
|
2559
2597
|
@data['table'][index][-1] = 0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_buy
|
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
|