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

Fix bug where geckodriver couldn't find firefox by allowing user to specify firefox path #99

Merged
merged 3 commits into from
Apr 3, 2023
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
1 change: 1 addition & 0 deletions twitchtube/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
# selenium
ROOT_PROFILE_PATH = r"C:/Users/USERNAME/AppData/Roaming/Mozilla/Firefox/Profiles/r4Nd0m.selenium" # Path to the Firefox profile where you are logged into YouTube
EXECUTABLE_PATH = r"geckodriver"
FIREFOX_PATH = r"" #specify this if your gecko driver can't find firefox ("Expected browser binary location...")
SLEEP = 3 # How many seconds Firefox should sleep for when uploading
HEADLESS = True # If True Firefox will be hidden (True/False)

Expand Down
14 changes: 12 additions & 2 deletions twitchtube/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
from .logging import Log as log
from .utils import *

from selenium.webdriver.firefox.options import Options


# add language as param
def make_video(
# required
data: list = DATA,
blacklist: list = BLACKLIST,
# other
path: str = get_path(),
path: str = "",
check_version: bool = CHECK_VERSION,
# twitch
client_id: str = CLIENT_ID,
Expand All @@ -31,6 +33,7 @@ def make_video(
# selenium
profile_path: str = ROOT_PROFILE_PATH,
executable_path: str = EXECUTABLE_PATH,
firefox_path: str = FIREFOX_PATH,
sleep: int = SLEEP,
headless: bool = HEADLESS,
debug: bool = DEBUG,
Expand Down Expand Up @@ -61,6 +64,7 @@ def make_video(
thumbnail: str = THUMBNAIL,
tags: list = TAGS,
) -> None:
path = get_path()
if check_version:
try:

Expand Down Expand Up @@ -187,7 +191,13 @@ def make_video(
log.info("No Firefox profile path given, skipping upload")

else:
upload = Upload(profile_path, executable_path, sleep, headless, debug)
if firefox_path != "":
options = Options()
options.binary_location = r"C:\Program Files\Mozilla Firefox\firefox.exe"

upload = Upload(profile_path, executable_path, sleep, headless, debug, options=options)
else:
upload = Upload(profile_path, executable_path, sleep, headless, debug)

log.info("Trying to upload video to YouTube")

Expand Down