duo_blog_cafe_comment 0.0.6 → 0.0.9
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.
Potentially problematic release.
This version of duo_blog_cafe_comment might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/duo_blog_cafe_comment.rb +78 -25
- 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: cfe5094730d9f125b951cd4e87a189874acea9c7fd92245c1d3f38ca5dde75ad
         | 
| 4 | 
            +
              data.tar.gz: aaadb2ec38f32d4422d0cc14c11bd90c2b64610c0468d1d9dce064e47f7ce529
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 494e71c8e433f6663027c33a3d0e31448ce11734c84af0a4c21f9db1c41696893e76e8831283cacb9ead6fd812d499fd2b4ec78dee22926ecd83d8e97719f45e
         | 
| 7 | 
            +
              data.tar.gz: 13acf4ab8cd412ca73851f9f5572bc8b79db5fd38cfca880f11c8abd72f66cd3edcbd41aac68961cfe502f4e4b15d2b456e997277293c48d8736f5e5591365a2
         | 
| @@ -50,9 +50,17 @@ class Naver | |
| 50 50 | 
             
                            options.add_argument('--disable-gpu')
         | 
| 51 51 | 
             
                            options.add_argument('--remote-debugging-port=9222')
         | 
| 52 52 | 
             
                            options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
         | 
| 53 | 
            -
                             | 
| 54 | 
            -
             | 
| 55 | 
            -
                             | 
| 53 | 
            +
                            # 'capabilities'과 'options' 배열로 설정
         | 
| 54 | 
            +
                            capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
         | 
| 55 | 
            +
                            capabilities["goog:chromeOptions"] = options.as_json
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                            # Selenium 4에서는 'capabilities'만 사용하는 방식
         | 
| 58 | 
            +
                            @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                            @driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                        rescue => e
         | 
| 63 | 
            +
                           @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
         | 
| 56 64 | 
             
                        end
         | 
| 57 65 | 
             
                    else
         | 
| 58 66 | 
             
                        begin
         | 
| @@ -68,7 +76,14 @@ class Naver | |
| 68 76 | 
             
                            options.add_argument('--disable-gpu')
         | 
| 69 77 | 
             
                            options.add_argument('--remote-debugging-port=9222')
         | 
| 70 78 | 
             
                            options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
         | 
| 71 | 
            -
                             | 
| 79 | 
            +
                            # 'capabilities'과 'options' 배열로 설정
         | 
| 80 | 
            +
                            capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
         | 
| 81 | 
            +
                            capabilities["goog:chromeOptions"] = options.as_json
         | 
| 82 | 
            +
             | 
| 83 | 
            +
                            # Selenium 4에서는 'capabilities'만 사용하는 방식
         | 
| 84 | 
            +
                            @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
         | 
| 85 | 
            +
             | 
| 86 | 
            +
                            @driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
         | 
| 72 87 | 
             
                        rescue => e
         | 
| 73 88 | 
             
                            puts e
         | 
| 74 89 | 
             
                            puts 'proxy error...'
         | 
| @@ -84,9 +99,16 @@ class Naver | |
| 84 99 | 
             
                                options.add_argument('--disable-gpu')
         | 
| 85 100 | 
             
                                options.add_argument('--remote-debugging-port=9222')
         | 
| 86 101 | 
             
                                options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
         | 
| 87 | 
            -
                                 | 
| 102 | 
            +
                                # 'capabilities'과 'options' 배열로 설정
         | 
| 103 | 
            +
                                capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
         | 
| 104 | 
            +
                                capabilities["goog:chromeOptions"] = options.as_json
         | 
| 105 | 
            +
             | 
| 106 | 
            +
                                # Selenium 4에서는 'capabilities'만 사용하는 방식
         | 
| 107 | 
            +
                                @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
         | 
| 108 | 
            +
             | 
| 109 | 
            +
                                @driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
         | 
| 88 110 | 
             
                            rescue
         | 
| 89 | 
            -
                                @driver = Selenium::WebDriver.for(:chrome,  | 
| 111 | 
            +
                                @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
         | 
| 90 112 | 
             
                            end
         | 
| 91 113 | 
             
                        end
         | 
| 92 114 | 
             
                    end
         | 
| @@ -94,6 +116,7 @@ class Naver | |
| 94 116 |  | 
| 95 117 |  | 
| 96 118 |  | 
| 119 | 
            +
             | 
| 97 120 | 
             
                def login(user_id, user_pw, proxy)
         | 
| 98 121 | 
             
                    @user_id = user_id
         | 
| 99 122 | 
             
                    @user_id11 = user_id
         | 
| @@ -2040,36 +2063,66 @@ class Wordpress | |
| 2040 2063 | 
             
                                    #if table[6].to_i #시작 부분 설정을 맞게해줘야 실행이 됨
         | 
| 2041 2064 |  | 
| 2042 2065 | 
             
                                    if @data['포스트설정']['테더링'].checked?
         | 
| 2043 | 
            -
                                        puts ' | 
| 2066 | 
            +
                                        puts 'Tethering IP change...'
         | 
| 2067 | 
            +
                                      
         | 
| 2044 2068 | 
             
                                        stdout, stderr, status = Open3.capture3('./adb devices')
         | 
| 2069 | 
            +
                                        
         | 
| 2045 2070 | 
             
                                        if status.success?
         | 
| 2046 | 
            -
             | 
| 2047 | 
            -
             | 
| 2048 | 
            -
             | 
| 2049 | 
            -
             | 
| 2071 | 
            +
                                          device_id = stdout.split("\n")[1].split("\t")[0]
         | 
| 2072 | 
            +
                                          puts device_id
         | 
| 2073 | 
            +
                                      
         | 
| 2074 | 
            +
                                          # ADB 서버 초기화
         | 
| 2075 | 
            +
                                          puts 'adb kill-server'
         | 
| 2076 | 
            +
                                          Open3.capture3('adb kill-server')
         | 
| 2077 | 
            +
                                          sleep(2)
         | 
| 2078 | 
            +
                                      
         | 
| 2079 | 
            +
                                          # 다시 ADB 서버 실행
         | 
| 2080 | 
            +
                                          puts 'adb start-server'
         | 
| 2081 | 
            +
                                          Open3.capture3('adb start-server')
         | 
| 2082 | 
            +
                                          sleep(2)
         | 
| 2083 | 
            +
                                      
         | 
| 2084 | 
            +
                                          # 데이터를 끄고 켜기
         | 
| 2085 | 
            +
                                          puts 'adb -s ' + device_id + ' shell svc data disable'
         | 
| 2086 | 
            +
                                          stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
         | 
| 2087 | 
            +
                                      
         | 
| 2088 | 
            +
                                          if status2.success?
         | 
| 2050 2089 | 
             
                                            sleep(3)
         | 
| 2051 | 
            -
                                            puts 'adb -s '+device_id+' shell svc data enable'
         | 
| 2052 | 
            -
                                            Open3.capture3('./adb -s '+device_id+' shell svc data enable')
         | 
| 2090 | 
            +
                                            puts 'adb -s ' + device_id + ' shell svc data enable'
         | 
| 2091 | 
            +
                                            Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
         | 
| 2053 2092 | 
             
                                            sleep(3)
         | 
| 2054 2093 | 
             
                                            puts 'adb ok'
         | 
| 2055 2094 | 
             
                                            sleep(8)
         | 
| 2095 | 
            +
                                      
         | 
| 2096 | 
            +
                                            # IP 변경을 확인하는 람다 함수
         | 
| 2056 2097 | 
             
                                            robot_ip = lambda do
         | 
| 2057 | 
            -
             | 
| 2058 | 
            -
                                                 | 
| 2059 | 
            -
             | 
| 2060 | 
            -
             | 
| 2061 | 
            -
             | 
| 2062 | 
            -
             | 
| 2063 | 
            -
             | 
| 2064 | 
            -
                                                     | 
| 2065 | 
            -
                                                     | 
| 2098 | 
            +
                                              loop do  # 무한 루프
         | 
| 2099 | 
            +
                                                begin
         | 
| 2100 | 
            +
                                                  http = HTTP.get('https://www.findip.kr/')
         | 
| 2101 | 
            +
                                                  noko = Nokogiri::HTML(http.to_s)
         | 
| 2102 | 
            +
                                                  new_ip = noko.xpath('/html/body/header/h2').text.strip
         | 
| 2103 | 
            +
                                      
         | 
| 2104 | 
            +
                                                  if new_ip != @my_ip
         | 
| 2105 | 
            +
                                                    @my_ip = new_ip
         | 
| 2106 | 
            +
                                                    puts "IP 변경됨: #{@my_ip}"
         | 
| 2107 | 
            +
                                                    break  # IP가 변경되었으면 루프 종료
         | 
| 2108 | 
            +
                                                  else
         | 
| 2109 | 
            +
                                                    puts 'IP가 변경되지 않음. 재시도...'
         | 
| 2110 | 
            +
                                                    sleep(3)  # 3초 후 재시도
         | 
| 2111 | 
            +
                                                  end
         | 
| 2112 | 
            +
                                                rescue => e
         | 
| 2113 | 
            +
                                                  puts "IP 확인 중 오류 발생: #{e.message}. 재시도 중..."
         | 
| 2114 | 
            +
                                                  sleep(3)  # 3초 후 재시도
         | 
| 2066 2115 | 
             
                                                end
         | 
| 2116 | 
            +
                                              end
         | 
| 2067 2117 | 
             
                                            end
         | 
| 2068 | 
            -
                                            robot_ip[]
         | 
| 2118 | 
            +
                                            robot_ip[]  # 최초 호출
         | 
| 2119 | 
            +
                                          else
         | 
| 2120 | 
            +
                                            puts 'Failed to disable data. Error: ' + stderr2
         | 
| 2121 | 
            +
                                          end
         | 
| 2069 2122 | 
             
                                        else
         | 
| 2070 | 
            -
             | 
| 2123 | 
            +
                                          puts 'adb error, unable to get devices. Error: ' + stderr
         | 
| 2071 2124 | 
             
                                        end
         | 
| 2072 | 
            -
             | 
| 2125 | 
            +
                                      end
         | 
| 2073 2126 |  | 
| 2074 2127 |  | 
| 2075 2128 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: duo_blog_cafe_comment
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.9
         | 
| 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-10 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies: []
         | 
| 13 13 | 
             
            description: File to Clipboard gem
         | 
| 14 14 | 
             
            email: mymin26@naver.com
         |