Skip to content

Commit

Permalink
yt headless fix and generic startup pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jlplenio committed Apr 26, 2024
1 parent 75da3f7 commit a60bbe2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions ctvbot/sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ def todo_after_spawn(self):
self.page.evaluate(tosend)

self.goto_with_retry(self.target_url)
self.page.keyboard.press("t")

self.page.wait_for_selector(".ytd-player", timeout=30000)
self.page.wait_for_timeout(5000)
if self.page.evaluate("""document.querySelector("div#movie_player").classList.contains('paused-mode')"""):
self.page.keyboard.press("Space")
self.page.keyboard.press("f")
self.status = utils.InstanceStatus.INITIALIZED


Expand All @@ -182,7 +187,7 @@ def update_status(self):
pass

def todo_after_spawn(self):
self.goto_with_retry("https://kick.com/auth/login")
self.goto_with_retry("https://kick.com/terms-of-service")
self.page.wait_for_timeout(5000)

for key, value in self.local_storage.items():
Expand Down Expand Up @@ -257,7 +262,7 @@ def update_status(self):
self.status = utils.InstanceStatus.BUFFERING

def todo_after_spawn(self):
self.goto_with_retry("https://www.twitch.tv/login")
self.goto_with_retry("https://www.twitch.tv/p/en/legal/giftcard/")

try:
self.page.click(self.cookie_css, timeout=15000)
Expand Down
2 changes: 1 addition & 1 deletion main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
CLOSER_THREAD_COUNT = 10
PROXY_FILE_NAME = "proxy_list.txt"
HEADLESS = True
AUTO_RESTART = True
AUTO_RESTART = False
SPAWN_INTERVAL_SECONDS = 2

manager = InstanceManager(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "crude-twitch-viewer-bot"
version = "0.6.3"
version = "0.6.4"
description = "Twitch live viewer bot with playwright. Spawns low-resolution muted Chrome instances with proxy & user-agent. Requires HTTP proxies."
authors = ["jlplenio <[email protected]>"]

Expand Down

0 comments on commit a60bbe2

Please sign in to comment.