mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-18 17:00:06 +08:00
50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php declare(strict_types=1);
|
||
|
||
/**
|
||
* Website: https://mudew.com/
|
||
* Author: Lkeme
|
||
* License: The MIT License
|
||
* Email: Useri@live.cn
|
||
* Updated: 2018 ~ 2026
|
||
*
|
||
* _____ _ _ _ _ _ _____ _ _____ _____ _____
|
||
* | _ \ | | | | | | | | | | | ____| | | | _ \ | ____| | _ \ & /l、
|
||
* | |_| | | | | | | | | |_| | | |__ | | | |_| | | |__ | |_| | (゚、 。 7
|
||
* | _ { | | | | | | | _ | | __| | | | ___/ | __| | _ / \、゙ ~ヽ *
|
||
* | |_| | | | | |___ | | | | | | | |___ | |___ | | | |___ | | \ \ じしf_, )ノ
|
||
* |_____/ |_| |_____| |_| |_| |_| |_____| |_____| |_| |_____| |_| \_\
|
||
*/
|
||
|
||
namespace Bhp\Api\Video;
|
||
|
||
use Bhp\Request\Request;
|
||
use Bhp\User\User;
|
||
|
||
class ApiShare
|
||
{
|
||
/**
|
||
* 分享视频
|
||
* @param string $aid
|
||
* @return array
|
||
*/
|
||
public static function share(string $aid): array
|
||
{
|
||
//
|
||
$user = User::parseCookie();
|
||
//
|
||
$url = 'https://api.bilibili.com/x/web-interface/share/add';
|
||
//
|
||
$payload = [
|
||
'aid' => $aid,
|
||
'csrf' => $user['csrf'],
|
||
];
|
||
$headers = [
|
||
'origin' => 'https://www.bilibili.com',
|
||
'Referer' => "https://www.bilibili.com/video/av$aid",
|
||
];
|
||
// {"code":0,"message":"0","ttl":1}
|
||
return Request::postJson(true, 'pc', $url, $payload, $headers);
|
||
}
|
||
|
||
}
|