thespis 0.1.0b1__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.
- thespis-0.1.0b1/.dockerignore +47 -0
- thespis-0.1.0b1/.github/workflows/publish.yml +31 -0
- thespis-0.1.0b1/.gitignore +207 -0
- thespis-0.1.0b1/.pre-commit-config.yaml +12 -0
- thespis-0.1.0b1/Dockerfile +46 -0
- thespis-0.1.0b1/LICENSE +21 -0
- thespis-0.1.0b1/Makefile +31 -0
- thespis-0.1.0b1/PKG-INFO +135 -0
- thespis-0.1.0b1/README.md +108 -0
- thespis-0.1.0b1/assets/thespis.png +0 -0
- thespis-0.1.0b1/docker-compose.yml +13 -0
- thespis-0.1.0b1/docker-entrypoint.sh +29 -0
- thespis-0.1.0b1/pyproject.toml +48 -0
- thespis-0.1.0b1/thespis/__init__.py +4 -0
- thespis-0.1.0b1/thespis/js/chrome_app.js +79 -0
- thespis-0.1.0b1/thespis/js/console_cdp.js +50 -0
- thespis-0.1.0b1/thespis/js/devtools.js +142 -0
- thespis-0.1.0b1/thespis/js/early_worker.js +57 -0
- thespis-0.1.0b1/thespis/js/headless_fixes.js +126 -0
- thespis-0.1.0b1/thespis/js/offscreen_canvas.js +68 -0
- thespis-0.1.0b1/thespis/js/permissions.js +12 -0
- thespis-0.1.0b1/thespis/js/screen.js +48 -0
- thespis-0.1.0b1/thespis/js/stack_trace.js +41 -0
- thespis-0.1.0b1/thespis/js/user_agent.js +85 -0
- thespis-0.1.0b1/thespis/js/utils.js +81 -0
- thespis-0.1.0b1/thespis/js/webdriver.js +46 -0
- thespis-0.1.0b1/thespis/js/webgl.js +61 -0
- thespis-0.1.0b1/thespis/js/worker.js +70 -0
- thespis-0.1.0b1/thespis/stealth.py +93 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
*.egg-info/
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
*.egg
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
venv/
|
|
14
|
+
env/
|
|
15
|
+
ENV/
|
|
16
|
+
|
|
17
|
+
# IDE
|
|
18
|
+
.vscode/
|
|
19
|
+
.idea/
|
|
20
|
+
*.swp
|
|
21
|
+
*.swo
|
|
22
|
+
*~
|
|
23
|
+
|
|
24
|
+
# OS
|
|
25
|
+
.DS_Store
|
|
26
|
+
Thumbs.db
|
|
27
|
+
|
|
28
|
+
# Outputs
|
|
29
|
+
screenshots/
|
|
30
|
+
*.png
|
|
31
|
+
*.jpg
|
|
32
|
+
*.webp
|
|
33
|
+
|
|
34
|
+
# Git
|
|
35
|
+
.git/
|
|
36
|
+
.gitignore
|
|
37
|
+
|
|
38
|
+
# Documentation (ya está en la imagen)
|
|
39
|
+
HEADLESS_GUIDE.md
|
|
40
|
+
|
|
41
|
+
# Tests outputs
|
|
42
|
+
.pytest_cache/
|
|
43
|
+
htmlcov/
|
|
44
|
+
.coverage
|
|
45
|
+
|
|
46
|
+
# Logs
|
|
47
|
+
*.log
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Set up Python 3
|
|
15
|
+
uses: actions/setup-python@v4
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.x"
|
|
18
|
+
|
|
19
|
+
- name: Install build dependencies
|
|
20
|
+
run: |
|
|
21
|
+
pip install --upgrade pip
|
|
22
|
+
pip install --upgrade build twine
|
|
23
|
+
|
|
24
|
+
- name: Build package
|
|
25
|
+
run: python -m build
|
|
26
|
+
|
|
27
|
+
- name: Publish to PyPI
|
|
28
|
+
env:
|
|
29
|
+
TWINE_USERNAME: __token__
|
|
30
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
31
|
+
run: twine upload dist/*
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
FROM python:3.11-slim
|
|
2
|
+
|
|
3
|
+
RUN apt-get update && apt-get install -y \
|
|
4
|
+
xvfb \
|
|
5
|
+
x11-xkb-utils \
|
|
6
|
+
xfonts-100dpi \
|
|
7
|
+
xfonts-75dpi \
|
|
8
|
+
xfonts-scalable \
|
|
9
|
+
xfonts-cyrillic \
|
|
10
|
+
wget \
|
|
11
|
+
gnupg \
|
|
12
|
+
ca-certificates \
|
|
13
|
+
fonts-liberation \
|
|
14
|
+
libasound2 \
|
|
15
|
+
libatk-bridge2.0-0 \
|
|
16
|
+
libatk1.0-0 \
|
|
17
|
+
libatspi2.0-0 \
|
|
18
|
+
libcups2 \
|
|
19
|
+
libdbus-1-3 \
|
|
20
|
+
libdrm2 \
|
|
21
|
+
libgbm1 \
|
|
22
|
+
libgtk-3-0 \
|
|
23
|
+
libnspr4 \
|
|
24
|
+
libnss3 \
|
|
25
|
+
libwayland-client0 \
|
|
26
|
+
libxcomposite1 \
|
|
27
|
+
libxdamage1 \
|
|
28
|
+
libxfixes3 \
|
|
29
|
+
libxkbcommon0 \
|
|
30
|
+
libxrandr2 \
|
|
31
|
+
xdg-utils \
|
|
32
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
33
|
+
|
|
34
|
+
RUN pip install --no-cache-dir playwright
|
|
35
|
+
|
|
36
|
+
RUN playwright install chromium
|
|
37
|
+
RUN playwright install-deps chromium
|
|
38
|
+
|
|
39
|
+
WORKDIR /app
|
|
40
|
+
|
|
41
|
+
ENV DISPLAY=:99
|
|
42
|
+
|
|
43
|
+
COPY docker-entrypoint-exec.sh /entrypoint.sh
|
|
44
|
+
RUN chmod +x /entrypoint.sh
|
|
45
|
+
|
|
46
|
+
ENTRYPOINT ["/entrypoint.sh"]
|
thespis-0.1.0b1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jalil SA
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
thespis-0.1.0b1/Makefile
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Makefile for Thespis development
|
|
2
|
+
|
|
3
|
+
.PHONY: help install format check clean
|
|
4
|
+
|
|
5
|
+
help:
|
|
6
|
+
@echo "Available commands:"
|
|
7
|
+
@echo " make install - Install dev dependencies"
|
|
8
|
+
@echo " make format - Format code with black and isort"
|
|
9
|
+
@echo " make check - Check code formatting"
|
|
10
|
+
@echo " make clean - Clean build artifacts"
|
|
11
|
+
|
|
12
|
+
install:
|
|
13
|
+
pip install -e ".[dev]"
|
|
14
|
+
playwright install chromium
|
|
15
|
+
pre-commit install
|
|
16
|
+
|
|
17
|
+
format:
|
|
18
|
+
black thespis/
|
|
19
|
+
isort thespis/
|
|
20
|
+
|
|
21
|
+
check:
|
|
22
|
+
black thespis/ --check
|
|
23
|
+
isort thespis/ --check-only
|
|
24
|
+
pre-commit run --all-files
|
|
25
|
+
|
|
26
|
+
clean:
|
|
27
|
+
rm -rf build/
|
|
28
|
+
rm -rf dist/
|
|
29
|
+
rm -rf *.egg-info
|
|
30
|
+
find . -type d -name __pycache__ -exec rm -rf {} +
|
|
31
|
+
find . -type f -name "*.pyc" -delete
|
thespis-0.1.0b1/PKG-INFO
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: thespis
|
|
3
|
+
Version: 0.1.0b1
|
|
4
|
+
Summary: Anti-detection plugin for Playwright automation
|
|
5
|
+
Project-URL: Homepage, https://github.com/jxlil/thespis
|
|
6
|
+
Author: Jalil SA
|
|
7
|
+
License: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: automation,bot-detection,playwright,stealth,web-scraping
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Topic :: Software Development :: Testing
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Requires-Dist: playwright>=1.30.0
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: black>=23.0.0; extra == 'dev'
|
|
23
|
+
Requires-Dist: isort>=5.12.0; extra == 'dev'
|
|
24
|
+
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# Thespis
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<img src="assets/thespis.png" width="150" height="150" alt="Thespis" />
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
<p align="center">
|
|
35
|
+
<img src="https://img.shields.io/badge/status-beta-orange" alt="Beta">
|
|
36
|
+
<img src="https://img.shields.io/badge/python-3.8+-blue" alt="Python">
|
|
37
|
+
<img src="https://img.shields.io/badge/license-MIT-green" alt="License">
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
<p align="center">
|
|
41
|
+
<strong>Make Playwright automation undetectable</strong>
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
> **Note:** This project is currently in beta. Features are stable but may change based on feedback.
|
|
45
|
+
|
|
46
|
+
## Why Use Thespis?
|
|
47
|
+
|
|
48
|
+
Websites detect Playwright because of `navigator.webdriver` and other automation signals.
|
|
49
|
+
|
|
50
|
+
**Results:** Tested against [CreepJS](https://abrahamjuliot.github.io/creepjs/):
|
|
51
|
+
|
|
52
|
+
| Metric | Real Browser | With Thespis | Without Thespis |
|
|
53
|
+
| ----------------------- | ------------ | ------------ | --------------- |
|
|
54
|
+
| **Like Headless** | 25% | **31%** | 44% |
|
|
55
|
+
| **Headless Detection** | 0% | **0%** | 33% |
|
|
56
|
+
|
|
57
|
+
## Quick Start
|
|
58
|
+
|
|
59
|
+
### Basic Example (Sync)
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from playwright.sync_api import sync_playwright
|
|
63
|
+
from thespis import stealth_sync
|
|
64
|
+
|
|
65
|
+
with sync_playwright() as p:
|
|
66
|
+
# Launch browser with special flag (REQUIRED!)
|
|
67
|
+
browser = p.chromium.launch(
|
|
68
|
+
headless=False,
|
|
69
|
+
args=['--disable-blink-features=AutomationControlled']
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# Create page and apply stealth
|
|
73
|
+
page = browser.new_page()
|
|
74
|
+
stealth_sync(page)
|
|
75
|
+
|
|
76
|
+
page.goto("https://bot.sannysoft.com")
|
|
77
|
+
page.screenshot(path="test.png")
|
|
78
|
+
|
|
79
|
+
browser.close()
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Important: Required Flag
|
|
83
|
+
|
|
84
|
+
**This flag is CRITICAL:**
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
args=['--disable-blink-features=AutomationControlled']
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Without it, `navigator.webdriver` stays `true` and detection fails.
|
|
91
|
+
|
|
92
|
+
## Docker (Production)
|
|
93
|
+
|
|
94
|
+
For servers without displays, use Docker with Xvfb:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Build image
|
|
98
|
+
docker-compose build
|
|
99
|
+
|
|
100
|
+
# Run test script
|
|
101
|
+
docker-compose run --rm thespis
|
|
102
|
+
|
|
103
|
+
# Run your own script
|
|
104
|
+
docker-compose run --rm thespis python your_script.py
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Why Docker?**
|
|
108
|
+
|
|
109
|
+
- Runs `headless=False` on servers (31% detection score)
|
|
110
|
+
- No visible windows (uses virtual display)
|
|
111
|
+
|
|
112
|
+
### Recommended Full Configuration
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
# Launch browser
|
|
116
|
+
browser = p.chromium.launch(
|
|
117
|
+
headless=False,
|
|
118
|
+
args=[
|
|
119
|
+
'--disable-blink-features=AutomationControlled',
|
|
120
|
+
'--disable-dev-shm-usage',
|
|
121
|
+
'--no-sandbox',
|
|
122
|
+
]
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
# Create realistic context
|
|
126
|
+
context = browser.new_context(
|
|
127
|
+
viewport={'width': 1366, 'height': 768},
|
|
128
|
+
user_agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
|
|
129
|
+
locale='en-US',
|
|
130
|
+
timezone_id='America/New_York',
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
page = context.new_page()
|
|
134
|
+
stealth_sync(page)
|
|
135
|
+
```
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Thespis
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="assets/thespis.png" width="150" height="150" alt="Thespis" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src="https://img.shields.io/badge/status-beta-orange" alt="Beta">
|
|
9
|
+
<img src="https://img.shields.io/badge/python-3.8+-blue" alt="Python">
|
|
10
|
+
<img src="https://img.shields.io/badge/license-MIT-green" alt="License">
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<strong>Make Playwright automation undetectable</strong>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
> **Note:** This project is currently in beta. Features are stable but may change based on feedback.
|
|
18
|
+
|
|
19
|
+
## Why Use Thespis?
|
|
20
|
+
|
|
21
|
+
Websites detect Playwright because of `navigator.webdriver` and other automation signals.
|
|
22
|
+
|
|
23
|
+
**Results:** Tested against [CreepJS](https://abrahamjuliot.github.io/creepjs/):
|
|
24
|
+
|
|
25
|
+
| Metric | Real Browser | With Thespis | Without Thespis |
|
|
26
|
+
| ----------------------- | ------------ | ------------ | --------------- |
|
|
27
|
+
| **Like Headless** | 25% | **31%** | 44% |
|
|
28
|
+
| **Headless Detection** | 0% | **0%** | 33% |
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### Basic Example (Sync)
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from playwright.sync_api import sync_playwright
|
|
36
|
+
from thespis import stealth_sync
|
|
37
|
+
|
|
38
|
+
with sync_playwright() as p:
|
|
39
|
+
# Launch browser with special flag (REQUIRED!)
|
|
40
|
+
browser = p.chromium.launch(
|
|
41
|
+
headless=False,
|
|
42
|
+
args=['--disable-blink-features=AutomationControlled']
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
# Create page and apply stealth
|
|
46
|
+
page = browser.new_page()
|
|
47
|
+
stealth_sync(page)
|
|
48
|
+
|
|
49
|
+
page.goto("https://bot.sannysoft.com")
|
|
50
|
+
page.screenshot(path="test.png")
|
|
51
|
+
|
|
52
|
+
browser.close()
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Important: Required Flag
|
|
56
|
+
|
|
57
|
+
**This flag is CRITICAL:**
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
args=['--disable-blink-features=AutomationControlled']
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Without it, `navigator.webdriver` stays `true` and detection fails.
|
|
64
|
+
|
|
65
|
+
## Docker (Production)
|
|
66
|
+
|
|
67
|
+
For servers without displays, use Docker with Xvfb:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Build image
|
|
71
|
+
docker-compose build
|
|
72
|
+
|
|
73
|
+
# Run test script
|
|
74
|
+
docker-compose run --rm thespis
|
|
75
|
+
|
|
76
|
+
# Run your own script
|
|
77
|
+
docker-compose run --rm thespis python your_script.py
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Why Docker?**
|
|
81
|
+
|
|
82
|
+
- Runs `headless=False` on servers (31% detection score)
|
|
83
|
+
- No visible windows (uses virtual display)
|
|
84
|
+
|
|
85
|
+
### Recommended Full Configuration
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
# Launch browser
|
|
89
|
+
browser = p.chromium.launch(
|
|
90
|
+
headless=False,
|
|
91
|
+
args=[
|
|
92
|
+
'--disable-blink-features=AutomationControlled',
|
|
93
|
+
'--disable-dev-shm-usage',
|
|
94
|
+
'--no-sandbox',
|
|
95
|
+
]
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
# Create realistic context
|
|
99
|
+
context = browser.new_context(
|
|
100
|
+
viewport={'width': 1366, 'height': 768},
|
|
101
|
+
user_agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
|
|
102
|
+
locale='en-US',
|
|
103
|
+
timezone_id='America/New_York',
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
page = context.new_page()
|
|
107
|
+
stealth_sync(page)
|
|
108
|
+
```
|
|
Binary file
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
rm -f /tmp/.X99-lock /tmp/.X11-unix/X99
|
|
5
|
+
|
|
6
|
+
echo "Starting Xvfb..."
|
|
7
|
+
Xvfb :99 -screen 0 1920x1080x24 -ac &
|
|
8
|
+
XVFB_PID=$!
|
|
9
|
+
|
|
10
|
+
sleep 2
|
|
11
|
+
|
|
12
|
+
if ! kill -0 $XVFB_PID 2>/dev/null; then
|
|
13
|
+
echo "❌ Error: Xvfb failed to start"
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
echo "✅ Xvfb started (PID: $XVFB_PID)"
|
|
18
|
+
echo "📺 Display: $DISPLAY"
|
|
19
|
+
echo ""
|
|
20
|
+
|
|
21
|
+
cleanup() {
|
|
22
|
+
echo "🛑 Stopping Xvfb..."
|
|
23
|
+
kill $XVFB_PID 2>/dev/null || true
|
|
24
|
+
wait $XVFB_PID 2>/dev/null || true
|
|
25
|
+
rm -f /tmp/.X99-lock /tmp/.X11-unix/X99
|
|
26
|
+
}
|
|
27
|
+
trap cleanup EXIT INT TERM
|
|
28
|
+
|
|
29
|
+
exec "$@"
|