Use undetected-playwright-patch instead of playwright

This commit is contained in:
2024-07-12 22:24:13 +02:00
parent 5ebcb665c2
commit 51c64efd65
6 changed files with 1537 additions and 12 deletions

View File

@ -5,15 +5,16 @@
<div class="row">
<div class="col-lg-3">{% include "partials/toc.html" %}</div>
<div class="col-lg-9">
{% for org in orgs %}
{{ org }}
fsafa
{% endfor %}
{% include "partials/info_box.html" %}
{% include "partials/news.html" %}
{% for game in games %}
{% for org in orgs %}
<h2 id="org-{{ org|slugify }}">
<a href="#org-{{ org|slugify }}">{{ org }}</a>
</h2>
{% for game in org.games.all %}
{% include "partials/game_card.html" %}
{% endfor %}
{% endfor %}
</div>
</div>
</div>

View File

@ -6,10 +6,13 @@
href="#info-box">Information</a>
<a class="list-group-item list-group-item-action plain-text-item"
href="#game-list">Site news</a>
{% for game in games %}
{% for org in orgs %}
{{ org }}
{% for game in org.games.all %}
<a class="list-group-item list-group-item-action plain-text-item"
href="#game-{{ game.game_id }}">{{ game.display_name }}</a>
{% endfor %}
{% endfor %}
</div>
</div>
</div>

1480
poetry.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,39 @@
[tool.poetry]
name = "twitch-drop-notifier"
version = "0.1.0"
description = ""
authors = ["Joakim Hellsén <tlovinator@gmail.com>"]
readme = "README.md"
package-mode = false
[tool.poetry.dependencies]
python = "^3.12"
discord-webhook = "^1.3.1"
django = { version = "^5.1b1", allow-prereleases = true }
django-auto-prefetch = "^1.9.0"
django-debug-toolbar = "^4.4.6"
django-ninja = "^1.2.1"
django-simple-history = "^3.7.0"
hishel = "^0.0.29"
httpx = "^0.27.0"
pillow = "^10.4.0"
platformdirs = "^4.2.2"
python-dotenv = "^1.0.1"
sentry-sdk = { extras = ["django"], version = "^2.9.0" }
whitenoise = { extras = ["brotli"], version = "^6.7.0" }
undetected-playwright-patch = "^1.40.0.post1700587210000"
[tool.poetry.group.dev.dependencies]
djlint = "^1.34.1"
pre-commit = "^3.7.1"
pytest = "^8.2.2"
pytest-django = "^4.8.0"
ruff = "^0.5.1"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.ruff]
# https://docs.astral.sh/ruff/settings/
target-version = "py312"

View File

@ -8,7 +8,7 @@ hishel
httpx
pillow
platformdirs
playwright
python-dotenv
sentry-sdk[django]
undetected-playwright-patch
whitenoise[brotli]

View File

@ -160,6 +160,11 @@ class Command(BaseCommand):
self,
playwright: Playwright,
) -> list[dict[str, typing.Any]]:
args = []
# disable navigator.webdriver:true flag
args.append("--disable-blink-features=AutomationControlled")
profile_dir: Path = Path(data_dir / "chrome-profile")
profile_dir.mkdir(parents=True, exist_ok=True)
logger.debug(
@ -168,10 +173,10 @@ class Command(BaseCommand):
)
browser: BrowserContext = await playwright.chromium.launch_persistent_context(
channel="chrome",
user_data_dir=profile_dir,
headless=False,
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36", # noqa: E501
viewport={"width": 1920, "height": 1080},
args=args,
)
logger.debug("Launched Chrome browser")