cafe_buy 0.1.53 → 0.1.57
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 +67 -21
- 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: 52cd8856cfd50d9896d4a00ffaeb1592464dd77d524a66388a7099672271a5ec
|
4
|
+
data.tar.gz: 26d4fc276e61179de3cb9b4a8e90bcbf9e90429dad62e7e5c7806f1d45ce6748
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f85498f113ae3743a318746e5bdc20942d848c99b428366b727d286b17607244691a5a9420ae3b4a9fade36e5068c94dd16eb513a3dc949a4e1888b03883bb0
|
7
|
+
data.tar.gz: 6e93c8f4fb5a81a0aff47285032c7fd4ce33505f4ed2551189cd6b19712dd7134d2139d5544046a1fa6ce56028919af84e85af2a08042d53ae990c8d3e177892
|
data/lib/cafe_buy.rb
CHANGED
@@ -511,19 +511,29 @@ class Naver
|
|
511
511
|
begin
|
512
512
|
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
513
513
|
#요소가 나타날 때까지 3초 동안 기다립니다.
|
514
|
-
wait.until { @driver.find_element(:xpath, '//*[@
|
515
|
-
|
516
|
-
@driver.find_element(:xpath, '//*[@id="login_keep_wrap"]/div[1]/label').click
|
517
|
-
sleep(1.5)
|
518
|
-
@driver.find_element(:xpath, '//*[@id="id"]').click
|
514
|
+
wait.until { @driver.find_element(:xpath, '//*[@id="id" and @name="id"]') }
|
515
|
+
@driver.find_element(:xpath, '//*[@id="id" and @name="id"]').click
|
519
516
|
Clipboard.copy(user_id)
|
520
517
|
@driver.action.key_down(:control).send_keys('v').key_up(:control).perform
|
521
518
|
sleep(1.5)
|
522
|
-
@driver.find_element(:xpath, '//*[@id="pw"]').click
|
519
|
+
@driver.find_element(:xpath, '//*[@id="pw" and @name="pw"]').click
|
523
520
|
Clipboard.copy(user_pw)
|
524
521
|
@driver.action.key_down(:control).send_keys('v').key_up(:control).perform
|
525
522
|
sleep(1.5)
|
526
|
-
|
523
|
+
|
524
|
+
begin
|
525
|
+
smart_level_value = @driver.find_element(id: 'smart_LEVEL').attribute('value')
|
526
|
+
if smart_level_value == '1'
|
527
|
+
@driver.find_element(xpath: '//label[@for="switch" and @class="switch_btn"]').click
|
528
|
+
sleep(1.5)
|
529
|
+
end
|
530
|
+
rescue
|
531
|
+
end
|
532
|
+
|
533
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
534
|
+
#요소가 나타날 때까지 3초 동안 기다립니다.
|
535
|
+
wait.until { @driver.find_element(xpath: '//button[@type="submit" and @id="log.login"]') }
|
536
|
+
@driver.find_element(xpath: '//button[@type="submit" and @id="log.login"]').click
|
527
537
|
sleep(2.5)
|
528
538
|
rescue => e
|
529
539
|
puts '-[√] 로딩 지연 접속 실패.......'.red
|
@@ -536,9 +546,8 @@ class Naver
|
|
536
546
|
puts "Failed to close tab: #{e.message}"
|
537
547
|
end
|
538
548
|
end
|
539
|
-
@driver.quit
|
540
549
|
return 0
|
541
|
-
|
550
|
+
@driver.quit
|
542
551
|
end
|
543
552
|
|
544
553
|
else
|
@@ -546,9 +555,9 @@ class Naver
|
|
546
555
|
end
|
547
556
|
|
548
557
|
begin
|
549
|
-
wait = Selenium::WebDriver::Wait.new(:timeout =>
|
558
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
550
559
|
#요소가 나타날 때까지 3초 동안 기다립니다.
|
551
|
-
wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
|
560
|
+
wait.until { @driver.find_element(:xpath, '//*[@type="button" and @class="MyView-module__btn_logout___bsTOJ"]') }
|
552
561
|
|
553
562
|
rescue => e
|
554
563
|
puts '-[√] 로그인 실패.......'.red
|
@@ -561,9 +570,8 @@ class Naver
|
|
561
570
|
puts "Failed to close tab: #{e.message}"
|
562
571
|
end
|
563
572
|
end
|
564
|
-
@driver.quit
|
565
573
|
return 0
|
566
|
-
|
574
|
+
@driver.quit
|
567
575
|
end
|
568
576
|
end
|
569
577
|
|
@@ -3938,15 +3946,34 @@ class Wordpress
|
|
3938
3946
|
# title = content.split("\n")[0]
|
3939
3947
|
#end
|
3940
3948
|
if @data['포스트설정']['내용첫줄제목에입력'].checked?
|
3941
|
-
# 콘텐츠를 줄 단위로 분리
|
3942
3949
|
content_lines = content.split("\n")
|
3943
|
-
|
3944
|
-
|
3945
|
-
|
3946
|
-
|
3947
|
-
|
3948
|
-
|
3949
|
-
|
3950
|
+
|
3951
|
+
title = content_lines.find do |line|
|
3952
|
+
line = line.strip
|
3953
|
+
!line.empty? && !line.start_with?('<img src=')
|
3954
|
+
end
|
3955
|
+
|
3956
|
+
title ||= content_lines[1]
|
3957
|
+
|
3958
|
+
if title
|
3959
|
+
# 마침표(.) 포함 첫 문장 추출
|
3960
|
+
first_part = title[/.*?\./]
|
3961
|
+
first_part = first_part ? first_part.strip : title.strip
|
3962
|
+
|
3963
|
+
# 200bytes 제한 (한글 100자 내외)
|
3964
|
+
bytes_limit = 200
|
3965
|
+
truncated = ""
|
3966
|
+
current_bytes = 0
|
3967
|
+
|
3968
|
+
first_part.each_char do |char|
|
3969
|
+
char_bytes = char.bytesize
|
3970
|
+
break if current_bytes + char_bytes > bytes_limit
|
3971
|
+
truncated << char
|
3972
|
+
current_bytes += char_bytes
|
3973
|
+
end
|
3974
|
+
|
3975
|
+
title = truncated
|
3976
|
+
end
|
3950
3977
|
end
|
3951
3978
|
|
3952
3979
|
if @data['포스트설정']['제목을내용첫줄입력'].checked?
|
@@ -3970,6 +3997,25 @@ class Wordpress
|
|
3970
3997
|
@data['table'] << []
|
3971
3998
|
@data['table'].pop
|
3972
3999
|
|
4000
|
+
# content를 줄 단위로 쪼갬
|
4001
|
+
lines = content.lines
|
4002
|
+
|
4003
|
+
# 맨 앞부터 빈 줄(공백 또는 빈 문자열) 갯수 계산
|
4004
|
+
empty_line_count = 0
|
4005
|
+
lines.each do |line|
|
4006
|
+
if line.strip.empty?
|
4007
|
+
empty_line_count += 1
|
4008
|
+
else
|
4009
|
+
break
|
4010
|
+
end
|
4011
|
+
end
|
4012
|
+
|
4013
|
+
# 앞 빈 줄 제거
|
4014
|
+
lines = lines.drop(empty_line_count)
|
4015
|
+
|
4016
|
+
# 다시 content로 합침
|
4017
|
+
content = lines.join
|
4018
|
+
|
3973
4019
|
p option
|
3974
4020
|
|
3975
4021
|
dd_time = @data['table'][index][9].to_s.force_encoding('utf-8').to_i
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_buy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.57
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-07-08 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: File to Clipboard gem
|
13
13
|
email: mymin26@naver.com
|