mirror of
https://github.com/mashirozx/sakura.git
synced 2024-11-29 10:18:12 +08:00
9abded81ec
add some music platforms, add netease-cloud-music cookies option. Integrate Meting API into theme, now you can use aplayer play other platform's music, refactor theme built-in api interface. BREAKING CHANGE: refactor api.php, close #211
40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Sakura\API;
|
|
|
|
class QQ
|
|
{
|
|
public static function get_qq_info($qq) {
|
|
$get_info = file_get_contents('http://r.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?get_nick=1&uins=' . $qq);
|
|
$get_info = mb_convert_encoding($get_info, "UTF-8", "GBK");
|
|
$name = json_decode(substr($get_info, 17, -1), true);
|
|
if ($name) {
|
|
$output = array(
|
|
'status' => 200,
|
|
'success' => true,
|
|
'message' => 'success',
|
|
'avatar' => 'https://q.qlogo.cn/headimg_dl?dst_uin=' . $qq . '&spec=100',
|
|
'name' => $name[$qq][6],
|
|
);
|
|
} else {
|
|
$output = array(
|
|
'status' => 404,
|
|
'success' => false,
|
|
'message' => 'QQ number not exist.'
|
|
);
|
|
}
|
|
return $output;
|
|
}
|
|
|
|
public static function get_qq_avatar($encrypted) {
|
|
global $sakura_privkey;
|
|
if (isset($encrypted)) {
|
|
$iv = str_repeat($sakura_privkey, 2);
|
|
$encrypted = base64_decode(urldecode($encrypted));
|
|
$qq_number = openssl_decrypt($encrypted, 'aes-128-cbc', $sakura_privkey, 0, $iv);
|
|
preg_match('/^\d{3,}$/', $qq_number, $matches);
|
|
$imgurl = 'https://q2.qlogo.cn/headimg_dl?dst_uin=' . $matches[0] . '&spec=100';
|
|
return $imgurl;
|
|
}
|
|
}
|
|
} |