commented out devmsgboxes that are no longer needed, added some extra error status messages

pull/2/head
Yuriy 2 years ago
parent fe72cc1c35
commit 1f9ce32649

@ -2959,6 +2959,7 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
} }
CheckForAlerts()
Message = Inputting Title Message = Inputting Title
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -2983,6 +2984,10 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
} }
Message = Inputting Description
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; trim description if it's too long ; trim description if it's too long
BitchuteDescription := VideoDescription BitchuteDescription := VideoDescription
if(StrLen(BitchuteDescription) > 2995){ if(StrLen(BitchuteDescription) > 2995){
@ -2992,8 +2997,6 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
else, else,
JSBitchuteDescription := FormatTextToJSText(BitchuteDescription) JSBitchuteDescription := FormatTextToJSText(BitchuteDescription)
Message = Inputting Description
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Loop, 10 { ; Attempt to input video description a couple of times Loop, 10 { ; Attempt to input video description a couple of times
Message = Inputting Description. Attempt #%A_index% Message = Inputting Description. Attempt #%A_index%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3260,7 +3263,7 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
if(InStr(CurrentTab, "login")) ; we're logged out if(InStr(CurrentTab, "login")) ; we're logged out
{ {
Message = Closing out of any popups that might appear on loin page Message = Currently Logged Out`nClosing out of any popups that might appear before clicking Login button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //body/div[@id='__next']/div[@id='modal-root']/div[2]/div[1]/div[1]//*[local-name()='svg'] Xpath = //body/div[@id='__next']/div[@id='modal-root']/div[2]/div[1]/div[1]//*[local-name()='svg']
@ -3276,7 +3279,7 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
; Try clicking the login button, sometimes this will auto log you back in without having to input credentials ; Try clicking the login button, sometimes this will auto log you back in without having to input credentials
xpath = //a[normalize-space()='Log In'] xpath = //a[normalize-space()='Log In']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100)
DevModeMsgBox(Status) ; DevModeMsgBox(Status)
Message = Checking Login Status Message = Checking Login Status
@ -3318,6 +3321,9 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Message = Navigating to Upload Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Navigate to Upload Page ; Navigate to Upload Page
try driver.executeScript("window.location = 'https://www.brighteon.com/dashboard/video-upload'") ;navigate using javascript try driver.executeScript("window.location = 'https://www.brighteon.com/dashboard/video-upload'") ;navigate using javascript
@ -3327,6 +3333,11 @@ try driver.executeScript("return document.readyState").equals("complete")
Xpath = //body/div[@id='__next']/div[@id='modal-root']/div/div/div[1]//*[local-name()='svg'] Xpath = //body/div[@id='__next']/div[@id='modal-root']/div/div/div[1]//*[local-name()='svg']
try driver.FindElementByXPath(Xpath).click() try driver.FindElementByXPath(Xpath).click()
CheckForAlerts()
Message = Uploading Video
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Upload Video ; Upload Video
Xpath = //input[@type='file'] Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath)
@ -3345,26 +3356,32 @@ loop, 3 {
Return Return
} }
; Input Title of the Video ; 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 Xpath = //input[@id='name']
try driver.FindElementByXPath(Xpath).SendKeys(VideoTitle) ;Sends Variable to an Xpath Item try driver.FindElementByXPath(Xpath).SendKeys(VideoTitle) ;Sends Variable to an Xpath Item
; click into keyword box to get focus away from title element and see if the video title registers with website
xpath = //input[@id='keywords']
try driver.FindElementByXPath(Xpath).click()
sleep, 500
; check if title got input
js = return document.querySelector("#name").value; js = return document.querySelector("#name").value;
try, status := driver.executeScript(js) try, status := driver.executeScript(js)
if(status = "")
continue
if(status = ""){ js = return document.querySelector("#name").value;
Message = Failed to input Title try, status := driver.executeScript(js)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
continue
}
Message = Title that got input: %status% Message = Title that got input: %status%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
break break
} }
; Msgbox % "status: " status
TooltipThis("Inputting Video Description") TooltipThis("Inputting Video Description")
@ -3373,7 +3390,7 @@ TooltipThis("Inputting Video Description")
; Attempt to input video description a couple of times ; Attempt to input video description a couple of times
Loop, 10 { Loop, 10 {
Message = Inputting Description. `nAttempt Number: %A_index% Message = Inputting Description. Attempt Number: %A_index%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:="DiscordErrorLogging") ; SaveOrPostProgress(Message:=Message,PostType:="DiscordErrorLogging")
@ -3469,7 +3486,6 @@ Loop, 5 {
; double check on video description after inputting tags ; double check on video description after inputting tags
js = return document.querySelector("div[class='e-content e-lib e-keyboard'] p").innerText; js = return document.querySelector("div[class='e-content e-lib e-keyboard'] p").innerText;
try Input_Description := driver.executeScript(JS) ;Execute Javascript try Input_Description := driver.executeScript(JS) ;Execute Javascript
DevModeMsgBox(Input_Description)
; if text in description box is longer than x chars, then description input worked ; if text in description box is longer than x chars, then description input worked
if(StrLen(Input_Description) > 5){ if(StrLen(Input_Description) > 5){
@ -3667,6 +3683,7 @@ try driver.executeScript("return document.readyState").equals("complete") ; wait
sleep, 1500 sleep, 1500
Message = Uploading Video Message = Uploading Video
SaveOrPostProgress(Message:=Message,PostType:="Tooltip") SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
@ -4810,111 +4827,94 @@ sleep, 5000
Return Return
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
/*
; "Select Video to Upload" Button
Xpath = /html/body/main/div/div/div/section/form[1]/div/div[1]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
Message =Upload Skipped (E#6044)`nLogin Cookies have expired. Please Re-login
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
Status := InputFilePathIntoOpenWindow(VideoFilepath) Message = Checking Login Status
if(Status) SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
{
Message = Upload Failed:`nUnable to Find "Open File" window to input filepath into
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
CheckForAlerts()
*/ try CurrentURL := driver.URL
if(InStr(CurrentURL, "/login.php")){
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
try CurrentURL := driver.URL ; AutoLogin := 1
if(InStr(CurrentURL, "/login.php")){ ; Msgbox % "AutoLogin: " AutoLogin
if(AutoLogin){
Message = Logging in Automatically by clicking into the UN+PW fields for info to register
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; AutoLogin := 1 ; have to click into username and password field for page to register that there's input
; Msgbox % "AutoLogin: " AutoLogin ; clicking with JS doesn't make it register, but with xpath selenium it does
Xpath = //input[@id='login-username']
driver.FindElementByXPath(Xpath).click()
if(AutoLogin){ Xpath = //input[@id='login-password']
Message = Logging in Automatically by clicking into the UN+PW fields for info to register driver.FindElementByXPath(Xpath).click()
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; have to click into username and password field for page to register that there's input
; clicking with JS doesn't make it register, but with xpath selenium it does
Xpath = //input[@id='login-username']
driver.FindElementByXPath(Xpath).click()
Xpath = //input[@id='login-password'] js = document.querySelector("button[type='submit']").click();
driver.FindElementByXPath(Xpath).click() driver.executeScript(js)
js = document.querySelector("button[type='submit']").click(); ; Do a double check to make sure that login worked
driver.executeScript(js) Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
try CurrentURL := driver.URL
; Do a double check to make sure that login worked if(!InStr(CurrentURL, "/upload")){
Message = Checking Login Status Message = Failed to log back in. Please Log Back In Manually
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
try CurrentURL := driver.URL
if(!InStr(CurrentURL, "/upload")){ }
Message = Failed to log back in. Please Log Back In Manually else, { ; notify user and return
Message = Login Expired. Please Log Back in
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
Message = Waiting 5 seconds for page to fully load
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 5000
} }
else, { ; notify user and return
Message = Login Expired. Please Log Back in CheckForAlerts()
Message = Uploading Video File
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //input[@id='Filedata']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath)
if(Status){
Message = Failed to Upload Video File
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
Message = Waiting 5 seconds for page to fully load
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 5000
}
Message = Uploading Video File
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //input[@id='Filedata']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath)
if(Status){
Message = Failed to Upload Video File
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; Input Title ; Input Title
try driver.findElementsByName("title").item[1].SendKeys(VideoTitle) ;selects element based on Name and sends variable to it. try driver.findElementsByName("title").item[1].SendKeys(VideoTitle) ;selects element based on Name and sends variable to it.
catch e { catch e {
Message = Video Upload Failed, Please Check Login Status Message = Video Upload Failed, Please Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
; Input Description ; Input Description
Loop, 5 { ; Attempt to input video description a couple of times Loop, 5 { ; Attempt to input video description a couple of times
TooltipThis("Inputting Description `nAttempt Number: " A_index) TooltipThis("Inputting Description `nAttempt Number: " A_index)
status := js_SendAndCheckWithID(Element:="description",ValueToCheck:="value",SleepLength:=3000,JSStringText:=JSVideoDescription) status := js_SendAndCheckWithID(Element:="description",ValueToCheck:="value",SleepLength:=3000,JSStringText:=JSVideoDescription)
if(!Status) if(!Status)
Break Break
/* if(A_index = 5){ /* if(A_index = 5){
Clipboard := VideoDescription Clipboard := VideoDescription

Loading…
Cancel
Save