diff --git a/Freedomain Video Uploader.ahk b/Freedomain Video Uploader.ahk index c09a106..b0e5b1b 100644 --- a/Freedomain Video Uploader.ahk +++ b/Freedomain Video Uploader.ahk @@ -3008,706 +3008,685 @@ Loop, %Number_of_loops_to_Check_Upload_status% { Return } - ; LogErrorToTextFile("Inputting Description") - - ; Input text - ; try BitChuteUploadProgress := driver.executeScript("return document.getElementsByClassName('progress-bar')[0].innerHTML;") ;navigate using javascript - ; send text to page - ; jsSend = document.getElementsByClassName('form-control')[1].value = "%JSBitchuteDescription%"; + status := js_SendAndCheckWithQuerySelector("#description",ValueToCheck:="value",SleepLength:=1000,JSStringText:=JSBitchuteDescription) + if(status){ + Message = %status% + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + } + else, + Break - jsSend = document.getElementById('description').value = "%JSBitchuteDescription%"; - ; try driver.executeScript(js) + sleep, 1000 + } - ; Check text in the box - jsCheck = return document.getElementById('description').value; - ; send text to the page - try driver.executeScript(jsSend) - - ; check contents of page - try VideoDescriptionOnPage := driver.executeScript(jsCheck) ;Executes a Javascript on the webpage, mostly used for buttons. + Message = Inputting Tags + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - if(StrLen(VideoDescription) > 5){ - Message = Video Description input successfully - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - break - } + ; Convert tags into #hasthtags + Loop, 3 { + Value := KeywordsArray[A_Index] + Value := StrReplace(Value, " ", "") ; Remove spaces if hashtag has two words + ; HashTag := "#" . Value + BitchuteHashtags .= Value . " " + } - ; if (A_index = 1){ - ; message := SubStr(VideoDescriptionOnPage, 1, 250) - ; message = Description that got input: %message% - ; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging") - ; } + ; input hashtags + Xpath = //input[@placeholder='Search Terms'] + Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BitchuteHashtags) - } + ; Upload Thumbnail + Message = Attaching Thumbnail + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + if(VideoThumbFilepath != ""){ + ; Upload Cover Image Button + Message = Uploading Thumbnail + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - Message = Inputting Tags - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - ; Convert tags into #hasthtags - Loop, 3 { - Value := KeywordsArray[A_Index] - Value := StrReplace(Value, " ", "") ; Remove spaces if hashtag has two words - ; HashTag := "#" . Value - BitchuteHashtags .= Value . " " + Xpath = //input[@name='thumbnailInput'] + Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath) + if(Status){ + Message = Failed to Attach Thumbnail + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + SaveDriverURLOFErrorPage() + Return } + ; sleep, 5000 + } - ; input hashtags - Xpath = //input[@placeholder='Search Terms'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BitchuteHashtags) + ; Upload Video button + Message = Uploading Video File + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - ; Upload Thumbnail - Message = Attaching Thumbnail - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + Xpath = //input[@name='videoInput'] + Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath) + if(Status){ + Message = Failed to Upload Video + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + SaveDriverURLOFErrorPage() + Return + } - if(VideoThumbFilepath != ""){ - ; Upload Cover Image Button - Message = Uploading Thumbnail - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + Message = Waiting for Video to Finish Uploading`nChecking Progress Every 5 seconds + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + Xpath = //div[@role='progressbar'] ; Xpath to progress % + Loop, %Number_of_loops_to_Check_Upload_status% { + sleep, %Time_Between_Loops_Upload_Status% - Xpath = //input[@name='thumbnailInput'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath) - if(Status){ - Message = Failed to Attach Thumbnail - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() - Return + if(A_index = 5){ ; while waiting for bitchute video to finish uploading, start up lbry + if(OdyseeVideo OR OdyseeAudio){ + SaveOrPostProgress(Message:="Starting up LBRY while waiting for Bitchute Video to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + CheckLBRYProcess() } - ; sleep, 5000 } + ; Selenium + ; try BitChuteUploadProgress := driver.findelementbyxpath(Xpath).Attribute("innerText") ;GREAT FOR GRABBING INNER CONTENTS/Values - ; Upload Video button - Message = Uploading Video File - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + try BitChuteUploadProgress := driver.executeScript("return document.querySelector('.filepond--file-status').innerHTML;") ;navigate using javascript + ; Msgbox % "BitChuteUploadProgress: " BitChuteUploadProgress - Xpath = //input[@name='videoInput'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath) - if(Status){ - Message = Failed to Upload Video + if(BitChuteUploadProgress = ""){ + Message = Unable to Grab Upload Progress, Upload Possibly Failed SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveDriverURLOFErrorPage() Return } + if(InStr(BitChuteUploadProgress, "Upload complete")){ + Message = Waiting 10 Seconds before clicking "Proceed" button + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + sleep, 10000 + Break ; Break out of the loop when 100% upload status - Message = Waiting for Video to Finish Uploading`nChecking Progress Every 5 seconds - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - Xpath = //div[@role='progressbar'] ; Xpath to progress % - Loop, %Number_of_loops_to_Check_Upload_status% { - sleep, %Time_Between_Loops_Upload_Status% - - if(A_index = 5){ ; while waiting for bitchute video to finish uploading, start up lbry - if(OdyseeVideo OR OdyseeAudio){ - SaveOrPostProgress(Message:="Starting up LBRY while waiting for Bitchute Video to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - CheckLBRYProcess() - } - } - ; Selenium - ; try BitChuteUploadProgress := driver.findelementbyxpath(Xpath).Attribute("innerText") ;GREAT FOR GRABBING INNER CONTENTS/Values - - try BitChuteUploadProgress := driver.executeScript("return document.querySelector('.filepond--file-status').innerHTML;") ;navigate using javascript - ; Msgbox % "BitChuteUploadProgress: " BitChuteUploadProgress - - if(BitChuteUploadProgress = ""){ - Message = Unable to Grab Upload Progress, Upload Possibly Failed - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() - Return - } - - if(InStr(BitChuteUploadProgress, "Upload complete")){ - Message = Waiting 10 Seconds before clicking "Proceed" button - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - sleep, 10000 - Break ; Break out of the loop when 100% upload status - - } + } - ; split_text = "> - ; Pull out upload percentage - BitChuteUploadProgress := StrSplit(BitChuteUploadProgress, ">") - BitChuteUploadProgress := BitChuteUploadProgress[2] - BitChuteUploadProgress := StrSplit(BitChuteUploadProgress, "") + BitChuteUploadProgress := BitChuteUploadProgress[2] + BitChuteUploadProgress := StrSplit(BitChuteUploadProgress, "= 5000){ - BrighteonVideoDescription := SubStr(VideoDescription, 1, 4800) + ; descriptions longer than 5k characters just fail to get input so trim them to below 5000 characters + if(StrLen(VideoDescription) >= 5000){ + BrighteonVideoDescription := SubStr(VideoDescription, 1, 4800) + BrighteonVideoDescription .= "...." + JSBrighteonVideoDescription := FormatTextToJSText(BrighteonVideoDescription) + + if(StrLen(JSBrighteonVideoDescription) > 5000){ + BrighteonVideoDescription := SubStr(VideoDescription, 1, 4500) BrighteonVideoDescription .= "...." JSBrighteonVideoDescription := FormatTextToJSText(BrighteonVideoDescription) - - if(StrLen(JSBrighteonVideoDescription) > 5000){ - BrighteonVideoDescription := SubStr(VideoDescription, 1, 4500) - BrighteonVideoDescription .= "...." - JSBrighteonVideoDescription := FormatTextToJSText(BrighteonVideoDescription) - } } + } - Message = Checking Login Status - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - try CurrentTab := driver.url - if(InStr(CurrentTab, "login")) ; we're logged out - { + Message = Checking Login Status + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + try CurrentTab := driver.url + if(InStr(CurrentTab, "login")) ; we're logged out + { - Message = Closing out of any popups that might appear on loin page - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + Message = Closing out of any popups that might appear on loin page + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - Xpath = //body/div[@id='__next']/div[@id='modal-root']/div[2]/div[1]/div[1]//*[local-name()='svg'] - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100) + Xpath = //body/div[@id='__next']/div[@id='modal-root']/div[2]/div[1]/div[1]//*[local-name()='svg'] + Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100) - Xpath = //body/div[@id='__next']/div[@id='modal-root']/div/div/div[1] ; get our free newsletter - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100) + Xpath = //body/div[@id='__next']/div[@id='modal-root']/div/div/div[1] ; get our free newsletter + Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100) - ; If newsletter pop up exists then close it. - Xpath = //div[@class='overlay__close inside'] - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100) + ; If newsletter pop up exists then close it. + Xpath = //div[@class='overlay__close inside'] + Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100) - ; Try clicking the login button, sometimes this will auto log you back in without having to input credentials - xpath = //a[normalize-space()='Log In'] - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100) - DevModeMsgBox(Status) + ; Try clicking the login button, sometimes this will auto log you back in without having to input credentials + xpath = //a[normalize-space()='Log In'] + Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100) + DevModeMsgBox(Status) - Message = Checking Login Status - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + Message = Checking Login Status + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - try PageURL := driver.url - if(InStr(PageURL, "auth.brighteon.com/login?state")){ ; we're logged out and need to manually log back in + try PageURL := driver.url + if(InStr(PageURL, "auth.brighteon.com/login?state")){ ; we're logged out and need to manually log back in - if(AutoLogin){ - Message = Trying to Log Back In - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + if(AutoLogin){ + Message = Trying to Log Back In + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - js = return document.querySelector("input[placeholder='username/email']").value; - status := try driver.executeScript(JS) ;Execute Javascript + js = return document.querySelector("input[placeholder='username/email']").value; + status := try driver.executeScript(JS) ;Execute Javascript - if(StrLen(Status) > 0){ - ; msgbox, clicking login button - Xpath = //a[normalize-space()='Log In'] ; click login button - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=6,SleepLength:=1000) + if(StrLen(Status) > 0){ + ; msgbox, clicking login button + Xpath = //a[normalize-space()='Log In'] ; click login button + Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=6,SleepLength:=1000) - sleep, 2000 - Xpath = //button[@type='submit'] ; click login button on login page - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) - try driver.executeScript("return document.readyState").equals("complete") + sleep, 2000 + Xpath = //button[@type='submit'] ; click login button on login page + Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) + try driver.executeScript("return document.readyState").equals("complete") - sleep, 2000 - } + sleep, 2000 + } - } - else, { - SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() - Return - } + } + else, { + SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + SaveDriverURLOFErrorPage() + Return } } +} - ; Navigate to Upload Page - try driver.executeScript("window.location = 'https://www.brighteon.com/dashboard/video-upload'") ;navigate using javascript +; Navigate to Upload Page +try driver.executeScript("window.location = 'https://www.brighteon.com/dashboard/video-upload'") ;navigate using javascript - try driver.executeScript("return document.readyState").equals("complete") +try driver.executeScript("return document.readyState").equals("complete") - ; Click out of the "Support free speech" pop-up if it pops up - Xpath = //body/div[@id='__next']/div[@id='modal-root']/div/div/div[1]//*[local-name()='svg'] - try driver.FindElementByXPath(Xpath).click() +; Click out of the "Support free speech" pop-up if it pops up +Xpath = //body/div[@id='__next']/div[@id='modal-root']/div/div/div[1]//*[local-name()='svg'] +try driver.FindElementByXPath(Xpath).click() - ; Upload Video - Xpath = //input[@type='file'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath) - if(Status){ - Message = Failed to Upload Video, Please check Login Status +; Upload Video +Xpath = //input[@type='file'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath) +if(Status){ + Message = Failed to Upload Video, Please check Login Status + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + SaveDriverURLOFErrorPage() + Return +} + + +loop, 3 { + if(A_index = 3){ + Message = Failed to input Video Title SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() Return } + ; Input Title of the Video + Xpath = /html/body/div/section[2]/div[2]/div/form/div[1]/div[1]/div[2]/div[1]/div/input + try driver.FindElementByXPath(Xpath).SendKeys(VideoTitle) ;Sends Variable to an Xpath Item - loop, 3 { - if(A_index = 3){ - Message = Failed to input Video Title - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - Return - } - - ; Input Title of the Video - Xpath = /html/body/div/section[2]/div[2]/div/form/div[1]/div[1]/div[2]/div[1]/div/input - try driver.FindElementByXPath(Xpath).SendKeys(VideoTitle) ;Sends Variable to an Xpath Item + js = return document.querySelector("#name").value; + try, status := driver.executeScript(js) - js = return document.querySelector("#name").value; - try, status := driver.executeScript(js) - - if(status = ""){ - Message = Failed to input Title - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - continue - } - - Message = Title that got input: %status% + if(status = ""){ + Message = Failed to input Title SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - break - + continue } - ; Msgbox % "status: " status + Message = Title that got input: %status% + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + break - TooltipThis("Inputting Video Description") +} +; Msgbox % "status: " status +TooltipThis("Inputting Video Description") - ; Attempt to input video description a couple of times - Loop, 10 { - Message = Inputting Description. `nAttempt Number: %A_index% - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - ; SaveOrPostProgress(Message:=Message,PostType:="DiscordErrorLogging") - ; SaveOrPostProgress(Message:="Inputting Video Description",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar") - ; TooltipThis("Inputting Description) - Xpath = //div[@class='e-content e-lib e-keyboard'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoDescription) - if(Status){ - SaveOrPostProgress(Message:="Failed to input Video Description",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() - Return - } - - ; DevModeMsgBox("pause") - - ; driver.FindElementByXPath(Xpath).SendKeys(VideoDescription) +; Attempt to input video description a couple of times +Loop, 10 { + Message = Inputting Description. `nAttempt Number: %A_index% + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + ; SaveOrPostProgress(Message:=Message,PostType:="DiscordErrorLogging") - ; js = document.getElementById('description').value = "%JSBrighteonVideoDescription%"; - ; try driver.executeScript(js) + ; SaveOrPostProgress(Message:="Inputting Video Description",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar") + ; TooltipThis("Inputting Description) + Xpath = //div[@class='e-content e-lib e-keyboard'] + Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoDescription) + if(Status){ + SaveOrPostProgress(Message:="Failed to input Video Description",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + SaveDriverURLOFErrorPage() + Return + } - ; sleep, 1000 - ; TooltipThis("checking description input") - ; try driver.findElementsByID("description").item[1].SendKeys(driver.Keys.ENTER) - ; sleep, 1000 + ; DevModeMsgBox("pause") - sleep, 5000 + ; driver.FindElementByXPath(Xpath).SendKeys(VideoDescription) + ; js = document.getElementById('description').value = "%JSBrighteonVideoDescription%"; + ; try driver.executeScript(js) - js = return document.querySelector("div[class='e-content e-lib e-keyboard'] p").innerText; - try Input_Description := driver.executeScript(JS) ;Execute Javascript - Input_DescriptionStrLen := StrLen(Input_Description) - Message = Length of Description that got input: %Input_DescriptionStrLen% - SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging") + ; sleep, 1000 + ; TooltipThis("checking description input") + ; try driver.findElementsByID("description").item[1].SendKeys(driver.Keys.ENTER) + ; sleep, 1000 - ; if text in description box is longer than x chars, then description input worked - if(StrLen(Input_Description) > 15){ - Input_Description := SubStr(Input_Description, 1, 20) - Message = Description that got input: %Input_Description% ... - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - Break - } + sleep, 5000 - } + js = return document.querySelector("div[class='e-content e-lib e-keyboard'] p").innerText; + try Input_Description := driver.executeScript(JS) ;Execute Javascript + Input_DescriptionStrLen := StrLen(Input_Description) + Message = Length of Description that got input: %Input_DescriptionStrLen% + SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging") - ; Thumbnail - if(VideoThumbFilepath != "") { - TooltipThis("Uploading Thumbnail") - Xpath = //input[@type='file'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath) - if(Status){ - Message = Failed to Upload Thumbnail - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - } + ; if text in description box is longer than x chars, then description input worked + if(StrLen(Input_Description) > 15){ + Input_Description := SubStr(Input_Description, 1, 20) + Message = Description that got input: %Input_Description% ... + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + Break } +} - ; DevModeMsgBox(VideoTags) - TooltipThis("Inputting Keywords") - Loop, 5 { - XPath = //input[@id='keywords'] - try driver.FindElementByXPath(Xpath).SendKeys(VideoTags) ;Sends Variable to an Xpath Item - catch e { - Message = Error (E#2312)`nVideo Uploaded but Unable to Input Video Tags - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - } - ; click into video title to get focus away from inputbox - Xpath = /html/body/div/section[2]/div[2]/div/form/div[1]/div[1]/div[2]/div[1]/div/input - try, driver.FindElementByXPath(Xpath).click() ;Sends Variable to an Xpath Item - ; check that the tags got input - js = return document.querySelector("#keywords").value; - try, status := driver.executeScript(js) - if(status){ - Message = Failed to input tags. - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - } - else, { - Message = Tags that got input: %status% - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - break - } - ; Msgbox % "status: " status +; Thumbnail +if(VideoThumbFilepath != "") { + TooltipThis("Uploading Thumbnail") + Xpath = //input[@type='file'] + Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath) + if(Status){ + Message = Failed to Upload Thumbnail + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + } +} +; DevModeMsgBox(VideoTags) +TooltipThis("Inputting Keywords") +Loop, 5 { + XPath = //input[@id='keywords'] + try driver.FindElementByXPath(Xpath).SendKeys(VideoTags) ;Sends Variable to an Xpath Item + catch e { + Message = Error (E#2312)`nVideo Uploaded but Unable to Input Video Tags + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") } - ; double check on video description after inputting tags - js = return document.querySelector("div[class='e-content e-lib e-keyboard'] p").innerText; - try Input_Description := driver.executeScript(JS) ;Execute Javascript - DevModeMsgBox(Input_Description) + ; click into video title to get focus away from inputbox + Xpath = /html/body/div/section[2]/div[2]/div/form/div[1]/div[1]/div[2]/div[1]/div/input + try, driver.FindElementByXPath(Xpath).click() ;Sends Variable to an Xpath Item - ; if text in description box is longer than x chars, then description input worked - if(StrLen(Input_Description) > 5){ - SaveOrPostProgress(Message:="Video Description second double check was successful",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + ; check that the tags got input + js = return document.querySelector("#keywords").value; + try, status := driver.executeScript(js) + if(status){ + Message = Failed to input tags. + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") } else, { - SaveOrPostProgress(Message:="Secondary video description check failed",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - Return + Message = Tags that got input: %status% + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + break } + ; Msgbox % "status: " status +} - TooltipThis("Waiting for Video to Finish Uploading") - Loop, %Number_of_loops_to_Check_Upload_status% { - sleep, %Time_Between_Loops_Upload_Status% +; double check on video description after inputting tags +js = return document.querySelector("div[class='e-content e-lib e-keyboard'] p").innerText; +try Input_Description := driver.executeScript(JS) ;Execute Javascript +DevModeMsgBox(Input_Description) - ; Get progress status through javascript - jsCheck = return document.getElementsByClassName('video-upload--details')[0].textContent; - try ProgressStatus := driver.executeScript(jsCheck) +; if text in description box is longer than x chars, then description input worked +if(StrLen(Input_Description) > 5){ + SaveOrPostProgress(Message:="Video Description second double check was successful",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") +} +else, { + SaveOrPostProgress(Message:="Secondary video description check failed",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + Return +} - if(ProgressStatus = ""){ - Message = Failed to Grab Video Upload Status. Upload Most Likely Failed - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() - Return - } - if(InStr(ProgressStatus, "Upload complete.")){ - Break - } - ; Pull out progress Percentage from full string - UploadPercent := StrSplit(ProgressStatus, "(") - UploadPercent := UploadPercent[2] - UploadPercent := StrSplit(UploadPercent, ")") - UploadPercent := UploadPercent[1] +TooltipThis("Waiting for Video to Finish Uploading") +Loop, %Number_of_loops_to_Check_Upload_status% { + sleep, %Time_Between_Loops_Upload_Status% - ; Message = Waiting for Video to Finish Uploading`nCurrent Upload Status: %UploadPercent% - ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip") + ; Get progress status through javascript + jsCheck = return document.getElementsByClassName('video-upload--details')[0].textContent; + try ProgressStatus := driver.executeScript(jsCheck) - Status := Check_For_Stuck_Video_Upload(A_index, UploadPercent) - if(Status = "Failed") + if(ProgressStatus = ""){ + Message = Failed to Grab Video Upload Status. Upload Most Likely Failed + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + SaveDriverURLOFErrorPage() Return } - ; Save Video button - TooltipThis("Clicking Save Video Button to finalize Upload") - try BrighteonUploadPageURL := driver.url - try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding + if(InStr(ProgressStatus, "Upload complete.")){ + Break + } + ; Pull out progress Percentage from full string + UploadPercent := StrSplit(ProgressStatus, "(") + UploadPercent := UploadPercent[2] + UploadPercent := StrSplit(UploadPercent, ")") + UploadPercent := UploadPercent[1] - TooltipThis("Waiting for Result page to finish loading") - Loop, 60 { ; 5 loops of 1 minute each - if(A_index = 10){ - Message = Upload Failed: Clicking "Save Video" did not Finalize the Upload - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() - Return ; Break out of gosub - } - js = document.getElementsByClassName('mr-2 btn btn-primary btn-sm')[0].click(); ; Save Video Button - try driver.executeScript(js) - driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding + ; Message = Waiting for Video to Finish Uploading`nCurrent Upload Status: %UploadPercent% + ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip") - sleep, 5000 ; 30 seconds - try CurrentURL := driver.url - if(BrighteonUploadPageURL != CurrentURL) - Break + Status := Check_For_Stuck_Video_Upload(A_index, UploadPercent) + if(Status = "Failed") + Return +} + +; Save Video button +TooltipThis("Clicking Save Video Button to finalize Upload") +try BrighteonUploadPageURL := driver.url +try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding + + +TooltipThis("Waiting for Result page to finish loading") +Loop, 60 { ; 5 loops of 1 minute each + if(A_index = 10){ + Message = Upload Failed: Clicking "Save Video" did not Finalize the Upload + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + SaveDriverURLOFErrorPage() + Return ; Break out of gosub } + js = document.getElementsByClassName('mr-2 btn btn-primary btn-sm')[0].click(); ; Save Video Button + try driver.executeScript(js) + driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding + sleep, 5000 ; 30 seconds + try CurrentURL := driver.url + if(BrighteonUploadPageURL != CurrentURL) + Break +} - Message = Trying to Grab Uploaded Video URL - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - ; Message = Waiting 60 Seconds Before Checking Results Page for URL - ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") +Message = Trying to Grab Uploaded Video URL +SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - ; Navigate to Videos page and loop through the videos and grab the URL of the latest upload - try driver.Get("https://www.brighteon.com/dashboard/videos") ;Open selected URL - try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding +; Message = Waiting 60 Seconds Before Checking Results Page for URL +; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") +; Navigate to Videos page and loop through the videos and grab the URL of the latest upload +try driver.Get("https://www.brighteon.com/dashboard/videos") ;Open selected URL +try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding - ; Get First word in video title to use in grabbing video URL - VideoTitleArray := StrSplit(VideoTitle, " ") - ; Iterate from 1 to the end of the array: - Loop % VideoTitleArray.Length(){ - VideoTitleLongWord := VideoTitleArray[A_Index] - ; VideoTitleFirstWord := StrReplace(VideoTitleFirstWord, "_","-") - if(StrLen(VideoTitleLongWord) > 4) - Break - ; MsgBox % VideoTitleArray[A_Index] - } +; Get First word in video title to use in grabbing video URL +VideoTitleArray := StrSplit(VideoTitle, " ") +; Iterate from 1 to the end of the array: +Loop % VideoTitleArray.Length(){ + VideoTitleLongWord := VideoTitleArray[A_Index] + ; VideoTitleFirstWord := StrReplace(VideoTitleFirstWord, "_","-") + if(StrLen(VideoTitleLongWord) > 4) + Break + ; MsgBox % VideoTitleArray[A_Index] +} - Message = VideoTitleLongWord: %VideoTitleLongWord% - SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile") +Message = VideoTitleLongWord: %VideoTitleLongWord% +SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile") - Loop, 4 { - ElementIndexNumber := A_index + 1 - jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].outerHTML; - try BrighteonURL := driver.executeScript(jsCheck) +Loop, 4 { + ElementIndexNumber := A_index + 1 - jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].textContent; - try InnerText := driver.executeScript(jsCheck) + jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].outerHTML; + try BrighteonURL := driver.executeScript(jsCheck) - Message = InnerText: %InnerText% - SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile") + jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].textContent; + try InnerText := driver.executeScript(jsCheck) - Message = BrighteonURL: %BrighteonURL% - SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile") + Message = InnerText: %InnerText% + SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile") - ; Msgbox % "VideoTitleLongWord: " VideoTitleLongWord "`nInnerText: " InnerText - ; clipboard := Message - ; msgbox % Message - ; Msgbox % "InnerText: " InnerText . "`n" . "BrighteonURL: " . BrighteonURL + Message = BrighteonURL: %BrighteonURL% + SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile") - if(InStr(InnerText, VideoTitleLongWord)){ - BrighteonURL := StrSplit(BrighteonURL, "/dashboard/videos/") - BrighteonURL := BrighteonURL[2] - BrighteonURL := StrSplit(BrighteonURL, ">