myuri 3.0.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.
- myuri-3.0.4/.gitignore +1 -0
- myuri-3.0.4/LICENSE +165 -0
- myuri-3.0.4/NOTICE +44 -0
- myuri-3.0.4/PKG-INFO +104 -0
- myuri-3.0.4/README.md +79 -0
- myuri-3.0.4/pyproject.toml +39 -0
- myuri-3.0.4/src/myuri/__init__.py +73 -0
- myuri-3.0.4/src/myuri/cursor.py +924 -0
- myuri-3.0.4/src/myuri/drivers/__init__.py +13 -0
- myuri-3.0.4/src/myuri/drivers/base.py +219 -0
- myuri-3.0.4/src/myuri/drivers/cdp.py +105 -0
- myuri-3.0.4/src/myuri/drivers/playwright.py +72 -0
- myuri-3.0.4/src/myuri/geometry.py +249 -0
- myuri-3.0.4/src/myuri/motion/__init__.py +15 -0
- myuri-3.0.4/src/myuri/motion/click_model.py +63 -0
- myuri-3.0.4/src/myuri/motion/scroll_model.py +433 -0
- myuri-3.0.4/src/myuri/motion/wheel_model.py +164 -0
- myuri-3.0.4/src/myuri/options.py +135 -0
- myuri-3.0.4/src/myuri/page.py +120 -0
- myuri-3.0.4/src/myuri/profile.py +88 -0
- myuri-3.0.4/src/myuri/rng.py +83 -0
- myuri-3.0.4/src/myuri/settings.py +141 -0
- myuri-3.0.4/src/myuri/types.py +72 -0
- myuri-3.0.4/src/myuri/typing_engine/__init__.py +35 -0
- myuri-3.0.4/src/myuri/typing_engine/bigrams.py +24 -0
- myuri-3.0.4/src/myuri/typing_engine/config.py +26 -0
- myuri-3.0.4/src/myuri/typing_engine/keyboard.py +93 -0
- myuri-3.0.4/src/myuri/typing_engine/language.py +72 -0
- myuri-3.0.4/src/myuri/typing_engine/markov.py +267 -0
- myuri-3.0.4/src/myuri/typing_engine/timing.py +371 -0
- myuri-3.0.4/src/myuri/typing_engine/typer.py +214 -0
- myuri-3.0.4/tests/test_click.py +20 -0
- myuri-3.0.4/tests/test_core.py +63 -0
- myuri-3.0.4/tests/test_ergonomics.py +28 -0
- myuri-3.0.4/tests/test_integration.py +239 -0
- myuri-3.0.4/tests/test_packaging.py +18 -0
- myuri-3.0.4/tests/test_profile.py +81 -0
- myuri-3.0.4/tests/test_typing.py +316 -0
- myuri-3.0.4/tests/test_wheel.py +47 -0
myuri-3.0.4/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uv.lock
|
myuri-3.0.4/LICENSE
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
myuri-3.0.4/NOTICE
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
myuri
|
|
2
|
+
=====
|
|
3
|
+
|
|
4
|
+
Human-like browser cursor, keyboard, and scroll simulation.
|
|
5
|
+
© Jake Writer, licensed under the GNU Lesser General Public License v3.0 or
|
|
6
|
+
later (see LICENSE).
|
|
7
|
+
|
|
8
|
+
Mouse trajectories
|
|
9
|
+
------------------
|
|
10
|
+
|
|
11
|
+
myuri does not generate mouse paths itself. It depends on, and does not
|
|
12
|
+
redistribute, the following packages:
|
|
13
|
+
|
|
14
|
+
- cursory (Python), https://github.com/Vinyzu/cursory
|
|
15
|
+
© Vinyzu. Dual-licensed under LGPLv3-or-later and GPLv3-or-later.
|
|
16
|
+
|
|
17
|
+
- cursory-js (TypeScript), https://github.com/JWriter20/cursory-js
|
|
18
|
+
A port of cursory. © Jake Writer, LGPLv3-or-later.
|
|
19
|
+
|
|
20
|
+
Both ship cursory's recorded-trajectory database, whose recordings the
|
|
21
|
+
original author credits to:
|
|
22
|
+
|
|
23
|
+
- Margit Antal, Norbert Fejer and Krisztian Buza, for SapiMouse
|
|
24
|
+
(https://ieeexplore.ieee.org/document/9465583)
|
|
25
|
+
- MIMIC-LOGICS, for Mouse-Synthesizer
|
|
26
|
+
(https://github.com/MIMIC-LOGICS/Mouse-Synthesizer)
|
|
27
|
+
|
|
28
|
+
Typing rhythm
|
|
29
|
+
-------------
|
|
30
|
+
|
|
31
|
+
js/src/typing/bigrams.ts and python/src/myuri/typing_engine/bigrams.py embed
|
|
32
|
+
a table derived from english_bigrams.txt in John Burkardt's NGRAMS dataset
|
|
33
|
+
(https://people.sc.fsu.edu/~jburkardt/datasets/ngrams/ngrams.html),
|
|
34
|
+
distributed under the GNU LGPL. scripts/gen_bigrams.py regenerates the table
|
|
35
|
+
from that file.
|
|
36
|
+
|
|
37
|
+
Typing rhythm
|
|
38
|
+
-------------
|
|
39
|
+
|
|
40
|
+
js/src/typing/bigrams.ts and python/src/myuri/typing_engine/bigrams.py embed
|
|
41
|
+
a table derived from english_bigrams.txt in John Burkardt's NGRAMS dataset
|
|
42
|
+
(https://people.sc.fsu.edu/~jburkardt/datasets/ngrams/ngrams.html),
|
|
43
|
+
distributed under the GNU LGPL. scripts/gen_bigrams.py regenerates the table
|
|
44
|
+
from that file.
|
myuri-3.0.4/PKG-INFO
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: myuri
|
|
3
|
+
Version: 3.0.4
|
|
4
|
+
Summary: API-agnostic human-like browser cursor, keyboard, and scroll simulation. Bring your own driver (Playwright, CDP, or custom).
|
|
5
|
+
Project-URL: Homepage, https://github.com/JWriter20/Myuri
|
|
6
|
+
Project-URL: Issues, https://github.com/JWriter20/Myuri/issues
|
|
7
|
+
Author: Jake Writer
|
|
8
|
+
License-Expression: LGPL-3.0-or-later
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: NOTICE
|
|
11
|
+
Keywords: anti-detection,automation,cdp,cursor,human-like,mouse,playwright,scroll,typing
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Requires-Dist: cursory<3,>=2.0.1
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: mypy>=1.8; extra == 'dev'
|
|
18
|
+
Requires-Dist: playwright>=1.40; extra == 'dev'
|
|
19
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
20
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
21
|
+
Requires-Dist: ruff<0.16,>=0.5; extra == 'dev'
|
|
22
|
+
Provides-Extra: playwright
|
|
23
|
+
Requires-Dist: playwright>=1.40; extra == 'playwright'
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# myuri (Python)
|
|
27
|
+
|
|
28
|
+
Human-like browser **cursor, keyboard, and scroll** simulation — driver-agnostic.
|
|
29
|
+
|
|
30
|
+
`myuri` generates realistic mouse trajectories (recorded human motion via cursory), fitted
|
|
31
|
+
scroll dynamics, and Markov-model typing with natural errors and corrections. It does
|
|
32
|
+
not talk to a browser itself — you inject a small **Driver**, so it works with
|
|
33
|
+
Playwright, raw CDP, or any backend you can wrap.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install myuri # core
|
|
37
|
+
pip install "myuri[playwright]" # + the default Playwright driver
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick start (Playwright)
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from myuri import create_cursor
|
|
44
|
+
from playwright.async_api import async_playwright
|
|
45
|
+
|
|
46
|
+
async with async_playwright() as p:
|
|
47
|
+
page = await (await p.chromium.launch()).new_page()
|
|
48
|
+
await page.goto("https://example.com")
|
|
49
|
+
|
|
50
|
+
cursor = create_cursor(page, seed=1234) # PlaywrightDriver inferred
|
|
51
|
+
await cursor.move("#username")
|
|
52
|
+
await cursor.click("#username")
|
|
53
|
+
await cursor.type("hello@example.com")
|
|
54
|
+
await cursor.scroll("#footer")
|
|
55
|
+
await cursor.drag("#card", "#bin") # selectors or Vector points
|
|
56
|
+
await cursor.dispose()
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Bring your own driver
|
|
60
|
+
|
|
61
|
+
Subclass `myuri.Driver` (implement the input primitives + `evaluate`) or assemble one
|
|
62
|
+
from callables with `define_driver`:
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from myuri import create_cursor, define_driver
|
|
66
|
+
|
|
67
|
+
driver = define_driver(
|
|
68
|
+
move=my_move, click=my_click, down=my_down, up=my_up,
|
|
69
|
+
wheel=my_wheel, press=my_press, evaluate=my_evaluate,
|
|
70
|
+
)
|
|
71
|
+
cursor = create_cursor(driver, seed=1234)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`my_click(button, click_count)` should pass `click_count` through to the browser (2 and 3
|
|
75
|
+
continue a double/triple click). `clear_existing` triple-clicks to select a field's text,
|
|
76
|
+
so a click that ignores it can't clear fields.
|
|
77
|
+
|
|
78
|
+
`evaluate(js, arg)` receives a JS arrow-function *source string* and one
|
|
79
|
+
JSON-serializable argument, and must run it in the page and return the result — the
|
|
80
|
+
same contract as Playwright's `page.evaluate`.
|
|
81
|
+
|
|
82
|
+
### Prebuilt wrappers
|
|
83
|
+
|
|
84
|
+
`from_playwright` / `from_cdp` turn a page into a driver, so you can construct directly:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from myuri import create_cursor, from_playwright, from_cdp
|
|
88
|
+
|
|
89
|
+
cursor = create_cursor(from_playwright(page), seed=1234)
|
|
90
|
+
# or dispatch mouse input over CDP on a Chromium page:
|
|
91
|
+
cursor = create_cursor(from_cdp(page), seed=1234)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Determinism
|
|
95
|
+
|
|
96
|
+
Seeded Mulberry32 PRNG — the **same seed produces the same numbers as the TypeScript
|
|
97
|
+
package**. Pass `seed=` to reproduce motion, scrolls, and typing rhythm; read it back
|
|
98
|
+
with `cursor.get_seed()`.
|
|
99
|
+
|
|
100
|
+
Part of the [Myuri](https://github.com/JWriter20/Myuri) project (TypeScript + Python).
|
|
101
|
+
Mouse trajectories come from [cursory](https://github.com/Vinyzu/cursory) by
|
|
102
|
+
[Vinyzu](https://github.com/Vinyzu/). Requires Python 3.11+ (cursory's minimum).
|
|
103
|
+
|
|
104
|
+
Licensed under the [GNU LGPL v3 or later](https://github.com/JWriter20/Myuri/blob/main/LICENSE). See [`NOTICE`](https://github.com/JWriter20/Myuri/blob/main/NOTICE) for credits.
|
myuri-3.0.4/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# myuri (Python)
|
|
2
|
+
|
|
3
|
+
Human-like browser **cursor, keyboard, and scroll** simulation — driver-agnostic.
|
|
4
|
+
|
|
5
|
+
`myuri` generates realistic mouse trajectories (recorded human motion via cursory), fitted
|
|
6
|
+
scroll dynamics, and Markov-model typing with natural errors and corrections. It does
|
|
7
|
+
not talk to a browser itself — you inject a small **Driver**, so it works with
|
|
8
|
+
Playwright, raw CDP, or any backend you can wrap.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install myuri # core
|
|
12
|
+
pip install "myuri[playwright]" # + the default Playwright driver
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick start (Playwright)
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from myuri import create_cursor
|
|
19
|
+
from playwright.async_api import async_playwright
|
|
20
|
+
|
|
21
|
+
async with async_playwright() as p:
|
|
22
|
+
page = await (await p.chromium.launch()).new_page()
|
|
23
|
+
await page.goto("https://example.com")
|
|
24
|
+
|
|
25
|
+
cursor = create_cursor(page, seed=1234) # PlaywrightDriver inferred
|
|
26
|
+
await cursor.move("#username")
|
|
27
|
+
await cursor.click("#username")
|
|
28
|
+
await cursor.type("hello@example.com")
|
|
29
|
+
await cursor.scroll("#footer")
|
|
30
|
+
await cursor.drag("#card", "#bin") # selectors or Vector points
|
|
31
|
+
await cursor.dispose()
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Bring your own driver
|
|
35
|
+
|
|
36
|
+
Subclass `myuri.Driver` (implement the input primitives + `evaluate`) or assemble one
|
|
37
|
+
from callables with `define_driver`:
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from myuri import create_cursor, define_driver
|
|
41
|
+
|
|
42
|
+
driver = define_driver(
|
|
43
|
+
move=my_move, click=my_click, down=my_down, up=my_up,
|
|
44
|
+
wheel=my_wheel, press=my_press, evaluate=my_evaluate,
|
|
45
|
+
)
|
|
46
|
+
cursor = create_cursor(driver, seed=1234)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`my_click(button, click_count)` should pass `click_count` through to the browser (2 and 3
|
|
50
|
+
continue a double/triple click). `clear_existing` triple-clicks to select a field's text,
|
|
51
|
+
so a click that ignores it can't clear fields.
|
|
52
|
+
|
|
53
|
+
`evaluate(js, arg)` receives a JS arrow-function *source string* and one
|
|
54
|
+
JSON-serializable argument, and must run it in the page and return the result — the
|
|
55
|
+
same contract as Playwright's `page.evaluate`.
|
|
56
|
+
|
|
57
|
+
### Prebuilt wrappers
|
|
58
|
+
|
|
59
|
+
`from_playwright` / `from_cdp` turn a page into a driver, so you can construct directly:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from myuri import create_cursor, from_playwright, from_cdp
|
|
63
|
+
|
|
64
|
+
cursor = create_cursor(from_playwright(page), seed=1234)
|
|
65
|
+
# or dispatch mouse input over CDP on a Chromium page:
|
|
66
|
+
cursor = create_cursor(from_cdp(page), seed=1234)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Determinism
|
|
70
|
+
|
|
71
|
+
Seeded Mulberry32 PRNG — the **same seed produces the same numbers as the TypeScript
|
|
72
|
+
package**. Pass `seed=` to reproduce motion, scrolls, and typing rhythm; read it back
|
|
73
|
+
with `cursor.get_seed()`.
|
|
74
|
+
|
|
75
|
+
Part of the [Myuri](https://github.com/JWriter20/Myuri) project (TypeScript + Python).
|
|
76
|
+
Mouse trajectories come from [cursory](https://github.com/Vinyzu/cursory) by
|
|
77
|
+
[Vinyzu](https://github.com/Vinyzu/). Requires Python 3.11+ (cursory's minimum).
|
|
78
|
+
|
|
79
|
+
Licensed under the [GNU LGPL v3 or later](https://github.com/JWriter20/Myuri/blob/main/LICENSE). See [`NOTICE`](https://github.com/JWriter20/Myuri/blob/main/NOTICE) for credits.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "myuri"
|
|
7
|
+
version = "3.0.4"
|
|
8
|
+
description = "API-agnostic human-like browser cursor, keyboard, and scroll simulation. Bring your own driver (Playwright, CDP, or custom)."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "LGPL-3.0-or-later"
|
|
11
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
12
|
+
authors = [{ name = "Jake Writer" }]
|
|
13
|
+
requires-python = ">=3.11"
|
|
14
|
+
keywords = ["playwright", "cdp", "automation", "human-like", "mouse", "cursor", "typing", "scroll", "anti-detection"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
dependencies = ["cursory>=2.0.1,<3"]
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
playwright = ["playwright>=1.40"]
|
|
23
|
+
dev = ["pytest>=8", "pytest-asyncio>=0.23", "playwright>=1.40", "mypy>=1.8", "ruff>=0.5,<0.16"]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/JWriter20/Myuri"
|
|
27
|
+
Issues = "https://github.com/JWriter20/Myuri/issues"
|
|
28
|
+
|
|
29
|
+
[tool.hatch.build.targets.wheel]
|
|
30
|
+
packages = ["src/myuri"]
|
|
31
|
+
|
|
32
|
+
[tool.pytest.ini_options]
|
|
33
|
+
asyncio_mode = "auto"
|
|
34
|
+
testpaths = ["tests"]
|
|
35
|
+
pythonpath = ["src"]
|
|
36
|
+
|
|
37
|
+
[tool.ruff]
|
|
38
|
+
line-length = 100
|
|
39
|
+
target-version = "py39"
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""myuri — API-agnostic human-like browser cursor, keyboard, and scroll.
|
|
2
|
+
|
|
3
|
+
Bring your own driver (Playwright by default, or any backend that can dispatch
|
|
4
|
+
input and run JS in the page). The simulation core (trajectories, scroll model,
|
|
5
|
+
Markov typing, seeded RNG) is pure and shared with the TypeScript package.
|
|
6
|
+
"""
|
|
7
|
+
import importlib.metadata as _metadata
|
|
8
|
+
from .cursor import Cursor, create_cursor
|
|
9
|
+
from .drivers import (
|
|
10
|
+
CdpDriver,
|
|
11
|
+
Driver,
|
|
12
|
+
PlaywrightDriver,
|
|
13
|
+
define_driver,
|
|
14
|
+
driver_from_page,
|
|
15
|
+
from_cdp,
|
|
16
|
+
from_playwright,
|
|
17
|
+
)
|
|
18
|
+
from .geometry import get_better_starting_position, get_random_box_point, path
|
|
19
|
+
from .options import (
|
|
20
|
+
ClickOptions,
|
|
21
|
+
DragOptions,
|
|
22
|
+
MoveOptions,
|
|
23
|
+
MoveToOptions,
|
|
24
|
+
RandomMoveOptions,
|
|
25
|
+
ScrollOptions,
|
|
26
|
+
TypeOptions,
|
|
27
|
+
)
|
|
28
|
+
from .profile import profile_from_seed
|
|
29
|
+
from .rng import SeededRng, gaussian, generate_random_seed, make_rng
|
|
30
|
+
from .settings import MyuriSettings, default_settings, resolve_settings
|
|
31
|
+
from .types import BoundingBox, TimedVector, Vector, ViewportSize
|
|
32
|
+
from .typing_engine.typer import HumanTyper, TyperInput
|
|
33
|
+
|
|
34
|
+
try:
|
|
35
|
+
__version__ = _metadata.version("myuri")
|
|
36
|
+
except _metadata.PackageNotFoundError: # running from a source checkout
|
|
37
|
+
__version__ = "0.0.0"
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
"Cursor",
|
|
41
|
+
"create_cursor",
|
|
42
|
+
"Driver",
|
|
43
|
+
"PlaywrightDriver",
|
|
44
|
+
"CdpDriver",
|
|
45
|
+
"define_driver",
|
|
46
|
+
"driver_from_page",
|
|
47
|
+
"from_playwright",
|
|
48
|
+
"from_cdp",
|
|
49
|
+
"HumanTyper",
|
|
50
|
+
"TyperInput",
|
|
51
|
+
"Vector",
|
|
52
|
+
"BoundingBox",
|
|
53
|
+
"TimedVector",
|
|
54
|
+
"ViewportSize",
|
|
55
|
+
"make_rng",
|
|
56
|
+
"SeededRng",
|
|
57
|
+
"gaussian",
|
|
58
|
+
"generate_random_seed",
|
|
59
|
+
"MyuriSettings",
|
|
60
|
+
"default_settings",
|
|
61
|
+
"resolve_settings",
|
|
62
|
+
"profile_from_seed",
|
|
63
|
+
"path",
|
|
64
|
+
"get_random_box_point",
|
|
65
|
+
"get_better_starting_position",
|
|
66
|
+
"MoveOptions",
|
|
67
|
+
"ClickOptions",
|
|
68
|
+
"DragOptions",
|
|
69
|
+
"MoveToOptions",
|
|
70
|
+
"ScrollOptions",
|
|
71
|
+
"TypeOptions",
|
|
72
|
+
"RandomMoveOptions",
|
|
73
|
+
]
|