Updating DailyMotion to work with new website design
This commit is contained in:
@@ -3913,7 +3913,8 @@ Loop, 5 { ; make a couple attempts to input description
|
|||||||
|
|
||||||
|
|
||||||
; Make a couple attempts to Click on Drop down menu and select the "Education" Category
|
; Make a couple attempts to Click on Drop down menu and select the "Education" Category
|
||||||
TooltipThis("Selecting Education Category")
|
Message = Selecting Education Category
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
Loop, 3 {
|
Loop, 3 {
|
||||||
if(A_index = 3){
|
if(A_index = 3){
|
||||||
@@ -3938,7 +3939,6 @@ Loop, 3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Message = Inputting Tags
|
Message = Inputting Tags
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
@@ -3958,45 +3958,19 @@ try, inputTags := driver.executeScript(js)
|
|||||||
Message = Tags that got input: %inputTags% (Will be doubled b/c of js)
|
Message = Tags that got input: %inputTags% (Will be doubled b/c of js)
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
; DevModeMsgBox(message)
|
|
||||||
|
|
||||||
/*sleep, 2000 ; sleep 2 seconds for everything to catch up GUI wise
|
; msgbox
|
||||||
loop, 5 {
|
Message = Clicking Next Button to Move on to next input screen
|
||||||
if(A_index = 4) ; if this is attempt number 5 then category wasn't able to be selected
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
{
|
|
||||||
Message = Upload Incomplete (E#5874)`nUnable to Select "Education" category`nPlease Select it and click the save button to finalize upload
|
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
||||||
; Return ; Kick out of the gosub
|
|
||||||
}
|
|
||||||
|
|
||||||
; ; click dropdown menu
|
Xpath = //button[@type='button']//span[contains(text(),'Next')]
|
||||||
; JsToExecute = document.getElementsByClassName('ant-select-selection__rendered')[1].click(); ; Save Video Button
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||||
; Status := JS_TryToExecute(JsToExecute)
|
|
||||||
|
|
||||||
xpath = (//div[@role='combobox'])[3]
|
; msgbox, click work?
|
||||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
|
||||||
; driver.FindElementByXPath(Xpath).click()
|
|
||||||
|
|
||||||
|
Message = Selecting "Not For Kids" checkbox
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
; select "educaiton" category
|
|
||||||
Xpath = //li[normalize-space()='Education']
|
|
||||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
|
||||||
|
|
||||||
|
|
||||||
jsCheck = return document.getElementsByClassName('ant-select-selection-selected-value')[1].textContent;
|
|
||||||
try SelectedCategory := driver.executeScript(jsCheck)
|
|
||||||
if(SelectedCategory = "Education")
|
|
||||||
Break
|
|
||||||
|
|
||||||
try SelectedCategory := driver.findelementbyxpath(CategoryBoxXpath).Attribute("innerText") ;GREAT FOR GRABBING INNER CONTENTS/Values
|
|
||||||
if(SelectedCategory = "Education")
|
|
||||||
Break
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
TooltipThis("Checking Not for Kids checkbox")
|
|
||||||
try driver.findElementsByName("is_created_for_kids").item[2].click()
|
try driver.findElementsByName("is_created_for_kids").item[2].click()
|
||||||
catch e {
|
catch e {
|
||||||
sleep, 2000
|
sleep, 2000
|
||||||
@@ -4022,12 +3996,12 @@ if(Status = "Failed"){
|
|||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
SaveOrPostProgress(Message:="Unchecking monetizaton checkbox",PostType:="Tooltip,ErrorLoggingTextFile")
|
; SaveOrPostProgress(Message:="Unchecking monetizaton checkbox",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
; switch over to advanced tab
|
; switch over to advanced tab
|
||||||
js = document.getElementsByName('advanced')[0].click();
|
; js = document.getElementsByName('advanced')[0].click();
|
||||||
try driver.executeScript(js)
|
; try driver.executeScript(js)
|
||||||
|
/*
|
||||||
|
|
||||||
sleep, 1000
|
sleep, 1000
|
||||||
Loop, 5 { ; Loop to uncheck the "monetization button"
|
Loop, 5 { ; Loop to uncheck the "monetization button"
|
||||||
@@ -4047,74 +4021,53 @@ Break
|
|||||||
Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
/*
|
||||||
; Switch back to Basic tab
|
; Switch back to Basic tab
|
||||||
js = document.getElementsByName('basic')[0].click();
|
js = document.getElementsByName('basic')[0].click();
|
||||||
try driver.executeScript(js)
|
try driver.executeScript(js)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
; Grab the Share URL and pull out the Video Link from it and save it to the Video Linsk ini file, so double uploads are not tried if fialure occurs
|
Message = Clicking Next Button to Move on to third video settings screen
|
||||||
Message = Grabbing Share URL
|
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
|
||||||
|
|
||||||
Xpath = //span[contains(text(),'Share link:')]
|
|
||||||
try ShareLink := driver.findelementbyxpath(Xpath).Attribute("innerText")
|
|
||||||
; Message = %ShareLink%
|
|
||||||
SaveOrPostProgress(Message:=ShareLink,PostType:="Tooltip,ErrorLoggingTextFile")
|
|
||||||
|
|
||||||
DailyMotionURL := StrReplace(ShareLink, "Share link: ","") ; remove the share link text from string
|
|
||||||
|
|
||||||
IniWrite, %DailyMotionURL%, %VideoLinksIniFile%, URLs, DailyMotionURL ; save URL
|
|
||||||
|
|
||||||
|
|
||||||
Message = Clicking Publish Button
|
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
Xpath = //span[normalize-space()='Publish']
|
Xpath = //button[@type='button']//span[contains(text(),'Next')]
|
||||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1500)
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Message = Clicking Save Button to Finalize Upload
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
Xpath = //span[normalize-space()='Save']
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||||
if(Status){
|
if(Status){
|
||||||
Message = Failed to submit with Publish //span button. Trying with //button
|
Message = Upload was ALMOST successfuly. Failed to Click Final Save button
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
}
|
||||||
|
|
||||||
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();
|
; Grab the Share URL and pull out the Video Link from it and save it to the Video links ini file, so double uploads are not tried if fialure occurs
|
||||||
try driver.executeScript(js)
|
Message = Waiting 30 seconds before grabbing Video URL
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
Message = Most likely failed to click the Publish button on video. Please click Publish on the DailyMotion tab to finalize.
|
sleep, 30000
|
||||||
|
|
||||||
|
|
||||||
|
Xpath = //ul[@data-test-id='videos-media-list']//li//div//div//div//div//h3//a
|
||||||
|
try, DailyMotionInternalURL := driver.findelementbyxpath(Xpath).Attribute("href")
|
||||||
|
if(DailyMotionInternalURL = ""){
|
||||||
|
Message = Failed to Grab Video URL. Upload Most likely Failed.
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
SaveDriverURLOFErrorPage()
|
SaveDriverURLOFErrorPage()
|
||||||
}
|
Return
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; Pull out URL slug from internal video URL and create dailymotion share URL from it
|
||||||
; Progress Percentage
|
DailyMotionURL := StrSplit(DailyMotionInternalURL, "/video/details/")[2]
|
||||||
; TooltipThis("Waiting for Video to Finish Uploading`nChecking Progress Every 5 seconds")
|
DailyMotionURL := "https://www.dailymotion.com/video/" . DailyMotionURL
|
||||||
; Xpath = //span[contains(text(),'Upload at')]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; 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")
|
|
||||||
|
|
||||||
if(!InStr(ShareLink, "https")){
|
|
||||||
Message = Upload Successful but Failed to Grab Video URL
|
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
||||||
; Return
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DailyMotionURL := StrReplace(ShareLink, "Share link: ","") ; remove the share link text from string
|
|
||||||
|
|
||||||
|
|
||||||
Message = Upload Complete: %DailyMotionURL%
|
Message = Upload Complete: %DailyMotionURL%
|
||||||
|
|||||||
Reference in New Issue
Block a user