cafe_buy_duo 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cafe_buy_duo.rb +67 -21
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 385bc3207c8c11406b1a4334217f61a88631a28085a923a52fa8b17adb665257
4
- data.tar.gz: c582a195fb18bed9a08b9cb0c7e2c109292e6341bf209974d412965d6ae90b99
3
+ metadata.gz: daca90772351291588281982417819cb4c4495f75ad006913fb381ee769f286b
4
+ data.tar.gz: 7ea28b1ff196b6711218a1f2c24c91db54c759f45f54acdaab029b41e8b03c4e
5
5
  SHA512:
6
- metadata.gz: d9126d46589500b7ebf21dcb59117cde07a547ffdba727d7973588f762562807f5672c9ef0c3a1053dddbce1013f77bf2b6b93c000f57fd64db5148d9c77300b
7
- data.tar.gz: 949882637008bafc25eaa2841c22bf95f8287b038e1b7244ac6ed74d646ec17c97069aa956ce568c3570474fd2c8fd00fa8f99d449e4bf1eef7316654ea86a93
6
+ metadata.gz: 036ce7d7b170cbb50be5dc18dbaac10763bebdb1ad771facc40c56bea1122295c38a5abef6638a7e1d75a4baf10144001ee47731f658a4b99d8a38dc497cbc1d
7
+ data.tar.gz: 97a251307074658c0507fcfddfe42111105df0bc78ce6408e41079b4f739f15564824101be36fea341129ea4c460323b44b343ebe11304a6d470a5fd0a08278c
data/lib/cafe_buy_duo.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, '//*[@for="switch"]') }
515
- sleep(1.5)
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
- @driver.find_element(:xpath, '//*[@id="log.login"]').click
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 => 3)
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
 
@@ -4006,15 +4014,34 @@ class Wordpress
4006
4014
  # title = content.split("\n")[0]
4007
4015
  #end
4008
4016
  if @data['포스트설정']['내용첫줄제목에입력'].checked?
4009
- # 콘텐츠를 줄 단위로 분리
4010
4017
  content_lines = content.split("\n")
4011
-
4012
- # 번째 줄이 <img src=로 시작하는지 확인하고, 시작하는 경우 두 번째 줄부터 확인
4013
- title = content_lines.find { |line| !line.start_with?('<img src=') }
4014
-
4015
- # 만약 첫 번째 줄부터 <img src=로 시작하는 경우, 두 번째 줄을 제목으로 설정
4016
- title ||= content_lines[1] # 첫 번째 줄이 <img src=일 경우 두 번째 줄을 사용
4017
-
4018
+
4019
+ title = content_lines.find do |line|
4020
+ line = line.strip
4021
+ !line.empty? && !line.start_with?('<img src=')
4022
+ end
4023
+
4024
+ title ||= content_lines[1]
4025
+
4026
+ if title
4027
+ # 마침표(.) 포함 첫 문장 추출
4028
+ first_part = title[/.*?\./]
4029
+ first_part = first_part ? first_part.strip : title.strip
4030
+
4031
+ # 200bytes 제한 (한글 100자 내외)
4032
+ bytes_limit = 200
4033
+ truncated = ""
4034
+ current_bytes = 0
4035
+
4036
+ first_part.each_char do |char|
4037
+ char_bytes = char.bytesize
4038
+ break if current_bytes + char_bytes > bytes_limit
4039
+ truncated << char
4040
+ current_bytes += char_bytes
4041
+ end
4042
+
4043
+ title = truncated
4044
+ end
4018
4045
  end
4019
4046
 
4020
4047
  if @data['포스트설정']['제목을내용첫줄입력'].checked?
@@ -4038,6 +4065,25 @@ class Wordpress
4038
4065
  @data['table'] << []
4039
4066
  @data['table'].pop
4040
4067
 
4068
+ # content를 줄 단위로 쪼갬
4069
+ lines = content.lines
4070
+
4071
+ # 맨 앞부터 빈 줄(공백 또는 빈 문자열) 갯수 계산
4072
+ empty_line_count = 0
4073
+ lines.each do |line|
4074
+ if line.strip.empty?
4075
+ empty_line_count += 1
4076
+ else
4077
+ break
4078
+ end
4079
+ end
4080
+
4081
+ # 앞 빈 줄 제거
4082
+ lines = lines.drop(empty_line_count)
4083
+
4084
+ # 다시 content로 합침
4085
+ content = lines.join
4086
+
4041
4087
  p option
4042
4088
 
4043
4089
  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_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.53
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-06-26 00:00:00.000000000 Z
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