mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-19 01:20:08 +08:00
[add] anchor
This commit is contained in:
parent
17e105e5b0
commit
ade3acb6d8
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,6 +1,18 @@
|
||||
# Release Notes
|
||||
# 本项目Log
|
||||
|
||||
## v0.0.1.191223 alpha (2019-12-23)
|
||||
|
||||
### Added
|
||||
- anchor(beta)
|
||||
-
|
||||
|
||||
### Changed
|
||||
-
|
||||
|
||||
### Fixed
|
||||
-
|
||||
|
||||
## v0.0.1.191030 alpha (2019-10-30)
|
||||
|
||||
### Added
|
||||
|
||||
35
DOC.md
35
DOC.md
@ -2,7 +2,7 @@
|
||||
<p align="center"><img width="300px" src="https://i.loli.net/2018/04/20/5ad97bd395912.jpeg"></p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/version-0.0.1.190713 alpha-green.svg?longCache=true&style=for-the-badge">
|
||||
<img src="https://img.shields.io/badge/version-0.0.1.191213 alpha-green.svg?longCache=true&style=for-the-badge">
|
||||
<img src="https://img.shields.io/badge/license-mit-blue.svg?longCache=true&style=for-the-badge">
|
||||
</p>
|
||||
|
||||
@ -17,22 +17,23 @@ B 站直播实用脚本
|
||||
|
||||
|plugin |version |description |
|
||||
|--------------------|--------------------|--------------------|
|
||||
|Daily |19.07.13 |每日背包奖励 |
|
||||
|GiftSend |19.07.13 |自动清空过期礼物 |
|
||||
|Heart |19.07.13 |双端直播间心跳 |
|
||||
|Login |19.07.13 |帐号登录组件 |
|
||||
|Silver |19.07.13 |自动领宝箱 |
|
||||
|Task |19.07.13 |每日任务 |
|
||||
|GiftHeart |19.07.13 |心跳礼物 |
|
||||
|Silver2Coin |19.07.13 |银瓜子换硬币 |
|
||||
|MaterialObject |19.07.13 |实物抽奖 |
|
||||
|GroupSignIn |19.07.13 |应援团签到 |
|
||||
|Storm |19.07.13 |节奏风暴 |
|
||||
|Notice |19.07.13 |Server酱 |
|
||||
|UnifyRaffle |19.07.23 |统一活动抽奖 |
|
||||
|MasterSite |19.07.13 |主站(观看、分享、投币)|
|
||||
|Guard |19.07.23 |舰长上船亲密度 |
|
||||
|PkRaffle |19.07.23 |大乱斗 |
|
||||
|Daily |19.12.23 |每日背包奖励 |
|
||||
|GiftSend |19.12.23 |自动清空过期礼物 |
|
||||
|Heart |19.12.23 |双端直播间心跳 |
|
||||
|Login |19.12.23 |帐号登录组件 |
|
||||
|Silver |19.12.23 |自动领宝箱 |
|
||||
|Task |19.12.23 |每日任务 |
|
||||
|GiftHeart |19.12.23 |心跳礼物 |
|
||||
|Silver2Coin |19.12.23 |银瓜子换硬币 |
|
||||
|MaterialObject |19.12.23 |实物抽奖 |
|
||||
|GroupSignIn |19.12.23 |应援团签到 |
|
||||
|Storm |19.12.23 |节奏风暴 |
|
||||
|Notice |19.12.23 |Server酱 |
|
||||
|UnifyRaffle |19.12.23 |统一活动抽奖 |
|
||||
|MasterSite |19.12.23 |主站(观看、分享、投币)|
|
||||
|Guard |19.12.23 |舰长上船亲密度 |
|
||||
|PkRaffle |19.12.23 |大乱斗 |
|
||||
|Anchor |19.12.23 |天选时刻 |
|
||||
|
||||
## 打赏赞助
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ Group: [55308141](https://jq.qq.com/?_wv=1027&k=5AIDaJg)
|
||||
|
||||
## 公告
|
||||
|
||||
Currently for Personal Edition **0.0.1.190822 alpha**
|
||||
Currently for Personal Edition **0.0.1.191213 alpha**
|
||||
|
||||
## 文档
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
"vlucas/phpdotenv": "^2.4",
|
||||
"monolog/monolog": "^1.23",
|
||||
"bramus/monolog-colored-line-formatter": "^2.0",
|
||||
"clue/socket-raw": "1.4"
|
||||
"clue/socket-raw": "^1.4.1"
|
||||
},
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
|
||||
68
composer.lock
generated
68
composer.lock
generated
@ -4,20 +4,20 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "6fca2d61232110e041d8cb569c30d02f",
|
||||
"content-hash": "d09e06835f7ff6a06fcb74285e6617c5",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bramus/ansi-php",
|
||||
"version": "3.0.2",
|
||||
"version": "3.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/bramus/ansi-php.git",
|
||||
"reference": "79d30c30651b0c6f23cf85503c779c72ac74ab8a"
|
||||
"reference": "fb0be33f36053af7454d462e3ddc0a2ac0b2f311"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/bramus/ansi-php/zipball/79d30c30651b0c6f23cf85503c779c72ac74ab8a",
|
||||
"reference": "79d30c30651b0c6f23cf85503c779c72ac74ab8a",
|
||||
"url": "https://api.github.com/repos/bramus/ansi-php/zipball/fb0be33f36053af7454d462e3ddc0a2ac0b2f311",
|
||||
"reference": "fb0be33f36053af7454d462e3ddc0a2ac0b2f311",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -50,7 +50,7 @@
|
||||
}
|
||||
],
|
||||
"description": "ANSI Control Functions and ANSI Control Sequences (Colors, Erasing, etc.) for PHP CLI Apps",
|
||||
"time": "2019-02-12T15:05:30+00:00"
|
||||
"time": "2019-12-03T09:04:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bramus/monolog-colored-line-formatter",
|
||||
@ -102,16 +102,16 @@
|
||||
},
|
||||
{
|
||||
"name": "clue/socket-raw",
|
||||
"version": "v1.4.0",
|
||||
"version": "v1.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/clue/php-socket-raw.git",
|
||||
"reference": "2f6654445233407900c9a804490cecd8e4f2ae86"
|
||||
"reference": "00ab102d061f6cdb895e79dd4d69140c7bda31cc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/clue/php-socket-raw/zipball/2f6654445233407900c9a804490cecd8e4f2ae86",
|
||||
"reference": "2f6654445233407900c9a804490cecd8e4f2ae86",
|
||||
"url": "https://api.github.com/repos/clue/php-socket-raw/zipball/00ab102d061f6cdb895e79dd4d69140c7bda31cc",
|
||||
"reference": "00ab102d061f6cdb895e79dd4d69140c7bda31cc",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -140,10 +140,10 @@
|
||||
"authors": [
|
||||
{
|
||||
"name": "Christian Lück",
|
||||
"email": "christian@lueck.tv"
|
||||
"email": "christian@clue.engineering"
|
||||
}
|
||||
],
|
||||
"description": "Simple and lightweight OOP wrapper for PHP's low level sockets extension (ext-sockets)",
|
||||
"description": "Simple and lightweight OOP wrapper for PHP's low-level sockets extension (ext-sockets)",
|
||||
"homepage": "https://github.com/clue/php-socket-raw",
|
||||
"keywords": [
|
||||
"Socket",
|
||||
@ -159,20 +159,20 @@
|
||||
"udp",
|
||||
"unix"
|
||||
],
|
||||
"time": "2019-01-22T11:08:01+00:00"
|
||||
"time": "2019-10-28T12:32:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.24.0",
|
||||
"version": "1.25.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266"
|
||||
"reference": "fa82921994db851a8becaf3787a9e73c5976b6f1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
|
||||
"reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/fa82921994db851a8becaf3787a9e73c5976b6f1",
|
||||
"reference": "fa82921994db851a8becaf3787a9e73c5976b6f1",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -243,20 +243,20 @@
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2018-11-05T09:00:11+00:00"
|
||||
"time": "2019-12-20T14:15:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd"
|
||||
"reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
|
||||
"reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801",
|
||||
"reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -271,7 +271,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
"dev-master": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -296,20 +296,20 @@
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2018-11-20T15:27:04+00:00"
|
||||
"time": "2019-11-01T11:05:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.11.0",
|
||||
"version": "v1.13.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "82ebae02209c21113908c229e9883c419720738a"
|
||||
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a",
|
||||
"reference": "82ebae02209c21113908c229e9883c419720738a",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
|
||||
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -327,7 +327,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.11-dev"
|
||||
"dev-master": "1.13-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -343,13 +343,13 @@
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Gert de Pagter",
|
||||
"email": "BackEndTea@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for ctype functions",
|
||||
@ -360,7 +360,7 @@
|
||||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"time": "2019-02-06T07:57:58+00:00"
|
||||
"time": "2019-11-27T13:56:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
|
||||
@ -44,15 +44,19 @@ SOCKET_ROOM_ID=9522051
|
||||
# 主站助手
|
||||
USE_MASTER_SITE=true
|
||||
|
||||
# 舰长总督
|
||||
USE_GUARD=true
|
||||
|
||||
# 统一活动
|
||||
USE_ACTIVE=true
|
||||
|
||||
# 舰长总督
|
||||
USE_GUARD=true
|
||||
|
||||
# 大乱斗
|
||||
USE_PK=true
|
||||
|
||||
# 天选时刻|抽取类型(0: 无限制; 1: 关注主播; 2: 粉丝勋章; 3大航海; 4用户等级;5主站等级)|逗号分隔
|
||||
USE_ANCHOR=false
|
||||
ANCHOR_TYPE=0,1
|
||||
|
||||
# 实物抽奖
|
||||
USE_MO=true
|
||||
|
||||
@ -93,7 +97,7 @@ APP_UNAME=
|
||||
# 多账号区别输出
|
||||
APP_MULTIPLE=false
|
||||
|
||||
# 账号别名,如果为空则默认使用登陆账号作为标示
|
||||
# 账号别名,如果为空则默认使用登录账号作为标示
|
||||
APP_USER_IDENTITY=
|
||||
|
||||
# 日志回调地址
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
@ -54,8 +54,9 @@ class Index
|
||||
PkRaffle::run();
|
||||
UnifyRaffle::run();
|
||||
Guard::run();
|
||||
Anchor::run();
|
||||
Statistics::run();
|
||||
usleep(0.1 * 1000000);
|
||||
usleep(0.2 * 1000000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
95
src/Anchor.php
Normal file
95
src/Anchor.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Website: https://mudew.com/
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
class Anchor extends BaseRaffle
|
||||
{
|
||||
const ACTIVE_TITLE = '天选时刻';
|
||||
const ACTIVE_SWITCH = 'USE_ANCHOR';
|
||||
|
||||
public static $lock = 0;
|
||||
public static $rw_lock = 0;
|
||||
|
||||
protected static $wait_list = [];
|
||||
protected static $finish_list = [];
|
||||
protected static $all_list = [];
|
||||
|
||||
private static $filter_type = [];
|
||||
|
||||
/**
|
||||
* 检查抽奖列表
|
||||
* @param $rid
|
||||
* @return bool
|
||||
*/
|
||||
protected static function check($rid): bool
|
||||
{
|
||||
$payload = [
|
||||
'roomid' => $rid
|
||||
];
|
||||
$url = 'https://api.live.bilibili.com/xlive/lottery-interface/v1/Anchor/Check';
|
||||
$raw = Curl::get($url, Sign::api($payload));
|
||||
$de_raw = json_decode($raw, true);
|
||||
|
||||
// 防止异常情况
|
||||
if (!isset($de_raw['data']) || $de_raw['data']['join_type'] || $de_raw['data']['lot_status']) {
|
||||
return false;
|
||||
}
|
||||
// TODO
|
||||
self::$filter_type = empty(self::$filter_type) ? explode(',', getenv('ANCHOR_TYPE')) : self::$filter_type;
|
||||
if (!in_array((string)$de_raw['data']['require_type'], self::$filter_type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'room_id' => $de_raw['data']['room_id'],
|
||||
'raffle_id' => $de_raw['data']['id'],
|
||||
'prize' => $de_raw['data']['award_name'],
|
||||
'wait' => strtotime(date("Y-m-d H:i:s"))
|
||||
];
|
||||
if (static::toRepeatLid($data['raffle_id'])) {
|
||||
return false;
|
||||
}
|
||||
Statistics::addPushList(static::ACTIVE_TITLE);
|
||||
array_push(static::$wait_list, $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @use 请求抽奖
|
||||
* @param array $data
|
||||
* @return bool
|
||||
*/
|
||||
protected static function lottery(array $data): bool
|
||||
{
|
||||
$user_info = User::parseCookies();
|
||||
$payload = [
|
||||
'id' => $data['raffle_id'],
|
||||
'roomid' => $data['room_id'],
|
||||
'platform' => 'pc',
|
||||
'csrf_token' => $user_info['token'],
|
||||
'csrf' => $user_info['token'],
|
||||
'visit_id' => '',
|
||||
];
|
||||
$url = 'https://api.live.bilibili.com/xlive/lottery-interface/v1/Anchor/Join';
|
||||
$raw = Curl::post($url, Sign::api($payload));
|
||||
$de_raw = json_decode($raw, true);
|
||||
|
||||
if (isset($de_raw['code']) && $de_raw['code'] == 0) {
|
||||
print_r($de_raw);
|
||||
Statistics::addSuccessList(static::ACTIVE_TITLE);
|
||||
Log::notice("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . static::ACTIVE_TITLE . ": {$data['prize']}");
|
||||
} else {
|
||||
Log::notice("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . static::ACTIVE_TITLE . ": {$de_raw['message']}");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
@ -46,6 +46,10 @@ class DataTreating
|
||||
// 乱斗
|
||||
PkRaffle::pushToQueue($info);
|
||||
break;
|
||||
case 'anchor':
|
||||
// 天选时刻
|
||||
Anchor::pushToQueue($info);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Website: https://mudew.com/
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
@ -134,6 +134,11 @@ class Login
|
||||
$headers = $captcha_data['headers'];
|
||||
continue;
|
||||
}
|
||||
// https://passport.bilibili.com/mobile/verifytel_h5.html
|
||||
if (!$data['code'] && $data['data']['status']) {
|
||||
Log::error('登录失败', ['msg' => '登录异常, 账号启用了设备锁或异地登录需验证手机!']);
|
||||
die();
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (isset($data['code']) && $data['code']) {
|
||||
@ -155,10 +160,10 @@ class Login
|
||||
|
||||
protected static function loginWithCaptcha()
|
||||
{
|
||||
Log::info('登陆需要验证 ,启动验证码登陆!');
|
||||
Log::info('登录需要验证, 启动验证码登录!');
|
||||
$headers = [
|
||||
'Accept' => 'application/json, text/plain, */*',
|
||||
'User-Agent' => 'bili-universal/8230 CFNetwork/975.0.3 Darwin/18.2.0',
|
||||
'User-Agent' => 'bili-universal/8470 CFNetwork/978.0.7 Darwin/18.5.0',
|
||||
'Host' => 'passport.bilibili.com',
|
||||
'Cookie' => 'sid=blhelper'
|
||||
];
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
@ -65,7 +65,7 @@ class Task
|
||||
} else {
|
||||
Log::info('签到成功');
|
||||
// 推送签到信息
|
||||
Notice::run('todaySign', $data['msg']);
|
||||
Notice::run('todaySign', $data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
@ -20,6 +20,7 @@ class TcpClient
|
||||
private static $client = null;
|
||||
private static $server_addr = null;
|
||||
private static $server_key = null;
|
||||
private static $socket_timeout = 0;
|
||||
|
||||
/**
|
||||
* @desc 入口
|
||||
@ -102,7 +103,7 @@ class TcpClient
|
||||
if (self::$heart_lock <= time()) {
|
||||
if (self::writer("")) {
|
||||
// 心跳默认35s 调整数据错开错误
|
||||
self::$heart_lock = time() + 20;
|
||||
self::$heart_lock = time() + 25;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,11 +117,14 @@ class TcpClient
|
||||
{
|
||||
$data = false;
|
||||
try {
|
||||
while (self::$client->selectRead(self::$socket_timeout)) {
|
||||
$data = self::$client->read($length);
|
||||
if (!$data) {
|
||||
throw new Exception("Connection failure");
|
||||
}
|
||||
if ($length == 4) $data = self::unPackMsg($data);
|
||||
break;
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
self::reConnect();
|
||||
}
|
||||
@ -136,8 +140,11 @@ class TcpClient
|
||||
{
|
||||
$status = false;
|
||||
try {
|
||||
while (self::$client->selectWrite(self::$socket_timeout)) {
|
||||
$data = self::packMsg($data);
|
||||
$status = self::$client->write($data);
|
||||
break;
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
self::reConnect();
|
||||
}
|
||||
@ -153,6 +160,7 @@ class TcpClient
|
||||
if (!self::$client) {
|
||||
try {
|
||||
$socket = (new Factory())->createClient(self::$server_addr, 40);
|
||||
$socket->setBlocking(false);
|
||||
self::$client = $socket;
|
||||
self::handShake();
|
||||
Log::info("连接到 {$socket->getPeerName()} 推送服务器");
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Author: Lkeme
|
||||
* License: The MIT License
|
||||
* Email: Useri@live.cn
|
||||
* Updated: 2019
|
||||
* Updated: 2019 ~ 2020
|
||||
*/
|
||||
|
||||
namespace lkeme\BiliHelper;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user