From dd7c85e22e74380448c400f4387a0af79ac9923d Mon Sep 17 00:00:00 2001 From: yuriy Date: Wed, 14 Feb 2024 20:04:51 -0500 Subject: [PATCH] fixed Brighteon description getting input multiple times --- Modules/Brighteon-Upload.ahk | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/Modules/Brighteon-Upload.ahk b/Modules/Brighteon-Upload.ahk index 15ebf93..e0e7848 100644 --- a/Modules/Brighteon-Upload.ahk +++ b/Modules/Brighteon-Upload.ahk @@ -8,7 +8,8 @@ Return JSBrighteonVideoDescription := FormatTextToJSText(VideoDescription) -; Msgbox % "JSBrighteonVideoDescription: " JSBrighteonVideoDescription + + ; descriptions longer than 5k characters just fail to get input so trim them to below 5000 characters if(StrLen(VideoDescription) >= 5000){ @@ -137,6 +138,25 @@ loop, 3 { } + ; input with js. Doesn't work in production, but does in the ConnectActiveTab script +/* + SaveOrPostProgress(Message:="Inputting title with JS",PostType:="Tooltip") + + ; Input Title of the Video + js = document.querySelector("#name").value = "%JSVideoDescription%"; + driver.executeScript(JS) ;Execute Javascript + + SaveOrPostProgress(Message:="Waiting 5 seconds to check if input was saved",PostType:="Tooltip") + sleep, 5000 + + Xpath = //input[@id='name'] + try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.SPACE) + try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.BACKSPACE) ;Sends Variable to an Xpath Item + +*/ + + + ; Input Title of the Video Xpath = //input[@id='name'] try driver.FindElementByXPath(Xpath).SendKeys(VideoTitle) ;Sends Variable to an Xpath Item @@ -166,9 +186,7 @@ loop, 3 { TooltipThis("Inputting Video Description") - - -; Attempt to input video description a couple of times +; Attempt to input video description multiple time in case Brighteon rejects the input Loop, 10 { if(A_index = 10){ Message = Failed to input Video Description after 10 attempts. @@ -204,8 +222,8 @@ Loop, 10 { sleep, 5000 - - js = return document.querySelector("div[class='e-content e-lib e-keyboard'] p").innerText; + ; get text that was input into description box + js = return document.querySelector("#richtexteditor_747903514_0rte-view").innerText; try Input_Description := driver.executeScript(JS) ;Execute Javascript Input_DescriptionStrLen := StrLen(Input_Description)