MCPcopy Index your code
hub / github.com/Infinity242/KickViewBot / doTest

Method doTest

KickViewBotHEADLESS.py:31–70  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

29 return csrf_token
30
31 def doTest(self):
32 self.setupWebBrowser()
33 self.driver.get(self.url)
34 not_found_count = 0
35 csrf_token = self.getToken()
36 while True:
37 try:
38
39 button = self.driver.find_element(By.CSS_SELECTOR, "button.variant-action.size-sm")
40
41 button.click()
42 print("Button clicked!")
43 not_found_count = 0
44 except NoSuchElementException:
45
46 if "Oops, Something went wrong" in self.driver.page_source:
47 self.driver.refresh()
48 print("Page refreshed!")
49 not_found_count = 0
50 elif not_found_count >= 10:
51 print("Watch now button not found after 10 attempts. Stopping search.")
52 break
53 elif "Checking if the site connection is secure" in self.driver.page_source:
54 self.driver.close()
55 sleep(5)
56 self.setupWebBrowser()
57 self.driver.get(self.url)
58 print("Browser restarted")
59 csrf_token = self.getToken()
60 else:
61 print("Watch now button not found on this page")
62 not_found_count += 1
63 sleep(10)
64
65
66 self.driver.execute_script("document.querySelector('#vjs_video_3 > div:nth-child(1) > video').style.display = 'none'")
67
68
69 while True:
70 pass
71
72def run_script(url, num_threads):
73 processes = []

Callers

nothing calls this directly

Calls 2

setupWebBrowserMethod · 0.95
getTokenMethod · 0.95

Tested by

no test coverage detected