Removed DailyMotion wait for upload to complete, fixed DailyMotion failing to click publish button sometimes

pull/2/head
Yuriy 2 years ago
parent 6bd717fe3e
commit 50814eef3b

@ -2969,7 +2969,8 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
loop, 5 {
if(A_index = 5){
try CurrentURL := driver.url
currentTabURL := SubStr(currentTabURL, 1, 40)
; CurrentURL := ExtractBaseURL(URL)
; currentTabURL := SubStr(currentTabURL, 1, 40)
Message = Failed to input Video Title after %A_index% attempts.`nCurrent Tab URL: %currentTabURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
@ -3004,9 +3005,9 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
if(A_index = 10){
try currentTabURL := driver.url
currentTabURL := SubStr(currentTabURL, 1, 40)
Message = Failed to input Video Description after %A_index% attempts`n `nCurrent Tab URL Beginning: %currentTabURL%
try currentTabURL := GetCurrentTabURlBase()
; currentTabURL := SubStr(currentTabURL, 1, 40)
Message = Failed to input Video Description after %A_index% attempts`nCurrent Tab URL: %currentTabURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
@ -3327,7 +3328,7 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
try driver.executeScript("return document.readyState").equals("complete")
try, TabURL := driver.url
TabURl := GetCurrentTabURlBase()
Message = Current Tab URL: %TabURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3558,9 +3559,6 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
TooltipThis("Waiting for Result page to finish loading")
Loop, 10 { ; 5 loops of 1 minute each
if(A_index = 10){
@ -4053,51 +4051,45 @@ DailyMotionURL := StrReplace(ShareLink, "Share link: ","") ; remove the share li
IniWrite, %DailyMotionURL%, %VideoLinksIniFile%, URLs, DailyMotionURL ; save URL
; Progress Percentage
TooltipThis("Waiting for Video to Finish Uploading`nChecking Progress Every 5 seconds")
; Xpath = //span[contains(text(),'Upload at')]
Message = Clicking Publish Button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Loop, %Number_of_loops_to_Check_Upload_status% {
sleep, %Time_Between_Loops_Upload_Status%
Xpath = //span[normalize-space()='Publish']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1500)
jsCheck = return document.getElementsByClassName('src-routes-media-common-components-progress-bar-index__details--3_P1L')[0].textContent;
try UploadPercentage := driver.executeScript(jsCheck)
if(Status){
Message = Failed to submit with Publish //span button. Trying with //button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
if(UploadPercentage = "")
{
Message = Upload Failed (E#2735)`nUnable to find Progress Upload Percentage
Xpath = //button[@name='submit']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1500)
if(Status){
Message = Failed to submit with //button button. Trying with JS
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
js = document.getElementsByClassName('ant-btn ant-btn-primary ant-btn-sm')[1].click();
try driver.executeScript(js)
Message = Most likely failed to click the Publish button on video. Please click Publish on the DailyMotion tab to finalize.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return ; Kick out of the gosub
}
if(InStr(UploadPercentage, "100%")) ; If at 100% uploaded, break out of loop
Break
Status := Check_For_Stuck_Video_Upload(A_index, UploadPercentage)
if(Status = "Failed")
Return
}
; if(HasVal(Array_Index_Num_of_Upload_StatusChecks, A_index)) { ; 30 minutes and 60 minutes - send a notification message
; Message = Upload Progress: %UploadPercentage%
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; }
}
; Grab the Share URL and pull out the Video Link from it.
SaveOrPostProgress(Message:="Grabbing Share URL",PostType:="Tooltip,ErrorLoggingTextFile")
; Progress Percentage
; TooltipThis("Waiting for Video to Finish Uploading`nChecking Progress Every 5 seconds")
; Xpath = //span[contains(text(),'Upload at')]
/*Xpath = //span[contains(text(),'Share link:')]
try ShareLink := driver.findelementbyxpath(Xpath).Attribute("innerText")
*/
jsCheck = return document.getElementsByClassName('src-routes-media-pages-upload-components-slot-index__shareLink--nc1-O')[0].textContent;
try ShareLink := driver.executeScript(jsCheck)
; jsCheck = return document.getElementsByClassName('src-routes-media-pages-upload-components-slot-index__shareLink--nc1-O')[0].textContent;
; try ShareLink := driver.executeScript(jsCheck)
Message = ShareLink: %ShareLink%
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
; Message = ShareLink: %ShareLink%
; SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
if(!InStr(ShareLink, "https")){
Message = Upload Successful but Failed to Grab Video URL
@ -4108,17 +4100,6 @@ if(!InStr(ShareLink, "https")){
DailyMotionURL := StrReplace(ShareLink, "Share link: ","") ; remove the share link text from string
; Click the publish button
Xpath = //button[@name='submit']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Video Uploaded but Failed to click Publish button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
js = document.getElementsByClassName('ant-btn ant-btn-primary ant-btn-sm')[1].click();
try driver.executeScript(js)
}
Message = Upload Complete: %DailyMotionURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -4565,7 +4546,7 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,Disc
Xpath = //input[@id='Filedata']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath)
if(Status){
try, CurrentURL := driver.url
try, CurrentURL := GetCurrentTabURlBase()
Message = Failed to Upload Video File`nCurrent Tab URL: %CurrentURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()

Loading…
Cancel
Save