云璃ღ - api
type: channel
link: https://www.masterzc.cn/tag/api
items: 免费API
items: 博客音乐调用网易云歌曲新版
items: 博客音乐调用网易云歌曲
items: Junichi模板调用全民K歌音乐源链
items: 全民K歌之源文件下载

免费API
type: item
date: 2018-06-20T17:48:42+08:00
description: 各类无次数限制的免费API接口整理，主要是聚合数据上和API Store上的一些，还有一些其他的。聚合数据提供30大类,160种以上基础数据API服务,国内最大的基础数据API服务，下面就罗列一些免费的各类API接口。聚合的免费API接口数据：手机号码归属地API接口：https://www.juhe.cn/docs/api/id/11历史上的今天API接口：https://www.juhe.cn/docs/api/id/63股票数据API接口：https://www.juhe.cn/docs/api/id/21全国WIFI接口：https://www.juhe.cn/docs/api/id/18星座运势接口：https://www.juhe.cn/docs/api/id/58黄金数据接口：https://www.juhe.cn/docs/api/id/29语音识别接口：https://www.juhe.cn/docs/api/id/134周公解梦接口：https://www.juhe.cn/docs/api/id/64天气预报API接口：https://www.juhe.cn/docs/api/id/73身份证查询API接口：https://www.juhe.cn/docs/api/id/38笑话大全API接口：https://www.juhe.cn/docs/api/id/95邮编查询接口：https://www.juhe.cn/docs/api/id/66老黄历接口：https://www.juhe.cn/docs/api/id/65网站安全检测接口：https://www.juhe.cn/docs/api/id/19手机固话来电显示接口：https://www.juhe.cn/docs/api/id/72基金财务数据接口：https://www.juhe.cn/docs/api/id/28成语词典接口：https://www.juhe.cn/docs/api/id/157新闻头条接口：https://www.juhe.cn/docs/api/id/235IP地址接口：https://www.juhe.cn/docs/api/id/1问答机器人接口：https://www.juhe.cn/docs/api/id/112汇率API接口：https://www.juhe.cn/docs/api/id/80电影票房接口：https://www.juhe.cn/docs/api/id/44万年历API接口：https://www.juhe.cn/docs/api/id/177NBA赛事接口：https://www.juhe.cn/docs/api/id/92百度 api集市免费接口IP地址查询 http://apistore.baidu.com/apiworks/servicedetail/114.html频道新闻API_易源 http://apistore.baidu.com/apiworks/servicedetail/688.html微信热门精选 http://apistore.baidu.com/apiworks/servicedetail/632.html天气查询 http://apistore.baidu.com/apiworks/servicedetail/112.html中国和世界天气预报 http://apistore.baidu.com/apiworks/servicedetail/478.html股票查询 http://apistore.baidu.com/apiworks/servicedetail/115.html身份证查询http://apistore.baidu.com/apiworks/servicedetail/113.html美女图片 http://apistore.baidu.com/apiworks/servicedetail/720.html音乐搜索 http://apistore.baidu.com/apiworks/servicedetail/1020.html图灵机器人 http://apistore.baidu.com/apiworks/servicedetail/736.html汇率转换 http://apistore.baidu.com/apiworks/servicedetail/119.html节假日 http://apistore.baidu.com/apiworks/servicedetail/1116.htmlpullword在线分词服务 http://apistore.baidu.com/apiworks/servicedetail/143.html去哪儿网火车票…

博客音乐调用网易云歌曲新版
type: item
date: 2017-11-19T13:04:00+08:00
description: 设置全民歌单，通过调用网易云API，直接播放歌单歌曲。编辑文件header.php //首页85行 var musicSrc =" <?php function sig($id, $random, $time){ return md5('$sdk=XXX&$id='.$id.'&$random='.$random.'&$time='.$time); } function curl($url, $id, $method = 'playlist') { $data['id'] = $id; $data['method'] = $method; $data['random'] = rand(100000,999999); $data['time'] = time(); $data['sig'] = sig($data['id'],$data['random'],$data['time']); $curl=curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); $data=curl_exec($curl); curl_close($curl); return json_decode($data); } function playlist($id){ $url = "https://localhost/music.php"; $data = curl($url, $id); $lists = array(); foreach($data as $k => $v){ $lists[] = $v->id; } return implode(',', $lists); } $id = $this->options->socialmusic; print_r(playlist($id)); ?>"; var musicIco = document.getElementById("musicico"); var musicArr = musicSrc.split(",") var musicBtn = document.getElementById("musicBtn"); //请求接口获取数据 function getMusic(id, method) { $.ajax({ type: "POST", url: "https://localhost/music.php", contentType: "application/json; charset=utf-8", data: JSON.stringify(getJsonData(id, method)), dataType: "json", success: function (message) { switch (method){ case 'playlist': musicData = message; break; case 'url': musicUrlData = message; musicObj.src = message.url; musicObj.loop = false; musicObj.style.display = "none"; musicObj.play(); break; } } }) } //计算签名 function getJsonData(id, method) { var num = randomNum(10000, 99999) var time = Math.round(new Date().getTime() / 1000) var sigText = '$sdk=XXX&$id=' + id + '&$random=' + num + '&$time=' + time var sig = $.md5(sigText) var json = { "id" : id, "random" : num, "time" : time, "sig" : sig, "method" : method } return json } //随机数字 function ra…

博客音乐调用网易云歌曲
type: item
date: 2017-08-31T20:44:00+08:00
description: 设置全民歌单，通过调用网易云API，直接播放歌单歌曲。编辑文件header.phpmusicSrc<?php function netease_AESECB($API) { $KEY='7246674226682325323F5E6544673A51'; $body=json_encode($API['body']); if (function_exists('openssl_encrypt')) { $body=openssl_encrypt($body, 'aes-128-ecb', pack('H*', $KEY)); } else { $PAD=16-(strlen($body)%16); $body=base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, hex2bin($KEY), $body.str_repeat(chr($PAD), $PAD), MCRYPT_MODE_ECB)); } $body=strtoupper(bin2hex(base64_decode($body))); $API['body']=array( 'eparams'=>$body, ); return $API; } function curl($API) { $API=netease_AESECB($API); $BASE = array( 'referer' => 'https://music.163.com/', 'cookie' => 'os=linux; appver=1.0.0.1026; osver=Ubuntu%2016.10; MUSIC_U=78d411095f4b022667bc8ec49e9a44cca088df057d987f5feaf066d37458e41c4a7d9447977352cf27ea9fee03f6ec4441049cea1c6bb9b6; __remember_me=true', 'useragent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', ); $curl=curl_init(); if ($API['method']=='POST') { if (is_array($API['body'])) { $API['body']=http_build_query($API['body']); } curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $API['body']); } elseif ($API['method']=='GET') { if (isset($API['body'])) { $API['url']=$API['url'].'?'.http_build_query($API['body']); } } curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_TIMEOUT, 20); curl_setopt($curl, CURLOPT_ENCODING, 'gzip'); curl_setopt($curl, CURLOPT_IPRESOLVE, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl, CURLOPT_URL, $API['url']); curl_setopt($curl, CURLOPT_COOKIE, $BASE['cookie']); curl_setopt($curl, CURLOPT_REFERER, $BASE['referer']); curl_setopt($curl, CURLOPT_USERAGENT, $BASE['useragent']); $data=curl_exec($curl); curl_close($curl); return $data; } function curlMusic($id, $type = 'list', $br = 320) { if ($type === 'list') { $API=array( 'method' => 'PO…

Junichi模板调用全民K歌音乐源链
type: item
date: 2017-08-29T23:20:00+08:00
description: 通过调用全民K歌API直接使用全民K歌播放音乐。编辑文件header.phpmusicSrc<?php /** * 调用全民K歌API获取playurl * @param string $id 全民K歌歌曲id * @return string 歌曲直链 */ function curlApi($id) { $url = "http://cgi.kg.qq.com/fcgi-bin/kg_ugc_getdetail?inCharset=GB2312&outCharset=utf-8&v=4&shareid=".$id."&callback=json"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $ret = curl_exec($curl); curl_close($curl); $urlJson = json_decode(substr($ret,5,-1)); return substr($urlJson->data->playurl,5); } /** * 组装url * @param array|string $id 全民K歌歌曲id * @return array|string 歌曲直链 */ function curlId($id) { if (is_array($id)) { foreach ($id as $k => $v) { $data[] = curlApi($v); } $data = implode(",", $data); } else { $data = curlApi($id); } return $data; } /** * 写入缓存 * @param array|string $id 全民K歌歌曲id * @param string $cache_file 缓存路径 * @param boolean $update 更新(true)/写入(flase) * @return string 歌曲直链组装字符串 */ function setCache($id, $cache_file, $update = false) { if(isset($id)) { if (strpos($id, ",")) { $data[0] = curlId(explode(",", $id)); } else { $data[0] = curlId($id); } $data[1] = $id; if($update) { unlink($cache_file); } file_put_contents($cache_file,serialize($data)); return $data[0]; } } //设置缓存路径及缓存时间 define('CACHE_ROOT', dirname(__FILE__).'/cache'); define('CACHE_LIFE', 3600); define('CACHE_SUFFIX','.cache'); $file_name = date("Y-m-d").CACHE_SUFFIX; $cache_file = CACHE_ROOT.'/'.$file_name; //存在缓存 && 缓存超时 && 修改歌曲设置 => 更新缓存 if (file_exists($cache_file)) { if (time()-filemtime($cache_file)<CACHE_LIFE) { $data = unserialize(file_get_contents($cache_file)); if($data[1] !== $this->options->socialmusic) { echo setCache($this->options->socialmusic, $cache_file, true); } else { echo $data[0]; } } else { echo setCache($this->options->socialmusic, $cache_file, true); } } else { if (!file_exists(CACHE_ROOT)) { mkdir(CACHE_ROOT,0777); chmod(CACHE_ROOT,0777); } echo setCache($this->options->socialmusic, $cache_file); } ?>编辑文件functi…

全民K歌之源文件下载
type: item
date: 2017-08-12T12:32:00+08:00
description: 全民K歌点击任一歌曲播放页。如：本色链接为：http://node.kg.qq.com/play?s=aYR-Bwa8CgDf5a9X&g_f=personal取其s参数：aYR-Bwa8CgDf5a9X打开链接:http://cgi.kg.qq.com/fcgi-bin/kg_ugc_getdetail?inCharset=GB2312&outCharset=utf-8&v=4&shareid=获取的ID&callback=json http://cgi.kg.qq.com/fcgi-bin/kg_ugc_getdetail?inCharset=GB2312&outCharset=utf-8&v=4&shareid=aYR-Bwa8CgDf5a9X&callback=json应答包体：json( { "code": 0, "subcode": 0, "message": "", "default": 0, "data": { "activity_id": 0, "avatar": "http:\/\/shp.qlogo.cn\/ttsing\/283022044\/283022044\/100", "client_key": "c5276c14-3a3c-4e6d-bd66-97dcfb56196b", "comment_num": 616, "comments": [ { "avatar": "http:\/\/shp.qlogo.cn\/ttsing\/234829030\/234829030\/100", "comment_id": "234829030_1502337353_699213_811", "content": "太厉害了", "ctime": 1502337353, "is_owner": 0, "nick": "[em]e400182[\/em]無情的殇", "reply_avatar": "", "reply_nick": "", "uid": "609e998d2724378834" }, { "avatar": "http:\/\/shp.qlogo.cn\/ttsing\/368821390\/368821390\/100", "comment_id": "368821390_1502422788_848146_318", "content": "好萌啊！受不了。。。。你一定比我大。。。。", "ctime": 1502422788, "is_owner": 0, "nick": "[em]e401137[\/em]幻[em]e400780[\/em]音[em]e401137[\/em]沫雨清", "reply_avatar": "", "reply_nick": "", "uid": "619b958d272c348234" }, { "avatar": "http:\/\/shp.qlogo.cn\/ttsing\/202034148\/202034148\/100", "comment_id": "202034148_1502453240_224086_353", "content": "好听", "ctime": 1502453240, "is_owner": 0, "nick": "谜ヾ [em]e400640[\/em]九妹", "reply_avatar": "", "reply_nick": "", "uid": "609d9f852629368f3c" }, { "avatar": "http:\/\/shp.qlogo.cn\/ttsing\/16787771\/16787771\/100", "comment_id": "16787771_1502470543_512550_165", "content": "这首歌不听都后悔", "ctime": 1502470543, "is_owner": 0, "nick": "伊伊小仙女[em]e400126[\/em]", "reply_avatar": "", "reply_nick": "", "uid": "639b9a8d222a308a" }, { "avatar": "http:\/\/shp.qlogo.cn\/ttsing\/10024497\/10024497\/100", "comment_id": "10024497_1502515820_450828_401", "content": "好听哇quq", "ctime": 1502515820, "is_owner": 0, "nick": "[em]e400126[\/em]?Y..晴°kaino@依苒", "reply_avatar": "", "re…