'ss'
This commit is contained in:
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
node_modules/
|
||||
__pycache__/
|
||||
dist/
|
||||
package.json
|
||||
package-lock.json
|
||||
.idea
|
||||
.venv
|
||||
.DS_Store
|
||||
*.pyc
|
||||
661
LICENSE
Normal file
661
LICENSE
Normal file
@@ -0,0 +1,661 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
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.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server 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,
|
||||
our General Public Licenses are 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.
|
||||
|
||||
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.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
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 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 work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero 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 Affero 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 Affero 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 Affero 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 Affero 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 Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero 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 your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
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 AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
176
README.md
176
README.md
@@ -1,92 +1,102 @@
|
||||
# douyinWebsocket
|
||||
|
||||
# 抖音网页版弹幕数据抓取
|
||||
|
||||
## 声明0:本代码库所有代码均只用于学习研究交流,严禁用于包括但不限于商业谋利、破坏系统、盗取个人信息等不良不法行为,违反此声明使用所产生的一切后果均由违反声明使用者承担。
|
||||
## 侵权或涉及相关利益请联系作者:[微博](https://weibo.com/u/7751075499)、[B站](https://space.bilibili.com/4690313)、[邮箱](mailto:kukushka@126.com)
|
||||
> 2024年1月2日
|
||||
|
||||
## 声明1:最近发现有人利用这个库的代码到CSDN还有其他博客去引流出售。。如果涉及到一些侵权或者其他利益相关的纠纷,此repo将会停止更新并归档,且行且珍惜。。。再次重申,如果涉及侵权请联系作者删除本库代码,此repo仅仅用于学习交流,交流可提issue明细
|
||||
> 2024年7月17日
|
||||
|
||||
|
||||
### 环境:
|
||||
- windows 10
|
||||
- python 3.7+
|
||||
- `protoc`版本:`libprotoc 25.1`
|
||||
- NodeJs v18.2.0
|
||||
|
||||
## Getting started
|
||||
|
||||
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
||||
## 有效测试:
|
||||
|
||||
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
||||
- [x] 2024/11/07 09:04 成功 测试成功,根据[PPG888](https://github.com/PPG888) 提出的[issue#74](https://github.com/saermart/DouyinLiveWebFetcher/issues/74)更新signature获取方式
|
||||
- [x] 2024/12/01 15:08 成功 测试成功
|
||||
- [x] 2024/12/11 15:08 成功 测试成功,添加赞赏渠道(thx :)
|
||||
- [x] 2024/12/17 10:41 成功 测试成功
|
||||
- [x] 2024/12/22 11:12 成功 测试成功
|
||||
- [x] 2025/01/03 14:52 成功 测试成功
|
||||
- [x] 2025/01/27 18:43 成功 测试成功
|
||||
- [x] 2025/01/28 09:15 成功 测试成功,新年快乐!!
|
||||
- [x] 2025/02/08 10:45 成功 测试成功
|
||||
- [x] 2025/03/05 21:22 成功 测试成功
|
||||
- [x] 2025/03/11 13:14 成功 测试成功
|
||||
- [x] 2025/03/14 20:52 成功 测试成功
|
||||
- [x] 2025/03/17 18:38 成功 测试成功
|
||||
- [x] 2025/04/10 18:20 成功 测试成功
|
||||
|
||||
## Add your files
|
||||
|
||||
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
||||
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
||||
|
||||
```
|
||||
cd existing_repo
|
||||
git remote add origin http://gitlab.yidooplanet.com/gitlab-instance-0a899031/douyinwebsocket.git
|
||||
git branch -M main
|
||||
git push -uf origin main
|
||||
## 抓取样例:
|
||||
```text
|
||||
【进场msg】[79026102598][男]🌈尘埃🌈🌈 进入了直播间
|
||||
【进场msg】[3548874980203464][男]姚先生 进入了直播间
|
||||
【进场msg】[2594451873598365][女]王大锤锤锤 进入了直播间
|
||||
【进场msg】[106602887532][男]嗨! 进入了直播间
|
||||
【进场msg】[1082384846973134][男]青泥湖茶食会所 进入了直播间
|
||||
【进场msg】[94817345810][男]每天都要看妞,只为心情愉悦 进入了直播间
|
||||
【进场msg】[83021093936][男]和财汽贸 进入了直播间
|
||||
【进场msg】[106001704984][男]静能生慧 进入了直播间
|
||||
【进场msg】[70493659812][男]格 局๑҉ 进入了直播间
|
||||
【进场msg】[76589441190][女]大龙 进入了直播间
|
||||
【进场msg】[70881184745][男]李浩哲 进入了直播间
|
||||
【进场msg】[100754703019][男]RussB 进入了直播间
|
||||
【进场msg】[102074576531][男]瞳可道 进入了直播间
|
||||
【礼物msg】X L 送出了 为你点亮x1
|
||||
【进场msg】[6782769126][男]舒克先生 进入了直播间
|
||||
【进场msg】[59189841620][女]冷瞳 进入了直播间
|
||||
【进场msg】[72741706046][男]I'm glad to be part of you 进入了直播间
|
||||
【点赞msg】小程๑ 点了9个赞
|
||||
【进场msg】[1543342918217780][男]上班很烦丶 进入了直播间
|
||||
【点赞msg】山东秋实微耗节能灶 点了12个赞
|
||||
【进场msg】[70657797444][男]🌈itsDav 进入了直播间
|
||||
【进场msg】[98472911773][男]真的小狮子 进入了直播间
|
||||
【进场msg】[69456861335][男]何苦 进入了直播间
|
||||
【进场msg】[81597830598][男]毣 进入了直播间
|
||||
【统计msg】当前观看人数: 22164, 累计观看人数: 43.6万
|
||||
【进场msg】[97729506904][男]流年 进入了直播间
|
||||
【聊天msg】[67197561586]说谎: 去拿 去拿去哪
|
||||
【进场msg】[1772006534547923][男]111 进入了直播间
|
||||
【进场msg】[1437751228776316][女]🌈星辰 进入了直播间
|
||||
【进场msg】[84994892671][男]浅蓝色的期许 进入了直播间
|
||||
【聊天msg】[58977458943]🌈烹世酌生: 厕所里有6倍
|
||||
【礼物msg】X L 送出了 为你点亮x1
|
||||
【点赞msg】小程๑ 点了11个赞
|
||||
【点赞msg】山东秋实微耗节能灶 点了1个赞
|
||||
【进场msg】[2286579209737694][男]🐭🐮🐍🐔 进入了直播间
|
||||
【进场msg】[60451809684][男]Nine九妹纸 进入了直播间
|
||||
【进场msg】[84538127235][男]🆑No smoking 进入了直播间
|
||||
【进场msg】[3984224739660126][男]か大龍貓か 进入了直播间
|
||||
【进场msg】[77098767219][男]魑魅魍魉 进入了直播间
|
||||
【进场msg】[25526482899][女]乘风 进入了直播间
|
||||
【进场msg】[1939189844950083][男]一个疯批帅哥 进入了直播间
|
||||
【点赞msg】小程๑ 点了9个赞
|
||||
【进场msg】[71283358628][男]🌈纯黑 进入了直播间
|
||||
【点赞msg】山东秋实微耗节能灶 点了8个赞
|
||||
【进场msg】[1559550207732659][女]用户5865026012091 进入了直播间
|
||||
【礼物msg】🐷囔囔滴男盆友 送出了 粉丝团灯牌x1
|
||||
【进场msg】[71297253367][男]ꪏꪶꪭꪆꪮ 皮 进入了直播间
|
||||
【进场msg】[108182840023][男]Time 进入了直播间
|
||||
【进场msg】[3918302612818491][女]用户4168810991567 进入了直播间
|
||||
【进场msg】[108698785871][男]万一啊 进入了直播间
|
||||
【进场msg】[24033588453][男]Intro 进入了直播间
|
||||
【点赞msg】小程๑ 点了3个赞
|
||||
【点赞msg】山东秋实微耗节能灶 点了1个赞
|
||||
【礼物msg】安好. 送出了 入团卡x1
|
||||
【进场msg】[87369427576][男]失格 进入了直播间
|
||||
【粉丝团msg】 恭喜 安好. 成为粉丝团第289687名成员
|
||||
【进场msg】[96183051026][男]王胖子 进入了直播间
|
||||
【进场msg】[3931489880510067][男]leee 进入了直播间
|
||||
【统计msg】当前观看人数: 22140, 累计观看人数: 43.6万
|
||||
【进场msg】[73874992083][男]😦 进入了直播间
|
||||
```
|
||||
|
||||
## Integrate with your tools
|
||||
|
||||
- [ ] [Set up project integrations](http://gitlab.yidooplanet.com/gitlab-instance-0a899031/douyinwebsocket/-/settings/integrations)
|
||||
|
||||
## Collaborate with your team
|
||||
|
||||
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
||||
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
||||
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
||||
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
||||
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
||||
|
||||
## Test and Deploy
|
||||
|
||||
Use the built-in continuous integration in GitLab.
|
||||
|
||||
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
||||
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
||||
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
||||
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
||||
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
||||
|
||||
***
|
||||
|
||||
# Editing this README
|
||||
|
||||
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
||||
|
||||
## Suggestions for a good README
|
||||
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
||||
|
||||
## Name
|
||||
Choose a self-explaining name for your project.
|
||||
|
||||
## Description
|
||||
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
||||
|
||||
## Badges
|
||||
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
||||
|
||||
## Visuals
|
||||
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
||||
|
||||
## Installation
|
||||
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
||||
|
||||
## Usage
|
||||
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
||||
|
||||
## Support
|
||||
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
||||
|
||||
## Roadmap
|
||||
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
||||
|
||||
## Contributing
|
||||
State if you are open to contributions and what your requirements are for accepting them.
|
||||
|
||||
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
||||
|
||||
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
||||
|
||||
## Authors and acknowledgment
|
||||
Show your appreciation to those who have contributed to the project.
|
||||
|
||||
## License
|
||||
For open source projects, say how it is licensed.
|
||||
|
||||
## Project status
|
||||
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
||||
## buy me a coffee
|
||||
<img src="alipay.jpg" width="400" height="400">
|
||||
|
||||
0
__init__.py
Normal file
0
__init__.py
Normal file
BIN
alipay.jpg
Normal file
BIN
alipay.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 244 KiB |
402
liveMan.py
Normal file
402
liveMan.py
Normal file
@@ -0,0 +1,402 @@
|
||||
#!/usr/bin/python
|
||||
# coding:utf-8
|
||||
|
||||
# @FileName: liveMan.py
|
||||
# @Time: 2024/1/2 21:51
|
||||
# @Author: bubu
|
||||
# @Project: douyinLiveWebFetcher
|
||||
|
||||
import codecs
|
||||
import gzip
|
||||
import hashlib
|
||||
import random
|
||||
import re
|
||||
import string
|
||||
import subprocess
|
||||
import threading
|
||||
import time
|
||||
import urllib.parse
|
||||
from contextlib import contextmanager
|
||||
from unittest.mock import patch
|
||||
|
||||
import requests
|
||||
import websocket
|
||||
from py_mini_racer import MiniRacer
|
||||
import websockets
|
||||
|
||||
from protobuf.douyin import *
|
||||
import asyncio
|
||||
|
||||
from ws_server import broadcast_message
|
||||
|
||||
|
||||
|
||||
async def send_message(message):
|
||||
uri = "ws://127.0.0.1:8888" # WebSocket 服务器地址
|
||||
async with websockets.connect(uri) as websocket:
|
||||
print(f"成功连接到 {uri}")
|
||||
await websocket.send(message) # 发送消息到 WebSocket 服务器
|
||||
print(f"已发送消息: {message}")
|
||||
|
||||
asyncio.run(send_message(f"【进场msg】111 进入了直播间"))
|
||||
|
||||
|
||||
@contextmanager
|
||||
def patched_popen_encoding(encoding='utf-8'):
|
||||
original_popen_init = subprocess.Popen.__init__
|
||||
|
||||
def new_popen_init(self, *args, **kwargs):
|
||||
kwargs['encoding'] = encoding
|
||||
original_popen_init(self, *args, **kwargs)
|
||||
|
||||
with patch.object(subprocess.Popen, '__init__', new_popen_init):
|
||||
yield
|
||||
|
||||
|
||||
def generateSignature(wss, script_file='sign.js'):
|
||||
"""
|
||||
出现gbk编码问题则修改 python模块subprocess.py的源码中Popen类的__init__函数参数encoding值为 "utf-8"
|
||||
"""
|
||||
params = ("live_id,aid,version_code,webcast_sdk_version,"
|
||||
"room_id,sub_room_id,sub_channel_id,did_rule,"
|
||||
"user_unique_id,device_platform,device_type,ac,"
|
||||
"identity").split(',')
|
||||
wss_params = urllib.parse.urlparse(wss).query.split('&')
|
||||
wss_maps = {i.split('=')[0]: i.split("=")[-1] for i in wss_params}
|
||||
tpl_params = [f"{i}={wss_maps.get(i, '')}" for i in params]
|
||||
param = ','.join(tpl_params)
|
||||
md5 = hashlib.md5()
|
||||
md5.update(param.encode())
|
||||
md5_param = md5.hexdigest()
|
||||
|
||||
with codecs.open(script_file, 'r', encoding='utf8') as f:
|
||||
script = f.read()
|
||||
|
||||
ctx = MiniRacer()
|
||||
ctx.eval(script)
|
||||
|
||||
try:
|
||||
signature = ctx.call("get_sign", md5_param)
|
||||
return signature
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
# 以下代码对应js脚本为sign_v0.js
|
||||
# context = execjs.compile(script)
|
||||
# with patched_popen_encoding(encoding='utf-8'):
|
||||
# ret = context.call('getSign', {'X-MS-STUB': md5_param})
|
||||
# return ret.get('X-Bogus')
|
||||
|
||||
|
||||
def generateMsToken(length=107):
|
||||
"""
|
||||
产生请求头部cookie中的msToken字段,其实为随机的107位字符
|
||||
:param length:字符位数
|
||||
:return:msToken
|
||||
"""
|
||||
random_str = ''
|
||||
base_str = string.ascii_letters + string.digits + '=_'
|
||||
_len = len(base_str) - 1
|
||||
for _ in range(length):
|
||||
random_str += base_str[random.randint(0, _len)]
|
||||
return random_str
|
||||
|
||||
|
||||
class DouyinLiveWebFetcher:
|
||||
|
||||
def __init__(self, live_id):
|
||||
"""
|
||||
直播间弹幕抓取对象
|
||||
:param live_id: 直播间的直播id,打开直播间web首页的链接如:https://live.douyin.com/261378947940,
|
||||
其中的261378947940即是live_id
|
||||
"""
|
||||
self.__ttwid = None
|
||||
self.__room_id = None
|
||||
self.live_id = live_id
|
||||
self.live_url = "https://live.douyin.com/"
|
||||
self.user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " \
|
||||
"Chrome/120.0.0.0 Safari/537.36"
|
||||
|
||||
def start(self):
|
||||
self._connectWebSocket()
|
||||
|
||||
def stop(self):
|
||||
self.ws.close()
|
||||
|
||||
@property
|
||||
def ttwid(self):
|
||||
"""
|
||||
产生请求头部cookie中的ttwid字段,访问抖音网页版直播间首页可以获取到响应cookie中的ttwid
|
||||
:return: ttwid
|
||||
"""
|
||||
if self.__ttwid:
|
||||
return self.__ttwid
|
||||
headers = {
|
||||
"User-Agent": self.user_agent,
|
||||
}
|
||||
try:
|
||||
response = requests.get(self.live_url, headers=headers)
|
||||
response.raise_for_status()
|
||||
except Exception as err:
|
||||
print("【X】Request the live url error: ", err)
|
||||
else:
|
||||
self.__ttwid = response.cookies.get('ttwid')
|
||||
return self.__ttwid
|
||||
|
||||
@property
|
||||
def room_id(self):
|
||||
"""
|
||||
根据直播间的地址获取到真正的直播间roomId,有时会有错误,可以重试请求解决
|
||||
:return:room_id
|
||||
"""
|
||||
if self.__room_id:
|
||||
return self.__room_id
|
||||
url = self.live_url + self.live_id
|
||||
headers = {
|
||||
"User-Agent": self.user_agent,
|
||||
"cookie": f"ttwid={self.ttwid}&msToken={generateMsToken()}; __ac_nonce=0123407cc00a9e438deb4",
|
||||
}
|
||||
try:
|
||||
response = requests.get(url, headers=headers)
|
||||
response.raise_for_status()
|
||||
except Exception as err:
|
||||
print("【X】Request the live room url error: ", err)
|
||||
else:
|
||||
match = re.search(r'roomId\\":\\"(\d+)\\"', response.text)
|
||||
if match is None or len(match.groups()) < 1:
|
||||
print("【X】No match found for roomId")
|
||||
|
||||
self.__room_id = match.group(1)
|
||||
|
||||
return self.__room_id
|
||||
|
||||
def get_room_status(self):
|
||||
"""
|
||||
获取直播间开播状态:
|
||||
room_status: 2 直播已结束
|
||||
room_status: 0 直播进行中
|
||||
"""
|
||||
url = ('https://live.douyin.com/webcast/room/web/enter/?aid=6383'
|
||||
'&app_name=douyin_web&live_id=1&device_platform=web&language=zh-CN&enter_from=web_live'
|
||||
'&cookie_enabled=true&screen_width=1536&screen_height=864&browser_language=zh-CN&browser_platform=Win32'
|
||||
'&browser_name=Edge&browser_version=133.0.0.0'
|
||||
f'&web_rid={self.live_id}'
|
||||
f'&room_id_str={self.room_id}'
|
||||
'&enter_source=&is_need_double_stream=false&insert_task_id=&live_reason='
|
||||
'&msToken=&a_bogus=')
|
||||
resp = requests.get(url, headers={
|
||||
'User-Agent': self.user_agent,
|
||||
'Cookie': f'ttwid={self.ttwid};'
|
||||
})
|
||||
data = resp.json().get('data')
|
||||
if data:
|
||||
room_status = data.get('room_status')
|
||||
user = data.get('user')
|
||||
user_id = user.get('id_str')
|
||||
nickname = user.get('nickname')
|
||||
print(f"【{nickname}】[{user_id}]直播间:{['正在直播', '已结束'][bool(room_status)]}.")
|
||||
|
||||
def _connectWebSocket(self):
|
||||
"""
|
||||
连接抖音直播间websocket服务器,请求直播间数据
|
||||
"""
|
||||
wss = ("wss://webcast5-ws-web-hl.douyin.com/webcast/im/push/v2/?app_name=douyin_web"
|
||||
"&version_code=180800&webcast_sdk_version=1.0.14-beta.0"
|
||||
"&update_version_code=1.0.14-beta.0&compress=gzip&device_platform=web&cookie_enabled=true"
|
||||
"&screen_width=1536&screen_height=864&browser_language=zh-CN&browser_platform=Win32"
|
||||
"&browser_name=Mozilla"
|
||||
"&browser_version=5.0%20(Windows%20NT%2010.0;%20Win64;%20x64)%20AppleWebKit/537.36%20(KHTML,"
|
||||
"%20like%20Gecko)%20Chrome/126.0.0.0%20Safari/537.36"
|
||||
"&browser_online=true&tz_name=Asia/Shanghai"
|
||||
"&cursor=d-1_u-1_fh-7392091211001140287_t-1721106114633_r-1"
|
||||
f"&internal_ext=internal_src:dim|wss_push_room_id:{self.room_id}|wss_push_did:7319483754668557238"
|
||||
f"|first_req_ms:1721106114541|fetch_time:1721106114633|seq:1|wss_info:0-1721106114633-0-0|"
|
||||
f"wrds_v:7392094459690748497"
|
||||
f"&host=https://live.douyin.com&aid=6383&live_id=1&did_rule=3&endpoint=live_pc&support_wrds=1"
|
||||
f"&user_unique_id=7319483754668557238&im_path=/webcast/im/fetch/&identity=audience"
|
||||
f"&need_persist_msg_count=15&insert_task_id=&live_reason=&room_id={self.room_id}&heartbeatDuration=0")
|
||||
|
||||
signature = generateSignature(wss)
|
||||
wss += f"&signature={signature}"
|
||||
|
||||
headers = {
|
||||
"cookie": f"ttwid={self.ttwid}",
|
||||
'user-agent': self.user_agent,
|
||||
}
|
||||
self.ws = websocket.WebSocketApp(wss,
|
||||
header=headers,
|
||||
on_open=self._wsOnOpen,
|
||||
on_message=self._wsOnMessage,
|
||||
on_error=self._wsOnError,
|
||||
on_close=self._wsOnClose)
|
||||
try:
|
||||
self.ws.run_forever()
|
||||
except Exception:
|
||||
self.stop()
|
||||
raise
|
||||
|
||||
def _sendHeartbeat(self):
|
||||
"""
|
||||
发送心跳包
|
||||
"""
|
||||
while True:
|
||||
try:
|
||||
heartbeat = PushFrame(payload_type='hb').SerializeToString()
|
||||
self.ws.send(heartbeat, websocket.ABNF.OPCODE_PING)
|
||||
print("【√】发送心跳包")
|
||||
# asyncio.run(send_message(f"【√】发送心跳包"))
|
||||
except Exception as e:
|
||||
print("【X】心跳包检测错误: ", e)
|
||||
break
|
||||
else:
|
||||
time.sleep(5)
|
||||
|
||||
def _wsOnOpen(self, ws):
|
||||
"""
|
||||
连接建立成功
|
||||
"""
|
||||
print("【√】WebSocket连接成功.")
|
||||
threading.Thread(target=self._sendHeartbeat).start()
|
||||
|
||||
def _wsOnMessage(self, ws, message):
|
||||
"""
|
||||
接收到数据
|
||||
:param ws: websocket实例
|
||||
:param message: 数据
|
||||
"""
|
||||
|
||||
# 根据proto结构体解析对象
|
||||
package = PushFrame().parse(message)
|
||||
response = Response().parse(gzip.decompress(package.payload))
|
||||
|
||||
# 返回直播间服务器链接存活确认消息,便于持续获取数据
|
||||
if response.need_ack:
|
||||
ack = PushFrame(log_id=package.log_id,
|
||||
payload_type='ack',
|
||||
payload=response.internal_ext.encode('utf-8')
|
||||
).SerializeToString()
|
||||
ws.send(ack, websocket.ABNF.OPCODE_BINARY)
|
||||
|
||||
# 根据消息类别解析消息体
|
||||
for msg in response.messages_list:
|
||||
method = msg.method
|
||||
try:
|
||||
{
|
||||
'WebcastChatMessage': self._parseChatMsg, # 聊天消息
|
||||
'WebcastGiftMessage': self._parseGiftMsg, # 礼物消息
|
||||
'WebcastLikeMessage': self._parseLikeMsg, # 点赞消息
|
||||
'WebcastMemberMessage': self._parseMemberMsg, # 进入直播间消息
|
||||
'WebcastSocialMessage': self._parseSocialMsg, # 关注消息
|
||||
'WebcastRoomUserSeqMessage': self._parseRoomUserSeqMsg, # 直播间统计
|
||||
'WebcastFansclubMessage': self._parseFansclubMsg, # 粉丝团消息
|
||||
'WebcastControlMessage': self._parseControlMsg, # 直播间状态消息
|
||||
'WebcastEmojiChatMessage': self._parseEmojiChatMsg, # 聊天表情包消息
|
||||
'WebcastRoomStatsMessage': self._parseRoomStatsMsg, # 直播间统计信息
|
||||
'WebcastRoomMessage': self._parseRoomMsg, # 直播间信息
|
||||
'WebcastRoomRankMessage': self._parseRankMsg, # 直播间排行榜信息
|
||||
'WebcastRoomStreamAdaptationMessage': self._parseRoomStreamAdaptationMsg, # 直播间流配置
|
||||
}.get(method)(msg.payload)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _wsOnError(self, ws, error):
|
||||
print("WebSocket error: ", error)
|
||||
|
||||
def _wsOnClose(self, ws, *args):
|
||||
self.get_room_status()
|
||||
print("WebSocket connection closed.")
|
||||
|
||||
def _parseChatMsg(self, payload):
|
||||
"""聊天消息"""
|
||||
message = ChatMessage().parse(payload)
|
||||
user_name = message.user.nick_name
|
||||
user_id = message.user.id
|
||||
content = message.content
|
||||
print(f"【聊天msg】[{user_id}]{user_name}: {content}")
|
||||
|
||||
def _parseGiftMsg(self, payload):
|
||||
"""礼物消息"""
|
||||
message = GiftMessage().parse(payload)
|
||||
user_name = message.user.nick_name
|
||||
gift_name = message.gift.name
|
||||
gift_cnt = message.combo_count
|
||||
print(f"【礼物msg】{user_name} 送出了 {gift_name}x{gift_cnt}")
|
||||
|
||||
def _parseLikeMsg(self, payload):
|
||||
'''点赞消息'''
|
||||
message = LikeMessage().parse(payload)
|
||||
user_name = message.user.nick_name
|
||||
count = message.count
|
||||
print(f"【点赞msg】{user_name} 点了{count}个赞")
|
||||
|
||||
async def _parseMemberMsg(self, payload):
|
||||
'''进入直播间消息'''
|
||||
message = MemberMessage().parse(payload)
|
||||
user_name = message.user.nick_name
|
||||
user_id = message.user.id
|
||||
gender = ["女", "男"][message.user.gender]
|
||||
print(f"【进场msg】[{user_id}][{gender}]{user_name} 进入了直播间")
|
||||
# asyncio.create_task(broadcast_message(f"【进场msg】[{user_id}][{gender}]{user_name} 进入了直播间"))
|
||||
# asyncio.run(send_message('123'))
|
||||
# 调用函数发送消息
|
||||
# await asyncio.to_thread(connect_and_send_message, 'test')
|
||||
# await broadcast_message(f"【进场msg】[{user_id}][{gender}]{user_name} 进入了直播间")
|
||||
asyncio.run(send_message(f"【进场msg】[{user_id}][{gender}]{user_name} 进入了直播间"))
|
||||
|
||||
def _parseSocialMsg(self, payload):
|
||||
'''关注消息'''
|
||||
message = SocialMessage().parse(payload)
|
||||
user_name = message.user.nick_name
|
||||
user_id = message.user.id
|
||||
print(f"【关注msg】[{user_id}]{user_name} 关注了主播")
|
||||
|
||||
def _parseRoomUserSeqMsg(self, payload):
|
||||
'''直播间统计'''
|
||||
message = RoomUserSeqMessage().parse(payload)
|
||||
current = message.total
|
||||
total = message.total_pv_for_anchor
|
||||
print(f"【统计msg】当前观看人数: {current}, 累计观看人数: {total}")
|
||||
|
||||
def _parseFansclubMsg(self, payload):
|
||||
'''粉丝团消息'''
|
||||
message = FansclubMessage().parse(payload)
|
||||
content = message.content
|
||||
print(f"【粉丝团msg】 {content}")
|
||||
|
||||
def _parseEmojiChatMsg(self, payload):
|
||||
'''聊天表情包消息'''
|
||||
message = EmojiChatMessage().parse(payload)
|
||||
emoji_id = message.emoji_id
|
||||
user = message.user
|
||||
common = message.common
|
||||
default_content = message.default_content
|
||||
print(f"【聊天表情包id】 {emoji_id},user:{user},common:{common},default_content:{default_content}")
|
||||
|
||||
def _parseRoomMsg(self, payload):
|
||||
message = RoomMessage().parse(payload)
|
||||
common = message.common
|
||||
room_id = common.room_id
|
||||
print(f"【直播间msg】直播间id:{room_id}")
|
||||
|
||||
def _parseRoomStatsMsg(self, payload):
|
||||
message = RoomStatsMessage().parse(payload)
|
||||
display_long = message.display_long
|
||||
print(f"【直播间统计msg】{display_long}")
|
||||
|
||||
def _parseRankMsg(self, payload):
|
||||
message = RoomRankMessage().parse(payload)
|
||||
ranks_list = message.ranks_list
|
||||
print(f"【直播间排行榜msg】{ranks_list}")
|
||||
|
||||
def _parseControlMsg(self, payload):
|
||||
'''直播间状态消息'''
|
||||
message = ControlMessage().parse(payload)
|
||||
|
||||
if message.status == 3:
|
||||
print("直播间已结束")
|
||||
self.stop()
|
||||
|
||||
def _parseRoomStreamAdaptationMsg(self, payload):
|
||||
message = RoomStreamAdaptationMessage().parse(payload)
|
||||
adaptationType = message.adaptation_type
|
||||
print(f'直播间adaptation: {adaptationType}')
|
||||
16
main.py
Normal file
16
main.py
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/python
|
||||
# coding:utf-8
|
||||
|
||||
from liveMan import DouyinLiveWebFetcher
|
||||
import asyncio
|
||||
from ws_server import start_ws_server
|
||||
|
||||
if __name__ == '__main__':
|
||||
live_id = '139226983757'
|
||||
room = DouyinLiveWebFetcher(live_id)
|
||||
room.get_room_status()
|
||||
room.start()
|
||||
|
||||
|
||||
|
||||
|
||||
0
protobuf/__init__.py
Normal file
0
protobuf/__init__.py
Normal file
753
protobuf/douyin.proto
Normal file
753
protobuf/douyin.proto
Normal file
@@ -0,0 +1,753 @@
|
||||
syntax = "proto3";
|
||||
package douyin;
|
||||
|
||||
message Response {
|
||||
repeated Message messagesList = 1;
|
||||
string cursor = 2;
|
||||
uint64 fetchInterval = 3;
|
||||
uint64 now = 4;
|
||||
string internalExt = 5;
|
||||
uint32 fetchType = 6;
|
||||
map<string, string> routeParams = 7;
|
||||
uint64 heartbeatDuration = 8;
|
||||
bool needAck = 9;
|
||||
string pushServer = 10;
|
||||
string liveCursor = 11;
|
||||
bool historyNoMore = 12;
|
||||
}
|
||||
|
||||
message Message{
|
||||
string method = 1;
|
||||
bytes payload = 2;
|
||||
int64 msgId = 3;
|
||||
int32 msgType = 4;
|
||||
int64 offset = 5;
|
||||
bool needWrdsStore = 6;
|
||||
int64 wrdsVersion = 7;
|
||||
string wrdsSubKey = 8;
|
||||
}
|
||||
|
||||
message EmojiChatMessage {
|
||||
Common common = 1;
|
||||
User user = 2;
|
||||
int64 emojiId = 3;
|
||||
Text emojiContent = 4;
|
||||
string defaultContent = 5;
|
||||
Image backgroundImage = 6;
|
||||
bool fromIntercom = 7;
|
||||
bool intercomHideUserCard = 8;
|
||||
}
|
||||
|
||||
// 聊天
|
||||
message ChatMessage {
|
||||
Common common = 1;
|
||||
User user = 2;
|
||||
string content = 3;
|
||||
bool visibleToSender = 4;
|
||||
Image backgroundImage = 5;
|
||||
string fullScreenTextColor = 6;
|
||||
Image backgroundImageV2 = 7;
|
||||
PublicAreaCommon publicAreaCommon = 9;
|
||||
Image giftImage = 10;
|
||||
uint64 agreeMsgId = 11;
|
||||
uint32 priorityLevel = 12;
|
||||
LandscapeAreaCommon landscapeAreaCommon = 13;
|
||||
uint64 eventTime = 15;
|
||||
bool sendReview = 16;
|
||||
bool fromIntercom = 17;
|
||||
bool intercomHideUserCard = 18;
|
||||
// repeated chatTagsList = 19;
|
||||
string chatBy = 20;
|
||||
uint32 individualChatPriority = 21;
|
||||
Text rtfContent = 22;
|
||||
}
|
||||
|
||||
|
||||
message LandscapeAreaCommon {
|
||||
bool showHead = 1;
|
||||
bool showNickname = 2;
|
||||
bool showFontColor = 3;
|
||||
repeated string colorValueList = 4;
|
||||
repeated CommentTypeTag commentTypeTagsList = 5;
|
||||
}
|
||||
|
||||
message RoomUserSeqMessage {
|
||||
Common common = 1;
|
||||
repeated RoomUserSeqMessageContributor ranksList = 2;
|
||||
int64 total = 3;
|
||||
string popStr = 4;
|
||||
repeated RoomUserSeqMessageContributor seatsList = 5;
|
||||
int64 popularity = 6;
|
||||
int64 totalUser = 7;
|
||||
string totalUserStr = 8;
|
||||
string totalStr = 9;
|
||||
string onlineUserForAnchor = 10;
|
||||
string totalPvForAnchor = 11;
|
||||
string upRightStatsStr = 12;
|
||||
string upRightStatsStrComplete = 13;
|
||||
|
||||
}
|
||||
|
||||
message CommonTextMessage {
|
||||
Common common = 1;
|
||||
User user = 2;
|
||||
string scene = 3;
|
||||
}
|
||||
|
||||
message UpdateFanTicketMessage {
|
||||
Common common = 1;
|
||||
string roomFanTicketCountText = 2;
|
||||
uint64 roomFanTicketCount = 3;
|
||||
bool forceUpdate = 4;
|
||||
}
|
||||
|
||||
message RoomUserSeqMessageContributor {
|
||||
uint64 score = 1;
|
||||
User user = 2;
|
||||
uint64 rank = 3;
|
||||
uint64 delta = 4;
|
||||
bool isHidden = 5;
|
||||
string scoreDescription = 6;
|
||||
string exactlyScore = 7;
|
||||
}
|
||||
|
||||
// 礼物消息
|
||||
message GiftMessage {
|
||||
Common common = 1;
|
||||
uint64 giftId = 2;
|
||||
uint64 fanTicketCount = 3;
|
||||
uint64 groupCount = 4;
|
||||
uint64 repeatCount = 5;
|
||||
uint64 comboCount = 6;
|
||||
User user = 7;
|
||||
User toUser = 8;
|
||||
uint32 repeatEnd = 9;
|
||||
TextEffect textEffect = 10;
|
||||
uint64 groupId = 11;
|
||||
uint64 incomeTaskgifts = 12;
|
||||
uint64 roomFanTicketCount = 13;
|
||||
GiftIMPriority priority = 14;
|
||||
GiftStruct gift = 15;
|
||||
string logId = 16;
|
||||
uint64 sendType = 17;
|
||||
PublicAreaCommon publicAreaCommon = 18;
|
||||
Text trayDisplayText = 19;
|
||||
uint64 bannedDisplayEffects = 20;
|
||||
// GiftTrayInfo trayInfo = 21;
|
||||
// AssetEffectMixInfo assetEffectMixInfo = 22;
|
||||
bool displayForSelf = 25;
|
||||
string interactGiftInfo = 26;
|
||||
string diyItemInfo = 27;
|
||||
repeated uint64 minAssetSetList = 28;
|
||||
uint64 totalCount = 29;
|
||||
uint32 clientGiftSource = 30;
|
||||
// AnchorGiftData anchorGift = 31;
|
||||
repeated uint64 toUserIdsList = 32;
|
||||
uint64 sendTime = 33;
|
||||
uint64 forceDisplayEffects = 34;
|
||||
string traceId = 35;
|
||||
uint64 effectDisplayTs = 36;
|
||||
}
|
||||
|
||||
message GiftStruct {
|
||||
Image image = 1;
|
||||
string describe = 2;
|
||||
bool notify = 3;
|
||||
uint64 duration = 4;
|
||||
uint64 id = 5;
|
||||
// GiftStructFansClubInfo fansclubInfo = 6;
|
||||
bool forLinkmic = 7;
|
||||
bool doodle = 8;
|
||||
bool forFansclub = 9;
|
||||
bool combo = 10;
|
||||
uint32 type = 11;
|
||||
uint32 diamondCount = 12;
|
||||
bool isDisplayedOnPanel = 13;
|
||||
uint64 primaryEffectId = 14;
|
||||
Image giftLabelIcon = 15;
|
||||
string name = 16;
|
||||
string region = 17;
|
||||
string manual = 18;
|
||||
bool forCustom = 19;
|
||||
// specialEffectsMap = 20;
|
||||
Image icon = 21;
|
||||
uint32 actionType = 22;
|
||||
// fixme 后面的就不写了还有几十个属性
|
||||
|
||||
}
|
||||
|
||||
message GiftIMPriority {
|
||||
repeated uint64 queueSizesList = 1;
|
||||
uint64 selfQueuePriority = 2;
|
||||
uint64 priority = 3;
|
||||
}
|
||||
|
||||
message TextEffect {
|
||||
TextEffectDetail portrait = 1;
|
||||
TextEffectDetail landscape = 2;
|
||||
}
|
||||
|
||||
message TextEffectDetail {
|
||||
Text text = 1;
|
||||
uint32 textFontSize = 2;
|
||||
Image background = 3;
|
||||
uint32 start = 4;
|
||||
uint32 duration = 5;
|
||||
uint32 x = 6;
|
||||
uint32 y = 7;
|
||||
uint32 width = 8;
|
||||
uint32 height = 9;
|
||||
uint32 shadowDx = 10;
|
||||
uint32 shadowDy = 11;
|
||||
uint32 shadowRadius = 12;
|
||||
string shadowColor = 13;
|
||||
string strokeColor = 14;
|
||||
uint32 strokeWidth = 15;
|
||||
}
|
||||
|
||||
// 成员消息
|
||||
message MemberMessage {
|
||||
Common common = 1;
|
||||
User user = 2;
|
||||
uint64 memberCount = 3;
|
||||
User operator = 4;
|
||||
bool isSetToAdmin = 5;
|
||||
bool isTopUser = 6;
|
||||
uint64 rankScore = 7;
|
||||
uint64 topUserNo = 8;
|
||||
uint64 enterType = 9;
|
||||
uint64 action = 10;
|
||||
string actionDescription = 11;
|
||||
uint64 userId = 12;
|
||||
EffectConfig effectConfig = 13;
|
||||
string popStr = 14;
|
||||
EffectConfig enterEffectConfig = 15;
|
||||
Image backgroundImage = 16;
|
||||
Image backgroundImageV2 = 17;
|
||||
Text anchorDisplayText = 18;
|
||||
PublicAreaCommon publicAreaCommon = 19;
|
||||
uint64 userEnterTipType = 20;
|
||||
uint64 anchorEnterTipType = 21;
|
||||
}
|
||||
|
||||
|
||||
message PublicAreaCommon {
|
||||
Image userLabel = 1;
|
||||
uint64 userConsumeInRoom = 2;
|
||||
uint64 userSendGiftCntInRoom = 3;
|
||||
}
|
||||
|
||||
message EffectConfig {
|
||||
uint64 type = 1;
|
||||
Image icon = 2;
|
||||
uint64 avatarPos = 3;
|
||||
Text text = 4;
|
||||
Image textIcon = 5;
|
||||
uint32 stayTime = 6;
|
||||
uint64 animAssetId = 7;
|
||||
Image badge = 8;
|
||||
repeated uint64 flexSettingArrayList = 9;
|
||||
Image textIconOverlay = 10;
|
||||
Image animatedBadge = 11;
|
||||
bool hasSweepLight = 12;
|
||||
repeated uint64 textFlexSettingArrayList = 13;
|
||||
uint64 centerAnimAssetId = 14;
|
||||
Image dynamicImage = 15;
|
||||
map<string, string> extraMap = 16;
|
||||
uint64 mp4AnimAssetId = 17;
|
||||
uint64 priority = 18;
|
||||
uint64 maxWaitTime = 19;
|
||||
string dressId = 20;
|
||||
uint64 alignment = 21;
|
||||
uint64 alignmentOffset = 22;
|
||||
}
|
||||
|
||||
message Text {
|
||||
string key = 1;
|
||||
string defaultPatter = 2;
|
||||
TextFormat defaultFormat = 3;
|
||||
repeated TextPiece piecesList = 4;
|
||||
}
|
||||
|
||||
message TextPiece {
|
||||
bool type = 1;
|
||||
TextFormat format = 2;
|
||||
string stringValue = 3;
|
||||
TextPieceUser userValue = 4;
|
||||
TextPieceGift giftValue = 5;
|
||||
TextPieceHeart heartValue = 6;
|
||||
TextPiecePatternRef patternRefValue = 7;
|
||||
TextPieceImage imageValue = 8;
|
||||
}
|
||||
|
||||
|
||||
message TextPieceImage {
|
||||
Image image = 1;
|
||||
float scalingRate = 2;
|
||||
}
|
||||
|
||||
message TextPiecePatternRef {
|
||||
string key = 1;
|
||||
string defaultPattern = 2;
|
||||
}
|
||||
|
||||
message TextPieceHeart {
|
||||
string color = 1;
|
||||
}
|
||||
|
||||
message TextPieceGift {
|
||||
uint64 giftId = 1;
|
||||
PatternRef nameRef = 2;
|
||||
}
|
||||
|
||||
message PatternRef {
|
||||
string key = 1;
|
||||
string defaultPattern = 2;
|
||||
}
|
||||
|
||||
message TextPieceUser {
|
||||
User user = 1;
|
||||
bool withColon = 2;
|
||||
}
|
||||
|
||||
message TextFormat {
|
||||
string color = 1;
|
||||
bool bold = 2;
|
||||
bool italic = 3;
|
||||
uint32 weight = 4;
|
||||
uint32 italicAngle = 5;
|
||||
uint32 fontSize = 6;
|
||||
bool useHeighLightColor = 7;
|
||||
bool useRemoteClor = 8;
|
||||
}
|
||||
|
||||
// 点赞
|
||||
message LikeMessage {
|
||||
Common common = 1;
|
||||
uint64 count = 2;
|
||||
uint64 total = 3;
|
||||
uint64 color = 4;
|
||||
User user = 5;
|
||||
string icon = 6;
|
||||
DoubleLikeDetail doubleLikeDetail = 7;
|
||||
DisplayControlInfo displayControlInfo = 8;
|
||||
uint64 linkmicGuestUid = 9;
|
||||
string scene = 10;
|
||||
PicoDisplayInfo picoDisplayInfo = 11;
|
||||
}
|
||||
|
||||
message SocialMessage {
|
||||
Common common = 1;
|
||||
User user = 2;
|
||||
uint64 shareType = 3;
|
||||
uint64 action = 4;
|
||||
string shareTarget = 5;
|
||||
uint64 followCount = 6;
|
||||
PublicAreaCommon publicAreaCommon = 7;
|
||||
}
|
||||
|
||||
message PicoDisplayInfo {
|
||||
uint64 comboSumCount = 1;
|
||||
string emoji = 2;
|
||||
Image emojiIcon = 3;
|
||||
string emojiText = 4;
|
||||
}
|
||||
|
||||
message DoubleLikeDetail {
|
||||
bool doubleFlag = 1;
|
||||
uint32 seqId = 2;
|
||||
uint32 renewalsNum = 3;
|
||||
uint32 triggersNum = 4;
|
||||
}
|
||||
|
||||
message DisplayControlInfo {
|
||||
bool showText = 1;
|
||||
bool showIcons = 2;
|
||||
}
|
||||
|
||||
message EpisodeChatMessage {
|
||||
Message common = 1;
|
||||
User user = 2;
|
||||
string content = 3;
|
||||
bool visibleToSende = 4;
|
||||
// BackgroundImage backgroundImage = 5;
|
||||
// PublicAreaCommon publicAreaCommon = 6;
|
||||
Image giftImage = 7;
|
||||
uint64 agreeMsgId = 8;
|
||||
repeated string colorValueList = 9;
|
||||
}
|
||||
|
||||
|
||||
message MatchAgainstScoreMessage {
|
||||
Common common = 1;
|
||||
Against against = 2;
|
||||
uint32 matchStatus = 3;
|
||||
uint32 displayStatus = 4;
|
||||
}
|
||||
|
||||
message Against {
|
||||
string leftName = 1;
|
||||
Image leftLogo = 2;
|
||||
string leftGoal = 3;
|
||||
// LeftPlayersList leftPlayersList = 4;
|
||||
// LeftGoalStageDetail leftGoalStageDetail = 5;
|
||||
string rightName = 6;
|
||||
Image rightLogo = 7;
|
||||
string rightGoal = 8;
|
||||
// RightPlayersList rightPlayersList = 9;
|
||||
// RightGoalStageDetail rightGoalStageDetail = 10;
|
||||
uint64 timestamp = 11;
|
||||
uint64 version = 12;
|
||||
uint64 leftTeamId = 13;
|
||||
uint64 rightTeamId = 14;
|
||||
uint64 diffSei2absSecond = 15;
|
||||
uint32 finalGoalStage = 16;
|
||||
uint32 currentGoalStage = 17;
|
||||
uint32 leftScoreAddition = 18;
|
||||
uint32 rightScoreAddition = 19;
|
||||
uint64 leftGoalInt = 20;
|
||||
uint64 rightGoalInt = 21;
|
||||
}
|
||||
|
||||
message Common {
|
||||
string method = 1;
|
||||
uint64 msgId = 2;
|
||||
uint64 roomId = 3;
|
||||
uint64 createTime = 4;
|
||||
uint32 monitor = 5;
|
||||
bool isShowMsg = 6;
|
||||
string describe = 7;
|
||||
// DisplayText displayText = 8;
|
||||
uint64 foldType = 9;
|
||||
uint64 anchorFoldType = 10;
|
||||
uint64 priorityScore = 11;
|
||||
string logId = 12;
|
||||
string msgProcessFilterK = 13;
|
||||
string msgProcessFilterV = 14;
|
||||
User user = 15;
|
||||
// Room room = 16;
|
||||
uint64 anchorFoldTypeV2 = 17;
|
||||
uint64 processAtSeiTimeMs = 18;
|
||||
uint64 randomDispatchMs = 19;
|
||||
bool isDispatch = 20;
|
||||
uint64 channelId = 21;
|
||||
uint64 diffSei2absSecond = 22;
|
||||
uint64 anchorFoldDuration = 23;
|
||||
}
|
||||
|
||||
message User {
|
||||
uint64 id = 1;
|
||||
uint64 shortId = 2;
|
||||
string nickName = 3;
|
||||
uint32 gender = 4;
|
||||
string Signature = 5;
|
||||
uint32 Level = 6;
|
||||
uint64 Birthday = 7;
|
||||
string Telephone = 8;
|
||||
Image AvatarThumb = 9;
|
||||
Image AvatarMedium = 10;
|
||||
Image AvatarLarge = 11;
|
||||
bool Verified = 12;
|
||||
uint32 Experience = 13;
|
||||
string city = 14;
|
||||
int32 Status = 15;
|
||||
uint64 CreateTime = 16;
|
||||
uint64 ModifyTime = 17;
|
||||
uint32 Secret = 18;
|
||||
string ShareQrcodeUri = 19;
|
||||
uint32 IncomeSharePercent = 20;
|
||||
repeated Image BadgeImageList = 21;
|
||||
FollowInfo FollowInfo = 22;
|
||||
PayGrade PayGrade = 23;
|
||||
FansClub FansClub = 24;
|
||||
// Border Border = 25;
|
||||
string SpecialId = 26;
|
||||
Image AvatarBorder = 27;
|
||||
Image Medal = 28;
|
||||
repeated Image RealTimeIconsList = 29;
|
||||
string displayId = 38;
|
||||
string secUid = 46;
|
||||
uint64 fanTicketCount = 1022;
|
||||
string idStr = 1028;
|
||||
uint32 ageRange = 1045;
|
||||
|
||||
|
||||
}
|
||||
|
||||
message PayGrade {
|
||||
int64 totalDiamondCount = 1;
|
||||
Image diamondIcon = 2;
|
||||
string name = 3;
|
||||
Image icon = 4;
|
||||
string nextName = 5;
|
||||
int64 level = 6;
|
||||
Image nextIcon = 7;
|
||||
int64 nextDiamond = 8;
|
||||
int64 nowDiamond = 9;
|
||||
int64 thisGradeMinDiamond = 10;
|
||||
int64 thisGradeMaxDiamond = 11;
|
||||
int64 payDiamondBak = 12;
|
||||
string gradeDescribe = 13;
|
||||
repeated GradeIcon gradeIconList = 14;
|
||||
int64 screenChatType = 15;
|
||||
Image imIcon = 16;
|
||||
Image imIconWithLevel = 17;
|
||||
Image liveIcon = 18;
|
||||
Image newImIconWithLevel = 19;
|
||||
Image newLiveIcon = 20;
|
||||
int64 upgradeNeedConsume = 21;
|
||||
string nextPrivileges = 22;
|
||||
Image background = 23;
|
||||
Image backgroundBack = 24;
|
||||
int64 score = 25;
|
||||
GradeBuffInfo buffInfo = 26;
|
||||
string gradeBanner = 1001;
|
||||
Image profileDialogBg = 1002;
|
||||
Image profileDialogBgBack = 1003;
|
||||
}
|
||||
|
||||
message FansClub{
|
||||
FansClubData data = 1;
|
||||
map<int32, FansClubData> preferData = 2;
|
||||
}
|
||||
message FansClubData {
|
||||
string clubName = 1;
|
||||
int32 level = 2;
|
||||
int32 userFansClubStatus = 3;
|
||||
UserBadge badge = 4;
|
||||
repeated int64 availableGiftIds = 5;
|
||||
int64 anchorId = 6;
|
||||
}
|
||||
message UserBadge {
|
||||
map<int32, Image> icons = 1;
|
||||
string title = 2;
|
||||
}
|
||||
|
||||
message GradeBuffInfo {
|
||||
}
|
||||
|
||||
message Border{
|
||||
|
||||
}
|
||||
|
||||
message GradeIcon{
|
||||
Image icon = 1;
|
||||
int64 iconDiamond = 2;
|
||||
int64 level = 3;
|
||||
string levelStr = 4;
|
||||
}
|
||||
|
||||
message FollowInfo {
|
||||
uint64 followingCount = 1;
|
||||
uint64 followerCount = 2;
|
||||
uint64 followStatus = 3;
|
||||
uint64 pushStatus = 4;
|
||||
string remarkName = 5;
|
||||
string followerCountStr = 6;
|
||||
string followingCountStr = 7;
|
||||
|
||||
}
|
||||
message Image {
|
||||
repeated string urlListList = 1;
|
||||
string uri = 2;
|
||||
uint64 height = 3;
|
||||
uint64 width = 4;
|
||||
string avgColor = 5;
|
||||
uint32 imageType = 6;
|
||||
string openWebUrl = 7;
|
||||
ImageContent content = 8;
|
||||
bool isAnimated = 9;
|
||||
NinePatchSetting FlexSettingList = 10;
|
||||
NinePatchSetting TextSettingList = 11;
|
||||
}
|
||||
|
||||
message NinePatchSetting {
|
||||
repeated string settingListList = 1;
|
||||
}
|
||||
|
||||
message ImageContent {
|
||||
string name = 1;
|
||||
string fontColor = 2;
|
||||
uint64 level = 3;
|
||||
string alternativeText = 4;
|
||||
}
|
||||
|
||||
message PushFrame {
|
||||
uint64 seqId = 1;
|
||||
uint64 logId = 2;
|
||||
uint64 service = 3;
|
||||
uint64 method = 4;
|
||||
repeated HeadersList headersList = 5;
|
||||
string payloadEncoding = 6;
|
||||
string payloadType = 7;
|
||||
bytes payload = 8;
|
||||
}
|
||||
|
||||
message kk {
|
||||
uint32 k = 14;
|
||||
}
|
||||
|
||||
message SendMessageBody {
|
||||
string conversationId = 1;
|
||||
uint32 conversationType = 2;
|
||||
uint64 conversationShortId = 3;
|
||||
string content = 4;
|
||||
repeated ExtList ext = 5;
|
||||
uint32 messageType = 6;
|
||||
string ticket = 7;
|
||||
string clientMessageId = 8;
|
||||
}
|
||||
|
||||
message ExtList {
|
||||
string key = 1;
|
||||
string value = 2;
|
||||
}
|
||||
|
||||
message Rsp{
|
||||
int32 a = 1;
|
||||
int32 b = 2;
|
||||
int32 c = 3;
|
||||
string d = 4;
|
||||
int32 e = 5;
|
||||
message F {
|
||||
uint64 q1 = 1;
|
||||
uint64 q3 = 3;
|
||||
string q4 = 4;
|
||||
uint64 q5 = 5;
|
||||
}
|
||||
F f = 6;
|
||||
string g = 7;
|
||||
uint64 h = 10;
|
||||
uint64 i = 11;
|
||||
uint64 j = 13;
|
||||
}
|
||||
|
||||
message PreMessage {
|
||||
uint32 cmd = 1;
|
||||
uint32 sequenceId = 2;
|
||||
string sdkVersion = 3;
|
||||
string token = 4;
|
||||
uint32 refer = 5;
|
||||
uint32 inboxType = 6;
|
||||
string buildNumber = 7;
|
||||
SendMessageBody sendMessageBody = 8;
|
||||
// 字段名待定
|
||||
string aa = 9;
|
||||
string devicePlatform = 11;
|
||||
repeated HeadersList headers = 15;
|
||||
uint32 authType = 18;
|
||||
string biz = 21;
|
||||
string access = 22;
|
||||
}
|
||||
|
||||
message HeadersList {
|
||||
string key = 1;
|
||||
string value = 2;
|
||||
}
|
||||
|
||||
message LiveShoppingMessage {
|
||||
Common common = 1;
|
||||
int32 msgType = 2;
|
||||
int64 promotionId = 4;
|
||||
}
|
||||
|
||||
message RoomStatsMessage {
|
||||
Common common = 1;
|
||||
string displayShort = 2;
|
||||
string displayMiddle = 3;
|
||||
string displayLong = 4;
|
||||
int64 displayValue = 5;
|
||||
int64 displayVersion = 6;
|
||||
bool incremental = 7;
|
||||
bool isHidden = 8;
|
||||
int64 total = 9;
|
||||
int64 displayType = 10;
|
||||
}
|
||||
|
||||
enum CommentTypeTag {
|
||||
COMMENTTYPETAGUNKNOWN = 0;
|
||||
COMMENTTYPETAGSTAR = 1;
|
||||
}
|
||||
|
||||
message ProductInfo {
|
||||
int64 promotionId = 1;
|
||||
int32 index = 2;
|
||||
repeated int64 targetFlashUidsList = 3;
|
||||
int64 explainType = 4;
|
||||
}
|
||||
message CategoryInfo {
|
||||
int32 id = 1;
|
||||
string name = 2;
|
||||
repeated int64 promotionIdsList = 3;
|
||||
string type = 4;
|
||||
string uniqueIndex = 5;
|
||||
}
|
||||
|
||||
message ProductChangeMessage {
|
||||
Common common = 1;
|
||||
int64 updateTimestamp = 2;
|
||||
string updateToast = 3;
|
||||
repeated ProductInfo updateProductInfoList = 4;
|
||||
int64 total = 5;
|
||||
repeated CategoryInfo updateCategoryInfoList = 8;
|
||||
}
|
||||
|
||||
// from https://github.com/HaoDong108/DouyinBarrageGrab/blob/main/BarrageGrab/proto/message.proto
|
||||
// status = 3 下播
|
||||
message ControlMessage {
|
||||
Common common = 1;
|
||||
int32 status = 2;
|
||||
}
|
||||
|
||||
// from https://github.com/HaoDong108/DouyinBarrageGrab/blob/main/BarrageGrab/proto/message.proto
|
||||
message FansclubMessage {
|
||||
Common commonInfo = 1;
|
||||
// 升级是1,加入是2
|
||||
int32 type = 2;
|
||||
string content = 3;
|
||||
User user = 4;
|
||||
}
|
||||
|
||||
// from https://github.com/scx567888/live-room-watcher/blob/master/src/main/proto/douyin_hack/webcast/im/RoomRankMessage.proto
|
||||
// 直播间排行榜
|
||||
message RoomRankMessage {
|
||||
Common common = 1;
|
||||
repeated RoomRank ranksList = 2;
|
||||
|
||||
message RoomRank{
|
||||
User user = 1;
|
||||
string scoreStr = 2;
|
||||
bool profileHidden = 3;
|
||||
}
|
||||
}
|
||||
// from https://github.com/scx567888/live-room-watcher/blob/master/src/main/proto/douyin_hack/webcast/im/RoomMsgTypeEnum.proto
|
||||
enum RoomMsgTypeEnum{
|
||||
DEFAULTROOMMSG = 0;
|
||||
ECOMLIVEREPLAYSAVEROOMMSG = 1;
|
||||
CONSUMERRELATIONROOMMSG = 2;
|
||||
JUMANJIDATAAUTHNOTIFYMSG = 3;
|
||||
VSWELCOMEMSG = 4;
|
||||
MINORREFUNDMSG = 5;
|
||||
PAIDLIVEROOMNOTIFYANCHORMSG = 6;
|
||||
HOSTTEAMSYSTEMMSG = 7;
|
||||
}
|
||||
// from https://github.com/scx567888/live-room-watcher/blob/master/src/main/proto/douyin_hack/webcast/im/RoomMessage.proto
|
||||
message RoomMessage{
|
||||
Common common = 1;
|
||||
string content = 2;
|
||||
bool supprotLandscape = 3;
|
||||
RoomMsgTypeEnum roommessagetype = 4;
|
||||
bool systemTopMsg = 5;
|
||||
bool forcedGuarantee = 6;
|
||||
string bizScene = 20;
|
||||
map<string, string> buriedPointMap = 30;
|
||||
}
|
||||
|
||||
|
||||
// from https://github.com/jwwsjlm/douyinLive/tree/main/protobuf/douyin.proto
|
||||
message RoomStreamAdaptationMessage {
|
||||
Common common = 1;
|
||||
int32 adaptationType = 2;
|
||||
float adaptationHeightRatio = 3;
|
||||
float adaptationBodyCenterRatio = 4;
|
||||
}
|
||||
855
protobuf/douyin.py
Normal file
855
protobuf/douyin.py
Normal file
@@ -0,0 +1,855 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# sources: douyin.proto
|
||||
# plugin: python-betterproto
|
||||
from dataclasses import dataclass
|
||||
from typing import Dict, List
|
||||
|
||||
import betterproto
|
||||
|
||||
|
||||
class CommentTypeTag(betterproto.Enum):
|
||||
COMMENTTYPETAGUNKNOWN = 0
|
||||
COMMENTTYPETAGSTAR = 1
|
||||
|
||||
|
||||
class RoomMsgTypeEnum(betterproto.Enum):
|
||||
"""
|
||||
from https://github.com/scx567888/live-room-watcher/blob/master/src/main/pr
|
||||
oto/douyin_hack/webcast/im/RoomMsgTypeEnum.proto
|
||||
"""
|
||||
|
||||
DEFAULTROOMMSG = 0
|
||||
ECOMLIVEREPLAYSAVEROOMMSG = 1
|
||||
CONSUMERRELATIONROOMMSG = 2
|
||||
JUMANJIDATAAUTHNOTIFYMSG = 3
|
||||
VSWELCOMEMSG = 4
|
||||
MINORREFUNDMSG = 5
|
||||
PAIDLIVEROOMNOTIFYANCHORMSG = 6
|
||||
HOSTTEAMSYSTEMMSG = 7
|
||||
|
||||
|
||||
@dataclass
|
||||
class Response(betterproto.Message):
|
||||
messages_list: List["Message"] = betterproto.message_field(1)
|
||||
cursor: str = betterproto.string_field(2)
|
||||
fetch_interval: int = betterproto.uint64_field(3)
|
||||
now: int = betterproto.uint64_field(4)
|
||||
internal_ext: str = betterproto.string_field(5)
|
||||
fetch_type: int = betterproto.uint32_field(6)
|
||||
route_params: Dict[str, str] = betterproto.map_field(
|
||||
7, betterproto.TYPE_STRING, betterproto.TYPE_STRING
|
||||
)
|
||||
heartbeat_duration: int = betterproto.uint64_field(8)
|
||||
need_ack: bool = betterproto.bool_field(9)
|
||||
push_server: str = betterproto.string_field(10)
|
||||
live_cursor: str = betterproto.string_field(11)
|
||||
history_no_more: bool = betterproto.bool_field(12)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Message(betterproto.Message):
|
||||
method: str = betterproto.string_field(1)
|
||||
payload: bytes = betterproto.bytes_field(2)
|
||||
msg_id: int = betterproto.int64_field(3)
|
||||
msg_type: int = betterproto.int32_field(4)
|
||||
offset: int = betterproto.int64_field(5)
|
||||
need_wrds_store: bool = betterproto.bool_field(6)
|
||||
wrds_version: int = betterproto.int64_field(7)
|
||||
wrds_sub_key: str = betterproto.string_field(8)
|
||||
|
||||
|
||||
@dataclass
|
||||
class EmojiChatMessage(betterproto.Message):
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
user: "User" = betterproto.message_field(2)
|
||||
emoji_id: int = betterproto.int64_field(3)
|
||||
emoji_content: "Text" = betterproto.message_field(4)
|
||||
default_content: str = betterproto.string_field(5)
|
||||
background_image: "Image" = betterproto.message_field(6)
|
||||
from_intercom: bool = betterproto.bool_field(7)
|
||||
intercom_hide_user_card: bool = betterproto.bool_field(8)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ChatMessage(betterproto.Message):
|
||||
"""聊天"""
|
||||
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
user: "User" = betterproto.message_field(2)
|
||||
content: str = betterproto.string_field(3)
|
||||
visible_to_sender: bool = betterproto.bool_field(4)
|
||||
background_image: "Image" = betterproto.message_field(5)
|
||||
full_screen_text_color: str = betterproto.string_field(6)
|
||||
background_image_v2: "Image" = betterproto.message_field(7)
|
||||
public_area_common: "PublicAreaCommon" = betterproto.message_field(9)
|
||||
gift_image: "Image" = betterproto.message_field(10)
|
||||
agree_msg_id: int = betterproto.uint64_field(11)
|
||||
priority_level: int = betterproto.uint32_field(12)
|
||||
landscape_area_common: "LandscapeAreaCommon" = betterproto.message_field(13)
|
||||
event_time: int = betterproto.uint64_field(15)
|
||||
send_review: bool = betterproto.bool_field(16)
|
||||
from_intercom: bool = betterproto.bool_field(17)
|
||||
intercom_hide_user_card: bool = betterproto.bool_field(18)
|
||||
# repeated chatTagsList = 19;
|
||||
chat_by: str = betterproto.string_field(20)
|
||||
individual_chat_priority: int = betterproto.uint32_field(21)
|
||||
rtf_content: "Text" = betterproto.message_field(22)
|
||||
|
||||
|
||||
@dataclass
|
||||
class LandscapeAreaCommon(betterproto.Message):
|
||||
show_head: bool = betterproto.bool_field(1)
|
||||
show_nickname: bool = betterproto.bool_field(2)
|
||||
show_font_color: bool = betterproto.bool_field(3)
|
||||
color_value_list: List[str] = betterproto.string_field(4)
|
||||
comment_type_tags_list: List["CommentTypeTag"] = betterproto.enum_field(5)
|
||||
|
||||
|
||||
@dataclass
|
||||
class RoomUserSeqMessage(betterproto.Message):
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
ranks_list: List["RoomUserSeqMessageContributor"] = betterproto.message_field(2)
|
||||
total: int = betterproto.int64_field(3)
|
||||
pop_str: str = betterproto.string_field(4)
|
||||
seats_list: List["RoomUserSeqMessageContributor"] = betterproto.message_field(5)
|
||||
popularity: int = betterproto.int64_field(6)
|
||||
total_user: int = betterproto.int64_field(7)
|
||||
total_user_str: str = betterproto.string_field(8)
|
||||
total_str: str = betterproto.string_field(9)
|
||||
online_user_for_anchor: str = betterproto.string_field(10)
|
||||
total_pv_for_anchor: str = betterproto.string_field(11)
|
||||
up_right_stats_str: str = betterproto.string_field(12)
|
||||
up_right_stats_str_complete: str = betterproto.string_field(13)
|
||||
|
||||
|
||||
@dataclass
|
||||
class CommonTextMessage(betterproto.Message):
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
user: "User" = betterproto.message_field(2)
|
||||
scene: str = betterproto.string_field(3)
|
||||
|
||||
|
||||
@dataclass
|
||||
class UpdateFanTicketMessage(betterproto.Message):
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
room_fan_ticket_count_text: str = betterproto.string_field(2)
|
||||
room_fan_ticket_count: int = betterproto.uint64_field(3)
|
||||
force_update: bool = betterproto.bool_field(4)
|
||||
|
||||
|
||||
@dataclass
|
||||
class RoomUserSeqMessageContributor(betterproto.Message):
|
||||
score: int = betterproto.uint64_field(1)
|
||||
user: "User" = betterproto.message_field(2)
|
||||
rank: int = betterproto.uint64_field(3)
|
||||
delta: int = betterproto.uint64_field(4)
|
||||
is_hidden: bool = betterproto.bool_field(5)
|
||||
score_description: str = betterproto.string_field(6)
|
||||
exactly_score: str = betterproto.string_field(7)
|
||||
|
||||
|
||||
@dataclass
|
||||
class GiftMessage(betterproto.Message):
|
||||
"""礼物消息"""
|
||||
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
gift_id: int = betterproto.uint64_field(2)
|
||||
fan_ticket_count: int = betterproto.uint64_field(3)
|
||||
group_count: int = betterproto.uint64_field(4)
|
||||
repeat_count: int = betterproto.uint64_field(5)
|
||||
combo_count: int = betterproto.uint64_field(6)
|
||||
user: "User" = betterproto.message_field(7)
|
||||
to_user: "User" = betterproto.message_field(8)
|
||||
repeat_end: int = betterproto.uint32_field(9)
|
||||
text_effect: "TextEffect" = betterproto.message_field(10)
|
||||
group_id: int = betterproto.uint64_field(11)
|
||||
income_taskgifts: int = betterproto.uint64_field(12)
|
||||
room_fan_ticket_count: int = betterproto.uint64_field(13)
|
||||
priority: "GiftIMPriority" = betterproto.message_field(14)
|
||||
gift: "GiftStruct" = betterproto.message_field(15)
|
||||
log_id: str = betterproto.string_field(16)
|
||||
send_type: int = betterproto.uint64_field(17)
|
||||
public_area_common: "PublicAreaCommon" = betterproto.message_field(18)
|
||||
tray_display_text: "Text" = betterproto.message_field(19)
|
||||
banned_display_effects: int = betterproto.uint64_field(20)
|
||||
# GiftTrayInfo trayInfo = 21; AssetEffectMixInfo assetEffectMixInfo = 22;
|
||||
display_for_self: bool = betterproto.bool_field(25)
|
||||
interact_gift_info: str = betterproto.string_field(26)
|
||||
diy_item_info: str = betterproto.string_field(27)
|
||||
min_asset_set_list: List[int] = betterproto.uint64_field(28)
|
||||
total_count: int = betterproto.uint64_field(29)
|
||||
client_gift_source: int = betterproto.uint32_field(30)
|
||||
# AnchorGiftData anchorGift = 31;
|
||||
to_user_ids_list: List[int] = betterproto.uint64_field(32)
|
||||
send_time: int = betterproto.uint64_field(33)
|
||||
force_display_effects: int = betterproto.uint64_field(34)
|
||||
trace_id: str = betterproto.string_field(35)
|
||||
effect_display_ts: int = betterproto.uint64_field(36)
|
||||
|
||||
|
||||
@dataclass
|
||||
class GiftStruct(betterproto.Message):
|
||||
image: "Image" = betterproto.message_field(1)
|
||||
describe: str = betterproto.string_field(2)
|
||||
notify: bool = betterproto.bool_field(3)
|
||||
duration: int = betterproto.uint64_field(4)
|
||||
id: int = betterproto.uint64_field(5)
|
||||
# GiftStructFansClubInfo fansclubInfo = 6;
|
||||
for_linkmic: bool = betterproto.bool_field(7)
|
||||
doodle: bool = betterproto.bool_field(8)
|
||||
for_fansclub: bool = betterproto.bool_field(9)
|
||||
combo: bool = betterproto.bool_field(10)
|
||||
type: int = betterproto.uint32_field(11)
|
||||
diamond_count: int = betterproto.uint32_field(12)
|
||||
is_displayed_on_panel: bool = betterproto.bool_field(13)
|
||||
primary_effect_id: int = betterproto.uint64_field(14)
|
||||
gift_label_icon: "Image" = betterproto.message_field(15)
|
||||
name: str = betterproto.string_field(16)
|
||||
region: str = betterproto.string_field(17)
|
||||
manual: str = betterproto.string_field(18)
|
||||
for_custom: bool = betterproto.bool_field(19)
|
||||
# specialEffectsMap = 20;
|
||||
icon: "Image" = betterproto.message_field(21)
|
||||
action_type: int = betterproto.uint32_field(22)
|
||||
|
||||
|
||||
@dataclass
|
||||
class GiftIMPriority(betterproto.Message):
|
||||
queue_sizes_list: List[int] = betterproto.uint64_field(1)
|
||||
self_queue_priority: int = betterproto.uint64_field(2)
|
||||
priority: int = betterproto.uint64_field(3)
|
||||
|
||||
|
||||
@dataclass
|
||||
class TextEffect(betterproto.Message):
|
||||
portrait: "TextEffectDetail" = betterproto.message_field(1)
|
||||
landscape: "TextEffectDetail" = betterproto.message_field(2)
|
||||
|
||||
|
||||
@dataclass
|
||||
class TextEffectDetail(betterproto.Message):
|
||||
text: "Text" = betterproto.message_field(1)
|
||||
text_font_size: int = betterproto.uint32_field(2)
|
||||
background: "Image" = betterproto.message_field(3)
|
||||
start: int = betterproto.uint32_field(4)
|
||||
duration: int = betterproto.uint32_field(5)
|
||||
x: int = betterproto.uint32_field(6)
|
||||
y: int = betterproto.uint32_field(7)
|
||||
width: int = betterproto.uint32_field(8)
|
||||
height: int = betterproto.uint32_field(9)
|
||||
shadow_dx: int = betterproto.uint32_field(10)
|
||||
shadow_dy: int = betterproto.uint32_field(11)
|
||||
shadow_radius: int = betterproto.uint32_field(12)
|
||||
shadow_color: str = betterproto.string_field(13)
|
||||
stroke_color: str = betterproto.string_field(14)
|
||||
stroke_width: int = betterproto.uint32_field(15)
|
||||
|
||||
|
||||
@dataclass
|
||||
class MemberMessage(betterproto.Message):
|
||||
"""成员消息"""
|
||||
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
user: "User" = betterproto.message_field(2)
|
||||
member_count: int = betterproto.uint64_field(3)
|
||||
operator: "User" = betterproto.message_field(4)
|
||||
is_set_to_admin: bool = betterproto.bool_field(5)
|
||||
is_top_user: bool = betterproto.bool_field(6)
|
||||
rank_score: int = betterproto.uint64_field(7)
|
||||
top_user_no: int = betterproto.uint64_field(8)
|
||||
enter_type: int = betterproto.uint64_field(9)
|
||||
action: int = betterproto.uint64_field(10)
|
||||
action_description: str = betterproto.string_field(11)
|
||||
user_id: int = betterproto.uint64_field(12)
|
||||
effect_config: "EffectConfig" = betterproto.message_field(13)
|
||||
pop_str: str = betterproto.string_field(14)
|
||||
enter_effect_config: "EffectConfig" = betterproto.message_field(15)
|
||||
background_image: "Image" = betterproto.message_field(16)
|
||||
background_image_v2: "Image" = betterproto.message_field(17)
|
||||
anchor_display_text: "Text" = betterproto.message_field(18)
|
||||
public_area_common: "PublicAreaCommon" = betterproto.message_field(19)
|
||||
user_enter_tip_type: int = betterproto.uint64_field(20)
|
||||
anchor_enter_tip_type: int = betterproto.uint64_field(21)
|
||||
|
||||
|
||||
@dataclass
|
||||
class PublicAreaCommon(betterproto.Message):
|
||||
user_label: "Image" = betterproto.message_field(1)
|
||||
user_consume_in_room: int = betterproto.uint64_field(2)
|
||||
user_send_gift_cnt_in_room: int = betterproto.uint64_field(3)
|
||||
|
||||
|
||||
@dataclass
|
||||
class EffectConfig(betterproto.Message):
|
||||
type: int = betterproto.uint64_field(1)
|
||||
icon: "Image" = betterproto.message_field(2)
|
||||
avatar_pos: int = betterproto.uint64_field(3)
|
||||
text: "Text" = betterproto.message_field(4)
|
||||
text_icon: "Image" = betterproto.message_field(5)
|
||||
stay_time: int = betterproto.uint32_field(6)
|
||||
anim_asset_id: int = betterproto.uint64_field(7)
|
||||
badge: "Image" = betterproto.message_field(8)
|
||||
flex_setting_array_list: List[int] = betterproto.uint64_field(9)
|
||||
text_icon_overlay: "Image" = betterproto.message_field(10)
|
||||
animated_badge: "Image" = betterproto.message_field(11)
|
||||
has_sweep_light: bool = betterproto.bool_field(12)
|
||||
text_flex_setting_array_list: List[int] = betterproto.uint64_field(13)
|
||||
center_anim_asset_id: int = betterproto.uint64_field(14)
|
||||
dynamic_image: "Image" = betterproto.message_field(15)
|
||||
extra_map: Dict[str, str] = betterproto.map_field(
|
||||
16, betterproto.TYPE_STRING, betterproto.TYPE_STRING
|
||||
)
|
||||
mp4_anim_asset_id: int = betterproto.uint64_field(17)
|
||||
priority: int = betterproto.uint64_field(18)
|
||||
max_wait_time: int = betterproto.uint64_field(19)
|
||||
dress_id: str = betterproto.string_field(20)
|
||||
alignment: int = betterproto.uint64_field(21)
|
||||
alignment_offset: int = betterproto.uint64_field(22)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Text(betterproto.Message):
|
||||
key: str = betterproto.string_field(1)
|
||||
default_patter: str = betterproto.string_field(2)
|
||||
default_format: "TextFormat" = betterproto.message_field(3)
|
||||
pieces_list: List["TextPiece"] = betterproto.message_field(4)
|
||||
|
||||
|
||||
@dataclass
|
||||
class TextPiece(betterproto.Message):
|
||||
type: bool = betterproto.bool_field(1)
|
||||
format: "TextFormat" = betterproto.message_field(2)
|
||||
string_value: str = betterproto.string_field(3)
|
||||
user_value: "TextPieceUser" = betterproto.message_field(4)
|
||||
gift_value: "TextPieceGift" = betterproto.message_field(5)
|
||||
heart_value: "TextPieceHeart" = betterproto.message_field(6)
|
||||
pattern_ref_value: "TextPiecePatternRef" = betterproto.message_field(7)
|
||||
image_value: "TextPieceImage" = betterproto.message_field(8)
|
||||
|
||||
|
||||
@dataclass
|
||||
class TextPieceImage(betterproto.Message):
|
||||
image: "Image" = betterproto.message_field(1)
|
||||
scaling_rate: float = betterproto.float_field(2)
|
||||
|
||||
|
||||
@dataclass
|
||||
class TextPiecePatternRef(betterproto.Message):
|
||||
key: str = betterproto.string_field(1)
|
||||
default_pattern: str = betterproto.string_field(2)
|
||||
|
||||
|
||||
@dataclass
|
||||
class TextPieceHeart(betterproto.Message):
|
||||
color: str = betterproto.string_field(1)
|
||||
|
||||
|
||||
@dataclass
|
||||
class TextPieceGift(betterproto.Message):
|
||||
gift_id: int = betterproto.uint64_field(1)
|
||||
name_ref: "PatternRef" = betterproto.message_field(2)
|
||||
|
||||
|
||||
@dataclass
|
||||
class PatternRef(betterproto.Message):
|
||||
key: str = betterproto.string_field(1)
|
||||
default_pattern: str = betterproto.string_field(2)
|
||||
|
||||
|
||||
@dataclass
|
||||
class TextPieceUser(betterproto.Message):
|
||||
user: "User" = betterproto.message_field(1)
|
||||
with_colon: bool = betterproto.bool_field(2)
|
||||
|
||||
|
||||
@dataclass
|
||||
class TextFormat(betterproto.Message):
|
||||
color: str = betterproto.string_field(1)
|
||||
bold: bool = betterproto.bool_field(2)
|
||||
italic: bool = betterproto.bool_field(3)
|
||||
weight: int = betterproto.uint32_field(4)
|
||||
italic_angle: int = betterproto.uint32_field(5)
|
||||
font_size: int = betterproto.uint32_field(6)
|
||||
use_heigh_light_color: bool = betterproto.bool_field(7)
|
||||
use_remote_clor: bool = betterproto.bool_field(8)
|
||||
|
||||
|
||||
@dataclass
|
||||
class LikeMessage(betterproto.Message):
|
||||
"""点赞"""
|
||||
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
count: int = betterproto.uint64_field(2)
|
||||
total: int = betterproto.uint64_field(3)
|
||||
color: int = betterproto.uint64_field(4)
|
||||
user: "User" = betterproto.message_field(5)
|
||||
icon: str = betterproto.string_field(6)
|
||||
double_like_detail: "DoubleLikeDetail" = betterproto.message_field(7)
|
||||
display_control_info: "DisplayControlInfo" = betterproto.message_field(8)
|
||||
linkmic_guest_uid: int = betterproto.uint64_field(9)
|
||||
scene: str = betterproto.string_field(10)
|
||||
pico_display_info: "PicoDisplayInfo" = betterproto.message_field(11)
|
||||
|
||||
|
||||
@dataclass
|
||||
class SocialMessage(betterproto.Message):
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
user: "User" = betterproto.message_field(2)
|
||||
share_type: int = betterproto.uint64_field(3)
|
||||
action: int = betterproto.uint64_field(4)
|
||||
share_target: str = betterproto.string_field(5)
|
||||
follow_count: int = betterproto.uint64_field(6)
|
||||
public_area_common: "PublicAreaCommon" = betterproto.message_field(7)
|
||||
|
||||
|
||||
@dataclass
|
||||
class PicoDisplayInfo(betterproto.Message):
|
||||
combo_sum_count: int = betterproto.uint64_field(1)
|
||||
emoji: str = betterproto.string_field(2)
|
||||
emoji_icon: "Image" = betterproto.message_field(3)
|
||||
emoji_text: str = betterproto.string_field(4)
|
||||
|
||||
|
||||
@dataclass
|
||||
class DoubleLikeDetail(betterproto.Message):
|
||||
double_flag: bool = betterproto.bool_field(1)
|
||||
seq_id: int = betterproto.uint32_field(2)
|
||||
renewals_num: int = betterproto.uint32_field(3)
|
||||
triggers_num: int = betterproto.uint32_field(4)
|
||||
|
||||
|
||||
@dataclass
|
||||
class DisplayControlInfo(betterproto.Message):
|
||||
show_text: bool = betterproto.bool_field(1)
|
||||
show_icons: bool = betterproto.bool_field(2)
|
||||
|
||||
|
||||
@dataclass
|
||||
class EpisodeChatMessage(betterproto.Message):
|
||||
common: "Message" = betterproto.message_field(1)
|
||||
user: "User" = betterproto.message_field(2)
|
||||
content: str = betterproto.string_field(3)
|
||||
visible_to_sende: bool = betterproto.bool_field(4)
|
||||
# BackgroundImage backgroundImage = 5; PublicAreaCommon publicAreaCommon =
|
||||
# 6;
|
||||
gift_image: "Image" = betterproto.message_field(7)
|
||||
agree_msg_id: int = betterproto.uint64_field(8)
|
||||
color_value_list: List[str] = betterproto.string_field(9)
|
||||
|
||||
|
||||
@dataclass
|
||||
class MatchAgainstScoreMessage(betterproto.Message):
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
against: "Against" = betterproto.message_field(2)
|
||||
match_status: int = betterproto.uint32_field(3)
|
||||
display_status: int = betterproto.uint32_field(4)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Against(betterproto.Message):
|
||||
left_name: str = betterproto.string_field(1)
|
||||
left_logo: "Image" = betterproto.message_field(2)
|
||||
left_goal: str = betterproto.string_field(3)
|
||||
# LeftPlayersList leftPlayersList = 4; LeftGoalStageDetail
|
||||
# leftGoalStageDetail = 5;
|
||||
right_name: str = betterproto.string_field(6)
|
||||
right_logo: "Image" = betterproto.message_field(7)
|
||||
right_goal: str = betterproto.string_field(8)
|
||||
# RightPlayersList rightPlayersList = 9; RightGoalStageDetail
|
||||
# rightGoalStageDetail = 10;
|
||||
timestamp: int = betterproto.uint64_field(11)
|
||||
version: int = betterproto.uint64_field(12)
|
||||
left_team_id: int = betterproto.uint64_field(13)
|
||||
right_team_id: int = betterproto.uint64_field(14)
|
||||
diff_sei2abs_second: int = betterproto.uint64_field(15)
|
||||
final_goal_stage: int = betterproto.uint32_field(16)
|
||||
current_goal_stage: int = betterproto.uint32_field(17)
|
||||
left_score_addition: int = betterproto.uint32_field(18)
|
||||
right_score_addition: int = betterproto.uint32_field(19)
|
||||
left_goal_int: int = betterproto.uint64_field(20)
|
||||
right_goal_int: int = betterproto.uint64_field(21)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Common(betterproto.Message):
|
||||
method: str = betterproto.string_field(1)
|
||||
msg_id: int = betterproto.uint64_field(2)
|
||||
room_id: int = betterproto.uint64_field(3)
|
||||
create_time: int = betterproto.uint64_field(4)
|
||||
monitor: int = betterproto.uint32_field(5)
|
||||
is_show_msg: bool = betterproto.bool_field(6)
|
||||
describe: str = betterproto.string_field(7)
|
||||
# DisplayText displayText = 8;
|
||||
fold_type: int = betterproto.uint64_field(9)
|
||||
anchor_fold_type: int = betterproto.uint64_field(10)
|
||||
priority_score: int = betterproto.uint64_field(11)
|
||||
log_id: str = betterproto.string_field(12)
|
||||
msg_process_filter_k: str = betterproto.string_field(13)
|
||||
msg_process_filter_v: str = betterproto.string_field(14)
|
||||
user: "User" = betterproto.message_field(15)
|
||||
# Room room = 16;
|
||||
anchor_fold_type_v2: int = betterproto.uint64_field(17)
|
||||
process_at_sei_time_ms: int = betterproto.uint64_field(18)
|
||||
random_dispatch_ms: int = betterproto.uint64_field(19)
|
||||
is_dispatch: bool = betterproto.bool_field(20)
|
||||
channel_id: int = betterproto.uint64_field(21)
|
||||
diff_sei2abs_second: int = betterproto.uint64_field(22)
|
||||
anchor_fold_duration: int = betterproto.uint64_field(23)
|
||||
|
||||
|
||||
@dataclass
|
||||
class User(betterproto.Message):
|
||||
id: int = betterproto.uint64_field(1)
|
||||
short_id: int = betterproto.uint64_field(2)
|
||||
nick_name: str = betterproto.string_field(3)
|
||||
gender: int = betterproto.uint32_field(4)
|
||||
signature: str = betterproto.string_field(5)
|
||||
level: int = betterproto.uint32_field(6)
|
||||
birthday: int = betterproto.uint64_field(7)
|
||||
telephone: str = betterproto.string_field(8)
|
||||
avatar_thumb: "Image" = betterproto.message_field(9)
|
||||
avatar_medium: "Image" = betterproto.message_field(10)
|
||||
avatar_large: "Image" = betterproto.message_field(11)
|
||||
verified: bool = betterproto.bool_field(12)
|
||||
experience: int = betterproto.uint32_field(13)
|
||||
city: str = betterproto.string_field(14)
|
||||
status: int = betterproto.int32_field(15)
|
||||
create_time: int = betterproto.uint64_field(16)
|
||||
modify_time: int = betterproto.uint64_field(17)
|
||||
secret: int = betterproto.uint32_field(18)
|
||||
share_qrcode_uri: str = betterproto.string_field(19)
|
||||
income_share_percent: int = betterproto.uint32_field(20)
|
||||
badge_image_list: List["Image"] = betterproto.message_field(21)
|
||||
follow_info: "FollowInfo" = betterproto.message_field(22)
|
||||
pay_grade: "PayGrade" = betterproto.message_field(23)
|
||||
fans_club: "FansClub" = betterproto.message_field(24)
|
||||
# Border Border = 25;
|
||||
special_id: str = betterproto.string_field(26)
|
||||
avatar_border: "Image" = betterproto.message_field(27)
|
||||
medal: "Image" = betterproto.message_field(28)
|
||||
real_time_icons_list: List["Image"] = betterproto.message_field(29)
|
||||
display_id: str = betterproto.string_field(38)
|
||||
sec_uid: str = betterproto.string_field(46)
|
||||
fan_ticket_count: int = betterproto.uint64_field(1022)
|
||||
id_str: str = betterproto.string_field(1028)
|
||||
age_range: int = betterproto.uint32_field(1045)
|
||||
|
||||
|
||||
@dataclass
|
||||
class PayGrade(betterproto.Message):
|
||||
total_diamond_count: int = betterproto.int64_field(1)
|
||||
diamond_icon: "Image" = betterproto.message_field(2)
|
||||
name: str = betterproto.string_field(3)
|
||||
icon: "Image" = betterproto.message_field(4)
|
||||
next_name: str = betterproto.string_field(5)
|
||||
level: int = betterproto.int64_field(6)
|
||||
next_icon: "Image" = betterproto.message_field(7)
|
||||
next_diamond: int = betterproto.int64_field(8)
|
||||
now_diamond: int = betterproto.int64_field(9)
|
||||
this_grade_min_diamond: int = betterproto.int64_field(10)
|
||||
this_grade_max_diamond: int = betterproto.int64_field(11)
|
||||
pay_diamond_bak: int = betterproto.int64_field(12)
|
||||
grade_describe: str = betterproto.string_field(13)
|
||||
grade_icon_list: List["GradeIcon"] = betterproto.message_field(14)
|
||||
screen_chat_type: int = betterproto.int64_field(15)
|
||||
im_icon: "Image" = betterproto.message_field(16)
|
||||
im_icon_with_level: "Image" = betterproto.message_field(17)
|
||||
live_icon: "Image" = betterproto.message_field(18)
|
||||
new_im_icon_with_level: "Image" = betterproto.message_field(19)
|
||||
new_live_icon: "Image" = betterproto.message_field(20)
|
||||
upgrade_need_consume: int = betterproto.int64_field(21)
|
||||
next_privileges: str = betterproto.string_field(22)
|
||||
background: "Image" = betterproto.message_field(23)
|
||||
background_back: "Image" = betterproto.message_field(24)
|
||||
score: int = betterproto.int64_field(25)
|
||||
buff_info: "GradeBuffInfo" = betterproto.message_field(26)
|
||||
grade_banner: str = betterproto.string_field(1001)
|
||||
profile_dialog_bg: "Image" = betterproto.message_field(1002)
|
||||
profile_dialog_bg_back: "Image" = betterproto.message_field(1003)
|
||||
|
||||
|
||||
@dataclass
|
||||
class FansClub(betterproto.Message):
|
||||
data: "FansClubData" = betterproto.message_field(1)
|
||||
prefer_data: Dict[int, "FansClubData"] = betterproto.map_field(
|
||||
2, betterproto.TYPE_INT32, betterproto.TYPE_MESSAGE
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class FansClubData(betterproto.Message):
|
||||
club_name: str = betterproto.string_field(1)
|
||||
level: int = betterproto.int32_field(2)
|
||||
user_fans_club_status: int = betterproto.int32_field(3)
|
||||
badge: "UserBadge" = betterproto.message_field(4)
|
||||
available_gift_ids: List[int] = betterproto.int64_field(5)
|
||||
anchor_id: int = betterproto.int64_field(6)
|
||||
|
||||
|
||||
@dataclass
|
||||
class UserBadge(betterproto.Message):
|
||||
icons: Dict[int, "Image"] = betterproto.map_field(
|
||||
1, betterproto.TYPE_INT32, betterproto.TYPE_MESSAGE
|
||||
)
|
||||
title: str = betterproto.string_field(2)
|
||||
|
||||
|
||||
@dataclass
|
||||
class GradeBuffInfo(betterproto.Message):
|
||||
pass
|
||||
|
||||
|
||||
@dataclass
|
||||
class Border(betterproto.Message):
|
||||
pass
|
||||
|
||||
|
||||
@dataclass
|
||||
class GradeIcon(betterproto.Message):
|
||||
icon: "Image" = betterproto.message_field(1)
|
||||
icon_diamond: int = betterproto.int64_field(2)
|
||||
level: int = betterproto.int64_field(3)
|
||||
level_str: str = betterproto.string_field(4)
|
||||
|
||||
|
||||
@dataclass
|
||||
class FollowInfo(betterproto.Message):
|
||||
following_count: int = betterproto.uint64_field(1)
|
||||
follower_count: int = betterproto.uint64_field(2)
|
||||
follow_status: int = betterproto.uint64_field(3)
|
||||
push_status: int = betterproto.uint64_field(4)
|
||||
remark_name: str = betterproto.string_field(5)
|
||||
follower_count_str: str = betterproto.string_field(6)
|
||||
following_count_str: str = betterproto.string_field(7)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Image(betterproto.Message):
|
||||
url_list_list: List[str] = betterproto.string_field(1)
|
||||
uri: str = betterproto.string_field(2)
|
||||
height: int = betterproto.uint64_field(3)
|
||||
width: int = betterproto.uint64_field(4)
|
||||
avg_color: str = betterproto.string_field(5)
|
||||
image_type: int = betterproto.uint32_field(6)
|
||||
open_web_url: str = betterproto.string_field(7)
|
||||
content: "ImageContent" = betterproto.message_field(8)
|
||||
is_animated: bool = betterproto.bool_field(9)
|
||||
flex_setting_list: "NinePatchSetting" = betterproto.message_field(10)
|
||||
text_setting_list: "NinePatchSetting" = betterproto.message_field(11)
|
||||
|
||||
|
||||
@dataclass
|
||||
class NinePatchSetting(betterproto.Message):
|
||||
setting_list_list: List[str] = betterproto.string_field(1)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ImageContent(betterproto.Message):
|
||||
name: str = betterproto.string_field(1)
|
||||
font_color: str = betterproto.string_field(2)
|
||||
level: int = betterproto.uint64_field(3)
|
||||
alternative_text: str = betterproto.string_field(4)
|
||||
|
||||
|
||||
@dataclass
|
||||
class PushFrame(betterproto.Message):
|
||||
seq_id: int = betterproto.uint64_field(1)
|
||||
log_id: int = betterproto.uint64_field(2)
|
||||
service: int = betterproto.uint64_field(3)
|
||||
method: int = betterproto.uint64_field(4)
|
||||
headers_list: List["HeadersList"] = betterproto.message_field(5)
|
||||
payload_encoding: str = betterproto.string_field(6)
|
||||
payload_type: str = betterproto.string_field(7)
|
||||
payload: bytes = betterproto.bytes_field(8)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Kk(betterproto.Message):
|
||||
k: int = betterproto.uint32_field(14)
|
||||
|
||||
|
||||
@dataclass
|
||||
class SendMessageBody(betterproto.Message):
|
||||
conversation_id: str = betterproto.string_field(1)
|
||||
conversation_type: int = betterproto.uint32_field(2)
|
||||
conversation_short_id: int = betterproto.uint64_field(3)
|
||||
content: str = betterproto.string_field(4)
|
||||
ext: List["ExtList"] = betterproto.message_field(5)
|
||||
message_type: int = betterproto.uint32_field(6)
|
||||
ticket: str = betterproto.string_field(7)
|
||||
client_message_id: str = betterproto.string_field(8)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ExtList(betterproto.Message):
|
||||
key: str = betterproto.string_field(1)
|
||||
value: str = betterproto.string_field(2)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Rsp(betterproto.Message):
|
||||
a: int = betterproto.int32_field(1)
|
||||
b: int = betterproto.int32_field(2)
|
||||
c: int = betterproto.int32_field(3)
|
||||
d: str = betterproto.string_field(4)
|
||||
e: int = betterproto.int32_field(5)
|
||||
f: "RspF" = betterproto.message_field(6)
|
||||
g: str = betterproto.string_field(7)
|
||||
h: int = betterproto.uint64_field(10)
|
||||
i: int = betterproto.uint64_field(11)
|
||||
j: int = betterproto.uint64_field(13)
|
||||
|
||||
|
||||
@dataclass
|
||||
class RspF(betterproto.Message):
|
||||
q1: int = betterproto.uint64_field(1)
|
||||
q3: int = betterproto.uint64_field(3)
|
||||
q4: str = betterproto.string_field(4)
|
||||
q5: int = betterproto.uint64_field(5)
|
||||
|
||||
|
||||
@dataclass
|
||||
class PreMessage(betterproto.Message):
|
||||
cmd: int = betterproto.uint32_field(1)
|
||||
sequence_id: int = betterproto.uint32_field(2)
|
||||
sdk_version: str = betterproto.string_field(3)
|
||||
token: str = betterproto.string_field(4)
|
||||
refer: int = betterproto.uint32_field(5)
|
||||
inbox_type: int = betterproto.uint32_field(6)
|
||||
build_number: str = betterproto.string_field(7)
|
||||
send_message_body: "SendMessageBody" = betterproto.message_field(8)
|
||||
# 字段名待定
|
||||
aa: str = betterproto.string_field(9)
|
||||
device_platform: str = betterproto.string_field(11)
|
||||
headers: List["HeadersList"] = betterproto.message_field(15)
|
||||
auth_type: int = betterproto.uint32_field(18)
|
||||
biz: str = betterproto.string_field(21)
|
||||
access: str = betterproto.string_field(22)
|
||||
|
||||
|
||||
@dataclass
|
||||
class HeadersList(betterproto.Message):
|
||||
key: str = betterproto.string_field(1)
|
||||
value: str = betterproto.string_field(2)
|
||||
|
||||
|
||||
@dataclass
|
||||
class LiveShoppingMessage(betterproto.Message):
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
msg_type: int = betterproto.int32_field(2)
|
||||
promotion_id: int = betterproto.int64_field(4)
|
||||
|
||||
|
||||
@dataclass
|
||||
class RoomStatsMessage(betterproto.Message):
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
display_short: str = betterproto.string_field(2)
|
||||
display_middle: str = betterproto.string_field(3)
|
||||
display_long: str = betterproto.string_field(4)
|
||||
display_value: int = betterproto.int64_field(5)
|
||||
display_version: int = betterproto.int64_field(6)
|
||||
incremental: bool = betterproto.bool_field(7)
|
||||
is_hidden: bool = betterproto.bool_field(8)
|
||||
total: int = betterproto.int64_field(9)
|
||||
display_type: int = betterproto.int64_field(10)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ProductInfo(betterproto.Message):
|
||||
promotion_id: int = betterproto.int64_field(1)
|
||||
index: int = betterproto.int32_field(2)
|
||||
target_flash_uids_list: List[int] = betterproto.int64_field(3)
|
||||
explain_type: int = betterproto.int64_field(4)
|
||||
|
||||
|
||||
@dataclass
|
||||
class CategoryInfo(betterproto.Message):
|
||||
id: int = betterproto.int32_field(1)
|
||||
name: str = betterproto.string_field(2)
|
||||
promotion_ids_list: List[int] = betterproto.int64_field(3)
|
||||
type: str = betterproto.string_field(4)
|
||||
unique_index: str = betterproto.string_field(5)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ProductChangeMessage(betterproto.Message):
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
update_timestamp: int = betterproto.int64_field(2)
|
||||
update_toast: str = betterproto.string_field(3)
|
||||
update_product_info_list: List["ProductInfo"] = betterproto.message_field(4)
|
||||
total: int = betterproto.int64_field(5)
|
||||
update_category_info_list: List["CategoryInfo"] = betterproto.message_field(8)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ControlMessage(betterproto.Message):
|
||||
"""
|
||||
from https://github.com/HaoDong108/DouyinBarrageGrab/blob/main/BarrageGrab/
|
||||
proto/message.proto status = 3 下播
|
||||
"""
|
||||
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
status: int = betterproto.int32_field(2)
|
||||
|
||||
|
||||
@dataclass
|
||||
class FansclubMessage(betterproto.Message):
|
||||
"""
|
||||
from https://github.com/HaoDong108/DouyinBarrageGrab/blob/main/BarrageGrab/
|
||||
proto/message.proto
|
||||
"""
|
||||
|
||||
common_info: "Common" = betterproto.message_field(1)
|
||||
# 升级是1,加入是2
|
||||
type: int = betterproto.int32_field(2)
|
||||
content: str = betterproto.string_field(3)
|
||||
user: "User" = betterproto.message_field(4)
|
||||
|
||||
|
||||
@dataclass
|
||||
class RoomRankMessage(betterproto.Message):
|
||||
"""
|
||||
from https://github.com/scx567888/live-room-watcher/blob/master/src/main/pr
|
||||
oto/douyin_hack/webcast/im/RoomRankMessage.proto 直播间排行榜
|
||||
"""
|
||||
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
ranks_list: List["RoomRankMessageRoomRank"] = betterproto.message_field(2)
|
||||
|
||||
|
||||
@dataclass
|
||||
class RoomRankMessageRoomRank(betterproto.Message):
|
||||
user: "User" = betterproto.message_field(1)
|
||||
score_str: str = betterproto.string_field(2)
|
||||
profile_hidden: bool = betterproto.bool_field(3)
|
||||
|
||||
|
||||
@dataclass
|
||||
class RoomMessage(betterproto.Message):
|
||||
"""
|
||||
from https://github.com/scx567888/live-room-
|
||||
watcher/blob/master/src/main/proto/douyin_hack/webcast/im/RoomMessage.proto
|
||||
"""
|
||||
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
content: str = betterproto.string_field(2)
|
||||
supprot_landscape: bool = betterproto.bool_field(3)
|
||||
roommessagetype: "RoomMsgTypeEnum" = betterproto.enum_field(4)
|
||||
system_top_msg: bool = betterproto.bool_field(5)
|
||||
forced_guarantee: bool = betterproto.bool_field(6)
|
||||
biz_scene: str = betterproto.string_field(20)
|
||||
buried_point_map: Dict[str, str] = betterproto.map_field(
|
||||
30, betterproto.TYPE_STRING, betterproto.TYPE_STRING
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class RoomStreamAdaptationMessage(betterproto.Message):
|
||||
"""
|
||||
from https://github.com/jwwsjlm/douyinLive/tree/main/protobuf/douyin.proto
|
||||
"""
|
||||
|
||||
common: "Common" = betterproto.message_field(1)
|
||||
adaptation_type: int = betterproto.int32_field(2)
|
||||
adaptation_height_ratio: float = betterproto.float_field(3)
|
||||
adaptation_body_center_ratio: float = betterproto.float_field(4)
|
||||
BIN
protobuf/protoc.exe
Normal file
BIN
protobuf/protoc.exe
Normal file
Binary file not shown.
18
protobuf/readme.md
Normal file
18
protobuf/readme.md
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
# 生成protobuf的Python版结构体脚本
|
||||
## 声明:本代码库所有代码均只用于学习研究交流,严禁用于包括但不限于商业谋利、破坏系统、盗取个人信息等不良不法行为,违反此声明使用所产生的一切后果均由违反声明使用者承担。
|
||||
## 侵权或涉及相关利益请联系作者:[微博](https://weibo.com/u/7751075499)、[B站](https://space.bilibili.com/4690313)、[邮箱](mailto:kukushka@126.com)
|
||||
> 2024年1月2日
|
||||
|
||||
## 0.安装[betterproto](https://github.com/danielgtaylor/python-betterproto)
|
||||
```shell
|
||||
pip install betterproto
|
||||
```
|
||||
注意`betterproto`版本为`2.0.0b6`,必须为2.0以上版本
|
||||
## 1.在当前目录下打开终端,输入:
|
||||
```shell
|
||||
protoc -I . --python_betterproto_out=. douyin.proto
|
||||
```
|
||||
当前目录下生成文件`douyin.py`和`__init__.py`即为成功(此程序已经生成可用)。
|
||||
|
||||
## Done
|
||||
5
requirements.txt
Normal file
5
requirements.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
requests==2.31.0
|
||||
betterproto==2.0.0b6
|
||||
websocket-client==1.7.0
|
||||
PyExecJS==1.5.1
|
||||
mini_racer==0.12.4
|
||||
6499
sign_v0.js
Normal file
6499
sign_v0.js
Normal file
File diff suppressed because one or more lines are too long
39
ws_server.py
Normal file
39
ws_server.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import asyncio
|
||||
import websockets
|
||||
|
||||
connected_clients = set()
|
||||
|
||||
async def ws_handler(websocket, path=None):
|
||||
"""处理WebSocket连接"""
|
||||
print("前端已连接")
|
||||
connected_clients.add(websocket)
|
||||
|
||||
try:
|
||||
async for message in websocket:
|
||||
print(f"收到前端消息: {message}")
|
||||
await broadcast_message(f"回送消息:{message}") # 发送回客户端的消息
|
||||
except websockets.exceptions.ConnectionClosed as e:
|
||||
print(f"连接关闭: {e}")
|
||||
finally:
|
||||
connected_clients.remove(websocket)
|
||||
print("客户端断开连接")
|
||||
|
||||
async def broadcast_message(msg):
|
||||
"""广播消息给所有连接的客户端"""
|
||||
if connected_clients:
|
||||
# 遍历所有连接的客户端并发送消息
|
||||
await asyncio.gather(*[client.send(msg) for client in connected_clients]) # 使用 client.open 检查连接状态
|
||||
else:
|
||||
print("没有连接的客户端,无法广播消息")
|
||||
|
||||
async def start_ws_server():
|
||||
"""启动WebSocket服务器"""
|
||||
server = await websockets.serve(ws_handler, '127.0.0.1', 8888)
|
||||
print("WebSocket 服务器已启动 ws://127.0.0.1:8888")
|
||||
try:
|
||||
await server.wait_closed()
|
||||
except asyncio.CancelledError:
|
||||
print("服务器已被取消")
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(start_ws_server())
|
||||
Reference in New Issue
Block a user