xhs-cli-headless 0.8.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xhs_cli_headless-0.8.4/.github/ISSUE_TEMPLATE/bug_report.yml +49 -0
- xhs_cli_headless-0.8.4/.github/ISSUE_TEMPLATE/feature_request.yml +24 -0
- xhs_cli_headless-0.8.4/.github/workflows/ci.yml +57 -0
- xhs_cli_headless-0.8.4/.github/workflows/publish.yml +66 -0
- xhs_cli_headless-0.8.4/.gitignore +12 -0
- xhs_cli_headless-0.8.4/LICENSE +201 -0
- xhs_cli_headless-0.8.4/NOTICE +23 -0
- xhs_cli_headless-0.8.4/PKG-INFO +239 -0
- xhs_cli_headless-0.8.4/README.md +204 -0
- xhs_cli_headless-0.8.4/RELEASE_NOTES.md +27 -0
- xhs_cli_headless-0.8.4/SCHEMA.md +30 -0
- xhs_cli_headless-0.8.4/SKILL.md +27 -0
- xhs_cli_headless-0.8.4/docs/browser-cookie-recovery.md +125 -0
- xhs_cli_headless-0.8.4/docs/release-checklist.md +102 -0
- xhs_cli_headless-0.8.4/pyproject.toml +64 -0
- xhs_cli_headless-0.8.4/release_test_matrix.md +159 -0
- xhs_cli_headless-0.8.4/scripts/live_release_validation.py +397 -0
- xhs_cli_headless-0.8.4/tests/__init__.py +0 -0
- xhs_cli_headless-0.8.4/tests/conftest.py +5 -0
- xhs_cli_headless-0.8.4/tests/test_anti_detection.py +104 -0
- xhs_cli_headless-0.8.4/tests/test_cli.py +853 -0
- xhs_cli_headless-0.8.4/tests/test_client.py +428 -0
- xhs_cli_headless-0.8.4/tests/test_cookies.py +206 -0
- xhs_cli_headless-0.8.4/tests/test_creator.py +30 -0
- xhs_cli_headless-0.8.4/tests/test_creator_signing.py +76 -0
- xhs_cli_headless-0.8.4/tests/test_formatter.py +62 -0
- xhs_cli_headless-0.8.4/tests/test_integration.py +443 -0
- xhs_cli_headless-0.8.4/tests/test_qr_login.py +369 -0
- xhs_cli_headless-0.8.4/tests/test_signing.py +81 -0
- xhs_cli_headless-0.8.4/tests/test_smoke.py +212 -0
- xhs_cli_headless-0.8.4/uv.lock +1508 -0
- xhs_cli_headless-0.8.4/xhs_cli/__init__.py +8 -0
- xhs_cli_headless-0.8.4/xhs_cli/__main__.py +6 -0
- xhs_cli_headless-0.8.4/xhs_cli/cli.py +105 -0
- xhs_cli_headless-0.8.4/xhs_cli/client.py +257 -0
- xhs_cli_headless-0.8.4/xhs_cli/client_mixins.py +764 -0
- xhs_cli_headless-0.8.4/xhs_cli/command_normalizers.py +65 -0
- xhs_cli_headless-0.8.4/xhs_cli/commands/__init__.py +0 -0
- xhs_cli_headless-0.8.4/xhs_cli/commands/_common.py +99 -0
- xhs_cli_headless-0.8.4/xhs_cli/commands/auth.py +598 -0
- xhs_cli_headless-0.8.4/xhs_cli/commands/creator.py +125 -0
- xhs_cli_headless-0.8.4/xhs_cli/commands/interactions.py +120 -0
- xhs_cli_headless-0.8.4/xhs_cli/commands/notifications.py +57 -0
- xhs_cli_headless-0.8.4/xhs_cli/commands/reading.py +309 -0
- xhs_cli_headless-0.8.4/xhs_cli/commands/social.py +107 -0
- xhs_cli_headless-0.8.4/xhs_cli/constants.py +24 -0
- xhs_cli_headless-0.8.4/xhs_cli/cookies.py +572 -0
- xhs_cli_headless-0.8.4/xhs_cli/creator_signing.py +71 -0
- xhs_cli_headless-0.8.4/xhs_cli/error_codes.py +39 -0
- xhs_cli_headless-0.8.4/xhs_cli/exceptions.py +71 -0
- xhs_cli_headless-0.8.4/xhs_cli/formatter.py +67 -0
- xhs_cli_headless-0.8.4/xhs_cli/formatter_normalizers.py +187 -0
- xhs_cli_headless-0.8.4/xhs_cli/formatter_renderers.py +313 -0
- xhs_cli_headless-0.8.4/xhs_cli/formatter_utils.py +187 -0
- xhs_cli_headless-0.8.4/xhs_cli/html_parser.py +73 -0
- xhs_cli_headless-0.8.4/xhs_cli/note_refs.py +56 -0
- xhs_cli_headless-0.8.4/xhs_cli/py.typed +0 -0
- xhs_cli_headless-0.8.4/xhs_cli/qr_login.py +605 -0
- xhs_cli_headless-0.8.4/xhs_cli/signing.py +85 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: Bug Report
|
|
2
|
+
description: Report a bug or unexpected behavior
|
|
3
|
+
labels: ["bug"]
|
|
4
|
+
body:
|
|
5
|
+
- type: input
|
|
6
|
+
id: version
|
|
7
|
+
attributes:
|
|
8
|
+
label: Version
|
|
9
|
+
description: "Run `xhs --version`"
|
|
10
|
+
placeholder: "e.g. 1.0.0"
|
|
11
|
+
validations:
|
|
12
|
+
required: true
|
|
13
|
+
- type: dropdown
|
|
14
|
+
id: os
|
|
15
|
+
attributes:
|
|
16
|
+
label: Operating System
|
|
17
|
+
options:
|
|
18
|
+
- macOS
|
|
19
|
+
- Linux
|
|
20
|
+
- Windows
|
|
21
|
+
- Other
|
|
22
|
+
validations:
|
|
23
|
+
required: true
|
|
24
|
+
- type: textarea
|
|
25
|
+
id: description
|
|
26
|
+
attributes:
|
|
27
|
+
label: What happened?
|
|
28
|
+
description: Describe the bug clearly.
|
|
29
|
+
validations:
|
|
30
|
+
required: true
|
|
31
|
+
- type: textarea
|
|
32
|
+
id: expected
|
|
33
|
+
attributes:
|
|
34
|
+
label: Expected behavior
|
|
35
|
+
description: What did you expect to happen?
|
|
36
|
+
validations:
|
|
37
|
+
required: true
|
|
38
|
+
- type: textarea
|
|
39
|
+
id: reproduce
|
|
40
|
+
attributes:
|
|
41
|
+
label: Steps to reproduce
|
|
42
|
+
description: "Commands or steps to reproduce the issue. Use `xhs -v <command>` for debug output."
|
|
43
|
+
render: bash
|
|
44
|
+
- type: textarea
|
|
45
|
+
id: logs
|
|
46
|
+
attributes:
|
|
47
|
+
label: Error output / logs
|
|
48
|
+
description: Paste any error messages or verbose output here.
|
|
49
|
+
render: text
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Feature Request
|
|
2
|
+
description: Suggest a new feature or improvement
|
|
3
|
+
labels: ["enhancement"]
|
|
4
|
+
body:
|
|
5
|
+
- type: input
|
|
6
|
+
id: version
|
|
7
|
+
attributes:
|
|
8
|
+
label: Current version
|
|
9
|
+
description: "Run `xhs --version`"
|
|
10
|
+
placeholder: "e.g. 1.0.0"
|
|
11
|
+
validations:
|
|
12
|
+
required: false
|
|
13
|
+
- type: textarea
|
|
14
|
+
id: description
|
|
15
|
+
attributes:
|
|
16
|
+
label: Describe the feature
|
|
17
|
+
description: What would you like to see added or changed?
|
|
18
|
+
validations:
|
|
19
|
+
required: true
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: use_case
|
|
22
|
+
attributes:
|
|
23
|
+
label: Use case
|
|
24
|
+
description: Why do you need this feature? How would you use it?
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
workflow_call:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
lint-and-test:
|
|
12
|
+
name: Lint and test (Python ${{ matrix.python-version }})
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.10", "3.12", "3.13"]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install uv
|
|
27
|
+
uses: astral-sh/setup-uv@v6
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: uv sync --extra dev
|
|
31
|
+
|
|
32
|
+
- name: Run ruff
|
|
33
|
+
run: uv run ruff check .
|
|
34
|
+
|
|
35
|
+
- name: Run tests
|
|
36
|
+
run: uv run python -m pytest -q --ignore=tests/test_integration.py
|
|
37
|
+
|
|
38
|
+
build:
|
|
39
|
+
name: Build package
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
needs: lint-and-test
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v4
|
|
44
|
+
|
|
45
|
+
- name: Set up Python
|
|
46
|
+
uses: actions/setup-python@v5
|
|
47
|
+
with:
|
|
48
|
+
python-version: "3.12"
|
|
49
|
+
|
|
50
|
+
- name: Install uv
|
|
51
|
+
uses: astral-sh/setup-uv@v6
|
|
52
|
+
|
|
53
|
+
- name: Install dependencies
|
|
54
|
+
run: uv sync --extra dev
|
|
55
|
+
|
|
56
|
+
- name: Build distribution
|
|
57
|
+
run: uv build
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
name: Build And Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
verify:
|
|
11
|
+
uses: ./.github/workflows/ci.yml
|
|
12
|
+
|
|
13
|
+
release-assets:
|
|
14
|
+
needs: verify
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.12"
|
|
25
|
+
|
|
26
|
+
- name: Setup uv
|
|
27
|
+
uses: astral-sh/setup-uv@v6
|
|
28
|
+
|
|
29
|
+
- name: Build package
|
|
30
|
+
run: uv build
|
|
31
|
+
|
|
32
|
+
- name: Upload dist artifacts
|
|
33
|
+
uses: actions/upload-artifact@v4
|
|
34
|
+
with:
|
|
35
|
+
name: dist-${{ github.ref_name }}
|
|
36
|
+
path: dist/*
|
|
37
|
+
|
|
38
|
+
- name: Attach artifacts to GitHub release
|
|
39
|
+
uses: softprops/action-gh-release@v2
|
|
40
|
+
with:
|
|
41
|
+
name: ${{ github.ref_name }}
|
|
42
|
+
body_path: RELEASE_NOTES.md
|
|
43
|
+
files: dist/*
|
|
44
|
+
|
|
45
|
+
publish-pypi:
|
|
46
|
+
needs: verify
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
environment: pypi
|
|
49
|
+
permissions:
|
|
50
|
+
id-token: write
|
|
51
|
+
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/checkout@v4
|
|
54
|
+
|
|
55
|
+
- uses: actions/setup-python@v5
|
|
56
|
+
with:
|
|
57
|
+
python-version: "3.12"
|
|
58
|
+
|
|
59
|
+
- name: Setup uv
|
|
60
|
+
uses: astral-sh/setup-uv@v6
|
|
61
|
+
|
|
62
|
+
- name: Build package
|
|
63
|
+
run: uv build
|
|
64
|
+
|
|
65
|
+
- name: Publish to PyPI
|
|
66
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
This repository is a maintained fork of:
|
|
2
|
+
|
|
3
|
+
jackwener/xiaohongshu-cli
|
|
4
|
+
https://github.com/jackwener/xiaohongshu-cli
|
|
5
|
+
|
|
6
|
+
Current repository:
|
|
7
|
+
|
|
8
|
+
kyalpha313/xhs-cli-headless
|
|
9
|
+
https://github.com/kyalpha313/xhs-cli-headless
|
|
10
|
+
|
|
11
|
+
This fork keeps the upstream reverse-engineered Xiaohongshu CLI foundation
|
|
12
|
+
and introduces substantial changes for headless and agent-oriented usage,
|
|
13
|
+
including but not limited to:
|
|
14
|
+
|
|
15
|
+
- headless-first QR login as the default recommended login flow
|
|
16
|
+
- auth diagnostics and session inspection commands
|
|
17
|
+
- session import workflow for existing cookies
|
|
18
|
+
- structured CLI output improvements
|
|
19
|
+
- release-surface reduction to stable default commands only
|
|
20
|
+
- documentation and release materials aligned to the stable command surface
|
|
21
|
+
|
|
22
|
+
This NOTICE file is provided for attribution and project-history clarity.
|
|
23
|
+
See LICENSE for the full Apache License 2.0 terms.
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xhs-cli-headless
|
|
3
|
+
Version: 0.8.4
|
|
4
|
+
Summary: Headless-friendly Xiaohongshu CLI fork focused on QR login and automation
|
|
5
|
+
Project-URL: Homepage, https://github.com/kyalpha313/xhs-cli-headless
|
|
6
|
+
Project-URL: Repository, https://github.com/kyalpha313/xhs-cli-headless
|
|
7
|
+
Project-URL: Issues, https://github.com/kyalpha313/xhs-cli-headless/issues
|
|
8
|
+
Author-email: jackwener <jakevingoo@gmail.com>
|
|
9
|
+
Maintainer-email: kyalpha313 <kyalpha313@users.noreply.github.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Keywords: agent,api,cli,headless,redbook,xhs,xiaohongshu
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Topic :: Utilities
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: browser-cookie3>=0.19
|
|
21
|
+
Requires-Dist: camoufox>=0.4.11
|
|
22
|
+
Requires-Dist: click>=8.0
|
|
23
|
+
Requires-Dist: httpx>=0.27
|
|
24
|
+
Requires-Dist: pycryptodome>=3.20
|
|
25
|
+
Requires-Dist: pyyaml>=6.0
|
|
26
|
+
Requires-Dist: qrcode>=7.0
|
|
27
|
+
Requires-Dist: rich>=13.0
|
|
28
|
+
Requires-Dist: xhshow>=0.1.9
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: mypy>=1.15.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: ruff>=0.11.0; extra == 'dev'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# xhs-cli-headless
|
|
37
|
+
|
|
38
|
+
一个面向无 GUI / 远程服务器 / Agent 场景的小红书 CLI fork。
|
|
39
|
+
|
|
40
|
+
- Fork 仓库:[kyalpha313/xhs-cli-headless](https://github.com/kyalpha313/xhs-cli-headless)
|
|
41
|
+
- 上游项目:[jackwener/xiaohongshu-cli](https://github.com/jackwener/xiaohongshu-cli)
|
|
42
|
+
- CLI 命令:`xhs`
|
|
43
|
+
|
|
44
|
+
> 说明:这是基于上游项目维护的发布分支,重点强化了 headless 二维码登录、登录态诊断、结构化输出和发布前验证流程。README 已按本 fork 的真实支持范围重写,不再沿用上游的推广内容与发布口径。
|
|
45
|
+
|
|
46
|
+
## 中文说明
|
|
47
|
+
|
|
48
|
+
### 项目定位
|
|
49
|
+
|
|
50
|
+
`xhs-cli-headless` 是一个以“服务器可用、Agent 可用、少人工介入”为目标的小红书 CLI fork。
|
|
51
|
+
|
|
52
|
+
### 与上游的关系
|
|
53
|
+
|
|
54
|
+
- 本仓库是 [jackwener/xiaohongshu-cli](https://github.com/jackwener/xiaohongshu-cli) 的 fork。
|
|
55
|
+
- 本 fork 的 README、测试矩阵和发布说明,只描述当前 fork 已验证的行为,不默认继承上游全部能力承诺。
|
|
56
|
+
- 原项目需要浏览器实现登陆动作,不适合服务器部署与Agent交互,本项目完善了命令行模式下的登陆功能,包括纯 HTTP 二维码登录,登录态导入 / 诊断 / 检查等。
|
|
57
|
+
|
|
58
|
+
### 首版稳定范围
|
|
59
|
+
|
|
60
|
+
以下能力已收敛为本 fork 当前首版稳定范围:
|
|
61
|
+
|
|
62
|
+
- `xhs login` 默认 headless 二维码登录(即--qrcode-http,含终端二维码 + 登录链接)
|
|
63
|
+
- `xhs status` 检查登录态
|
|
64
|
+
- `xhs whoami` 获取当前用户 ID
|
|
65
|
+
- `xhs auth doctor` 诊断当前登录态是否完整、是否可用
|
|
66
|
+
- `xhs auth inspect` 检查本地已保存 cookies 的字段情况(不输出敏感值)
|
|
67
|
+
- `xhs auth import --file` 导入 cookies
|
|
68
|
+
- `xhs search` 搜索笔记
|
|
69
|
+
- `xhs search-user` 搜索用户
|
|
70
|
+
- `xhs topics` 获取话题
|
|
71
|
+
- `xhs feed` 获取动态
|
|
72
|
+
- `xhs hot` 获取热门笔记
|
|
73
|
+
- `xhs read` 读取笔记
|
|
74
|
+
- `xhs comments` 获取评论
|
|
75
|
+
- `xhs my-notes` 获取自己的笔记
|
|
76
|
+
- `xhs unread` 获取未读笔记
|
|
77
|
+
- `xhs like` / `xhs like --undo` 点赞/取消点赞笔记
|
|
78
|
+
- `xhs favorite` / `xhs unfavorite` 收藏/取消收藏笔记
|
|
79
|
+
- `xhs comment` / `xhs delete-comment` 评论/删除评论
|
|
80
|
+
- `xhs follow` / `xhs unfollow` 关注/取消关注用户
|
|
81
|
+
|
|
82
|
+
### 当前未纳入发布命令面
|
|
83
|
+
|
|
84
|
+
以下能力当前不纳入本 release 的默认命令面:
|
|
85
|
+
|
|
86
|
+
- `xhs login --browser` 浏览器方式登录
|
|
87
|
+
- `xhs login --qrcode` 浏览器辅助二维码登录
|
|
88
|
+
- `xhs sub-comments` 获取子评论
|
|
89
|
+
- `xhs reply` 回复评论
|
|
90
|
+
- `xhs post` 发布笔记
|
|
91
|
+
- `xhs delete` 删除笔记
|
|
92
|
+
- `xhs user` 获取用户信息
|
|
93
|
+
- `xhs user-posts` 获取用户笔记
|
|
94
|
+
- `xhs favorites` 获取收藏笔记
|
|
95
|
+
- `xhs likes` 获取点赞笔记
|
|
96
|
+
- `xhs notifications` 获取通知
|
|
97
|
+
|
|
98
|
+
说明:
|
|
99
|
+
|
|
100
|
+
- 上述能力中,一部分是兼容/实验路径,另一部分已确认在当前 public web API 下不可稳定使用
|
|
101
|
+
- 它们当前不在 `xhs --help` 的默认命令列表中,也不应作为 Agent 的默认调用入口
|
|
102
|
+
|
|
103
|
+
### 安装
|
|
104
|
+
|
|
105
|
+
#### 方式 1:直接从本 fork 安装
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
uv tool install git+https://github.com/kyalpha313/xhs-cli-headless
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
或:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
pipx install git+https://github.com/kyalpha313/xhs-cli-headless
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
PyPI 发布后,也可以改为:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
uv tool install xhs-cli-headless
|
|
121
|
+
pipx install xhs-cli-headless
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
计划使用的 PyPI 包名为 `xhs-cli-headless`。
|
|
125
|
+
|
|
126
|
+
#### 方式 2:源码运行
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
git clone https://github.com/kyalpha313/xhs-cli-headless.git
|
|
130
|
+
cd xhs-cli-headless
|
|
131
|
+
uv sync
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 快速开始
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# 1) 推荐:直接登录(默认就是 headless 二维码 + 终端二维码 + 登录链接)
|
|
138
|
+
xhs login
|
|
139
|
+
|
|
140
|
+
# 2) 检查登录态
|
|
141
|
+
xhs status --yaml
|
|
142
|
+
xhs auth doctor --yaml
|
|
143
|
+
xhs auth inspect --yaml
|
|
144
|
+
|
|
145
|
+
# 3) 核心只读命令
|
|
146
|
+
xhs search "小红书" --yaml
|
|
147
|
+
xhs read <note_id_or_url> --yaml
|
|
148
|
+
xhs comments <note_id_or_url> --yaml
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 认证方式
|
|
152
|
+
|
|
153
|
+
当前对外推荐的认证方式:
|
|
154
|
+
|
|
155
|
+
- 默认推荐:`xhs login`
|
|
156
|
+
- 默认 headless 二维码登录,包含终端二维码和登录链接
|
|
157
|
+
- 显式指定纯 HTTP 二维码:`xhs login --qrcode-http`
|
|
158
|
+
- 与默认 `xhs login` 属于同一路径
|
|
159
|
+
- 导入已有登录态:`xhs auth import --file cookies.json`
|
|
160
|
+
- 适合从其他环境迁移已验证 cookies
|
|
161
|
+
- 从浏览器/F12 粘贴关键字段:`xhs auth import-fields --interactive`
|
|
162
|
+
- 适合在用户本机浏览器完成登录后,把关键 cookies 字段带回服务器
|
|
163
|
+
|
|
164
|
+
说明:
|
|
165
|
+
|
|
166
|
+
- `xhs status`、`xhs whoami`、`xhs read` 等命令默认只使用本地已保存登录态
|
|
167
|
+
- 若当前没有有效登录态,请先执行 `xhs login` 或 `xhs auth import --file cookies.json`
|
|
168
|
+
- 如果 `xhs login` 在扫码确认后触发额外验证码,请参考 [browser-cookie-recovery.md](file:///Users/bytedance/Documents/Trae/xhs-cli-headless/docs/browser-cookie-recovery.md)
|
|
169
|
+
|
|
170
|
+
辅助命令:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
xhs auth doctor
|
|
174
|
+
xhs auth inspect
|
|
175
|
+
xhs auth import --file cookies.json
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### 常用命令
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Auth
|
|
182
|
+
xhs login
|
|
183
|
+
xhs login --qrcode-http
|
|
184
|
+
xhs status
|
|
185
|
+
xhs whoami
|
|
186
|
+
xhs auth doctor
|
|
187
|
+
xhs auth inspect
|
|
188
|
+
xhs auth import --file cookies.json
|
|
189
|
+
xhs auth import-fields --interactive
|
|
190
|
+
xhs logout
|
|
191
|
+
|
|
192
|
+
# Search / Reading
|
|
193
|
+
xhs search "美食"
|
|
194
|
+
xhs search-user "用户关键词"
|
|
195
|
+
xhs topics "旅行"
|
|
196
|
+
xhs feed
|
|
197
|
+
xhs hot
|
|
198
|
+
xhs read <note_id_or_url>
|
|
199
|
+
xhs comments <note_id_or_url>
|
|
200
|
+
|
|
201
|
+
# Interactions
|
|
202
|
+
xhs like <note_id_or_url>
|
|
203
|
+
xhs like <note_id_or_url> --undo
|
|
204
|
+
xhs favorite <note_id_or_url>
|
|
205
|
+
xhs unfavorite <note_id_or_url>
|
|
206
|
+
xhs comment <note_id_or_url> -c "好赞"
|
|
207
|
+
xhs delete-comment <note_id> <comment_id>
|
|
208
|
+
xhs follow <user_id>
|
|
209
|
+
xhs unfollow <user_id>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### 登录恢复
|
|
213
|
+
|
|
214
|
+
如果 `xhs login` 在扫码确认后仍被平台要求额外验证码:
|
|
215
|
+
|
|
216
|
+
- 优先在你自己的浏览器里完成验证
|
|
217
|
+
- 然后使用 `xhs auth import-fields --interactive`
|
|
218
|
+
- 详细步骤见 [browser-cookie-recovery.md](file:///Users/bytedance/Documents/Trae/xhs-cli-headless/docs/browser-cookie-recovery.md)
|
|
219
|
+
|
|
220
|
+
### 结构化输出
|
|
221
|
+
|
|
222
|
+
所有命令都支持:
|
|
223
|
+
|
|
224
|
+
- `--yaml`
|
|
225
|
+
- `--json`
|
|
226
|
+
|
|
227
|
+
非 TTY 输出默认会偏向结构化格式,适合脚本和 Agent 使用。
|
|
228
|
+
|
|
229
|
+
统一 envelope 见 [SCHEMA.md](./SCHEMA.md)。
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
uv sync
|
|
233
|
+
uv run pytest tests/ -v
|
|
234
|
+
uv run pytest -m smoke tests/test_smoke.py -q
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## License
|
|
238
|
+
|
|
239
|
+
Apache-2.0
|