Update Readme for Windows. Executable path also for geckodriver (Firefox)
This commit is contained in:
@@ -81,6 +81,13 @@ If you already have a `twitch-cookies.pkl` and you don't want to login again ple
|
||||
| +-- your-twitch-username.pkl
|
||||
```
|
||||
|
||||
## Windows
|
||||
Other users have find multiple problems on Windows my suggestion are:
|
||||
- Stop use Windows :stuck_out_tongue_closed_eyes:
|
||||
- Suppress the emoji in logs with `logger_settings=LoggerSettings(emoji=False)`
|
||||
- Download the geckodriver from here: https://github.com/mozilla/geckodriver/releases/ and extract in the same folder of this project. For other issue with geckodriver just googling: https://stackoverflow.com/questions/40208051/selenium-using-python-geckodriver-executable-needs-to-be-in-path
|
||||
|
||||
|
||||
## Use Chrome instead Firefox
|
||||
If you prefer Chrome instead Firefox please download the WebDriver matching with your Chrome version and OS from this link: https://chromedriver.chromium.org/downloads.
|
||||
Extract the archivie, copy the chromedriver file in this project folder.
|
||||
@@ -88,6 +95,6 @@ Edit your run.py file and the browser_settings should something like this:
|
||||
```python
|
||||
browser_settings=BrowserSettings(
|
||||
browser=Browser.CHROME,
|
||||
chrome_path="/path/of/your/chromedriver" # If no path was provided the script will try to search automatically
|
||||
driver_path="/path/of/your/chromedriver" # If no path was provided the script will try to search automatically
|
||||
),
|
||||
```
|
||||
@@ -1,3 +1,3 @@
|
||||
__version__ = "2.0.0"
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
__version__ = "2.1.1"
|
||||
from .TwitchChannelPointsMiner import TwitchChannelPointsMiner
|
||||
|
||||
@@ -28,13 +28,15 @@ class Streamer:
|
||||
|
||||
def set_offline(self):
|
||||
self.offline_at = time.time()
|
||||
self.is_online = False
|
||||
logger.info(f"{self} is Offline!", extra={"emoji": ":sleeping:"})
|
||||
if self.is_online:
|
||||
self.is_online = False
|
||||
logger.info(f"{self} is Offline!", extra={"emoji": ":sleeping:"})
|
||||
|
||||
def set_online(self):
|
||||
self.online_at = time.time()
|
||||
self.is_online = True
|
||||
logger.info(f"{self} is Online!", extra={"emoji": ":partying_face:"})
|
||||
if not self.is_online:
|
||||
self.is_online = True
|
||||
logger.info(f"{self} is Online!", extra={"emoji": ":partying_face:"})
|
||||
|
||||
def print_history(self):
|
||||
return ", ".join(
|
||||
|
||||
@@ -82,6 +82,9 @@ class Twitch:
|
||||
"User-Agent": USER_AGENT,
|
||||
},
|
||||
)
|
||||
logger.debug(
|
||||
f"Data: {json_data}, Status code: {response.status_code}, Content: {response.json()}"
|
||||
)
|
||||
return response.json()
|
||||
|
||||
def get_broadcast_id(self, streamer):
|
||||
|
||||
@@ -56,7 +56,7 @@ class BrowserSettings:
|
||||
save_html: bool = False, # Options for debug
|
||||
show: bool = True,
|
||||
browser: Browser = Browser.FIREFOX,
|
||||
chrome_path: str = None,
|
||||
driver_path: str = None,
|
||||
):
|
||||
self.timeout = timeout
|
||||
self.implicitly_wait = implicitly_wait
|
||||
@@ -65,12 +65,15 @@ class BrowserSettings:
|
||||
self.save_html = save_html
|
||||
self.show = show
|
||||
self.browser = browser
|
||||
self.chrome_path = (
|
||||
chrome_path
|
||||
if chrome_path is not None
|
||||
self.driver_path = (
|
||||
driver_path
|
||||
if driver_path is not None
|
||||
else os.path.join(
|
||||
Path().absolute(),
|
||||
("chromedriver" + (".exe" if platform.system() == "Windows" else "")),
|
||||
(
|
||||
("chromedriver" if browser == Browser.CHROME else "geckodriver")
|
||||
+ (".exe" if platform.system() == "Windows" else "")
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -170,11 +173,11 @@ class TwitchBrowser:
|
||||
)
|
||||
options.add_experimental_option("excludeSwitches", ["enable-logging"])
|
||||
|
||||
if os.path.isfile(self.settings.chrome_path) is True:
|
||||
self.browser = webdriver.Chrome(self.settings.chrome_path, options=options)
|
||||
if os.path.isfile(self.settings.driver_path) is True:
|
||||
self.browser = webdriver.Chrome(self.settings.driver_path, options=options)
|
||||
else:
|
||||
logger.warning(
|
||||
f"The path {self.settings.chrome_path} is not valid",
|
||||
f"The path {self.settings.driver_path} is not valid. Use default path",
|
||||
extra={"emoji": ":wrench:"},
|
||||
)
|
||||
self.browser = webdriver.Chrome(options=options)
|
||||
@@ -195,7 +198,18 @@ class TwitchBrowser:
|
||||
fp.set_preference("startup.homepage_welcome_url", "about:blank")
|
||||
fp.set_preference("startup.homepage_welcome_url.additional", "about:blank")
|
||||
|
||||
self.browser = webdriver.Firefox(options=options, firefox_profile=fp)
|
||||
if os.path.isfile(self.settings.driver_path) is True:
|
||||
self.browser = webdriver.Firefox(
|
||||
executable_path=self.settings.driver_path,
|
||||
options=options,
|
||||
firefox_profile=fp,
|
||||
)
|
||||
else:
|
||||
logger.warning(
|
||||
f"The path {self.settings.driver_path} is not valid. Use default path",
|
||||
extra={"emoji": ":wrench:"},
|
||||
)
|
||||
self.browser = webdriver.Firefox(options=options, firefox_profile=fp)
|
||||
|
||||
def __debug(self, event, method):
|
||||
if self.settings.do_screenshot:
|
||||
|
||||
2
setup.py
2
setup.py
@@ -8,7 +8,7 @@ def read(fname):
|
||||
|
||||
setuptools.setup(
|
||||
name="Twitch-Channel-Points-Miner-v2",
|
||||
version="2.0.0",
|
||||
version="2.1.1",
|
||||
author="Tkd-Alex (Alessandro Maggio)",
|
||||
author_email="alex.tkd.alex@gmail.com",
|
||||
description="A simple script that will watch a stream for you and earn the channel points.",
|
||||
|
||||
Reference in New Issue
Block a user