Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

master #2

Merged
merged 4 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions Python-Rumble-Bot-Final-Bot/bot/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait as WDW
from selenium.common.exceptions import NoSuchElementException
from config.data import urls, locators, useragents, time_buffer
from selenium.webdriver.common.by import By
from urllib.error import HTTPError
from seleniumbase import Driver
import logging

class web_driver:
def __init__(self):
self.driver = None

def start_driver(self):
self.driver = Driver(uc=True)
user_agent = useragents.ua.random
self.driver.execute_cdp_cmd(
f"Network.setUserAgentOverride",
{"userAgent":user_agent})
return self.driver

def start_browser(self):
for i in urls.url_dict:
value = urls.url_dict[i]
try:
self.driver.get(value)
WDW(self.driver, 10).until(
EC.url_to_be(value))
try:
WDW(self.driver,10).until(
EC.presence_of_element_located((
By.CLASS_NAME,locators.play_btn_classname
)))
self.driver.find_element(
By.CLASS_NAME,locators.play_btn_classname).click()
time_buffer.time_altered(1)
except NoSuchElementException as err:
if err:
logging.error(f'NoSuchElementException: {err}')

except HTTPError as err:
if err.code != 200:
logging.error(f"HTTP error occurred: {err}")


def close_browser(self):
self.driver.quit()
Empty file.
23 changes: 23 additions & 0 deletions Python-Rumble-Bot-Final-Bot/config/data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from dataclasses import dataclass
from fake_useragent import UserAgent
from time import sleep

@dataclass
class nums:
num_nodes: int = 10

class time_buffer:
time_altered = sleep

class urls:
url_dict = {
1:'www.example.com/',
2:'',
}

class locators:
play_btn_classname: str = 'bigPlayUIInner'


class useragents:
ua = UserAgent()
23 changes: 8 additions & 15 deletions Python-Rumble-Bot/root.py → Python-Rumble-Bot-Final-Bot/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ def __init__(self,_):
self.right = None

def activate(self):
func = web_driver()
func.start_driver()
func.start_browser()
func.close_browser()
for i in range(nums.num_nodes):
func = web_driver()
func.start_driver()
func.start_browser()
func.close_browser()



class binary_tree:
global stack
Expand All @@ -26,7 +29,6 @@ def main(self, root:node):
stack.append(root)
root = root.left
root = stack.pop()
self.activate()
result.append(root.data)
root = root.right
print(f'Node: {node}')
Expand All @@ -36,16 +38,7 @@ def main(self, root:node):
try:
instance = binary_tree()
root = node(1)
root.left = node(2)
root.right = node(3)
root.left.left = node(4)
root.left.right = node(5)
root.right.left = node(6)
root.right.right = node(7)
for i in range(nums.num_nodes):
traversal = instance.main(root=root)
print(f'Traversal Pattern: {val}')
print(f'Execution: {i}')
except KeyboardInterrupt:
print("exiting gracefully...")
exit(0)

25 changes: 0 additions & 25 deletions Python-Rumble-Bot/Dockerfile

This file was deleted.

82 changes: 0 additions & 82 deletions Python-Rumble-Bot/bot/main.py

This file was deleted.

1 change: 0 additions & 1 deletion Python-Rumble-Bot/config/__init__.py

This file was deleted.

30 changes: 0 additions & 30 deletions Python-Rumble-Bot/config/data.py

This file was deleted.

6 changes: 0 additions & 6 deletions Python-Rumble-Bot/docker-compose.yml

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ https://www.python.org/downloads/

Dependencies:

seleniumbase==4.23.7
fake-useragent==1.5.1
see - requirements.txt

License

Expand Down
Loading