[fix(MainSite)] try to fix share

This commit is contained in:
Lkeme 2022-11-07 13:53:22 +08:00
parent 5b4de4369e
commit 2c10b35cba
8 changed files with 232 additions and 14 deletions

View File

@ -8,10 +8,23 @@
![](https://img.shields.io/badge/dynamic/json?label=GitHub%20Followers&query=%24.data.totalSubs&url=https%3A%2F%2Fapi.spencerwoo.com%2Fsubstats%2F%3Fsource%3Dgithub%26queryKey%3Dlkeme&labelColor=282c34&color=181717&logo=github&longCache=true "关注数量")
![](https://img.shields.io/github/stars/lkeme/BiliHelper-personal.svg?style=plastic&logo=appveyor "Star数量")
![](https://img.shields.io/github/forks/lkeme/BiliHelper-personal.svg?style=plastic&logo=stackshare "Fork数量")
![](https://img.shields.io/github/issues/lkeme/BiliHelper-personal.svg?style=plastic&logo=stackshare "Issues数量")
![](https://img.shields.io/github/contributors/lkeme/BiliHelper-personal "贡献者")
![](https://img.shields.io/github/repo-size/lkeme/BiliHelper-personal?style=flat-square&label=files&color=cf8ef4&labelColor=373e4dl "文件大小")
![](https://img.shields.io/github/languages/code-size/lkeme/BiliHelper-personal?color=blueviolet&style=flat-square "代码大小")
[![Docker Pulls](https://img.shields.io/docker/pulls/lkeme/bilihelper-personal?style=flat-square)](https://hub.docker.com/r/lkeme/bilihelper-personal)
[//]: # (<br>)
[//]: # (<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/lkeme/BiliHelper-personal/cron%20update?style=flat-square">)
[//]: # (<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/lkeme/BiliHelper-personal/main?style=flat-square">)
[//]: # (<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/w/lkeme/BiliHelper-personal/main?style=flat-square"> )
[//]: # (<img alt="GitHub commit activity" src="https://data.jsdelivr.com/v1/package/gh/lkeme/BiliHelper-personal/badge?style=rounded&style=flat-square"> )
[//]: # (<br>)
</div>
<p align="center">
@ -42,6 +55,10 @@
<p align="center">
<img alingn="center" src="https://profile-counter.glitch.me/BiliHelper-personal/count.svg" />
[//]: # ( <br>)
[//]: # ( <img src="https://count.getloli.com/get/@:BiliHelper-personal" alt=":BiliHelper-personal" />)
</p>
## 🖨️ 相关文档
@ -73,8 +90,10 @@ Group: [602815575](https://jq.qq.com/?_wv=1027&k=UaalVexM) | **请不要来问
以下任务都是按设定周期自动执行,`true`为正常使用,`false`为暂停使用或抛弃。
<details open>
<summary>点击展开</summary>
[//]: # (<details open><summary>点击展开</summary>)
<details><summary><strong><code>已经藏起来啦~~ 点击展开 嘻嘻~</code></strong></summary></code>
<br>
| plugin | version | description | author | pid | cycle | status |
|-----------------|---------|----------------|---------|------|-----------|--------|
@ -100,10 +119,10 @@ Group: [602815575](https://jq.qq.com/?_wv=1027&k=UaalVexM) | **请不要来问
## 🖥️星图
[//]: # ([![Star History Chart]&#40;https://api.star-history.com/svg?repos=lkeme/BiliHelper-personal&type=Timeline&#41;]&#40;https://star-history.com/#lkeme/BiliHelper-personal&Timeline&#41;)
[![Stargazers over time](https://starchart.cc/lkeme/BiliHelper-personal.svg)](https://starchart.cc/lkeme/BiliHelper-personal)
[![Stargazers over time](https://starchart.cc/lkeme/BiliHelper.svg)](https://starchart.cc/lkeme/BiliHelper)
## 🤭 运行效果
效果图不代表当前版本,请以当前最新版本运行结果为准。
@ -112,7 +131,7 @@ Group: [602815575](https://jq.qq.com/?_wv=1027&k=UaalVexM) | **请不要来问
[comment]: <> (![Image]&#40;https://i.loli.net/2019/07/13/5d296961a4bae41364.png&#41;)
## 🪣 项目相关
## 🪣 项目相关
* [BilibiliHelper](https://github.com/metowolf/BilibiliHelper)
* [BiliHelper](https://github.com/lkeme/BiliHelper)
@ -132,7 +151,8 @@ BiliHelper is under the MIT license.
本项目基于 MIT 协议发布,并增加了 SATA 协议。
当你使用了使用 SATA 的开源软件或文档的时候,在遵守基础许可证的前提下,你必须马不停蹄地给你所使用的开源项目 “点赞” ,比如在 GitHub 上
当你使用了使用 SATA 的开源软件或文档的时候,在遵守基础许可证的前提下,你必须马不停蹄地给你所使用的开源项目 “点赞” ,比如在
GitHub 上
star然后你必须感谢这个帮助了你的开源项目的作者作者信息可以在许可证头部的版权声明部分找到。
本项目的所有代码文件、配置项,除另有说明外,均基于上述介绍的协议发布,具体请看分支下的 LICENSE。

View File

@ -187,6 +187,33 @@ $ php app.php test m:d -p VipPoint
## Docker使用指南
<strong>🌐 镜像加速器</strong>(部分网络原因导致拉取镜像失败)<br/><br/>
<details><summary><strong><code>已经藏起来啦~~ 点击展开 嘻嘻~</code></strong></summary></code>
> 以下是通用系统配置,部分特殊系统修改可能不一样,请自行搜索解决。
`在文件 /etc/docker/daemon.json 写入以下内容,如果部分不可用节点自行删除`
```json
{
"registry-mirrors":[
"https://0b27f0a81a00f3560fbdc00ddd2f99e0.mirror.swr.myhuaweicloud.com",
"https://dockerproxy.com",
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com",
"https://oyukeh0j.mirror.aliyuncs.com",
"https://ypzju6vq.mirror.aliyuncs.com",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn"
]
}
```
<br>
</details>
1. 安装好[Docker](https://yeasy.gitbooks.io/docker_practice/content/install/)
2. 直接命令行拉取镜像后运行
@ -204,10 +231,7 @@ $ docker run -itd --rm -e USER_NAME=你的B站登录账号 -e USER_PASSWORD=你
[//]: # (2. 修改)
1.
下载[配置文件夹](https://github.com/lkeme/BiliHelper-personal/tree/master/profile) `注意是文件夹,可以完整下载后提出来`
1. 下载 [配置文件夹](https://github.com/lkeme/BiliHelper-personal/tree/master/profile) `注意是文件夹,可以完整下载后提出来`
2. 重命名 `profile/example -> profile/user` , 修改 `profile/user/config/user.ini`
3. 通过下面的命令进行挂载并运行

View File

@ -231,7 +231,9 @@ class Login extends BasePlugin
*/
public function patchCookie(): string
{
$response = ApiMain::home();
// $response = ApiMain::home();
$bvid_list = ["BV16X4y1g7wT", "BV1cy4y1k7A2", "BV1bz4y1r7Ug", "BV1ti4y1K7uw", "BV1GK411K7Ke", "BV1CC4y1a7ee", "BV1PK411L7h5", "BV1qt411j7fV", "BV1yt4y1Q7SS", "BV1mi4y1b76M", "BV1pi4y147tQ", "BV1FE411A7Xd", "BV19E41197Kc", "BV1tJ411W7hw", "BV1w7411P7jJ", "BV1Jb411W7dH", "BV12J411X7cD", "BV1Nt4y1D7pW", "BV1Wb411v7WN", "BV1Yc411h7uQ", "BV1x54y1e7zf", "BV1UE411y7Wy", "BV1zp4y1U7Z5", "BV1mK411V7wY", "BV1ht411L72V", "BV16Z4y1H7NG", "BV1jE41137eu", "BV1dW411n7La", "BV1Jb411U7u2", "BV1kt411d7Ht", "BV1Sx411T7QQ", "BV1bW411n7fY", "BV1Ys41167aL", "BV1es411D7sW", "BV1f4411M7QC", "BV1XW411F7L6", "BV1xx411c7mu", "BV1Ss411o7vY", "BV1js411f7jY", "BV1gs411B7y4", "BV12s411N7g2", "BV1fs411t7EK", "BV15W411W7NJ", "BV1xx411c7XW", "BV1vx411K7jb", "BV1Ls41127sG", "BV1GW411g7mc", "BV1Hx411V7n9", "BV1hs411Q7zf", "BV1zs411S7sz", "BV1Us411d71V", "BV1EW41167Yv", "BV1px411N7Yd", "BV1Yx411A7wM", "BV1Js411o76u", "BV1Xs411X7wh", "BV1nx411F7Jf", "BV1Dt411r7Tv", "BV1xx411c79H", "BV1Bx411c7hB", "BV1ix411c7Ye", "BV1Vs411y7TM", "BV1rs411S736", "BV11p411o73u", "BV1Js411Z7Nq", "BV1nx411F7fM", "BV1YW411n7aW", "BV1Ds411m7c5", "BV1Fx411w7GK", "BV1cs411S7DX", "BV1cb411V7Lm", "BV1Kt41147o3", "BV1Mt411D73n", "BV1fx411c7v6", "BV1dx411P79c", "BV1es41197ai", "BV1hx411w7MG", "BV1Ys411H7QK", "BV1Kx411y7TJ", "BV1ts411D7mf", "BV1Sx41117dD", "BV1tx411P7N4", "BV1fs411k7Kj", "BV1Sx411T7L3", "BV1es41197hA"];
$response = ApiMain::video($bvid_list[array_rand($bvid_list)]);
$headers = $response['Set-Cookie'];
$cookies = [];
foreach ($headers as $header) {

View File

@ -104,6 +104,8 @@ class MainSite extends BasePlugin
// 投币
foreach ($aids as $aid) {
$this->reward((string)$aid);
//
sleep(1);
}
return true;
}

View File

@ -132,7 +132,7 @@ class VipPrivilege extends BasePlugin
case -101:
throw new NoLoginException($response['message']);
case 0:
Log::warning("大会员权益: 领取权益 {$this->privilege[$type]} 成功");
Log::notice("大会员权益: 领取权益 {$this->privilege[$type]} 成功");
break;
default:
Log::warning("大会员权益: 领取权益 {$this->privilege[$type]} 失败 {$response['code']} -> {$response['message']}");

View File

@ -30,4 +30,16 @@ class ApiMain
$url = 'https://www.bilibili.com/';
return Request::headers('pc', $url);
}
/**
* video主页
* @return array|mixed
*/
public static function video(string $bvid): mixed
{
$url = "https://www.bilibili.com/video/$bvid/";
return Request::headers('pc', $url);
}
}

View File

@ -126,12 +126,12 @@ function getAppHomePage(): string
/**
* 错误退出
* @param $message
* @param mixed $message
* @param array $context
* @param int $delay
* @return void
*/
#[NoReturn] function failExit($message, array $context = [], int $delay = 60 * 2): void
#[NoReturn] function failExit(mixed $message = 'exit', array $context = [], int $delay = 60 * 2): void
{
Log::error($message, $context);
// 如果在docker环境中延迟退出方便查看错误

158
src/Util/UUID/UUID.php Normal file
View File

@ -0,0 +1,158 @@
<?php declare(strict_types=1);
/**
* Website: https://mudew.com/
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
* Updated: 2022 ~ 2023
* Source: https://raw.githubusercontent.com/abmmhasan/UUID/main/src/Uuid.php
*
* _____ _ _ _ _ _ _____ _ _____ _____ _____
* | _ \ | | | | | | | | | | | ____| | | | _ \ | ____| | _ \ & l、
* | |_| | | | | | | | | |_| | | |__ | | | |_| | | |__ | |_| | (゚、
* | _ { | | | | | | | _ | | __| | | | ___/ | __| | _ /   \、゙ ~ *
* | |_| | | | | |___ | | | | | | | |___ | |___ | | | |___ | | \ \  じしf_, )
* |_____/ |_| |_____| |_| |_| |_| |_____| |_____| |_| |_____| |_| \_\
*/
namespace Bhp\Util\UUID;
use Exception;
class UUID
{
private static $nsList = [
'dns' => 0,
'url' => 1,
'oid' => 2,
'x500' => 3
];
private static $node;
/**
* Generate UUID v1 string
*
* @param string|null $node
* @return string
* @throws Exception
*/
public static function v1(string $node = null): string
{
$time = microtime(false);
$time = substr($time, 11) . substr($time, 2, 7);
$time = str_pad(dechex($time + 0x01b21dd213814000), 16, '0', STR_PAD_LEFT);
$clockSeq = random_int(0, 0x3fff);
$node = $node ?? self::getNode();
return sprintf('%08s-%04s-1%03s-%04x-%012s',
substr($time, -8),
substr($time, -12, 4),
substr($time, -15, 3),
$clockSeq | 0x8000,
$node
);
}
/**
* Generate UUID v3 string
*
* @param string $string
* @param string $namespace
* @return string
* @throws Exception
*/
public static function v3(string $string, string $namespace = 'x500'): string
{
$namespace = self::nsResolve($namespace);
if (!$namespace) {
throw new Exception('Invalid NameSpace!');
}
$hash = md5(hex2bin($namespace) . $string);
return self::output(3, $hash);
}
/**
* Generate UUID v4 Random string
*
* @return string
* @throws Exception
*/
public static function v4(): string
{
$string = bin2hex(random_bytes(16));
return self::output(4, $string);
}
/**
* Generate UUID v5 string
*
* @param string $string
* @param string $namespace
* @return string
* @throws Exception
*/
public static function v5(string $string, string $namespace = 'x500'): string
{
$namespace = self::nsResolve($namespace);
if (!$namespace) {
throw new Exception('Invalid NameSpace!');
}
$hash = sha1(hex2bin($namespace) . $string);
return self::output(5, $hash);
}
/**
* Get generated Node (for v1)
*
* @return string
* @throws Exception
*/
public static function getNode(): string
{
if (self::$node) {
return self::$node;
}
return self::$node = sprintf('%06x%06x',
random_int(0, 0xffffff) | 0x010000,
random_int(0, 0xffffff)
);
}
/**
* @param int $version
* @param string $string
* @return string
*/
private static function output(int $version, string $string): string
{
$string = str_split($string, 4);
return sprintf("%08s-%04s-{$version}%03s-%04x-%012s",
$string[0] . $string[1], $string[2],
substr($string[3], 1, 3),
hexdec($string[4]) & 0x3fff | 0x8000,
$string[5] . $string[6] . $string[7]
);
}
private static function nsResolve($namespace)
{
if (self::isValid($namespace)) {
return str_replace('-', '', $namespace);
}
$namespace = str_replace(['namespace', 'ns', '_'], '', strtolower($namespace));
if (isset(self::$nsList[$namespace])) {
return "6ba7b81" . self::$nsList[$namespace] . "9dad11d180b400c04fd430c8";
}
return false;
}
/**
* @param $uuid
* @return bool
*/
private static function isValid($uuid): bool
{
return (bool)preg_match('{^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$}Di', $uuid);
}
}