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 { loop, 5 {
if(A_index = 5){ if(A_index = 5){
try CurrentURL := driver.url 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% Message = Failed to input Video Title after %A_index% attempts.`nCurrent Tab URL: %currentTabURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
@ -3004,9 +3005,9 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
if(A_index = 10){ if(A_index = 10){
try currentTabURL := driver.url try currentTabURL := GetCurrentTabURlBase()
currentTabURL := SubStr(currentTabURL, 1, 40) ; currentTabURL := SubStr(currentTabURL, 1, 40)
Message = Failed to input Video Description after %A_index% attempts`n `nCurrent Tab URL Beginning: %currentTabURL% Message = Failed to input Video Description after %A_index% attempts`nCurrent Tab URL: %currentTabURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
@ -3327,7 +3328,7 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
try driver.executeScript("return document.readyState").equals("complete") try driver.executeScript("return document.readyState").equals("complete")
try, TabURL := driver.url TabURl := GetCurrentTabURlBase()
Message = Current Tab URL: %TabURL% Message = Current Tab URL: %TabURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") 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 try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
TooltipThis("Waiting for Result page to finish loading") TooltipThis("Waiting for Result page to finish loading")
Loop, 10 { ; 5 loops of 1 minute each Loop, 10 { ; 5 loops of 1 minute each
if(A_index = 10){ if(A_index = 10){
@ -4053,51 +4051,45 @@ DailyMotionURL := StrReplace(ShareLink, "Share link: ","") ; remove the share li
IniWrite, %DailyMotionURL%, %VideoLinksIniFile%, URLs, DailyMotionURL ; save URL IniWrite, %DailyMotionURL%, %VideoLinksIniFile%, URLs, DailyMotionURL ; save URL
; Progress Percentage Message = Clicking Publish Button
TooltipThis("Waiting for Video to Finish Uploading`nChecking Progress Every 5 seconds") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; Xpath = //span[contains(text(),'Upload at')]
Loop, %Number_of_loops_to_Check_Upload_status% { Xpath = //span[normalize-space()='Publish']
sleep, %Time_Between_Loops_Upload_Status% Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1500)
if(Status){
Message = Failed to submit with Publish //span button. Trying with //button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
jsCheck = return document.getElementsByClassName('src-routes-media-common-components-progress-bar-index__details--3_P1L')[0].textContent; Xpath = //button[@name='submit']
try UploadPercentage := driver.executeScript(jsCheck) 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")
if(UploadPercentage = "") js = document.getElementsByClassName('ant-btn ant-btn-primary ant-btn-sm')[1].click();
{ try driver.executeScript(js)
Message = Upload Failed (E#2735)`nUnable to find Progress Upload Percentage
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") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() 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. ; Progress Percentage
SaveOrPostProgress(Message:="Grabbing Share URL",PostType:="Tooltip,ErrorLoggingTextFile") ; 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; ; jsCheck = return document.getElementsByClassName('src-routes-media-pages-upload-components-slot-index__shareLink--nc1-O')[0].textContent;
try ShareLink := driver.executeScript(jsCheck) ; try ShareLink := driver.executeScript(jsCheck)
Message = ShareLink: %ShareLink% ; Message = ShareLink: %ShareLink%
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile") ; SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
if(!InStr(ShareLink, "https")){ if(!InStr(ShareLink, "https")){
Message = Upload Successful but Failed to Grab Video URL 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 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% Message = Upload Complete: %DailyMotionURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -4565,7 +4546,7 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,Disc
Xpath = //input[@id='Filedata'] Xpath = //input[@id='Filedata']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath)
if(Status){ if(Status){
try, CurrentURL := driver.url try, CurrentURL := GetCurrentTabURlBase()
Message = Failed to Upload Video File`nCurrent Tab URL: %CurrentURL% Message = Failed to Upload Video File`nCurrent Tab URL: %CurrentURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()

Loading…
Cancel
Save