Skip to content

Commit 9758561

Browse files
bugfixes for webdriver arguments
1 parent e9f3838 commit 9758561

File tree

4 files changed

+66
-11
lines changed

4 files changed

+66
-11
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "netunicorn-library"
3-
version = "0.3.6"
3+
version = "0.3.7"
44
authors = [
55
{name = "Roman Beltiukov", email = "[email protected]"},
66
]

tasks/video_watchers/twitch_watcher.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,26 @@ def watch(
4747

4848

4949
class WatchTwitchStream(TaskDispatcher):
50-
def __init__(self, video_url: str, duration: Optional[int] = None, *args, **kwargs):
50+
def __init__(
51+
self,
52+
video_url: str,
53+
duration: Optional[int] = None,
54+
chrome_location: Optional[str] = None,
55+
webdriver_arguments: Optional[list] = None,
56+
*args, **kwargs
57+
):
5158
super().__init__(*args, **kwargs)
5259
self.video_url = video_url
5360
self.duration = duration
54-
self.linux_implementation = WatchTwitchStreamLinuxImplementation(self.video_url, self.duration, name=self.name)
61+
self.chrome_location = chrome_location
62+
self.webdriver_arguments = webdriver_arguments
63+
self.linux_implementation = WatchTwitchStreamLinuxImplementation(
64+
self.video_url,
65+
self.duration,
66+
self.chrome_location,
67+
self.webdriver_arguments,
68+
name=self.name
69+
)
5570

5671
def dispatch(self, node: Node) -> Task:
5772
if node.architecture in {Architecture.LINUX_AMD64, Architecture.LINUX_ARM64}:
@@ -69,17 +84,23 @@ class WatchTwitchStreamLinuxImplementation(Task):
6984
]
7085

7186
def __init__(
72-
self, video_url: str, duration: int = 10, chrome_location: Optional[str] = None, *args, **kwargs
87+
self,
88+
video_url: str,
89+
duration: int = 10,
90+
chrome_location: Optional[str] = None,
91+
webdriver_arguments: Optional[list] = None,
92+
*args, **kwargs
7393
):
7494
self.video_url = video_url
7595
self.duration = duration
7696
self.chrome_location = chrome_location
7797
if not self.chrome_location:
7898
self.chrome_location = "/usr/bin/chromium"
99+
self.webdriver_arguments = webdriver_arguments
79100
super().__init__(*args, **kwargs)
80101

81102
def run(self):
82-
return watch(self.video_url, self.duration, self.chrome_location)
103+
return watch(self.video_url, self.duration, self.chrome_location, self.webdriver_arguments)
83104

84105

85106
if __name__ == "__main__":

tasks/video_watchers/vimeo_watcher.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,26 @@ def watch(
7777

7878

7979
class WatchVimeoVideo(TaskDispatcher):
80-
def __init__(self, video_url: str, duration: Optional[int] = None, *args, **kwargs):
80+
def __init__(
81+
self,
82+
video_url: str,
83+
duration: Optional[int] = None,
84+
chrome_location: Optional[str] = None,
85+
webdriver_arguments: Optional[list] = None,
86+
*args, **kwargs
87+
):
8188
super().__init__(*args, **kwargs)
8289
self.video_url = video_url
8390
self.duration = duration
84-
self.linux_implementation = WatchVimeoVideoLinuxImplementation(self.video_url, self.duration, name=self.name)
91+
self.chrome_location = chrome_location
92+
self.webdriver_arguments = webdriver_arguments
93+
self.linux_implementation = WatchVimeoVideoLinuxImplementation(
94+
self.video_url,
95+
self.duration,
96+
self.chrome_location,
97+
self.webdriver_arguments,
98+
name=self.name
99+
)
85100

86101
def dispatch(self, node: Node) -> Task:
87102
if node.architecture in {Architecture.LINUX_AMD64, Architecture.LINUX_ARM64}:
@@ -103,6 +118,7 @@ def __init__(
103118
video_url: str,
104119
duration: Optional[int] = None,
105120
chrome_location: Optional[str] = None,
121+
webdriver_arguments: Optional[list] = None,
106122
*args,
107123
**kwargs
108124
):
@@ -111,10 +127,11 @@ def __init__(
111127
self.chrome_location = chrome_location
112128
if not self.chrome_location:
113129
self.chrome_location = "/usr/bin/chromium"
130+
self.webdriver_arguments = webdriver_arguments
114131
super().__init__(*args, **kwargs)
115132

116133
def run(self):
117-
return watch(self.video_url, self.duration, self.chrome_location)
134+
return watch(self.video_url, self.duration, self.chrome_location, self.webdriver_arguments)
118135

119136

120137
if __name__ == "__main__":

tasks/video_watchers/youtube_watcher.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,26 @@ def watch(
100100

101101

102102
class WatchYouTubeVideo(TaskDispatcher):
103-
def __init__(self, video_url: str, duration: Optional[int] = None, *args, **kwargs):
103+
def __init__(
104+
self,
105+
video_url: str,
106+
duration: Optional[int] = None,
107+
chrome_location: Optional[str] = None,
108+
webdriver_arguments: Optional[list] = None,
109+
*args, **kwargs
110+
):
104111
super().__init__(*args, **kwargs)
105112
self.video_url = video_url
106113
self.duration = duration
107-
self.linux_implementation = WatchYouTubeVideoLinuxImplementation(self.video_url, self.duration, name=self.name)
114+
self.chrome_location = chrome_location
115+
self.webdriver_arguments = webdriver_arguments
116+
self.linux_implementation = WatchYouTubeVideoLinuxImplementation(
117+
self.video_url,
118+
self.duration,
119+
self.chrome_location,
120+
self.webdriver_arguments,
121+
name=self.name
122+
)
108123

109124
def dispatch(self, node: Node) -> Task:
110125
if node.architecture in {Architecture.LINUX_AMD64, Architecture.LINUX_ARM64}:
@@ -126,6 +141,7 @@ def __init__(
126141
video_url: str,
127142
duration: Optional[int] = None,
128143
chrome_location: Optional[str] = None,
144+
webdriver_arguments: Optional[list] = None,
129145
*args,
130146
**kwargs,
131147
):
@@ -134,10 +150,11 @@ def __init__(
134150
self.chrome_location = chrome_location
135151
if not self.chrome_location:
136152
self.chrome_location = "/usr/bin/chromium"
153+
self.webdriver_arguments = webdriver_arguments
137154
super().__init__(*args, **kwargs)
138155

139156
def run(self):
140-
return watch(self.video_url, self.duration, self.chrome_location)
157+
return watch(self.video_url, self.duration, self.chrome_location, self.webdriver_arguments)
141158

142159

143160
if __name__ == "__main__":

0 commit comments

Comments
 (0)