Compare commits

...
63 Commits
Author SHA1 Message Date
shanmite b568208990 docs: 更新CHANGELOG 2023-08-30 16:25:36 +08:00
shanmite 62768ddc71 fix: 修改win脚本 2023-08-30 16:17:28 +08:00
shanmite 101df0a7a6 fix: login等待时间过长 2023-08-30 13:59:58 +08:00
shanmite f8829b5d4b fix: 清理动态检索动态延时 2023-08-29 10:30:18 +08:00
shanmite be6552a321 docs: 更新CHANGELOG 2023-08-29 08:43:21 +08:00
shanmite 83e19d44e3 docs: 扫码登陆使用说明 2023-08-29 08:41:32 +08:00
KirDeerandshanmite c238c27d7d fix:多账号login添加时延进行间隔 2023-08-29 08:14:01 +08:00
KirDeerandshanmite 8addc9078d fix:登录跳过执行正常状态的账号 2023-08-29 08:14:01 +08:00
KirDeerandshanmite 288851b491 feat: 扫码登录获取移动端的CK更新账号,带sid可减小掉号频率 2023-08-28 10:35:07 +08:00
shanmite ddcfceecef fix: 移除公共黑名单设置 2023-08-28 09:05:33 +08:00
shanmite 49ef4070ca docs: 更新CHANGELOG 2023-08-26 08:37:03 +08:00
shanmite 0024b19cbf feat: 移除远程设置启用自动更新 2023-08-26 08:36:12 +08:00
shanmite 04c25a88fc docs: 更新CHANGELOG 2023-08-25 09:31:42 +08:00
shanmite 9ab605a186 feat: 新增本地dyids抽奖新信息获取方式 (#311)(#287)
Fixed #311
2023-08-25 09:27:50 +08:00
shanmite a83c5ab91a fix: extend_json undefined 2023-08-24 13:45:52 +08:00
shanmite 092bd843e1 docs: 更新CHANGELOG 2023-08-23 16:28:35 +08:00
shanmite 2f2eaabc57 fix: 预约抽奖包月抽奖识别异常 (#288)
Fixed #288
2023-08-23 16:20:45 +08:00
shanmite da8d460dc6 docs: 更新CHANGELOG 2023-08-18 10:15:22 +08:00
shanmite 3825be45df feat: 查看帐号信息 2023-08-18 10:13:18 +08:00
shanmite 248c78d669 feat: 快速移除关注模式新增粉丝数限制 (#305)
Fixed #305
2023-08-05 16:37:17 +08:00
shanmite 3d90e11b96 docs: 更新CHANGELOG 2023-07-27 10:49:47 +08:00
shanmite d44981b7eb fix: 随机cookie参数buvid3 2023-07-27 10:47:24 +08:00
shanmite 3bfc93fd4e fix: 目前回复无法正常推送 (#302)
Fixed #302
2023-07-27 10:15:35 +08:00
shanmite ef8366be66 fix: tg推送代理设置出错 (#298)
Fixed #289
2023-07-10 10:48:48 +08:00
shanmite a7e31b484e docs: update 2023-07-10 09:49:36 +08:00
shanmite f4f45c5107 fix: cookie参数buvid3错误导致专栏获取滞后 2023-07-04 13:37:43 +08:00
shanmite c8876a7fd1 docs: 更新CHANGELOG 2023-06-30 14:50:21 +08:00
shanmite 2f935bbebb chore: update env.js 2023-06-30 14:49:19 +08:00
shanmite eec22ffd76 feat: 验证码自动识别 2023-06-30 14:42:43 +08:00
shanmite 909fb83f79 chore: update qinglong script 2023-06-30 08:05:00 +08:00
shanmite 41b036966e ci: fix pkg.yml 2023-06-29 08:01:24 +08:00
shanmite c282d8492d docs: 更新CHANGELOG 2023-06-28 16:06:23 +08:00
shanmite 5a3c16d20d fix: 专栏获取内容不正确,需要排除推荐内容 (#293)
Fixed #293
2023-06-28 15:28:27 +08:00
shanmite 75383e8faa docs: 更新CHANGELOG 2023-05-16 09:56:09 +08:00
shanmite 29645bc4e7 fixed: 话题搜索功能已失效 #285
Fixed #285
2023-05-16 09:55:08 +08:00
shanmite d950a59b4d fix: is_imitator导致错误评论 2023-05-15 11:24:09 +08:00
shanmite d3e3436075 docs: 更新CHANGELOG 2023-05-15 10:49:26 +08:00
shanmite 3828a0f054 fix: Cannot read properties of null (#284)
Fixed #284
2023-05-15 10:47:57 +08:00
shanmite 67313f4a23 feat: 专栏里的动态链接识别优化 (#283)
Fixed #283
2023-05-05 10:20:17 +08:00
shanmite fd2921cb07 docs: 更新CHANGELOG 2023-05-04 15:07:42 +08:00
shanmite ad6af9705f feat: 专栏短链接识别 (#263)
Fixed #263
2023-05-04 14:58:19 +08:00
shanmite b6c56c5061 feat: 取关分区支持设置多分区 (#281)
Fixed #281
2023-05-03 08:37:47 +08:00
shanmite c7bdf74d5c docs: 更新CHANGELOG 2023-04-23 16:17:02 +08:00
shanmite 2426fe2384 fix: 动态详情获取接口412频繁 (#279)
Fixed #279
2023-04-23 16:04:33 +08:00
shanmite d370fef899 fix: 获取动态详情出现undefined (#271)
Fixes #271
2023-03-23 08:33:48 +08:00
shanmite 00174b0fdc fix(monitor): L615 2023-02-15 15:16:55 +08:00
shanmite ea711ae048 docs: 更新CHANGELOG 2023-02-15 15:06:15 +08:00
shanmite 881923ba54 fix: 开奖时间和粉丝数判断逻辑 (#253)
Fixed #253
2023-02-15 15:05:18 +08:00
shanmite 097e2d61e7 fix: 筛选掉置顶的评论,与该动态UP的评论 (#252)
Fixed #252
2023-02-15 10:57:58 +08:00
shanmite 82d285e841 fix: 充电专属动态 (#251)
Fixed  #251
2023-02-13 11:47:16 +08:00
shanmite bf4e8945c0 docs: 更新CHANGELOG 2023-02-12 15:31:39 +08:00
shanmite 9c9bc18a44 fix: 查询评论报错 (#250)
Fixed #250
2023-02-12 15:27:26 +08:00
shanmite 52c6464650 docs: 更新CHANGELOG 2023-02-12 13:17:00 +08:00
shanmite 0630c8931a feat: 新增设置抄热评屏蔽词 (#239)
Fixed #239
2023-02-12 13:04:03 +08:00
shanmite 7b9d251e80 feat: 热评包含发送热评的人的昵称换成自己的昵称 (#239) 2023-02-12 12:42:30 +08:00
shanmite 5ae7801086 fix: 带话题正则修改 2023-02-12 12:13:06 +08:00
shanmite 0ab5ec0540 feat: 未知错误不重试 2023-02-12 11:38:34 +08:00
shanmite 50c22a4ecf fix: 账号异常点赞失败 (#247)
Fixed #247
2023-02-12 11:27:19 +08:00
shanmite 8ac7466878 fix: 未知错误 已赞过 (#249)
Fixed #249
2023-02-12 10:47:16 +08:00
shanmite 7f6188d510 feat: UID保护列表输出调整为debug级 2023-02-12 09:59:33 +08:00
shanmite 2ad128ce99 docs: change LICENSE
Create LICENSE
2023-02-06 11:20:39 +08:00
spiritLHLSandshanmite e945be4347 feat: 检测docker是否已安装,未安装则预先安装docker
检测docker是否已安装,未安装则预先安装docker
2023-02-06 11:02:20 +08:00
ouyangjintingandshanmite bfdbc7ae9e fix: /bin/env path error 2023-02-05 22:35:00 +08:00
34 changed files with 1693 additions and 288 deletions
+2 -4
View File
@@ -26,8 +26,8 @@ jobs:
nodev: 18
- platform: win
nodev: 18
- platform: win
nodev: 12
# - platform: win
# nodev: 12
steps:
- name: "Checkout codes"
uses: actions/checkout@v3
@@ -49,7 +49,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
file: "dist/*.zip"
delete_file: "dist/*.zip"
tag_name: "v2"
overwrite: true
arm64:
@@ -78,6 +77,5 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
file: "dist/*.zip"
delete_file: "dist/*.zip"
tag_name: "v2"
overwrite: true
+1
View File
@@ -3,6 +3,7 @@ node_modules/
tests/
dyids/
lottery_info/
lottery_dyids/
dist/
.env
*.log
+111
View File
@@ -1,5 +1,116 @@
<!-- markdownlint-disable MD036 MD024-->
# CHANGELOG
## 主要变化(2.8.7)
* 62768dd fix: 修改win脚本
* 101df0a fix: login等待时间过长
* f8829b5 fix: 清理动态检索动态延时
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.8.6)
* 83e19d4 docs: 扫码登陆使用说明
* c238c27 fix:多账号login添加时延进行间隔
* 8addc90 fix:登录跳过执行正常状态的账号
* 288851b feat: 扫码登录获取移动端的CK更新账号,带sid可减小掉号频率
* ddcfcee fix: 移除公共黑名单设置
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.8.5)
* 0024b19 feat: 移除远程设置启用自动更新
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.8.4)
* 9ab605a feat: 新增本地dyids抽奖新信息获取方式 (#311)(#287)
* a83c5ab fix: extend_json undefined
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.8.3)
* 2f2eaab fix: 预约抽奖包月抽奖识别异常 (#288)
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.8.2)
* 3825be4 feat: 查看帐号信息
* 248c78d feat: 快速移除关注模式新增粉丝数限制 (#305)
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.8.1)
* d44981b fix: 随机cookie参数buvid3
* 3bfc93f fix: 目前回复无法正常推送 (#302)
* ef8366b fix: tg推送代理设置出错 (#298)
* a7e31b4 docs: update
* f4f45c5 fix: cookie参数buvid3错误导致专栏获取滞后
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.8.0)
* 2f935bb chore: update env.js
* eec22ff feat: 验证码自动识别
* 909fb83 chore: update qinglong script
* 41b0369 ci: fix pkg.yml
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.7.11)
* 5a3c16d fix: 专栏获取内容不正确,需要排除推荐内容 (#293)
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.7.10)
* 29645bc fixed: 话题搜索功能已失效 #285
* d950a59 fix: is_imitator导致错误评论
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.7.9)
* 3828a0f fix: Cannot read properties of null (#284)
* 67313f4 feat: 专栏里的动态链接识别优化 (#283)
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.7.8)
* ad6af97 feat: 专栏短链接识别 (#263)
* b6c56c5 feat: 取关分区支持设置多分区 (#281)
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.7.7)
* 2426fe2 fix: 动态详情获取接口412频繁 (#279)
* d370fef fix: 获取动态详情出现undefined (#271)
* 00174b0 fix(monitor): L615
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.7.6)
* 881923b fix: 开奖时间和粉丝数判断逻辑 (#253)
* 097e2d6 fix: 筛选掉置顶的评论,与该动态UP的评论 (#252)
* 82d285e fix: 充电专属动态 (#251)
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.7.5)
* 9c9bc18 fix: 查询评论报错 (#250)
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.7.4)
* 0630c89 feat: 新增设置抄热评屏蔽词 (#239)
* 7b9d251 feat: 热评包含发送热评的人的昵称换成自己的昵称 (#239)
* 5ae7801 fix: 带话题正则修改
* 0ab5ec0 feat: 未知错误不重试
* 50c22a4 fix: 账号异常点赞失败 (#247)
* 8ac7466 fix: 未知错误 已赞过 (#249)
* 7f6188d feat: UID保护列表输出调整为debug级
* 2ad128c docs: change LICENSE
* e945be4 feat: 检测docker是否已安装,未安装则预先安装docker
* bfdbc7a fix: /bin/env path error
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
## 主要变化(2.7.3)
* d13c0a5 docs: 添加设置修改说明
* 9615d25 fix: 预约抽奖转发 (#240)
+670 -17
View File
@@ -1,21 +1,674 @@
MIT License
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (c) 2020 shanmite
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Preamble
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
+37 -27
View File
@@ -3,16 +3,19 @@
- [AutoScript](#autoscript)
- [操作步骤](#操作步骤)
- [获取COOKIE](#获取cookie)
- [扫码登陆](#扫码登陆)
- [手动获取](#手动获取)
- [本地运行](#本地运行)
- [可执行文件](#可执行文件)
- [以源码方式运行](#以源码方式运行)
- [Docker](#docker)
- [青龙面板](#青龙面板)
- [防重复转发(可选)](#防重复转发可选)
- [检测中奖](#检测中奖)
- [检测未读信息, 已读未读信息](#检测未读信息-已读未读信息)
- [中奖推送(可选)](#中奖推送可选)
- [中奖推送](#中奖推送)
- [设置说明](#设置说明)
- [评论验证码识别](#评论验证码识别)
- [其他](#其他)
- [Awesome](#awesome)
[Github仓库链接](https://github.com/shanmiteko/LotteryAutoScript)
@@ -53,6 +56,14 @@
### 获取COOKIE
#### 扫码登陆
`env.js`文件填`COOKIE`的对应位置写入`"DedeUserID=你的UID"`即可使用`lottery login`扫码自动获取Cookie
`COOKIE`中包含`DedeUserID=你的UID`的都会被自动替换
#### 手动获取
进入[B站主页](https://www.bilibili.com/)获取Cookie用于登录
Chrome浏览器:
@@ -73,7 +84,7 @@ Chrome浏览器:
.cookie
.split(/\s*;\s*/)
.map(it => it.split('='))
.filter(it => ['DedeUserID','bili_jct', 'SESSDATA'].indexOf(it[0]) > -1)
.filter(it => ['DedeUserID','bili_jct', 'SESSDATA', 'buvid3'].indexOf(it[0]) > -1)
.map(it => it.join('='))
.join('; ')
.split()
@@ -82,7 +93,9 @@ Chrome浏览器:
也可以采用**其他方式获取**所需的Cookie
只需含有 `DedeUserID=...;SESSDATA=...;bili_jct=...` 三项即可
只需含有 `DedeUserID=...;SESSDATA=...;bili_jct=...;buvid3=...` 即可
buvid3亦可不填 使用随机生成值
(分号分割, 不要换行, 顺序随意)
@@ -109,22 +122,21 @@ Chrome浏览器:
4. 在`my_config.js`中自定义设置
5. 在当前目录下**打开终端**运行可执行文件`lottery`(勿直接点击`lottery`)
- windows 可直接点击对应的`*.bat`文件
- unix-like
```sh
## 进入脚本所在目录
## 授予执行权限
$ chmod u+x lottery
## 启动脚本
$ ./lottery start
## 检测中奖
$ ./lottery check
## 清理关注动态
$ ./lottery clear
## 下载最新版本
$ ./lottery update
```
用法: lottery [OPTIONS]
OPTIONS:
start 启动抽奖
check 中奖检查
acount 查看帐号信息
clear 清理动态和关注
update 检查更新
login 扫码登录更新CK
help 帮助信息
```
7. 运行截图
1. 运行截图
![lottery_start](https://raw.githubusercontents.com/shanmiteko/LotteryAutoScript/main/doc/pic/lottery_start.png)
#### 以源码方式运行
@@ -145,14 +157,6 @@ Chrome浏览器:
----------------------------------------
## 防重复转发(可选)
- 脚本将转发过的动态和被过滤的动态都写入`dyids/dyid*.txt`文件中
- 是否点赞
----------------------------------------
## 检测中奖
### 检测未读信息, 已读未读信息
@@ -165,7 +169,7 @@ Chrome浏览器:
关键词有限 可能会有**漏掉**的或**误报**
### 中奖推送(可选)
### 中奖推送
> 填写在env.js内
@@ -204,6 +208,12 @@ Chrome浏览器:
## 设置说明
### 评论验证码识别
[点击跳转](doc/chat_captcha_orc.md)
### 其他
详见[env.example.js](./env.example.js)文件内部注释
详见[my_config.example.js](./my_config.example.js)文件内部注释
+18
View File
@@ -0,0 +1,18 @@
使用此功能前需启动OCR服务
## 拉取镜像
```
docker pull shanmite/ocr_api_server
```
## 启动容器
```
docker run -p 9898:9898 -d ocr_api_server
```
### 非docker启动方式
![ocr server](pic/ocr1.png)
[ocr_api_server](https://github.com/shanmiteko/ocr_api_server)
![start](pic/ocr0.png)
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

+5 -1
View File
@@ -5,11 +5,14 @@ module.exports = Object.freeze({
* - `NOTE` 帐号备注
* - `NUMBER` 表示是第几个账号
* - `CLEAR` 是否启用清理功能
* ## 高级功能
* - `ENABLE_CHAT_CAPTCHA_OCR` 开启评论验证码识别 使用方法见README
* - `ENABLE_MULTIPLE_ACCOUNT` 是否启用多账号
* - `MULTIPLE_ACCOUNT_PARM` 多账号参数(JSON格式)
* - `MULTIPLE_ACCOUNT_PARM` 多账号参数(JSON格式) <不推荐使用
* ## 调试相关
* - `LOTTERY_LOG_LEVEL` 输出日志等级 Error<Warn<Info<Debug 1<2<3<4
* - `NOT_GO_LOTTERY` 关闭抽奖行为
*
* ## 多账号
* 1. 将 ENABLE_MULTIPLE_ACCOUNT 的值改为true
* 2. 将账号信息依次填写于 multiple_account_parm 中, 参考例子类推
@@ -23,6 +26,7 @@ module.exports = Object.freeze({
NUMBER: 1,
CLEAR: true,
ENABLE_CHAT_CAPTCHA_OCR: "",
ENABLE_MULTIPLE_ACCOUNT: false,
MULTIPLE_ACCOUNT_PARM: "",
+15
View File
@@ -0,0 +1,15 @@
const bili = require('./net/bili')
const { log } = require('./utils')
async function account() {
const my_info = await bili.getMyinfo();
const stat = await bili.getStat();
if (my_info && stat) {
log.info("帐号信息", `${my_info.name} Lv${my_info.level} ${my_info.silence ? "已封禁" : "未封禁"} 升级还需${my_info.level_exp.next_exp - my_info.level_exp.current_exp}经验`)
log.info("帐号信息", `当前关注数:${stat.following} 粉丝数:${stat.follower} 动态数量:${stat.dynamic_count}`)
} else {
log.error("帐号信息", "获取失败");
}
}
module.exports = { account }
+21 -13
View File
@@ -6,12 +6,13 @@ const config = require("./data/config");
/**
* 获取关注分区里的uid
* @param {string} partition
* @returns { Promise<number[]> }
*/
async function getFollowList() {
async function getFollowList(partition) {
const
{ clear_partition, clear_white_list, get_partition_wait } = config,
tagid = await bili.checkMyPartition(clear_partition);
{ clear_white_list, get_partition_wait } = config,
tagid = await bili.checkMyPartition(partition);
let rmup = [];
if (typeof tagid === 'undefined') {
log.info('获取关注列表', '未能成功获取关注分区id');
@@ -32,9 +33,9 @@ async function getFollowList() {
* 清理动态和关注
*/
async function clear() {
const { search_wait, clear_white_list, clear_max_day, clear_quick_remove_attention, clear_remove_dynamic, clear_remove_attention, clear_remove_delay, clear_dynamic_type } = config;
const { search_wait, clear_white_list, clear_max_day, clear_quick_remove_attention, clear_quick_remove_attention_fans_number_smallest, clear_remove_dynamic, clear_remove_attention, clear_remove_delay, clear_dynamic_type, clear_partition } = config;
let success = true;
const uid_list = await getFollowList();
const uid_list = (await Promise.all(clear_partition.split(',').map(getFollowList))).flat();
if (!uid_list.length) {
log.info('清理关注', `关注为空`)
} else {
@@ -44,13 +45,17 @@ async function clear() {
log.info('清理关注', '进入只清理关注模式')
/* 专清关注 */
for (const [index, uid] of uid_list.entries()) {
log.info('清理关注', `(${index}) (${uid})`)
/* 取消关注 */
if (await retryfn(3, [false], () => bili.cancelAttention(uid))) {
log.info('清理关注', '成功')
} else {
log.error('清理关注', '失败')
break
const fannumber = await bili.getUserInfo(uid);
log.info('清理关注', `粉丝数${fannumber}`)
if (fannumber !== -1 && fannumber < clear_quick_remove_attention_fans_number_smallest) {
log.info('清理关注', `(${index}) (${uid})`)
/* 取消关注 */
if (await retryfn(3, [false], () => bili.cancelAttention(uid))) {
log.info('清理关注', '成功')
} else {
log.error('清理关注', '失败')
break
}
}
/* 延时 */
await delay(clear_remove_delay);
@@ -82,7 +87,7 @@ async function clear() {
const days_ago = (Now - create_time) / 86400;
if (days_ago > clear_max_day) {
log.info('清理动态', `当前UID保护列表:\n${before_separate.join(',')}\n`)
log.debug('清理动态', `当前UID保护列表:\n${before_separate.join(',')}\n`)
/* 移除动态 */
if (dynamic_id
&& clear_remove_dynamic
@@ -103,6 +108,7 @@ async function clear() {
log.error("清理失败", "出现错误")
break
}
/* 延时 */
await delay(clear_remove_delay);
} else {
@@ -119,6 +125,8 @@ async function clear() {
log.info('清理动态', `此动态类型为${type} != 要清理的动态类型${clear_dynamic_type}`)
}
}
/* 延时 */
await delay(clear_remove_delay);
log.info('清理动态', `${page + 1}页(${allModifyDynamicResArray.length})中的转发动态与关注全部处理成功`)
if (next_offset === '0' || !success) break;
}
+59 -54
View File
@@ -26,7 +26,8 @@ class Monitor extends Searcher {
['UIDs', this.getLotteryInfoByUID.bind(this)],
['TAGs', this.getLotteryInfoByTag.bind(this)],
['Articles', this.getLotteryInfoByArticle.bind(this)],
['APIs', this.getLotteryInfoByAPI.bind(this)]
['APIs', this.getLotteryInfoByAPI.bind(this)],
['TxT', this.getLotteryInfoByTxT.bind(this)]
]);
}
/**
@@ -62,14 +63,15 @@ class Monitor extends Searcher {
event_bus.emit('Turn_off_the_Monitor', '关注出错')
break;
case 3001:
event_bus.emit('Turn_off_the_Monitor', '分区移动出错')
event_bus.emit('Turn_off_the_Monitor', '分区移动出错 可于设置处关闭移动分区')
break;
case 2004:
log.warn('账号异常', `UID(${global_var.get('myUID')})异常号只会对部分UP出现关注异常`)
case 4005:
log.warn(`账号异常${status}`, `UID(${global_var.get('myUID')})异常号只会对部分UP出现异常`)
if (!config.is_exception) {
await sendNotify(
'[动态抽奖]账号异常通知',
`UID: ${global_var.get('myUID')}\n异常号只会对部分UP出现关注异常\n可在设置中令is_exception为true关闭此推送\n${log._cache.filter(it => /Error|\s抽奖信息\]/.test(it)).join('\n')}`
`[动态抽奖]账号异常${status}通知`,
`UID: ${global_var.get('myUID')}\n异常号只会对部分UP出现异常\n可在设置中令is_exception为true关闭此推送\n${log._cache.filter(it => /Error|\s抽奖信息\]/.test(it)).join('\n')}`
)
}
config.is_exception = true;
@@ -90,12 +92,6 @@ class Monitor extends Searcher {
case 5001:
event_bus.emit('Turn_off_the_Monitor', '转发失败')
break
case 6001:
event_bus.emit('Turn_off_the_Monitor', '获取开奖时间失败')
break
case 7001:
event_bus.emit('Turn_off_the_Monitor', '获取关注数失败')
break
default:
event_bus.emit('Turn_off_the_Monitor', `??? 未知错误: ${status}`)
break;
@@ -134,9 +130,16 @@ class Monitor extends Searcher {
if (lottery.isOfficialLottery) {
let { ts } = await bili.getLotteryNotice(lottery.dyid);
const ts_10 = Date.now() / 1000;
if (ts < 0) {
status = 6001
break;
if (ts === -1) {
log.warn('过滤', '无法判断开奖时间')
await delay(filter_wait)
continue
}
if (ts === -9999) {
log.info('过滤', '已撤销抽奖')
d_storage.updateDyid(lottery.dyid)
await delay(filter_wait)
continue
}
if (ts < ts_10) {
log.info('过滤', '已过开奖时间')
@@ -154,9 +157,10 @@ class Monitor extends Searcher {
const { minfollower } = config
if (minfollower > 0) {
const followerNum = await bili.getUserInfo(lottery.uid[0]);
if (followerNum < 0) {
status = 7001
break;
if (followerNum === -1) {
log.warn('过滤', `粉丝数(${followerNum})获取失败`)
await delay(filter_wait)
continue
}
if (followerNum < minfollower) {
log.info('过滤', `粉丝数(${followerNum})小于指定数量`)
@@ -197,6 +201,7 @@ class Monitor extends Searcher {
case 4001:
case 4002:
case 4003:
case 4004:
case 5002:
case 5003:
case 5004:
@@ -205,6 +210,9 @@ class Monitor extends Searcher {
case 2004:
is_exception = 2004
break;
case 4005:
is_exception = 4005
break;
case 2005:
is_outof_maxfollow = 2005
break;
@@ -215,6 +223,8 @@ class Monitor extends Searcher {
case 5001:
is_shutdown = true
break;
default:
break;
}
if (is_shutdown) break
@@ -271,7 +281,6 @@ class Monitor extends Searcher {
model, chatmodel, chat: chats, relay: relays,
block_dynamic_type, max_create_time, is_imitator,
only_followed, at_users, blockword, blacklist,
use_public_blacklist
} = config,
now_ts = Date.now() / 1000;
@@ -378,7 +387,7 @@ class Monitor extends Searcher {
: [m_uid, mIsFollowed],
description = des.split(/\/\/@.*?:/)[0],
needAt = /(?:@|艾特)[^@|(艾特)]*?好友/.test(description),
needTopic = [...new Set(description.match(/(?<=[带加](?:话题|tag).*)#.+?#|(?<=[带加])#.+?#(?=话题|tag)/ig) || [])].join(' '),
needTopic = [...new Set(description.match(/(?<=[带加]上?(?:话题|tag).*)#.+?#|(?<=[带加])上?#.+?#(?=话题|tag)/ig) || [])].join(' '),
isRelayDynamic = type === 1,
has_key_words = key_words.every(it => new RegExp(it).test(description)),
isBlock = blockword.length && new RegExp(blockword.join('|')).test(description + reserve_lottery_text),
@@ -387,28 +396,14 @@ class Monitor extends Searcher {
|| (hasOfficialLottery && model[0] === '1')
|| (!hasOfficialLottery && model[1] === '1' && has_key_words),
isSendChat =
(is_imitator && lottery_info_type === 'uid' && chatmodel !== '00')
|| (hasOfficialLottery && chatmodel[0] === '1')
(hasOfficialLottery && chatmodel[0] === '1')
|| (!hasOfficialLottery && chatmodel[1] === '1'),
{ blacklist: remote_blacklist } = use_public_blacklist === false
? { blacklist: "" }
: global_var.get("remoteconfig"),
/**
* 获取黑名单并去重合并
* @type {string[]}
*/
new_blacklist = remote_blacklist
? [
...new Set([...blacklist.split(','),
...remote_blacklist.split(',')])
]
: blacklist.split(','),
keys = [dyid, m_uid, ori_uid];
log.debug("筛选动态", { real_uid, mIsFollowed, oriIsFollowed, realIsFollowed, needAt, needTopic, type, isRelayDynamic, key_words, has_key_words, blockword, isBlock, isLottery, isSendChat })
if (
new_blacklist.some(id => keys.some(key => {
blacklist.split(',').some(id => keys.some(key => {
if (key + '' === id) {
log.info("筛选动态", `黑名单匹配(${id})(https://t.bilibili.com/${dyid})`)
return true
@@ -463,7 +458,6 @@ class Monitor extends Searcher {
}
if (isLottery) {
const { uname_map = {} } = global_var.get("remoteconfig")
let onelotteryinfo = {};
onelotteryinfo.isOfficialLottery = hasOfficialLottery;
@@ -479,8 +473,8 @@ class Monitor extends Searcher {
let
/**转发评语 */
RandomStr = getRandomOne(relays)
.replace(/\$\{uname\}/g, uname_map[real_uid] || uname),
RandomStr = (getRandomOne(relays) || "!!!")
.replace(/\$\{uname\}/g, uname),
/**控制字段 */
new_ctrl = [];
@@ -532,8 +526,8 @@ class Monitor extends Searcher {
/* 是否评论 */
if (isSendChat) {
onelotteryinfo.rid = rid
onelotteryinfo.chat = getRandomOne(chats)
.replace(/\$\{uname\}/g, uname_map[real_uid] || uname)
onelotteryinfo.chat = (getRandomOne(chats) || "!!!")
.replace(/\$\{uname\}/g, uname)
}
alllotteryinfo.push(onelotteryinfo);
@@ -569,6 +563,8 @@ class Monitor extends Searcher {
* - 点赞 未知错误 4001
* - 点赞 点赞异常 4002
* - 点赞 点赞频繁 4003
* - 点赞 已赞过 4004
* - 点赞 账号异常,点赞失败 4005
* - 转发 未知错误 5001
* - 转发 该动态不能转发分享 5002
* - 转发 请求数据发生错误,请刷新或稍后重试 5003
@@ -584,18 +580,25 @@ class Monitor extends Searcher {
let
status = 0,
{ uid, dyid, chat_type, rid, relay_chat, ctrl, chat } = option,
{ check_if_duplicated, is_copy_chat, is_repost_then_chat, is_not_create_partition } = config;
{ check_if_duplicated, is_copy_chat, copy_blockword, is_repost_then_chat, is_not_create_partition } = config;
/* 评论 */
if (rid && chat_type) {
if (is_copy_chat) {
chat = getRandomOne(await bili.getChat(rid, chat_type)) || "!!!"
const copy_chat = getRandomOne(
(await bili.getChat(rid, chat_type))
.filter(it => !(new RegExp(copy_blockword.join('|')).test(it[1])))
) || [";;;;;;;;;", chat || "!!!"];
chat = copy_chat[1]
.replace(
new RegExp(copy_chat[0], 'g'),
global_var.get("myUNAME") || '')
}
status = await retryfn(
6,
[1, 4],
() => bili.sendChat(
[4],
() => bili.sendChatWithOcr(
rid,
is_repost_then_chat ? relay_chat.split('//')[0] : chat,
chat_type
@@ -604,7 +607,7 @@ class Monitor extends Searcher {
if (status === 8 ||
status === 9) {
status = await bili.sendChat(
status = await bili.sendChatWithOcr(
rid,
"[doge][doge][doge][doge][doge]",
chat_type
@@ -646,7 +649,7 @@ class Monitor extends Searcher {
if (!check_if_duplicated || check_if_duplicated === 3) {
status = await retryfn(
5,
[1, 2, 3],
[3],
() => bili.autolike(dyid)
)
@@ -657,15 +660,17 @@ class Monitor extends Searcher {
}
/* 转发 */
status = await retryfn(
5,
[1, 3, 4],
() => bili.autoRelay(global_var.get("myUID"), dyid, relay_chat, ctrl)
)
if (dyid) {
status = await retryfn(
5,
[3, 4],
() => bili.autoRelay(global_var.get("myUID"), dyid, relay_chat, ctrl)
)
if (status) {
log.warn("抽奖信息", `dyid: ${dyid}`)
return 5000 + status
if (status) {
log.warn("抽奖信息", `dyid: ${dyid}`)
return 5000 + status
}
}
return status
+111 -14
View File
@@ -62,7 +62,7 @@ function parseDynamicCard(dynamic_detail_card) {
const { strToJson } = utils;
/**临时储存单个动态中的信息 */
let obj = {};
const { desc, card, extension, extend_json, display = {} } = dynamic_detail_card
const { desc, card, extension, extend_json = "{}", display = {} } = dynamic_detail_card
, { is_liked = 1, user_profile = {} } = desc
, { info = {} } = user_profile
, cardToJson = strToJson(card)
@@ -103,21 +103,34 @@ function parseDynamicCard(dynamic_detail_card) {
obj.reserve_lottery_text = text;
}
}
if (JSON.stringify(add_on_card_info).match(/充电专属抽奖/)) {
if (extendjsonToJson[""]) {
let r = extendjsonToJson[""].reserve || {};
let { reserve_id, reserve_lottery } = r;
if (reserve_lottery === 1) {
obj.reserve_id = reserve_id + "";
obj.reserve_lottery_text = "信息丢失";
}
}
if (extend_json.match(/"":\{"lottery/)) {
obj.is_charge_lottery = true
}
/* 是否有官方抽奖 */
obj.hasOfficialLottery = extension && extension.lott && true;
/* 转发者的描述 纯文字内容 图片动态描述 后两个分别是视频动态的描述和视频本身的描述*/
obj.description =
(item && (item.content || '' + item.description || ''))
|| (cardToJson.dynamic || '' + cardToJson.desc || '')
(item && ((item.content || '') + (item.description || '')))
|| (
(cardToJson.dynamic || '')
+ (cardToJson.desc || '')
+ (cardToJson.vest && cardToJson.vest.content || '')
)
|| '';
/* 转发 */
if (obj.type === 1) {
const { origin_extension, origin } = cardToJson
const { origin_extension, origin, origin_extend_json = "{}" } = cardToJson
, originToJson = strToJson(origin)
, { add_on_card_info = [] } = display.origin || {}
, originExtendjsonToJson = strToJson(origin_extend_json)
, { user, item } = originToJson;
/* 源动态的ts10 */
obj.origin_create_time = desc.origin.timestamp;
@@ -146,7 +159,15 @@ function parseDynamicCard(dynamic_detail_card) {
obj.origin_reserve_lottery_text = text;
}
}
if (JSON.stringify(add_on_card_info).match(/充电专属抽奖/)) {
if (originExtendjsonToJson[""]) {
let r = originExtendjsonToJson[""].reserve || {};
let { reserve_id, reserve_lottery } = r;
if (reserve_lottery === 1) {
obj.origin_reserve_id = reserve_id + "";
obj.origin_reserve_lottery_text = "信息丢失";
}
}
if (origin_extend_json.match(/"":\{"lottery/)) {
obj.origin_is_charge_lottery = true
}
/* 是否有官方抽奖 */
@@ -182,6 +203,12 @@ function modifyDynamicRes(res) {
log.warn('处理动态数据', '未找到任何动态信息')
}
if (typeof has_more === "undefined"
&& typeof offset === "undefined") {
log.error('处理动态数据', '该功能已失效');
return null;
}
const
/**
* 字符串offset防止损失精度
@@ -349,6 +376,8 @@ class Searcher {
* @returns {Promise<LotteryInfo[] | null>}
*/
async getLotteryInfoByTag(tag_name) {
log.info('获取动态', `开始获取带话题#${tag_name}#的动态信息`);
const
tag_id = await bili.getTagIDByTagName(tag_name),
hotdy = await bili.getHotDynamicInfoByTagID(tag_id),
@@ -356,7 +385,6 @@ class Searcher {
if (modDR === null) return null;
log.info('获取动态', `开始获取带话题#${tag_name}#的动态信息`);
log.info('获取动态', '成功获取热门动态');
/**
@@ -421,13 +449,16 @@ class Searcher {
continue
}
const
content = await bili.getOneArticleByCv(id),
dyids = content.match(/(?<=t.bilibili.com\/)[0-9]+/g) || [],
dyids_set = [...new Set(dyids)],
content = (await bili.getOneArticleByCv(id) || "").split("推荐文章")[0],
dyids = content.match(/[0-9]{18}/g) || [],
short_ids = content.match(/(?<=b23.tv\/)[a-zA-Z0-9]{7}/g) || [],
short_id_set = [...new Set(short_ids)],
short_ids_to_dyids = await Promise.all(short_id_set.map(bili.shortDynamicIdToDyid)),
dyid_set = [...new Set([...dyids, ...short_ids_to_dyids])],
/**判断此专栏是否查看过的权重 */
weight = dyids_set.length / 2;
weight = dyid_set.length / 2;
let { length } = dyids_set,
let { length } = dyid_set,
/**初始权重 */
_weight = 0,
/**单个专栏中的dyid */
@@ -435,8 +466,9 @@ class Searcher {
log.info('获取动态', `提取专栏(${id})中提及的dyid(${length})`)
/**遍历某专栏中的dyids */
for (const dyid of dyids_set) {
if (dyid.length === utils.dyid_length) {
for (const dyid of dyid_set) {
if (typeof dyid === "string"
&& dyid.length === utils.dyid_length) {
log.info('获取动态', `查看专栏中所提及动态(${dyid}) (${length--})`)
const card = await bili.getOneDynamicByDyid(dyid)
@@ -573,6 +605,71 @@ class Searcher {
}
});
}
/**
* 从本地文件中获取抽奖信息
* @param {string} txt
* @returns {Promise<LotteryInfo[] | null>}
*/
async getLotteryInfoByTxT(txt) {
log.info('获取动态', `开始获取${utils.lottery_dyids}`);
const dyids = await utils.getLocalLotteryTxt(txt);
let
length = dyids.length,
dyinfos = [];
for (const dyid of dyids) {
if (typeof dyid === "string"
&& dyid.length === utils.dyid_length) {
log.info('获取动态', `查看Txt中所提及动态(${dyid}) (${length--})`)
const card = await bili.getOneDynamicByDyid(dyid)
if (card) {
await utils.delay(get_dynamic_detail_wait)
const parsed_card = parseDynamicCard(card)
, { is_liked } = parsed_card;
if (
((!check_if_duplicated || check_if_duplicated >= 2)
&& is_liked)
|| ((check_if_duplicated >= 1)
&& await d_storage.searchDyid(dyid))
) {
log.info('获取动态', `动态(${dyid})已转发过`)
continue
}
dyinfos.push(parsed_card);
}
} else {
log.warn('获取动态', `动态(${dyid})无效 (${length--})`)
}
}
const fomatdata = dyinfos.map(o => {
return {
lottery_info_type: 'txt',
create_time: o.create_time,
is_liked: o.is_liked,
uids: [o.uid, o.origin_uid],
uname: o.uname,
ctrl: o.ctrl,
dyid: o.dynamic_id,
reserve_id: o.reserve_id,
reserve_lottery_text: o.reserve_lottery_text,
is_charge_lottery: o.is_charge_lottery,
rid: o.rid_str,
chat_type: o.chat_type,
des: o.description,
type: o.type,
hasOfficialLottery: o.hasOfficialLottery
};
})
log.info('获取动态', `成功获取txt信息`);
return fomatdata
}
}
module.exports = { Searcher, parseDynamicCard };
+21 -8
View File
@@ -47,12 +47,19 @@ const config = {
*/
APIs: [],
/**
* lottery_dyids目录下抽奖动态文件名(如dyids.txt)
* 一行一个dyids
*/
TxT: [],
/**
* 抽奖参与顺序组合
* * 0 - UIDs
* * 1 - TAGs
* * 2 - Articles
* * 3 - APIs
* * 4 - TxT
* @example
* [3,2,1,0]
* [1,2,1,2,1]
@@ -298,12 +305,6 @@ const config = {
*/
blacklist: '',
/**
* - 自动同步 https://gitee.com/shanmite/lottery-notice/raw/master/notice.json
* - 使用公共黑名单
*/
use_public_blacklist: true,
/**
* 屏蔽词
*/
@@ -336,6 +337,11 @@ const config = {
*/
is_copy_chat: false,
/**
* 热评屏蔽词
*/
copy_blockword: [],
/**
* - 抽奖UP用户分组id(网页端点击分区后地址栏中的tagid)
* - 自动获取
@@ -348,7 +354,7 @@ const config = {
is_not_create_partition: false,
/**
* 是否关注异常
* 是否异常
*/
is_exception: false,
@@ -403,6 +409,13 @@ const config = {
*/
clear_quick_remove_attention: false,
/**
* - 快速移除关注
* - 不加判断只去除关注
* - 移除粉丝数小于指定数量的
*/
clear_quick_remove_attention_fans_number_smallest: Infinity,
/**
* 是否移除动态
*/
@@ -414,7 +427,7 @@ const config = {
clear_remove_attention: true,
/**
* 清除动态延时(毫秒)
* 清除延时(毫秒)
*/
clear_remove_delay: 8000,
+21 -5
View File
@@ -1,4 +1,4 @@
const { getRemoteConfig, createDir, createFile, dyids_dir } = require("../utils");
const { getRandomOne, createDir, createFile, dyids_dir } = require("../utils");
const config = require("../data/config");
let global_var = {
@@ -25,11 +25,28 @@ let global_var = {
[0, "UIDs"],
[1, "TAGs"],
[2, "Articles"],
[3, "APIs"]]);
[3, "APIs"],
[4, "TxT"],
]);
config.updata(num);
this.set('cookie', cookie + ';buvid3=AAAAAAAA-BBBB-CCCC-DDDD-DDDDDDDDDDDDDDDDDinfoc');
if (!/buvid3/.test(cookie)) {
const charset = "0123456789ABCDEF".split("");
const buvid3 = "x".repeat(8).split("").map(() => getRandomOne(charset)).join("")
+ "-"
+ "x".repeat(4).split("").map(() => getRandomOne(charset)).join("")
+ "-"
+ "x".repeat(4).split("").map(() => getRandomOne(charset)).join("")
+ "-"
+ "x".repeat(4).split("").map(() => getRandomOne(charset)).join("")
+ "-"
+ "x".repeat(17).split("").map(() => getRandomOne(charset)).join("")
+ "infoc";
this.set('cookie', cookie + ";" + buvid3);
} else {
this.set('cookie', cookie);
}
cookie.split(/\s*;\s*/).forEach(item => {
const _item = item.split('=');
@@ -45,7 +62,6 @@ let global_var = {
.map(lottery_option => config[lottery_option].map(it => [lottery_option, it]))
.flat()
);
this.set('remoteconfig', await getRemoteConfig());
}
await createDir('dyids');
await createFile(dyids_dir, num < 2 ? 'dyid.txt' : `dyid${num}.txt`, '', 'a')
@@ -53,4 +69,4 @@ let global_var = {
};
module.exports = global_var;
module.exports = global_var;
+2 -2
View File
@@ -495,8 +495,8 @@ function tgBotNotify(text, desp) {
}
if (TG_PROXY_HOST && TG_PROXY_PORT) {
options.proxy = {
hostname: TG_PROXY_HOST,
port: TG_PROXY_PORT * 1
url: "http://" + TG_PROXY_HOST + ":" + TG_PROXY_PORT,
auth_headers: []
}
}
send(options)
+3 -1
View File
@@ -1,6 +1,8 @@
const { login } = require('./login');
const { isMe } = require('./check');
const { clear } = require('./clear');
const { start } = require('./lottery');
const { account } = require("./account");
const global_var = require('./data/global_var')
const bili = require('./net/bili')
const { log } = require('./utils')
@@ -23,4 +25,4 @@ async function checkCookie(num) {
}
module.exports = { start, isMe, clear, checkCookie }
module.exports = { login, start, isMe, clear, checkCookie, account }
+58
View File
@@ -0,0 +1,58 @@
const { readFileSync, writeFileSync } = require('fs');
const { log, env_file } = require("./utils");
/**
* 扫码登陆
* @param {string} num
*/
async function login(num) {
try {
const { pcLogin } = require('@catlair/blogin');
const loginInfo = await pcLogin();
if (!loginInfo) {
log.error("扫码登陆", "失败/取消");
return;
}
log.info("扫码登陆", "登录成功");
JSON.stringify(loginInfo, null, 2);
const uid = `${loginInfo.mid}`;
const cookie = `${loginInfo.cookie}`;
log.info("账号UID", uid);
log.info("Cookie", cookie);
if (replaceCookie(env_file, uid, cookie)) {
log.info("扫码登陆", `账号${num}已进行cookie自动更新,如未能生效请手动复制在env.js内替换。路径:${env_file}`);
}
} catch (error) {
log.error(error);
}
}
/**
* 正则检索uid更新cookie
* @param {string} filePath
* @param {string} uid
* @param {string} oldCK
*/
function replaceCookie(filePath, uid, oldCK) {
try {
const content = readFileSync(filePath, 'utf-8');
const DedeUserID = `DedeUserID=${uid}`;
const reg = new RegExp(`['"]?COOKIE['"]?:\\s?['"](.*${DedeUserID}.*)['"]`, 'g');
const newCK = content.replaceAll(reg, substring => {
let quote = substring.at(0) || '';
/['"]/.test(quote) || (quote = '');
const quote2 = oldCK.includes("'")
? '"'
: substring.match(/^['"]?COOKIE['"]?:\s?(['"])/)?.[1] || '"';
return `${quote}COOKIE${quote}: ${quote2}${oldCK}${quote2}`;
});
if (content === newCK) return false;
writeFileSync(filePath, newCK);
return true;
} catch (error) {
log.error("扫码登陆", error);
}
return false;
}
module.exports = { login }
+8 -1
View File
@@ -5,7 +5,12 @@ module.exports = Object.freeze({
DYNAMIC_REPOST_SHARE: 'https://api.vc.bilibili.com/dynamic_repost/v1/dynamic_repost/share',
DYNAMIC_SVR_CREATE_DRAW: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create_draw',
DYNAMIC_SVR_CREATE: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V2: 'https://api.vc.bilibili.com/dynamic_svr/v2/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V3: 'https://api.vc.bilibili.com/dynamic_svr/v3/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V4: 'https://api.vc.bilibili.com/dynamic_svr/v4/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V5: 'https://api.vc.bilibili.com/dynamic_svr/v5/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V6: 'https://api.vc.bilibili.com/dynamic_svr/v6/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V7: 'https://api.vc.bilibili.com/dynamic_svr/v7/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_RM_DYNAMIC: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/rm_dynamic',
DYNAMIC_SVR_SPACE_HISTORY: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/space_history',
FEED_GET_ATTENTION_LIST: 'https://api.vc.bilibili.com/feed/v1/feed/get_attention_list',
@@ -27,6 +32,7 @@ module.exports = Object.freeze({
SESSION_SVR_GET_SESSIONS: 'https://api.vc.bilibili.com/session_svr/v1/session_svr/get_sessions',
SESSION_SVR_SINGLE_UNREAD: 'https://api.vc.bilibili.com/session_svr/v1/session_svr/single_unread',
SESSION_SVR_UPDATE_ACK: 'https://api.vc.bilibili.com/session_svr/v1/session_svr/update_ack',
SHORTLINK: 'https://b23.tv/{{short_id}}',
SPACE_MYINFO: 'https://api.bilibili.com/x/space/myinfo',
TAG_INFO: 'https://api.bilibili.com/x/tag/info',
TOP_FEED_RCMD: "https://api.bilibili.com/x/web-interface/index/top/feed/rcmd",
@@ -35,5 +41,6 @@ module.exports = Object.freeze({
TOPIC_SVR_TOPIC_NEW: 'https://api.vc.bilibili.com/topic_svr/v1/topic_svr/topic_new',
V2_REPLAY: "https://api.bilibili.com/x/v2/reply",
WEB_INTERFACE_CARD: 'https://api.bilibili.com/x/web-interface/card',
WEB_INTERFACE_NAV_STAT: "https://api.bilibili.com/x/web-interface/nav/stat",
WEB_INTERFACE_SEARCH_TYPE: 'https://api.bilibili.com/x/web-interface/search/type',
})
+213 -49
View File
@@ -1,5 +1,5 @@
const GlobalVar = require('../data/global_var');
const { strToJson, log } = require('../utils');
const { strToJson, log, ocr, hasEnv } = require('../utils');
const { send } = require('./http');
const API = require('./api.bili');
@@ -117,7 +117,7 @@ function post({ url, config, contents, query }) {
config,
headers: {
"accept": 'application/json, text/plain, */*',
"content-type": 'application/x-www-form-urlencoded; charset=utf-8',
"content-type": 'application/x-www-form-urlencoded; charset=UTF-8',
"cookie": GlobalVar.get("cookie")
},
query,
@@ -134,7 +134,7 @@ function post({ url, config, contents, query }) {
const bili_client = {
/**
* 判断是否成功登录
* @returns {Promise<boolean>}
* @returns {Promise<Object?>}
*/
async getMyinfo() {
const
@@ -143,9 +143,26 @@ const bili_client = {
}),
res = strToJson(responseText);
if (res.code === 0) {
return true;
GlobalVar.set("myUNAME", res.data.name)
return res.data;
} else {
return false;
return null;
}
},
/**
* 帐号统计
* @returns {Promise<Object?>}
*/
async getStat() {
const
responseText = await get({
url: API.WEB_INTERFACE_NAV_STAT
}),
res = strToJson(responseText);
if (res.code === 0) {
return res.data;
} else {
return null;
}
},
/**
@@ -217,7 +234,9 @@ const bili_client = {
items = data.items || [];
log.info('获取一页回复', `成功(${items.length})`);
return items
.filter(it => it.item.type === 'reply')
.filter(it => it.item !== undefined
&& it.user !== undefined
&& it.reply_time !== undefined)
.map(it => {
return {
nickname: it.user.nickname,
@@ -377,31 +396,90 @@ const bili_client = {
return null;
}
},
/**
* @param {string} short_id
* @returns {Promise<string>}
*/
async shortDynamicIdToDyid(short_id) {
return get({
url: API.SHORTLINK.replace('{{short_id}}', short_id),
config: {
redirect: false,
}
}).then(a => {
const dyid = (a.match(/[0-9]{18}/) || [])[0];
log.info("短连接转换", `${short_id} -> ${dyid}`)
return dyid
})
},
_getOneDynamicByDyid: new Line('获取一个动态的细节', [
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V2,
config: { retry: false },
query: {
dynamic_id
}
}),
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V3,
config: { retry: false },
query: {
dynamic_id
}
}),
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V4,
config: { retry: false },
query: {
dynamic_id
}
}),
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V5,
config: { retry: false },
query: {
dynamic_id
}
}),
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V6,
config: { retry: false },
query: {
dynamic_id
}
}),
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V7,
config: { retry: false },
query: {
dynamic_id
}
}),
], responseText => {
const
res = strToJson(responseText),
{ code, data } = res,
{ card } = data || {};
switch (code) {
case 0:
if (card) {
return [false, card, `ok`];
} else {
return [false, undefined, `动态不存在`];
}
case 500207:
return [false, undefined, `该动态为包月充电专属可以给UP主充电后观看`];
default:
return [true, undefined, `获取动态数据出错:\n${responseText}`]
}
}),
/**
* 获取一个动态的细节
* @param {string} dynamic_id
* @return {Promise<JSON>} 失败返回undefined
*/
async getOneDynamicByDyid(dynamic_id) {
const
responseText = await get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL,
query: {
dynamic_id
}
}),
{ code, data } = strToJson(responseText),
{ card } = data || {};
if (code !== 0) {
log.error('获取一个动态的细节', `获取动态(${dynamic_id})数据出错:\n${responseText}`);
return;
}
if (!card) {
log.warn('获取一个动态的细节', `动态(${dynamic_id})不存在`);
return;
}
log.info('获取一个动态的细节', `动态id(${dynamic_id})`);
return card;
return this._getOneDynamicByDyid.run(dynamic_id)
},
/**
* 获取一组动态的信息
@@ -571,7 +649,7 @@ const bili_client = {
if (res.code === 0) {
return [false, res.data.follower, 'ok'];
} else {
return [true, 1, `出错 可能是访问过频繁\n${responseText}`]
return [true, -1, `出错 可能是访问过频繁\n${responseText}`]
}
}),
/**
@@ -587,7 +665,7 @@ const bili_client = {
* @param {string} dyid
* 动态id
* @typedef LotteryNotice
* @property {number | -1} ts
* @property {number} ts
* @returns {Promise<LotteryNotice>} 开奖时间
*/
async getLotteryNotice(dyid) {
@@ -599,15 +677,21 @@ const bili_client = {
}
}),
res = strToJson(responseText);
if (res.code === 0) {
return {
ts: res.data.lottery_time
};
} else {
log.error('获取开奖信息', `失败\n${responseText}`);
return {
ts: -1
};
switch (res.code) {
case 0:
return {
ts: res.data.lottery_time
};
case -9999:
log.warn('获取开奖信息', `${dyid}已撤销抽奖`);
return {
ts: -9999
};
default:
log.error('获取开奖信息', `${dyid}失败\n${responseText}`);
return {
ts: -1
};
}
},
_autoAttention: new Line('自动关注', [
@@ -733,9 +817,11 @@ const bili_client = {
* @param {string} dyid
* @returns {Promise<number>}
* - 成功 0
* - 未知错误 1
* - 点赞异常 2
* - 点赞频繁 3
* - 未知错误 1
* - 点赞异常 2
* - 点赞频繁 3
* - 已赞过 4
* - 账号异常,点赞失败 5
*/
async autolike(dyid) {
const
@@ -759,6 +845,12 @@ const bili_client = {
case 1000001:
log.warn('自动点赞', '点赞频繁');
return 3;
case 65006:
log.warn('自动点赞', '已赞过');
return 4;
case 4128014:
log.warn('自动点赞', '账号异常,点赞失败');
return 5;
default:
log.error('自动点赞', `未知错误\n${responseText}`);
return 1;
@@ -819,7 +911,7 @@ const bili_client = {
},
/**
* 预约抽奖
* @param {number} reserve_id
* @param {string} reserve_id
* @returns
*/
async reserve_lottery(reserve_id) {
@@ -976,15 +1068,16 @@ const bili_client = {
* cid_str
* @param {string} msg
* @param {number} type
* @param {string} code
* 1(视频)
* 11(有图)
* 17(无图)
* @returns {Promise<number>}
* @returns {Promise<number|string>}
* - 成功 0
* - 未知错误 1
* - 原动态已删除 2
* - 评论区已关闭 3
* - 需要输入验证码 4
* - 需要输入验证码 4 -> url
* - 已被对方拉入黑名单 5
* - 黑名单用户无法互动 6
* - UP主已关闭评论区 7
@@ -992,8 +1085,9 @@ const bili_client = {
* - 重复评论 9
* - 帐号未登录 10
* - 关注UP主7天以上的人可发评论 11
* - 验证码错误 12
*/
async sendChat(rid, msg, type) {
async sendChat(rid, msg, type, code) {
const
responseText = await post({
url: API.REPLY_ADD,
@@ -1001,6 +1095,7 @@ const bili_client = {
oid: rid,
type: type,
message: msg,
code,
csrf: GlobalVar.get("csrf")
}
}),
@@ -1017,7 +1112,7 @@ const bili_client = {
return 3;
case 12015:
log.error('自动评论', '需要输入验证码');
return 4;
return res.data.url;
case 12035:
log.error('自动评论', `已被对方拉入黑名单`);
return 5;
@@ -1039,16 +1134,82 @@ const bili_client = {
case 12078:
log.error('自动评论', '关注UP主7天以上的人可发评论');
return 11;
case 12073:
log.error('自动评论', '验证码错误');
return 12;
default:
log.error('自动评论', `未知错误\n${responseText}`);
return 1;
}
},
/**
* 发送评论 自动识别验证码
* @param {string} rid
* cid_str
* @param {string} msg
* @param {number} type
* 1(视频)
* 11(有图)
* 17(无图)
* @returns {Promise<number>}
* - 成功 0
* - 未知错误 1
* - 原动态已删除 2
* - 评论区已关闭 3
* - 需要输入验证码 4 -> url
* - 已被对方拉入黑名单 5
* - 黑名单用户无法互动 6
* - UP主已关闭评论区 7
* - 评论内容包含敏感信息 8
* - 重复评论 9
* - 帐号未登录 10
* - 关注UP主7天以上的人可发评论 11
* - 验证码错误 12
*/
async sendChatWithOcr(rid, msg, type) {
let need_captcha = false;
let url = "";
let status = 0;
do {
if (need_captcha) {
const code = await ocr(url);
if (code) {
log.info("验证码识别", `${url} -> ${code}`);
status = await bili_client.sendChat(
rid,
msg,
type,
code
);
if (status === 0) {
need_captcha = false
} else if (status === 12) {
need_captcha = true
} else {
need_captcha = false
}
}
} else {
url = await bili_client.sendChat(
rid,
msg,
type
)
if (typeof url === "string"
&& hasEnv("ENABLE_CHAT_CAPTCHA_OCR")) {
need_captcha = true
} else {
status = url
}
}
} while (need_captcha);
return status;
},
/**
* 查询评论
* @param {*} rid
* @param {*} type
* @returns {Promise<Array<string>>}
* @returns {Promise<Array<[string,string]>>} [[uname,chat],]
*/
async getChat(rid, type) {
const
@@ -1064,7 +1225,10 @@ const bili_client = {
case 0:
log.info('查询评论', `成功`);
try {
return res.data.replies.map(it => it.content.message);
const upmid = res.data.upper.mid;
return res.data.replies
.filter(it => it.mid !== upmid)
.map(it => [it.member.uname, it.content.message]);
} catch (_) {
return []
}
@@ -1091,7 +1255,7 @@ const bili_client = {
if (res.code === 0) {
const data = res.data.filter((it) => it.name === name);
if (data.length) {
log.info('获取分区id', '成功');
log.info('获取分区id', `成功 ${name}`);
tagid = data[0].tagid;
} else {
log.warn('获取分区id', `失败 无指定分区名${name}`);
@@ -1158,10 +1322,10 @@ const bili_client = {
res.data.forEach(d => {
uids.push(d.mid);
});
log.info(`获取分组${tagid}`, `成功获取取关分区列表${n}`);
log.info(`获取分组id${tagid}`, `成功获取取关分区列表${n}`);
return uids;
} else {
log.error(`获取分组${tagid}`, `获取取关分区列表失败\n${responseText}`);
log.error(`获取分组id${tagid}`, `获取取关分区列表失败\n${responseText}`);
return uids;
}
}
+18 -5
View File
@@ -20,12 +20,16 @@
* @property {boolean} [redirect] 是否重定向
* @property {number} [retry_times] 重试次数
*
* @typedef ProxyConfig
* @property {string} url https?://{IP}:{PORT}
* @property {[[string, string]]} auth_headers [[k,v],[k,v]]
*
* @typedef {object} RequestOptions Http请求选项
* @property {string} [method] 请求方法
* @property {string} url 完整链接
* @property {boolean} [stream] 是否流式数据
* @property {RequestConfig} [config] 设置
* @property {string} [proxy] HTTP代理 IP:PORT
* @property {ProxyConfig} [proxy] HTTP代理 IP:PORT
* @property {Object.<string, string|number>} [query] 查询选项
* @property {Object.<string, string|number> | string} [contents] 内容
* @property {HttpHeaders} [headers] 请求头
@@ -34,7 +38,9 @@
*/
const { request: http_request } = require('http');
const { HttpProxyAgent } = require('http-proxy-agent');
const { request: https_request } = require('https');
const { HttpsProxyAgent } = require('https-proxy-agent');
const { stringify } = require('querystring');
/**默认编码 */
@@ -64,7 +70,10 @@ function send(detail) {
const { timeout, wait, retry, redirect, retry_times } = config;
const thisURL = new URL(url)
, content = formatContents(headers["content-type"], contents)
, request = (thisURL.protocol === 'https:') && !proxy ? https_request : http_request;
, request = (thisURL.protocol === 'https:') ? https_request : http_request;
/**
* @type {import("https").RequestOptions}
*/
let options = {
timeout,
method: method.toUpperCase(),
@@ -80,9 +89,13 @@ function send(detail) {
options.headers['content-length'] = Buffer.byteLength(content, 'utf-8').toString();
}
if (proxy) {
options.headers.host = thisURL.host;
options.path = thisURL.href;
[options.host, options.port] = proxy.split(':');
options.agent = (thisURL.protocol === 'https:')
? new HttpsProxyAgent(proxy.url)
: new HttpProxyAgent(proxy.url);
for (const ah of proxy.auth_headers) {
options.headers[ah[0]] = ah[1]
}
options.rejectUnauthorized = false
}
const req = request(options, res => {
let protodata = '';
+20 -16
View File
@@ -56,8 +56,9 @@ function checkPlatform(releases) {
/**
* 半自动更新
* @param {boolean} isDdownload
*/
async function update() {
async function update(isDdownload) {
try {
const { tag_name, assets, body: text } = await getLatestRelease('shanmiteko', 'LotteryAutoScript')
if (checkVersion(version) < checkVersion(tag_name)) {
@@ -65,20 +66,23 @@ async function update() {
.filter(({ name }) => checkPlatform(name))
.map(({ browser_download_url }) => browser_download_url)
if (download_url.length) {
await try_for_each(download_url.entries(), async ([i, url]) => {
let proxy_url = "https://ghproxy.com/";
proxy_url += url
log.warn('自动下载', `切换代理${proxy_url}`)
await download(proxy_url, `latest_version${i}.zip`)
.catch(async err => {
log.error('自动下载', err)
proxy_url = url
log.warn('自动下载', `使用原始链接${proxy_url}`)
await download(proxy_url, `latest_version${i}.zip`)
})
return false
})
log.info('自动下载', '成功下载到当前目录')
if (isDdownload) {
await try_for_each(download_url.entries(), async ([i, url]) => {
let proxy_url = "https://ghproxy.com/";
proxy_url += url
log.warn('自动下载', `切换代理${proxy_url}`)
await download(proxy_url, `latest_version${i}.zip`)
.catch(async err => {
log.error('自动下载', err)
proxy_url = url
log.warn('自动下载', `使用原始链接${proxy_url}`)
await download(proxy_url, `latest_version${i}.zip`)
})
return false
})
log.info('自动下载', '成功下载到当前目录')
log.info('检查更新', '请手动解压替换可执行文件');
}
log.info('更新说明', '\n' + text + '\n')
} else {
throw `未找到能在此平台(${process.platform})-(${process.arch})上运行的版本,建议以源码运行`
@@ -87,7 +91,7 @@ async function update() {
throw '当前已是最新版本'
}
} catch (error) {
log.error('更新脚本', error)
log.warn('更新脚本', error)
}
}
+41 -29
View File
@@ -17,6 +17,8 @@ const utils = {
dyids_dir: path.join(process.cwd(), "dyids"),
/**lottery_info存放目录 */
lottery_info_dir: path.join(process.cwd(), "lottery_info"),
/**本地抽奖信息存放目录 */
lottery_dyids: path.join(process.cwd(), "lottery_dyids"),
/**dyid长度 */
dyid_length: 18,
/**
@@ -275,6 +277,29 @@ const utils = {
}
}
},
/**
* 验证码识别
* @param {string} url
* @returns {Promise<string>}
*/
ocr(url) {
return new Promise((resolve) => {
send({
method: 'POST',
url: 'http://127.0.0.1:9898/ocr/url/text',
headers: {
"content-type": 'application/x-www-form-urlencoded; charset=UTF-8',
},
contents: { url },
success: res => {
resolve(res.body)
},
failure: () => {
resolve()
}
})
})
},
/**
* 下载文件
* @param {string} url
@@ -313,35 +338,6 @@ const utils = {
})
});
},
/**
* 获取远程设置
* @returns {Promise<JSON>}
*/
getRemoteConfig() {
return new Promise((resolve) => {
send({
method: 'GET',
url: 'https://gitee.com/shanmite/lottery-notice/raw/master/notice.json',
headers: {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36',
},
success: res => {
try {
const body = JSON.parse(Buffer.from(res.body, "base64").toString());
if (body.node_msg) utils.log.info('公告', '\n' + body.node_msg + '\n');
resolve(body.config)
} catch (error) {
utils.log.error('获取远程设置', '获取远程设置错误: ' + error);
resolve({})
}
},
failure: err => {
utils.log.error('获取远程设置', '获取远程设置错误: ' + err);
resolve({})
}
})
})
},
/**
* 是否存在文件或目录
* @param {string} path
@@ -459,6 +455,22 @@ const utils = {
async clearLotteryInfo() {
await utils.createDir(utils.lottery_info_dir);
await utils.createFile(utils.lottery_info_dir, `lottery_info_${Number(process.env.NUMBER)}.json`, "{}", "w")
},
/**
* 获取含抽奖dyids
* @param {string} filename
* @returns {Promise<Array<String>>}
*/
getLocalLotteryTxt(filename) {
return new Promise((resolve) => {
fs.readFile(path.join(utils.lottery_dyids, filename), (err, data) => {
if (err) {
resolve([])
} else {
resolve(data.toString("utf8").split(/[^0123456789]+/))
}
})
});
}
};
+31 -9
View File
@@ -16,6 +16,9 @@ const metainfo = [
let multiple_account = [];
/**循环等待时间 */
let loop_wait = 0;
/**账号状态标记 1正常 -1失效 */
// eslint-disable-next-line no-unused-vars
let ck_flag = 0
/**
* @returns {Promise<string>} 错误信息
@@ -38,7 +41,11 @@ async function main() {
if (err_msg) {
return err_msg
} else {
await delay(acco.WAIT);
if (ck_flag === 1) {
await delay(acco.WAIT);
} else {
await delay(3 * 1000);
}
}
}
@@ -49,15 +56,16 @@ async function main() {
await global_var.init(COOKIE, NUMBER);
/**引入基础功能 */
const { start, isMe, clear, checkCookie } = require("./lib/index");
const { start, isMe, clear, account, checkCookie, login } = require("./lib/index");
log.info('main', '当前为第' + NUMBER + '个账号');
log._cache.length = 0
const mode = process.env.lottery_mode;
const help_msg = "用法: lottery [OPTIONS]\n\nOPTIONS:\n\tstart 启动抽奖\n\tcheck 中奖检查\n\tacount 查看帐号信息\n\tclear 清理动态和关注\n\tlogin 扫码登录更新CK\n\tupdate 检查更新\n\thelp 帮助信息";
if (await checkCookie(NUMBER)) {
const mode = process.env.lottery_mode;
const help_msg = "用法: lottery [OPTIONS]\n\nOPTIONS:\n\tstart 启动抽奖\n\tcheck 中奖检查\n\tclear 清理动态和关注\n\tupdate 检查更新\n\thelp 帮助信息";
const { lottery_loop_wait, check_loop_wait, clear_loop_wait, save_lottery_info_to_file } = require("./lib/data/config");
ck_flag = 1;
switch (mode) {
case 'start':
log.info('抽奖', '开始运行');
@@ -79,8 +87,15 @@ async function main() {
await clear();
}
break;
case 'login':
log.info('登录状态', '正常,跳过扫码');
break;
case 'help':
return help_msg
case 'account':
log.info('检查帐号信息', '开始运行');
await account();
break;
case undefined:
return "未提供以下参数\n\t[OPTIONS]\n\n" + help_msg
default:
@@ -88,7 +103,12 @@ async function main() {
}
} else {
log.error('Cookie已失效', '切换账号时不要点击退出账号而应直接删除Cookie退出')
return
ck_flag = -1;
if (mode === "login") {
log.info('登陆', '开始扫码');
await login(NUMBER);
await delay(1000);
}
}
} else {
return '请查看README文件, 在env.js指定位置填入cookie'
@@ -149,11 +169,13 @@ function initConfig() {
/**OPTIONS */
process.env.lottery_mode = process.argv[2]
log.info('检查更新', '开始')
if (process.env.lottery_mode === "update") {
log.info('检查更新', '开始')
await require("./lib/update").update()
log.info('检查更新', '请手动解压替换可执行文件')
await require("./lib/update").update(true)
return
} else {
await require("./lib/update").update(false)
}
const err_msg = await main();
@@ -168,7 +190,7 @@ function initConfig() {
if (initEnv() || initConfig()) return;
await main()
}
log.info('结束运行', '未在config.js中设置休眠时间')
log.info('结束运行', '未在my_config.js中设置休眠时间')
}
process.exit(0);
+22 -8
View File
@@ -51,12 +51,19 @@ module.exports = Object.freeze({
*/
APIs: ["file://lottery_info_1.json"],
/**
* lottery_dyids目录下抽奖动态文件名(如dyids.txt)
* 一行一个dyids(非数字字符分割即可)
*/
TxT: ["dyids.txt"],
/**
* 抽奖参与顺序组合
* * 0 - UIDs
* * 1 - TAGs
* * 2 - Articles
* * 3 - APIs
* * 4 - TxT
* @example
* [3,2,1,0]
* [1,2,1,2,1]
@@ -303,12 +310,6 @@ module.exports = Object.freeze({
*/
blacklist: '',
/**
* - 自动同步 https://gitee.com/shanmite/lottery-notice/raw/master/notice.json
* - 使用公共黑名单
*/
use_public_blacklist: true,
/**
* 屏蔽词
*/
@@ -345,6 +346,11 @@ module.exports = Object.freeze({
*/
is_copy_chat: false,
/**
* 热评屏蔽词
*/
copy_blockword: ["三不原则"],
/**
* - 抽奖UP用户分组id(网页端点击分区后地址栏中的tagid)
* - 自动获取
@@ -357,7 +363,7 @@ module.exports = Object.freeze({
is_not_create_partition: false,
/**
* 是否关注异常
* 是否异常
*/
is_exception: false,
@@ -398,6 +404,7 @@ module.exports = Object.freeze({
/**
* - 取关分区
* - 默认为: 此处存放因抽奖临时关注的up
* - 可用逗号分割以取关多分区
*/
clear_partition: '',
@@ -412,6 +419,13 @@ module.exports = Object.freeze({
*/
clear_quick_remove_attention: false,
/**
* - 快速移除关注
* - 不加判断只去除关注
* - 移除粉丝数小于指定数量的
*/
clear_quick_remove_attention_fans_number_smallest: Infinity,
/**
* 是否移除动态
*/
@@ -423,7 +437,7 @@ module.exports = Object.freeze({
clear_remove_attention: true,
/**
* 清除动态延时(毫秒)
* 清除延时(毫秒)
*/
clear_remove_delay: 8000,
+8 -2
View File
@@ -1,14 +1,17 @@
{
"name": "lottery-auto-script",
"version": "2.7.3",
"version": "2.8.7",
"description": "自动参与B站动态抽奖",
"main": "main.js",
"scripts": {
"login": "node main.js login",
"start": "node main.js start",
"test": "node test/index.js",
"clear": "node main.js clear",
"check": "node main.js check",
"update": "node main.js update",
"account": "node main.js account",
"help": "node main.js help",
"pkg": "bash script/build/pkg.sh",
"changelog": "bash script/build/changelog.sh"
},
@@ -42,6 +45,9 @@
},
"dependencies": {
"chalk": "^4.1.2",
"nodemailer": "^6.7.0"
"http-proxy-agent": "^7.0.0",
"https-proxy-agent": "^7.0.0",
"nodemailer": "^6.7.0",
"@catlair/blogin": "^0.0.8"
}
}
+4 -3
View File
@@ -12,7 +12,8 @@ TARGET_DIR="dist"
BIN_NAME="lottery"
create_win_bat() {
echo "@echo off && lottery $1 && pause"
echo "set NODE_SKIP_PLATFORM_CHECK=1" >>$2
echo "lottery $1 & pause" >>$2
}
if [ -d "$TARGET_DIR" ]; then
@@ -49,9 +50,9 @@ for file in "$TARGET_DIR/"*; do
cp $TEMPLATE_CONFIG_FILE "$TMPDIR.d/$CONFIG_FILE"
cp $TEMPLATE_ENV_FILE "$TMPDIR.d/$ENV_FILE"
if [ "$(echo $file | grep '.exe')" ]; then
BATS=("start" "check" "clear" "update")
BATS=("start" "check" "clear" "account" "update" "login")
for item in "${BATS[@]}"; do
create_win_bat "${item}" >"$TMPDIR.d/$item.bat"
create_win_bat "${item}" "$TMPDIR.d/$item.bat"
done
mv "$TMPDIR.d/$BIN_NAME" "$TMPDIR.d/$BIN_NAME.exe"
else
+80 -5
View File
@@ -1,6 +1,33 @@
#!/bin/bash
set -e
# docker环境预安装
REGEX=("debian" "ubuntu" "centos|red hat|kernel|oracle linux|alma|rocky" "'amazon linux'" "fedora" "arch")
RELEASE=("Debian" "Ubuntu" "CentOS" "CentOS" "Fedora" "Arch")
PACKAGE_UPDATE=("! apt-get update && apt-get --fix-broken install -y && apt-get update" "apt-get update" "yum -y update" "yum -y update" "yum -y update" "pacman -Sy")
PACKAGE_INSTALL=("apt-get -y install" "apt-get -y install" "yum -y install" "yum -y install" "yum -y install" "pacman -Sy --noconfirm --needed")
PACKAGE_REMOVE=("apt-get -y remove" "apt-get -y remove" "yum -y remove" "yum -y remove" "yum -y remove" "pacman -Rsc --noconfirm")
PACKAGE_UNINSTALL=("apt-get -y autoremove" "apt-get -y autoremove" "yum -y autoremove" "yum -y autoremove" "yum -y autoremove" "")
CMD=("$(grep -i pretty_name /etc/os-release 2>/dev/null | cut -d \" -f2)" "$(hostnamectl 2>/dev/null | grep -i system | cut -d : -f2)" "$(lsb_release -sd 2>/dev/null)" "$(grep -i description /etc/lsb-release 2>/dev/null | cut -d \" -f2)" "$(grep . /etc/redhat-release 2>/dev/null)" "$(grep . /etc/issue 2>/dev/null | cut -d \\ -f1 | sed '/^[ ]*$/d')" "$(grep -i pretty_name /etc/os-release 2>/dev/null | cut -d \" -f2)")
SYS="${CMD[0]}"
[[ -n $SYS ]] || exit 1
for ((int = 0; int < ${#REGEX[@]}; int++)); do
if [[ $(echo "$SYS" | tr '[:upper:]' '[:lower:]') =~ ${REGEX[int]} ]]; then
SYSTEM="${RELEASE[int]}"
[[ -n $SYSTEM ]] && break
fi
done
if ! systemctl is-active docker >/dev/null 2>&1; then
if [ $SYSTEM = "CentOS" ]; then
${PACKAGE_INSTALL[int]} yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo &&
${PACKAGE_INSTALL[int]} docker-ce docker-ce-cli containerd.io
systemctl enable --now docker
else
${PACKAGE_INSTALL[int]} docker.io
fi
fi
# 脚本根目录
SCRIPT_FOLDER=lottery
# 设置环境变量文件
@@ -49,12 +76,13 @@ docker -v && docker pull $DOCKER_REPO
echo "create start.sh"
cat >start.sh <<EOF
#!/bin/env bash
#!$(which env) bash
NAME=shanmite-lottery-start
if [[ -z "\$(docker ps -a | grep \$NAME)" ]]; then
docker run \\
-v $PWD/$ENV_FILE:/lottery/$ENV_FILE \\
-v $PWD/$CONFIG_FILE:/lottery/$CONFIG_FILE \\
--network host \\
--name \$NAME \\
$DOCKER_REPO \\
start
@@ -70,12 +98,13 @@ chmod +x start.sh
echo "create check.sh"
cat >check.sh <<EOF
#!/bin/env bash
#!$(which env) bash
NAME=shanmite-lottery-check
if [[ -z "\$(docker ps -a | grep \$NAME)" ]]; then
docker run \\
-v $PWD/$ENV_FILE:/lottery/$ENV_FILE \\
-v $PWD/$CONFIG_FILE:/lottery/$CONFIG_FILE \\
--network host \\
--name \$NAME \\
$DOCKER_REPO \\
check
@@ -89,14 +118,37 @@ fi
EOF
chmod +x check.sh
echo "create account.sh"
cat >account.sh <<EOF
#!$(which env) bash
NAME=shanmite-lottery-account
if [[ -z "\$(docker ps -a | grep \$NAME)" ]]; then
docker run \\
-v $PWD/$ENV_FILE:/lottery/$ENV_FILE \\
-v $PWD/$CONFIG_FILE:/lottery/$CONFIG_FILE \\
--network host \\
--name \$NAME \\
$DOCKER_REPO \\
account
else
echo "container \$NAME already existed"
echo "history logs -> docker logs \$NAME"
echo "close this -> docker stop \$NAME"
echo "start \$NAME"
docker start \$NAME
fi
EOF
chmod +x account.sh
echo "create clear.sh"
cat >clear.sh <<EOF
#!/bin/env bash
#!$(which env) bash
NAME=shanmite-lottery-clear
if [[ -z "\$(docker ps -a | grep \$NAME)" ]]; then
docker run \\
-v $PWD/$ENV_FILE:/lottery/$ENV_FILE \\
-v $PWD/$CONFIG_FILE:/lottery/$CONFIG_FILE \\
--network host \\
--name \$NAME \\
$DOCKER_REPO \\
clear
@@ -112,11 +164,12 @@ chmod +x clear.sh
echo "create debug.sh"
cat >debug.sh <<EOF
#!/bin/env bash
#!$(which env) bash
NAME=shanmite-lottery-debug
echo "create temporary debug container"
docker run \\
-it \\
--network host \\
--name \$NAME \\
--entrypoint /bin/bash \\
$DOCKER_REPO -c bash
@@ -127,7 +180,7 @@ chmod +x debug.sh
echo "create remove_all.sh"
cat >remove_all.sh <<EOF
#!/bin/env bash
#!$(which env) bash
echo "remove all containers about $DOCKER_REPO"
docker rm -v \$(docker ps -a | awk '/shanmite\/lottery_auto_docker/ {print \$1}')
echo "remove image $DOCKER_REPO"
@@ -135,3 +188,25 @@ docker image rm -f shanmite/lottery_auto_docker
echo "see you next time!"
EOF
chmod +x remove_all.sh
echo "create login.sh"
cat >login.sh <<EOF
#!$(which env) bash
NAME=shanmite-lottery-login
if [[ -z "\$(docker ps -a | grep \$NAME)" ]]; then
docker run \\
-v $PWD/$ENV_FILE:/lottery/$ENV_FILE \\
-v $PWD/$CONFIG_FILE:/lottery/$CONFIG_FILE \\
--network host \\
--name \$NAME \\
$DOCKER_REPO \\
login
else
echo "container \$NAME already existed"
echo "history logs -> docker logs \$NAME"
echo "close this -> docker stop \$NAME"
echo "login \$NAME"
docker login \$NAME
fi
EOF
chmod +x login.sh
+4 -1
View File
@@ -2,6 +2,7 @@
set -e
NAME=LotteryAutoScript
BRABCH=main
# 视网络情况选择链接
GIT_REPO=https://github.com/shanmiteko/${NAME}.git
@@ -12,7 +13,7 @@ if [ -d "$NAME" ]; then
git pull
cd ..
else
git clone $GIT_REPO $NAME --depth=1
git clone -b $BRABCH $GIT_REPO $NAME
fi
if [ -f "$NAME/my_config.js" ]; then
@@ -38,6 +39,8 @@ EOF
create start
create check
create clear
create account
create login
cd $NAME
npm i
+14 -5
View File
@@ -1,11 +1,12 @@
const assert = require('assert');
const bili_client = require("../lib/net/bili");
const util = require('./util');
const { parseDynamicCard } = require('../lib/core/searcher');
(async () => {
assert(await bili_client.getMyinfo());
assert.notEqual(await bili_client.getMyinfo(), null);
await util.par_run([0, 1, 2, 3, 4], [
await util.par_run([0, 3], [
// 0
async () => {
assert.equal((await bili_client.getTopRcmd()).length, 10)
@@ -13,7 +14,7 @@ const util = require('./util');
// 1
async () => {
assert.equal(await bili_client.sendChat(
(await bili_client.getOneDynamicByDyid("692193323569381399")).desc.rid,
parseDynamicCard(await bili_client.getOneDynamicByDyid("692193323569381399")).rid_str,
"test",
11),
7
@@ -22,7 +23,7 @@ const util = require('./util');
// 2
async () => {
assert.equal(await bili_client.sendChat(
(await bili_client.getOneDynamicByDyid("11229466874154064")).desc.rid,
parseDynamicCard(await bili_client.getOneDynamicByDyid("11229466874154064")).rid_str,
"test",
1),
3
@@ -39,7 +40,15 @@ const util = require('./util');
// 5
async () => {
assert(!await bili_client.createDynamic("1"))
}
},
// 6
async () => {
assert.equal(await bili_client.autolike("761391835139538967"), 4)
},
// 7
async () => {
assert(await bili_client.rmDynamic("835102428771647513"))
},
])
console.log("api.test ... ok!");
+15
View File
@@ -0,0 +1,15 @@
const assert = require('assert');
const bili_client = require("../lib/net/bili");
const util = require('./util');
(async () => {
await util.par_run([], [
// 0
async () => {
let info = await bili_client.getOneArticleByCv(22112353);
let short_ids = [...new Set(info.match(/(?<=b23.tv\/)[a-zA-Z0-9]{7}/g) || [])];
assert.equal((await Promise.all(short_ids.map(bili_client.shortDynamicIdToDyid)))[0], "767357823884460033");
},
])
console.log("article.test ... ok!");
})()
+36 -8
View File
@@ -4,9 +4,7 @@ const searcher = require("../lib/core/searcher");
const util = require('./util');
(async () => {
assert(await bili_client.getMyinfo());
await util.par_run([0, 1, 2, 3], [
await util.par_run([0, 1, 2, 3, 4, 5, 6, 7, 8], [
// 0
async () => {
let info = await bili_client.getOneDynamicByDyid("728424890210713624");
@@ -14,14 +12,14 @@ const util = require('./util');
},
// 1
async () => {
let info = await bili_client.getOneDynamicByDyid("728455586333589522");
let info = await bili_client.getOneDynamicByDyid("768874900850999300");
assert(searcher.parseDynamicCard(info).origin_is_charge_lottery);
},
// 2
async () => {
let card = searcher.parseDynamicCard(await bili_client.getOneDynamicByDyid("746824225190314008"));
let chats = await bili_client.getChat(card.rid_str, card.chat_type)
assert(chats.length > 0 && typeof chats[0] == "string")
assert(chats.length > 0 && typeof chats[0][0] == "string")
},
// 3
async () => {
@@ -31,10 +29,40 @@ const util = require('./util');
assert(card.chat_type == 17)
assert(card.origin_chat_type == 11)
},
// 4
async () => {
assert.equal(await bili_client.getOneDynamicByDyid("111111111111111111"), undefined);
assert.notEqual(await bili_client.getOneDynamicByDyid("746824225190314008"), undefined);
assert.equal(await bili_client.getOneDynamicByDyid("761475750233636886"), undefined);
},
// 5
async () => {
let card = searcher.parseDynamicCard(await bili_client.getOneDynamicByDyid("762591475338838053"));
let chats = await bili_client.getChat(card.rid_str, card.chat_type)
assert.equal(chats.length, 19)
card = searcher.parseDynamicCard(await bili_client.getOneDynamicByDyid("762502724122050647"));
chats = await bili_client.getChat(card.rid_str, card.chat_type)
assert.equal(chats.filter(it => it[0] === '六的月').length, 0)
},
// 6
async () => {
const dy = await bili_client.getOneDynamicByDyid("774973685666676768");
const card = searcher.parseDynamicCard(dy)
assert.notEqual(card.description + "", undefined + "");
},
// 7
async () => {
const dy = await bili_client.getOneDynamicByDyid("832208853440397352");
const card = searcher.parseDynamicCard(dy)
assert.equal(card.reserve_id, "3106984");
},
// 8
async () => {
const dy = await bili_client.getOneDynamicByDyid("832966468497834066");
const card = searcher.parseDynamicCard(dy)
assert.equal(card.origin_reserve_id, "3106984");
},
])
console.log("dynamic_card.test ... ok!");
})()
+1 -1
View File
@@ -3,7 +3,7 @@ const global_var = require("../lib/data/global_var");
const { log } = require('../lib/utils');
const fs = require('fs');
log._level = 1
log._level = 4
env.init()
global_var.init(process.env["COOKIE"], 1)
+23
View File
@@ -0,0 +1,23 @@
const assert = require('assert');
const bili_client = require("../lib/net/bili");
const util = require('./util');
const { parseDynamicCard } = require('../lib/core/searcher');
(async () => {
await util.par_run([], [
// 0
async () => {
assert.notEqual(await bili_client.getMyinfo(), null);
const rid = parseDynamicCard(await bili_client.getOneDynamicByDyid("551416252543796684")).rid_str;
for (let index = 0; index < 100; index++) {
console.log(index);
await bili_client.sendChatWithOcr(
rid,
Date.now().toString(),
17,
)
}
},]);
})()