cafe_basics_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_basics_duo.rb +68 -22
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b868b13d28d76acb532714d33421cd445eb6b369b1a369a80c3711f26fb995a
4
- data.tar.gz: b4b5777cb76884c022ed55c6ab9c16a34b84e9a61db13923a1fd94da9ed1e50e
3
+ metadata.gz: 5ba1f5e67864021ce468b7221e971657cd3bcdf861ecb356ef8fc9469d54cd50
4
+ data.tar.gz: 07e7e1bae82c7a22532023761f89288b71d1ad119a0907deb4461d3ebda8dcdc
5
5
  SHA512:
6
- metadata.gz: 4b60c2de99e80f65a1b9bb4b0fc231c9c7ee0fb3fb5d81d5fdb20524391a047e6003bb188924aec1614c76936e6aa8941b31d5e2609e60c7eaff1160df4b0812
7
- data.tar.gz: 4caf5a67d2c104a676c40e5c41dedef98c3aabcd276d8f3f36fc9ecc10d9328516caebbe998725d5a3394541aca32877638c44bf73f44d443e5693e71d8d459d
6
+ metadata.gz: 4072b667d0174afb9b934334b6bc0754a1162a35174d13c886c10e36b678c0f30b0458c20dc4f2aadb41e9b93c1035a07ff64ef3f13826627a85e6373332951c
7
+ data.tar.gz: 0b1ea78fcc1a2585352ebf7b04e7ac1ffb5f3124f719b38846ee9dcc4cdc0c2c91e67d62c724f6084e256984ad84e4b177f8ee4f5a7e5dcc07cbc36029db80ef
@@ -509,19 +509,29 @@ class Naver
509
509
  begin
510
510
  wait = Selenium::WebDriver::Wait.new(:timeout => 7)
511
511
  #요소가 나타날 때까지 3초 동안 기다립니다.
512
- wait.until { @driver.find_element(:xpath, '//*[@for="switch"]') }
513
- sleep(1.5)
514
- @driver.find_element(:xpath, '//*[@id="login_keep_wrap"]/div[1]/label').click
515
- sleep(1.5)
516
- @driver.find_element(:xpath, '//*[@id="id"]').click
512
+ wait.until { @driver.find_element(:xpath, '//*[@id="id" and @name="id"]') }
513
+ @driver.find_element(:xpath, '//*[@id="id" and @name="id"]').click
517
514
  Clipboard.copy(user_id)
518
515
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
519
516
  sleep(1.5)
520
- @driver.find_element(:xpath, '//*[@id="pw"]').click
517
+ @driver.find_element(:xpath, '//*[@id="pw" and @name="pw"]').click
521
518
  Clipboard.copy(user_pw)
522
519
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
523
520
  sleep(1.5)
524
- @driver.find_element(:xpath, '//*[@id="log.login"]').click
521
+
522
+ begin
523
+ smart_level_value = @driver.find_element(id: 'smart_LEVEL').attribute('value')
524
+ if smart_level_value == '1'
525
+ @driver.find_element(xpath: '//label[@for="switch" and @class="switch_btn"]').click
526
+ sleep(1.5)
527
+ end
528
+ rescue
529
+ end
530
+
531
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
532
+ #요소가 나타날 때까지 3초 동안 기다립니다.
533
+ wait.until { @driver.find_element(xpath: '//button[@type="submit" and @id="log.login"]') }
534
+ @driver.find_element(xpath: '//button[@type="submit" and @id="log.login"]').click
525
535
  sleep(2.5)
526
536
  rescue => e
527
537
  puts '-[√] 로딩 지연 접속 실패.......'.red
@@ -534,9 +544,8 @@ class Naver
534
544
  puts "Failed to close tab: #{e.message}"
535
545
  end
536
546
  end
537
- @driver.quit
538
547
  return 0
539
-
548
+ @driver.quit
540
549
  end
541
550
 
542
551
  else
@@ -544,9 +553,9 @@ class Naver
544
553
  end
545
554
 
546
555
  begin
547
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
556
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5)
548
557
  #요소가 나타날 때까지 3초 동안 기다립니다.
549
- wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
558
+ wait.until { @driver.find_element(:xpath, '//*[@type="button" and @class="MyView-module__btn_logout___bsTOJ"]') }
550
559
 
551
560
  rescue => e
552
561
  puts '-[√] 로그인 실패.......'.red
@@ -559,10 +568,9 @@ class Naver
559
568
  puts "Failed to close tab: #{e.message}"
560
569
  end
561
570
  end
562
- @driver.quit
563
571
  return 0
564
-
565
- end
572
+ @driver.quit
573
+ end
566
574
  end
567
575
 
568
576
  def create_id
@@ -3621,15 +3629,34 @@ class Wordpress
3621
3629
  # title = content.split("\n")[0]
3622
3630
  #end
3623
3631
  if @data['포스트설정']['내용첫줄제목에입력'].checked?
3624
- # 콘텐츠를 줄 단위로 분리
3625
3632
  content_lines = content.split("\n")
3626
-
3627
- # 번째 줄이 <img src=로 시작하는지 확인하고, 시작하는 경우 두 번째 줄부터 확인
3628
- title = content_lines.find { |line| !line.start_with?('<img src=') }
3629
-
3630
- # 만약 첫 번째 줄부터 <img src=로 시작하는 경우, 두 번째 줄을 제목으로 설정
3631
- title ||= content_lines[1] # 첫 번째 줄이 <img src=일 경우 두 번째 줄을 사용
3632
-
3633
+
3634
+ title = content_lines.find do |line|
3635
+ line = line.strip
3636
+ !line.empty? && !line.start_with?('<img src=')
3637
+ end
3638
+
3639
+ title ||= content_lines[1]
3640
+
3641
+ if title
3642
+ # 마침표(.) 포함 첫 문장 추출
3643
+ first_part = title[/.*?\./]
3644
+ first_part = first_part ? first_part.strip : title.strip
3645
+
3646
+ # 200bytes 제한 (한글 100자 내외)
3647
+ bytes_limit = 200
3648
+ truncated = ""
3649
+ current_bytes = 0
3650
+
3651
+ first_part.each_char do |char|
3652
+ char_bytes = char.bytesize
3653
+ break if current_bytes + char_bytes > bytes_limit
3654
+ truncated << char
3655
+ current_bytes += char_bytes
3656
+ end
3657
+
3658
+ title = truncated
3659
+ end
3633
3660
  end
3634
3661
 
3635
3662
  if @data['포스트설정']['제목을내용첫줄입력'].checked?
@@ -3653,6 +3680,25 @@ class Wordpress
3653
3680
  @data['table'] << []
3654
3681
  @data['table'].pop
3655
3682
 
3683
+ # content를 줄 단위로 쪼갬
3684
+ lines = content.lines
3685
+
3686
+ # 맨 앞부터 빈 줄(공백 또는 빈 문자열) 갯수 계산
3687
+ empty_line_count = 0
3688
+ lines.each do |line|
3689
+ if line.strip.empty?
3690
+ empty_line_count += 1
3691
+ else
3692
+ break
3693
+ end
3694
+ end
3695
+
3696
+ # 앞 빈 줄 제거
3697
+ lines = lines.drop(empty_line_count)
3698
+
3699
+ # 다시 content로 합침
3700
+ content = lines.join
3701
+
3656
3702
  p option
3657
3703
 
3658
3704
  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_basics_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