Reworked Brighteon Login Check

pull/2/head
Yuriy 2 years ago
parent ae9a59506d
commit 67291b5763

@ -3048,380 +3048,392 @@ try CurrentTab := driver.url
if(InStr(CurrentTab, "login")) ; we're logged out
{
Message = Closing out of any popups that might appear
Message = Closing out of any popups that might appear on loin page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; loop, 2 {
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:=1000)
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:=1000)
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)
; try driver.FindElementByXPath(Xpath).click()
; 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:=1000)
if(AutoLogin){
Message = Trying to Log Back In
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; 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)
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)
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
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")
try PageURL := driver.url
if(InStr(PageURL, "auth.brighteon.com/login?state")){ ; we're logged out and need to manually log back in
sleep, 2000
}
}
else, {
SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
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
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)
; Navigate to Upload Page
try driver.executeScript("window.location = 'https://www.brighteon.com/dashboard/video-upload'") ;navigate using javascript
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")
try driver.executeScript("return document.readyState").equals("complete")
sleep, 2000
}
; 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
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
else, {
SaveOrPostProgress(Message:="Login Expired. Please log back in",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
TooltipThis("Inputting Video Description")
; sleep, 5000
; @todo this doesn't do anything anymore.
; DevModeMsgBox("rework me here")
; Xpath = //textarea[@id='description']
; try, driver.FindElementByXPath(XPATH).SendKeys(driver.Keys.SPACE)
; sleep, 1000
; 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")
; Navigate to Upload Page
try driver.executeScript("window.location = 'https://www.brighteon.com/dashboard/video-upload'") ;navigate using javascript
; SaveOrPostProgress(Message:="Inputting Video Description",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar")
; TooltipThis("Inputting Description)
try driver.executeScript("return document.readyState").equals("complete")
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
}
; 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()
; DevModeMsgBox("pause")
; 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
}
; driver.FindElementByXPath(Xpath).SendKeys(VideoDescription)
; 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 = document.getElementById('description').value = "%JSBrighteonVideoDescription%";
; try driver.executeScript(js)
TooltipThis("Inputting Video Description")
; sleep, 1000
; TooltipThis("checking description input")
; try driver.findElementsByID("description").item[1].SendKeys(driver.Keys.ENTER)
; sleep, 1000
; sleep, 5000
; @todo this doesn't do anything anymore.
; DevModeMsgBox("rework me here")
; Xpath = //textarea[@id='description']
; try, driver.FindElementByXPath(XPATH).SendKeys(driver.Keys.SPACE)
sleep, 5000
; sleep, 1000
js = return document.querySelector("div[class='e-content e-lib e-keyboard'] p").innerText;
try Input_Description := driver.executeScript(JS) ;Execute Javascript
; 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")
; if text in description box is longer than x chars, then description input worked
if(StrLen(Input_Description) > 15){
Input_Description := SubStr(Description, 1, 200)
Message = Description that got input: %Input_Description% ...
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Break
}
; 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)
; 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")
}
}
; js = document.getElementById('description').value = "%JSBrighteonVideoDescription%";
; try driver.executeScript(js)
; Keywords (Tags)
; DevModeMsgBox(VideoTags)
TooltipThis("Inputting Keywords")
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")
}
; sleep, 1000
; TooltipThis("checking description input")
; try driver.findElementsByID("description").item[1].SendKeys(driver.Keys.ENTER)
; sleep, 1000
sleep, 5000
; 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)
; 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")
if(StrLen(Input_Description) > 15){
Input_Description := SubStr(Description, 1, 200)
Message = Description that got input: %Input_Description% ...
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Break
}
else, {
SaveOrPostProgress(Message:="Secondary video description check failed",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
; 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")
}
}
; Keywords (Tags)
; DevModeMsgBox(VideoTags)
TooltipThis("Inputting Keywords")
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")
}
TooltipThis("Waiting for Video to Finish Uploading")
Loop, %Number_of_loops_to_Check_Upload_status% {
sleep, %Time_Between_Loops_Upload_Status%
; Get progress status through javascript
jsCheck = return document.getElementsByClassName('video-upload--details')[0].textContent;
try ProgressStatus := driver.executeScript(jsCheck)
if(ProgressStatus = ""){
Message = Failed to Grab Video Upload Status. Upload Most Likely Failed
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; 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)
if(InStr(ProgressStatus, "Upload complete.")){
Break
}
; 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
}
; Pull out progress Percentage from full string
UploadPercent := StrSplit(ProgressStatus, "(")
UploadPercent := UploadPercent[2]
UploadPercent := StrSplit(UploadPercent, ")")
UploadPercent := UploadPercent[1]
; Message = Waiting for Video to Finish Uploading`nCurrent Upload Status: %UploadPercent%
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
Status := Check_For_Stuck_Video_Upload(A_index, UploadPercent)
if(Status = "Failed")
TooltipThis("Waiting for Video to Finish Uploading")
Loop, %Number_of_loops_to_Check_Upload_status% {
sleep, %Time_Between_Loops_Upload_Status%
; Get progress status through javascript
jsCheck = return document.getElementsByClassName('video-upload--details')[0].textContent;
try ProgressStatus := driver.executeScript(jsCheck)
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, "><div")
BrighteonURL := BrighteonURL[1]
BrighteonURL := StrReplace(BrighteonURL, """", "")
BrighteonURL := "https://www.brighteon.com/" . BrighteonURL
; Msgbox % "BrighteonURL: " BrighteonURL
; Msgbox % "VideoTitleLongWord: " VideoTitleLongWord "`nInnerText: " InnerText
; clipboard := Message
; msgbox % Message
; Msgbox % "InnerText: " InnerText . "`n" . "BrighteonURL: " . BrighteonURL
Break
}
BrighteonURL :=
if(InStr(InnerText, VideoTitleLongWord)){
BrighteonURL := StrSplit(BrighteonURL, "/dashboard/videos/")
BrighteonURL := BrighteonURL[2]
BrighteonURL := StrSplit(BrighteonURL, "><div")
BrighteonURL := BrighteonURL[1]
BrighteonURL := StrReplace(BrighteonURL, """", "")
BrighteonURL := "https://www.brighteon.com/" . BrighteonURL
; Msgbox % "BrighteonURL: " BrighteonURL
Break
}
BrighteonURL :=
}
; Convert dashboard URL to Public URL
; BrighteonURL := StrReplace(BrighteonURL, "dashboard/videos/", "")
if(BrighteonURL = ""){
Message = Upload Completed Successfully but failed to grab Share URL. Please Copy and Paste it in.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
Message = Upload Complete:`n%BrighteonURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniWrite, %BrighteonURL%, %VideoLinksIniFile%, URLs, BrighteonURL
SaveDriverURL()
AddToTotalVideosUploadedCount()
; TakeScreenshotOfPage(ScreenShotSavePath)
; Convert dashboard URL to Public URL
; BrighteonURL := StrReplace(BrighteonURL, "dashboard/videos/", "")
if(BrighteonURL = ""){
Message = Upload Completed Successfully but failed to grab Share URL. Please Copy and Paste it in.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
; -------------------------------/Brighteon Upload-------------------------------
}
Message = Upload Complete:`n%BrighteonURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniWrite, %BrighteonURL%, %VideoLinksIniFile%, URLs, BrighteonURL
SaveDriverURL()
AddToTotalVideosUploadedCount()
; TakeScreenshotOfPage(ScreenShotSavePath)
Return
; -------------------------------/Brighteon Upload-------------------------------
; -------------------------------DailyMotion-------------------------------
DailyMotionUpload:
CurrentSite := "DailyMotion"
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; @todo: remove This section later after update 1.92
IniRead, DailyMotionParnerUploadPage, %SettingsIniFilepath%, General, DailyMotionPostPageURL, %A_Space%
if(!DailyMotionParnerUploadPage){
DailyMotionParnerUploadPage := "https://www.dailymotion.com/partner/x7e48a/media/video/upload"
IniWrite, %DailyMotionParnerUploadPage%, %SettingsIniFilepath%, General, DailyMotionPostPageURL
}
; -------------------------------DailyMotion-------------------------------
DailyMotionUpload:
Status := NavigateFromBaseURLTo(DailyMotionParnerUploadPage,"Partner HQ - Dailymotion")
if(Status)
Return
CurrentSite := "DailyMotion"
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Message = Waiting for Page to Finish Fully Loading
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
sleep, 1500
; @todo: remove This section later after update 1.92
IniRead, DailyMotionParnerUploadPage, %SettingsIniFilepath%, General, DailyMotionPostPageURL, %A_Space%
if(!DailyMotionParnerUploadPage){
DailyMotionParnerUploadPage := "https://www.dailymotion.com/partner/x7e48a/media/video/upload"
IniWrite, %DailyMotionParnerUploadPage%, %SettingsIniFilepath%, General, DailyMotionPostPageURL
}
Status := NavigateFromBaseURLTo(DailyMotionParnerUploadPage,"Partner HQ - Dailymotion")
if(Status)
Return
Message = Waiting for Page to Finish Fully Loading
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
sleep, 1500
Message = Uploading Video
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
Message = Uploading Video
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=2000,StringTextContent:=VideoFilepath)
if(Status){
; DevModeMsgBox(Status)
Message = Trying to Log Back In
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = //button[normalize-space()='Log in']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
sleep, 5000
; Upload file again
Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=2000,StringTextContent:=VideoFilepath)
if(Status){
; DevModeMsgBox(Status)
Message = Trying to Log Back In
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = //button[normalize-space()='Log in']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
sleep, 5000
; Upload file again
Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=2000,StringTextContent:=VideoFilepath)
}
; DevModeMsgBox("test")
sleep, 2000
; Click on Upload Thumbnail Button
TooltipThis("Uploading Thumbnail")
}
; DevModeMsgBox("test")
sleep, 2000
; Click on Upload Thumbnail Button
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: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath)
if(Status){
Message = Failed to Upload Thumbnail: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
Message = Inputting Video Details
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Message = Inputting Video Details
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; @todo: uncomment this and replace the selenium funciton
; Clear video title that is input automatically and input the real title
; @todo: uncomment this and replace the selenium funciton
; Clear video title that is input automatically and input the real title
/*Msgbox % "JSVideoTitle: " JSVideoTitle
js_SendAndCheckWithNAME(Element:="title",ClassIndexNum:=0,ValueToCheck:="value",SleepLength:=1000,JSStringText:=JSVideoTitle)
Msgbox % "Status: " Status

Loading…
Cancel
Save