<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                首先要獲取hash值是歌曲名的hash值 搜索歌曲接口 https://songsearch.kugou.com/song_search_v2?keyword=numb 關鍵詞 得到一個lists列表數據 歌曲的hash值 FileHash 和文件名 第二 獲取歌曲播放地址接口 mid不知道是什么意思 猜測是瀏覽器的編碼還是什么鬼 以下是示例接口 https://wwwapi.kugou.com/yy/index.php?r=play/getdata&hash=A9DC61CBFBC27F1F0BF63482D9469438&mid=407a9697947211b828f908950a4460ec https://wwwapi.kugou.com/yy/index.php?r=play/getdata&hash=29AFE0B705056DE252ED0E5A6E4A5EE2&mid=407a9697947211b828f908950a4460ec 得到播放地址 play_url 此為歌曲播放地址 第三下載歌曲 可以替換名字 以下為測試代碼 使用第三方庫 ``` composer require curl/curl ``` ``` <?php namespace app\index\controller; use Curl\Curl; use think\Controller; use think\Request; class Index extends Controller { public function test(Request $request) { $keyword = $request->param('keyword'); $url = "https://songsearch.kugou.com/song_search_v2"; $curl = new Curl(); $arr = ['keyword' => $keyword]; $curl->get($url,$arr); $curl->close(); $result = $curl->response; $res = json_decode($result, true); $lists = $res['data']['lists']; $arr = []; foreach ($lists as $k => $v) { // 過濾數據 // $arr[$k]['name'] = $v['SongName']; // $arr[$k]['hash'] = $v['FileHash']; $this->getPlayUrl($v['FileHash'], $v['SongName']); } // 是否存數據庫 待定 // return json($arr); } public function getPlayUrl($hash, $song_name) { // $url = "https://wwwapi.kugou.com/yy/index.php?r=play/getdata&mid=407a9697947211b828f908950a4460ec&hash=A8136351BE3DA7D077E95B976EB723CB"; $url = "https://wwwapi.kugou.com/yy/index.php"; $curl = new Curl(); $curl->setOpt(CURLOPT_RETURNTRANSFER, FALSE); // https接口需設置這個為false $curl->setOpt(CURLOPT_SSL_VERIFYPEER, FALSE); // https接口需設置這個為false $curl->setOpt(CURLOPT_SSL_VERIFYHOST, FALSE); // https接口需設置這個為false $curl->setOpt(CURLOPT_RETURNTRANSFER, 1); // 只獲取不顯示 $arr = [ 'r' =>'play/getdata', 'mid' =>'407a9697947211b828f908950a4460ec', 'hash' =>$hash, ]; $curl->get($url,$arr); $curl->close(); $result = $curl->response; $res = json_decode($result, true); $play_url = $res['data']['play_url'];// 音樂播放地址 $this->down($play_url, $song_name); } public function down($playUrl, $song_name) { $ch = new Curl(); $curl->setOpt(CURLOPT_RETURNTRANSFER, FALSE); // https接口需設置這個為false $curl->setOpt(CURLOPT_SSL_VERIFYPEER, FALSE); // https接口需設置這個為false $curl->setOpt(CURLOPT_SSL_VERIFYHOST, FALSE); // https接口需設置這個為false $curl->setOpt(CURLOPT_RETURNTRANSFER, 1); // 只獲取不顯示 $ch->get($playUrl); $ch->close(); // 打開文件夾 $path = '/www/wwwroot/www.kg.com/public/'; // 寫入文件處理 $file_name = $song_name . '.mp3'; $fp = fopen($path . $file_name, 'w+'); fwrite($fp, $ch->response); } } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看