modularization of the individual upload sites into their own #include files
parent
f3e526f79d
commit
781ca473ba
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,313 @@
|
|||||||
|
BitChuteUpload:
|
||||||
|
;------------------------------------------------
|
||||||
|
CurrentSite := "Bitchute"
|
||||||
|
|
||||||
|
Message = Starting Upload
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
|
||||||
|
Status := NavigateFromBaseURLTo("https://www.bitchute.com/myupload", "BitChute Video Uploader")
|
||||||
|
if(Status)
|
||||||
|
Return
|
||||||
|
|
||||||
|
Message = Checking Login Status
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
try TabUrl := driver.url
|
||||||
|
if(InStr(TabUrl, "/accounts/login/")){
|
||||||
|
if(AutoLogin){
|
||||||
|
Xpath = (//button[normalize-space()='Submit'])[1]
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||||
|
if(Status){
|
||||||
|
Message = Failed to click Login Button. Please Log Back In
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else, {
|
||||||
|
Message = Login Expired. Please Log Back In
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CheckForAlerts()
|
||||||
|
|
||||||
|
Message = Inputting Title
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
; Try to input video title, check if input and if not, try again
|
||||||
|
loop, 5 {
|
||||||
|
status := js_SendAndCheckWithQuerySelector(Selector:="#title",ValueToCheck:="value",SleepLength:=1000,JSStringText:=VideoTitle)
|
||||||
|
; Msgbox % "status: " status
|
||||||
|
|
||||||
|
if(!Status)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(Status){
|
||||||
|
Message = Failed to input Video Title with Javascript. Trying again with Manual Typing
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
Xpath = //input[@id='title']
|
||||||
|
Status := Selenium_TypeTextIntoElement(VideoTitle, Xpath)
|
||||||
|
if(Status){
|
||||||
|
Message = Failed to Input Video Title after trying two different ways. Please try Upload again and double check that the website hasn't been updated in a major way.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar, DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
try, TextInputted := driver.findelementbyxpath(Xpath).Attribute("value") ;XPath: ID=site-title & span tag
|
||||||
|
if(InStr(VideoTitle, TextInputted) OR VideoTitle = TextInputted){
|
||||||
|
; Title got input successfully
|
||||||
|
}
|
||||||
|
else, {
|
||||||
|
Message = Title that got input into Bitchute: %TextInputted%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
Message = Failed to Input Video Title after trying two different ways. Please try Upload again and double check that the website hasn't been updated in a major way.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar, DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Message = Inputting Description
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
; trim description if it's too long
|
||||||
|
BitchuteDescription := VideoDescription
|
||||||
|
if(StrLen(BitchuteDescription) > 2995){
|
||||||
|
BitchuteDescription := SubStr(BitchuteDescription, 1, 2995)
|
||||||
|
JSBitchuteDescription := FormatTextToJSText(BitchuteDescription)
|
||||||
|
}
|
||||||
|
else,
|
||||||
|
JSBitchuteDescription := FormatTextToJSText(BitchuteDescription)
|
||||||
|
|
||||||
|
Loop, 10 { ; Attempt to input video description a couple of times
|
||||||
|
Message = Inputting Description. Attempt #%A_index%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
|
||||||
|
if(A_index = 10){
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status := js_SendAndCheckWithQuerySelector("#description",ValueToCheck:="value",SleepLength:=1000,JSStringText:=JSBitchuteDescription)
|
||||||
|
if(status){
|
||||||
|
Message = %status%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
}
|
||||||
|
else,
|
||||||
|
Break
|
||||||
|
|
||||||
|
sleep, 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Message = Inputting Tags
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
; Convert tags into #hasthtags
|
||||||
|
Loop, 3 {
|
||||||
|
Value := KeywordsArray[A_Index]
|
||||||
|
Value := StrReplace(Value, " ", "") ; Remove spaces if hashtag has two words
|
||||||
|
; HashTag := "#" . Value
|
||||||
|
BitchuteHashtags .= Value . " "
|
||||||
|
}
|
||||||
|
|
||||||
|
; input hashtags
|
||||||
|
Xpath = //input[@placeholder='Search Terms']
|
||||||
|
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BitchuteHashtags)
|
||||||
|
|
||||||
|
; Upload Thumbnail
|
||||||
|
Message = Attaching Thumbnail
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
if(VideoThumbFilepath != ""){
|
||||||
|
; Upload Cover Image Button
|
||||||
|
Message = Uploading Thumbnail
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
|
||||||
|
Xpath = //input[@name='thumbnailInput']
|
||||||
|
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath)
|
||||||
|
if(Status){
|
||||||
|
Message = Failed to Attach Thumbnail
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
; sleep, 5000
|
||||||
|
}
|
||||||
|
|
||||||
|
; Upload Video button
|
||||||
|
Message = Uploading Video File
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
Xpath = //input[@name='videoInput']
|
||||||
|
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath)
|
||||||
|
if(Status){
|
||||||
|
Message = Failed to Upload Video
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Message = Waiting for Video to Finish Uploading`nChecking Progress Every 5 seconds
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
Xpath = //div[@role='progressbar'] ; Xpath to progress %
|
||||||
|
Loop, %Number_of_loops_to_Check_Upload_status% {
|
||||||
|
sleep, %Time_Between_Loops_Upload_Status%
|
||||||
|
|
||||||
|
if(A_index = 5){ ; while waiting for bitchute video to finish uploading, start up lbry
|
||||||
|
if(OdyseeVideo OR OdyseeAudio){
|
||||||
|
SaveOrPostProgress(Message:="Starting up LBRY while waiting for Bitchute Video to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
CheckLBRYProcess()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
; Selenium
|
||||||
|
; try BitChuteUploadProgress := driver.findelementbyxpath(Xpath).Attribute("innerText") ;GREAT FOR GRABBING INNER CONTENTS/Values
|
||||||
|
|
||||||
|
try BitChuteUploadProgress := driver.executeScript("return document.querySelector('.filepond--file-status').innerHTML;") ;navigate using javascript
|
||||||
|
; Msgbox % "BitChuteUploadProgress: " BitChuteUploadProgress
|
||||||
|
|
||||||
|
if(BitChuteUploadProgress = ""){
|
||||||
|
Message = Unable to Grab Upload Progress, Upload Possibly Failed
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
if(InStr(BitChuteUploadProgress, "Upload complete")){
|
||||||
|
Message = Waiting 10 Seconds before clicking "Proceed" button
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
sleep, 10000
|
||||||
|
Break ; Break out of the loop when 100% upload status
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
; split_text = ">
|
||||||
|
; Pull out upload percentage
|
||||||
|
BitChuteUploadProgress := StrSplit(BitChuteUploadProgress, ">")
|
||||||
|
BitChuteUploadProgress := BitChuteUploadProgress[2]
|
||||||
|
BitChuteUploadProgress := StrSplit(BitChuteUploadProgress, "</span")
|
||||||
|
BitChuteUploadProgress := BitChuteUploadProgress[1]
|
||||||
|
; DevModeMsgBox(BitChuteUploadProgress)
|
||||||
|
|
||||||
|
Status := Check_For_Stuck_Video_Upload(A_index, BitChuteUploadProgress)
|
||||||
|
if(Status = "Failed")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
try UploadPageURL := driver.url ; save the active URL to a variable
|
||||||
|
|
||||||
|
; Finish Uploading Button
|
||||||
|
Xpath = //button[normalize-space()='Proceed'] ; Finish button
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=5000)
|
||||||
|
if(Status){
|
||||||
|
Message = Failed to Click "Finish" button
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
}
|
||||||
|
; try driver.FindElementByXPath(Xpath).click() ;Try to click on the "Finish" button
|
||||||
|
|
||||||
|
; Error Popup Location if something goes wrong.
|
||||||
|
Xpath = /html/body/div[2]/div
|
||||||
|
try BitChuteError := driver.findelementbyxpath(Xpath).Attribute("innerText") ; Grabb innertext
|
||||||
|
|
||||||
|
|
||||||
|
TooltipThis("Waiting for video page to finish loading")
|
||||||
|
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
|
||||||
|
|
||||||
|
; Loop for 2 minutes and keep checking if the active page has moved on to the video page
|
||||||
|
|
||||||
|
Message = Waiting 30 Seconds Before Refreshing Page to Find Newest Video
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
Loop, 6 { ; 6 loops X 30 seconds
|
||||||
|
sleep, 5000
|
||||||
|
try CurrentWindow := driver.URL
|
||||||
|
if(CurrentWindow != UploadPageURL AND A_index = 6) ; could also check for: https://www.bitchute.com/channel in str
|
||||||
|
Break
|
||||||
|
|
||||||
|
if(A_index = 6){
|
||||||
|
Message = Upload Likely Failed: Videos Page did not Appear after 2 minutes
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try driver.executeScript("history.go(0)") ;refresh page
|
||||||
|
|
||||||
|
|
||||||
|
try FirstResultVideoTitle := driver.findElementsByClass("channel-videos-title").item[1].Attribute("innerText") ; Grabb innertext
|
||||||
|
|
||||||
|
; msgbox % FirstResultVideoTitle = VideoTitle
|
||||||
|
|
||||||
|
try FirstResultIDAndTag := driver.findElementsByClass("channel-videos-title").item[1].Attribute("outerHTML") ;XPath: ID=site-title & span tag
|
||||||
|
; Msgbox % "FirstResultIDAndTag: " FirstResultIDAndTag
|
||||||
|
VideoHref := StrSplit(FirstResultIDAndTag, "<a href=")[2]
|
||||||
|
VideoHref := StrSplit(VideoHref, " class=")[1]
|
||||||
|
SingleQuote = "
|
||||||
|
VideoHref := StrReplace(VideoHref, SingleQuote, "")
|
||||||
|
|
||||||
|
if(VideoHref = ""){
|
||||||
|
Message = Failed to Grab Video URL. Please Copy and Paste it into Result Window
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
BitChuteURL := "https://www.bitchute.com/" . VideoHref
|
||||||
|
BitChuteURL := StrReplace(BitchuteURL, "//video", "/video")
|
||||||
|
|
||||||
|
; navigate to video page
|
||||||
|
try driver.Get(BitChuteURL) ;Open selected URL
|
||||||
|
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
|
||||||
|
|
||||||
|
|
||||||
|
Xpath = //a[@data-toggle='tab'][normalize-space()='Settings']
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=15,SleepLength:=5000)
|
||||||
|
if(Status){
|
||||||
|
Message = Failed to Navigate to Video Settings Page to Uncheck "Allow Comments"
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; Unclick the "Discussion Allowed on This Video" checkbox
|
||||||
|
js = document.querySelector("form[id='save-settings'] div div label span").click()
|
||||||
|
try driver.executeScript(js)
|
||||||
|
|
||||||
|
try Status := driver.findElementsByID("id_is_discussable").item[1].isSelected()
|
||||||
|
Message = Checked Status = %Status%`n-1 is checked. 0 is unchecked
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
|
||||||
|
; Click the save button
|
||||||
|
Xpath = //button[normalize-space()='Save']
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||||
|
|
||||||
|
Message = Upload Complete:`n%BitChuteURL%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
IniWrite, %BitChuteURL%, %VideoLinksIniFile%, URLs, BitChuteURL
|
||||||
|
|
||||||
|
SaveDriverURL()
|
||||||
|
AddToTotalVideosUploadedCount()
|
||||||
|
|
||||||
|
|
||||||
|
Return
|
@ -0,0 +1,452 @@
|
|||||||
|
BrighteonUpload:
|
||||||
|
;------------------------------------------------
|
||||||
|
CurrentSite := "Brighteon"
|
||||||
|
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
Status := NavigateFromBaseURLTo("https://www.brighteon.com/dashboard/video-upload")
|
||||||
|
if(Status)
|
||||||
|
Return
|
||||||
|
|
||||||
|
|
||||||
|
JSBrighteonVideoDescription := FormatTextToJSText(VideoDescription)
|
||||||
|
; Msgbox % "JSBrighteonVideoDescription: " JSBrighteonVideoDescription
|
||||||
|
|
||||||
|
; descriptions longer than 5k characters just fail to get input so trim them to below 5000 characters
|
||||||
|
if(StrLen(VideoDescription) >= 5000){
|
||||||
|
BrighteonVideoDescription := SubStr(VideoDescription, 1, 4800)
|
||||||
|
BrighteonVideoDescription .= "...."
|
||||||
|
JSBrighteonVideoDescription := FormatTextToJSText(BrighteonVideoDescription)
|
||||||
|
|
||||||
|
if(StrLen(JSBrighteonVideoDescription) > 5000){
|
||||||
|
BrighteonVideoDescription := SubStr(VideoDescription, 1, 4500)
|
||||||
|
BrighteonVideoDescription .= "...."
|
||||||
|
JSBrighteonVideoDescription := FormatTextToJSText(BrighteonVideoDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Message = Checking Login Status
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
try CurrentTab := driver.url
|
||||||
|
if(InStr(CurrentTab, "login")) ; we're logged out
|
||||||
|
{
|
||||||
|
|
||||||
|
Message = Currently Logged Out`nClosing out of any popups that might appear before clicking Login button
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
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:=100)
|
||||||
|
|
||||||
|
; If newsletter pop up exists then close it.
|
||||||
|
Xpath = //div[@class='overlay__close inside']
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100)
|
||||||
|
|
||||||
|
; 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)
|
||||||
|
|
||||||
|
|
||||||
|
Message = Checking Login Status
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
try PageURL := driver.url
|
||||||
|
if(InStr(PageURL, "auth.brighteon.com/login?state")){ ; we're logged out and need to manually log back in
|
||||||
|
|
||||||
|
|
||||||
|
if(AutoLogin){
|
||||||
|
Message = Trying to Log Back In
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile, DiscordErrorLogging")
|
||||||
|
|
||||||
|
; js = return document.querySelector("input[placeholder='username/email']").value;
|
||||||
|
; status := try driver.executeScript(JS) ;Execute Javascript
|
||||||
|
|
||||||
|
; sleep, 5000
|
||||||
|
; Msgbox % "status: " status
|
||||||
|
|
||||||
|
; if(StrLen(Status) > 0){
|
||||||
|
; msgbox, clicking login button
|
||||||
|
Xpath = //a[normalize-space()='Log In'] ; click login button at top right of page
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||||
|
|
||||||
|
; sleep, 2000
|
||||||
|
Xpath = //button[@type='submit'] ; click login button on login page
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=6,SleepLength:=1000)
|
||||||
|
try driver.executeScript("return document.readyState").equals("complete")
|
||||||
|
|
||||||
|
sleep, 2000
|
||||||
|
; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else, {
|
||||||
|
SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Message = Navigating to Upload Page
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
; Navigate to Upload Page
|
||||||
|
try driver.executeScript("window.location = 'https://www.brighteon.com/dashboard/video-upload'") ;navigate using javascript
|
||||||
|
|
||||||
|
try driver.executeScript("return document.readyState").equals("complete")
|
||||||
|
|
||||||
|
TabURl := GetCurrentTabURlBase()
|
||||||
|
Message = Current Tab URL: %TabURL%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
; 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()
|
||||||
|
|
||||||
|
|
||||||
|
CheckForAlerts()
|
||||||
|
|
||||||
|
Message = Uploading Video
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
; 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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
loop, 3 {
|
||||||
|
if(A_index = 3){
|
||||||
|
Message = Failed to input Video Title
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; Input Title of the Video
|
||||||
|
Xpath = //input[@id='name']
|
||||||
|
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;
|
||||||
|
try, status := driver.executeScript(js)
|
||||||
|
if(status = "")
|
||||||
|
continue
|
||||||
|
|
||||||
|
js = return document.querySelector("#name").value;
|
||||||
|
try, status := driver.executeScript(js)
|
||||||
|
|
||||||
|
Message = Title that got input: %status%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
break
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TooltipThis("Inputting Video Description")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Attempt to input video description a couple of times
|
||||||
|
Loop, 10 {
|
||||||
|
if(A_index = 10){
|
||||||
|
Message = Failed to input Video Description after 10 attempts.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
Message = Inputting Description. Attempt Number: %A_index%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
; SaveOrPostProgress(Message:=Message,PostType:="DiscordErrorLogging")
|
||||||
|
|
||||||
|
; 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,DiscordErrorLogging")
|
||||||
|
; SaveDriverURLOFErrorPage()
|
||||||
|
; Return
|
||||||
|
}
|
||||||
|
|
||||||
|
; DevModeMsgBox("pause")
|
||||||
|
|
||||||
|
; driver.FindElementByXPath(Xpath).SendKeys(VideoDescription)
|
||||||
|
|
||||||
|
; js = document.getElementById('description').value = "%JSBrighteonVideoDescription%";
|
||||||
|
; try driver.executeScript(js)
|
||||||
|
|
||||||
|
|
||||||
|
; sleep, 1000
|
||||||
|
; TooltipThis("checking description input")
|
||||||
|
; try driver.findElementsByID("description").item[1].SendKeys(driver.Keys.ENTER)
|
||||||
|
; sleep, 1000
|
||||||
|
|
||||||
|
sleep, 5000
|
||||||
|
|
||||||
|
|
||||||
|
js = return document.querySelector("div[class='e-content e-lib e-keyboard'] p").innerText;
|
||||||
|
try Input_Description := driver.executeScript(JS) ;Execute Javascript
|
||||||
|
|
||||||
|
Input_DescriptionStrLen := StrLen(Input_Description)
|
||||||
|
Message = Length of Description that got input: %Input_DescriptionStrLen%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
; if text in description box is longer than x chars, then description input worked
|
||||||
|
if(StrLen(Input_Description) > 15){
|
||||||
|
Input_Description := SubStr(Input_Description, 1, 20)
|
||||||
|
Message = Description that got input: %Input_Description% ...
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
Break
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; 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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; DevModeMsgBox(VideoTags)
|
||||||
|
TooltipThis("Inputting Keywords")
|
||||||
|
Loop, 5 {
|
||||||
|
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")
|
||||||
|
}
|
||||||
|
|
||||||
|
; click into video title to get focus away from inputbox
|
||||||
|
Xpath = /html/body/div/section[2]/div[2]/div/form/div[1]/div[1]/div[2]/div[1]/div/input
|
||||||
|
try, driver.FindElementByXPath(Xpath).click() ;Sends Variable to an Xpath Item
|
||||||
|
|
||||||
|
; check that the tags got input
|
||||||
|
js = return document.querySelector("#keywords").value;
|
||||||
|
try, status := driver.executeScript(js)
|
||||||
|
if(!status){
|
||||||
|
Message = Failed to input tags.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
}
|
||||||
|
else, {
|
||||||
|
Message = Tags that got input: %status%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
; Msgbox % "status: " status
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
; 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
|
||||||
|
|
||||||
|
; 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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
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]
|
||||||
|
|
||||||
|
; 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")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; "Save Now" button
|
||||||
|
js = return document.querySelector("button[class='mr-2 btn btn-primary btn-sm']").textContent;
|
||||||
|
try, status := driver.executeScript(js)
|
||||||
|
if(!InStr(status, "Save Video")){
|
||||||
|
Message = Save Video Button is not clickable. Please check page for errors.
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
TooltipThis("Waiting for Result page to finish loading")
|
||||||
|
Loop, 10 { ; 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 Newest Video's URL
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
sleep, 2000
|
||||||
|
|
||||||
|
; Navigate to Videos page to make sure it's refreshed with latest video
|
||||||
|
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
|
||||||
|
sleep, 2000
|
||||||
|
|
||||||
|
|
||||||
|
; 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:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
try, CurrentURL := driver.url
|
||||||
|
Message = Trying to Grab URL of latest upload containing keyword: %VideoTitleLongWord%. Tab's current URL: %CurrentURL%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
; DevModeMsgBox(Message)
|
||||||
|
|
||||||
|
Loop, 4 {
|
||||||
|
ElementIndexNumber := A_index - 1
|
||||||
|
|
||||||
|
jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].outerHTML;
|
||||||
|
try BrighteonURL := driver.executeScript(jsCheck)
|
||||||
|
|
||||||
|
jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].textContent;
|
||||||
|
try InnerText := driver.executeScript(jsCheck)
|
||||||
|
|
||||||
|
; Message = Loop Number: %ElementIndexNumber% element's Text Content: %innerText%`nBrighteonURL: %BrighteonURL%
|
||||||
|
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
; Message = InnerText: %InnerText%
|
||||||
|
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||||
|
; DevModeMsgBox(InnerText)
|
||||||
|
|
||||||
|
; Message = BrighteonURL: %BrighteonURL%
|
||||||
|
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Msgbox % "VideoTitleLongWord: " VideoTitleLongWord "`nInnerText: " InnerText
|
||||||
|
; clipboard := Message
|
||||||
|
; msgbox % Message
|
||||||
|
; Msgbox % "InnerText: " InnerText . "`n" . "BrighteonURL: " . BrighteonURL
|
||||||
|
|
||||||
|
if(InStr(InnerText, VideoTitleLongWord)){
|
||||||
|
Message = Title Keyword was found on %A_index% loop, within element: %innerText%`nTrying to pull out BrighteonURL from element's outerHTML
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
BrighteonURL := StrSplit(BrighteonURL, "/dashboard/videos/")
|
||||||
|
BrighteonURL := BrighteonURL[2]
|
||||||
|
BrighteonURL := StrSplit(BrighteonURL, "><div")
|
||||||
|
BrighteonURL := BrighteonURL[1]
|
||||||
|
BrighteonURL := StrReplace(BrighteonURL, """", "")
|
||||||
|
BrighteonURL := "https://www.brighteon.com/" . BrighteonURL
|
||||||
|
Break
|
||||||
|
}
|
||||||
|
else, {
|
||||||
|
message = Keyword was not within: %VideoTitle%. Trying again with next element.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
Return
|
@ -0,0 +1,379 @@
|
|||||||
|
DailyMotionUpload:
|
||||||
|
;------------------------------------------------
|
||||||
|
|
||||||
|
CurrentSite := "DailyMotion"
|
||||||
|
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
IniRead, DailyMotionParnerUploadPage, %SettingsIniFilepath%, General, DailyMotionPostPageURL, %A_Space%
|
||||||
|
if(DailyMotionParnerUploadPage = ""){
|
||||||
|
Message = Please add your DailyMotion Upload URL to settings.ini file under:`n`n[General]`nDailyMotionParnerUploadPage=https://www.dailymotion.com/partner/[YOURIDNUMBER]/media/video/upload
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
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 = Checking Log In Status
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
LoggedOutStatus := CheckURLForSubstring("/sign-in")
|
||||||
|
if(LoggedOutStatus){
|
||||||
|
|
||||||
|
if(AutoLogin){
|
||||||
|
Message = Trying to Log Back in Automatically
|
||||||
|
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[@placeholder='Email address']
|
||||||
|
try driver.FindElementByXPath(Xpath).click()
|
||||||
|
|
||||||
|
Xpath = //input[@placeholder='Enter password']
|
||||||
|
driver.FindElementByXPath(Xpath).click()
|
||||||
|
|
||||||
|
js = document.querySelector("button[type='submit']").click();
|
||||||
|
driver.executeScript(js)
|
||||||
|
|
||||||
|
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
|
||||||
|
sleep, 1000
|
||||||
|
|
||||||
|
; Do a double check to make sure that login worked
|
||||||
|
Message = Checking Login Status
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
LoggedOutStatus := CheckURLForSubstring("/sign-in")
|
||||||
|
if(LoggedOutStatus){
|
||||||
|
Message = Failed to log back in. Please Log Back In Manually
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else, { ; notify user and return
|
||||||
|
Message = Login Expired. Please Log Back in
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
Message = Waiting 5 seconds for page to fully load
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
sleep, 5000
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status := CheckForAlerts()
|
||||||
|
if(Status){
|
||||||
|
Message = Waiting for page to fully load
|
||||||
|
try, driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
|
||||||
|
sleep, 2000
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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){
|
||||||
|
|
||||||
|
Message = Failed to Upload Video. Please Check Login Status
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
|
||||||
|
}
|
||||||
|
sleep, 2000
|
||||||
|
|
||||||
|
|
||||||
|
Message = Uploading Thumbnail
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,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 Title
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
loop, 5 { ; sometimes the pre-inserted title doesn't get cleaned out when inputting title
|
||||||
|
|
||||||
|
if(A_index = 5){
|
||||||
|
Message = Failed to input title after 5 attempts.
|
||||||
|
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
; Return
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
Xpath = (//input[@placeholder='Enter text'])[1]
|
||||||
|
try, driver.FindElementByXPath(Xpath).click()
|
||||||
|
|
||||||
|
js = document.querySelector("input[placeholder='Enter text']").value = "%JSVideoTitle%";
|
||||||
|
try driver.executeScript(js)
|
||||||
|
|
||||||
|
Xpath = (//input[@placeholder='Enter text'])[1]
|
||||||
|
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.SPACE)
|
||||||
|
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.BackSpace)
|
||||||
|
|
||||||
|
; get text in title box and see if it matches video title
|
||||||
|
js = return document.querySelector("input[placeholder='Enter text']").value;
|
||||||
|
try CurrentTitle := driver.executeScript(js)
|
||||||
|
; Msgbox % "CurrentTitle: " CurrentTitle
|
||||||
|
|
||||||
|
if(CurrentTitle != VideoTitle){
|
||||||
|
Message = Failed to input title on attempt %A_index%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
sleep, 1000
|
||||||
|
}
|
||||||
|
else,
|
||||||
|
Break
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Message = Inputting Video Description
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
|
||||||
|
if(strLen(VideoDescription) > 2900){
|
||||||
|
DailyMotionDescription := SubStr(VideoDescription, 1, 2900) . "..."
|
||||||
|
}
|
||||||
|
else,
|
||||||
|
DailyMotionDescription := VideoDescription
|
||||||
|
|
||||||
|
|
||||||
|
DailyMotionJSDescription := FormatTextToJSText(DailyMotionDescription)
|
||||||
|
|
||||||
|
Message := "DailyMotionJSDescription String Length: " . StrLen(DailyMotionJSDescription)
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
|
||||||
|
Message = Inputting Video Description
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
Loop, 5 { ; make a couple attempts to input description
|
||||||
|
if(A_index = 5){
|
||||||
|
Message = Failed to input Description after %A_index% attempts.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; click into element
|
||||||
|
Xpath = //textarea[@placeholder='Enter a description']
|
||||||
|
try driver.FindElementByXPath(Xpath).click()
|
||||||
|
|
||||||
|
; send a space and then backspace so element registers the input
|
||||||
|
Xpath = //textarea[@placeholder='Enter a description']
|
||||||
|
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.SPACE)
|
||||||
|
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.BackSpace)
|
||||||
|
|
||||||
|
|
||||||
|
; inut description with javascript
|
||||||
|
js = document.querySelector("textarea[placeholder='Enter a description']").value = "%JSVideoDescription%";
|
||||||
|
try driver.executeScript(js)
|
||||||
|
|
||||||
|
; send a space and then backspace so element registers the input
|
||||||
|
Xpath = //textarea[@placeholder='Enter a description']
|
||||||
|
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.SPACE)
|
||||||
|
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.BackSpace)
|
||||||
|
|
||||||
|
sleep, 1000
|
||||||
|
|
||||||
|
js = return document.querySelector("textarea[placeholder='Enter a description']").textContent;
|
||||||
|
try, InputDescription := driver.executeScript(js)
|
||||||
|
|
||||||
|
message = InputDescription: %InputDescription%
|
||||||
|
DevModeMsgBox(InputDescription)
|
||||||
|
|
||||||
|
; if input description is less than 15 chars, try again
|
||||||
|
if(StrLen(InputDescription) < 15)
|
||||||
|
Continue
|
||||||
|
else,
|
||||||
|
Break
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Make a couple attempts to Click on Drop down menu and select the "Education" Category
|
||||||
|
Message = Selecting Education Category
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
Loop, 3 {
|
||||||
|
if(A_index = 3){
|
||||||
|
Message = Failed to Select Education Category after %A_index% attempts
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
Xpath = //div[@name='channel']
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||||
|
|
||||||
|
js = document.querySelector("div[title='Education'] div[class='ant-select-item-option-content']").click()
|
||||||
|
try status := driver.executeScript(js)
|
||||||
|
|
||||||
|
js = return document.querySelector("div[name='channel']").textContent;
|
||||||
|
try, status := driver.executeScript(js)
|
||||||
|
|
||||||
|
if(instr(status, "Education"))
|
||||||
|
break
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Message = Inputting Tags
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
; Append comma to end of tags
|
||||||
|
; DailyMotion page automtically splits the tags into their little boxes when they're seperated by commas
|
||||||
|
DailyMotionVideoTags := VideoTags . ","
|
||||||
|
|
||||||
|
Message = Video Tags: %DailyMotionVideoTags%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
Xpath = //div[@class='ant-select-selection-search']//input[@role='combobox']
|
||||||
|
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=DailyMotionVideoTags)
|
||||||
|
|
||||||
|
; double check the input
|
||||||
|
js = return document.querySelector("div[name='tags']").textContent;
|
||||||
|
try, inputTags := driver.executeScript(js)
|
||||||
|
Message = Tags that got input: %inputTags% (Will be doubled b/c of js)
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
|
||||||
|
; msgbox
|
||||||
|
Message = Clicking Next Button to Move on to next input screen
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
Xpath = //button[@type='button']//span[contains(text(),'Next')]
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||||
|
|
||||||
|
; msgbox, click work?
|
||||||
|
|
||||||
|
Message = Selecting "Not For Kids" checkbox
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
try driver.findElementsByName("is_created_for_kids").item[2].click()
|
||||||
|
catch e {
|
||||||
|
sleep, 2000
|
||||||
|
try driver.findElementsByName("is_created_for_kids").item[2].click()
|
||||||
|
catch e {
|
||||||
|
Message = Failed to Click on the "Not Made For Kids" checkbox. Please switch to tab and finalize upload.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
; Disable monitization for video
|
||||||
|
SaveOrPostProgress(Message:="Unchecking monetizaton checkbox",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
Xpath = //button[normalize-space()='Advanced'] ; advanced tab button
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
|
||||||
|
if(Status = "Failed"){
|
||||||
|
Message = Unable to Navigate to Advanced Settings Page to turn off monetization
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
; SaveOrPostProgress(Message:="Unchecking monetizaton checkbox",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
; switch over to advanced tab
|
||||||
|
; js = document.getElementsByName('advanced')[0].click();
|
||||||
|
; try driver.executeScript(js)
|
||||||
|
/*
|
||||||
|
|
||||||
|
sleep, 1000
|
||||||
|
Loop, 5 { ; Loop to uncheck the "monetization button"
|
||||||
|
|
||||||
|
if(A_index = 5){
|
||||||
|
Message = Failed to uncheck "monetization enabled" checkbox
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
}
|
||||||
|
|
||||||
|
Xpath = //input[@name='advertising_instream_blocked'] ; monetization checkbox
|
||||||
|
try Status := driver.FindElementByXPath(Xpath).isSelected()
|
||||||
|
|
||||||
|
if(Status = 0) ; -1 is checked, 0 is unchecked
|
||||||
|
Break
|
||||||
|
|
||||||
|
; Click to uncheck the "allow monetization" checkbox
|
||||||
|
Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
; Switch back to Basic tab
|
||||||
|
js = document.getElementsByName('basic')[0].click();
|
||||||
|
try driver.executeScript(js)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Message = Clicking Next Button to Move on to third video settings screen
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
Xpath = //button[@type='button']//span[contains(text(),'Next')]
|
||||||
|
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){
|
||||||
|
Message = Upload was ALMOST successfuly. Failed to Click Final Save button
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; 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
|
||||||
|
Message = Waiting 30 seconds before grabbing Video URL
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
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")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; Pull out URL slug from internal video URL and create dailymotion share URL from it
|
||||||
|
DailyMotionURL := StrSplit(DailyMotionInternalURL, "/video/details/")[2]
|
||||||
|
DailyMotionURL := "https://www.dailymotion.com/video/" . DailyMotionURL
|
||||||
|
|
||||||
|
|
||||||
|
Message = Upload Complete: %DailyMotionURL%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
IniWrite, %DailyMotionURL%, %VideoLinksIniFile%, URLs, DailyMotionURL
|
||||||
|
SaveDriverURL()
|
||||||
|
AddToTotalVideosUploadedCount()
|
||||||
|
|
||||||
|
Return
|
@ -0,0 +1,363 @@
|
|||||||
|
LBRYVideoUpload:
|
||||||
|
LBRYAudioUpload:
|
||||||
|
;------------------------------------------------
|
||||||
|
|
||||||
|
if(LBRYUploadType = "Video"){
|
||||||
|
CurrentSite := "LBRY Video"
|
||||||
|
IniRead, LBRYPermanentURL, %VideoLinksIniFile%, Misc, LBRYVideoPermanentURL, %A_Space%
|
||||||
|
|
||||||
|
}
|
||||||
|
if(LBRYUploadType = "Audio"){
|
||||||
|
CurrentSite := "LBRY Audio"
|
||||||
|
IniRead, LBRYPermanentURL, %VideoLinksIniFile%, Misc, LBRYAudioPermanentURL, %A_Space%
|
||||||
|
}
|
||||||
|
|
||||||
|
; if LBRY permanent URL was already grabbed before, exit
|
||||||
|
if(LBRYPermanentURL != "")
|
||||||
|
Return
|
||||||
|
|
||||||
|
CheckLBRYProcess() ; double check lbry process
|
||||||
|
|
||||||
|
|
||||||
|
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
|
||||||
|
; If LBRY Killer not found, then download it
|
||||||
|
; @todo: Add LBRY kill download functionality from gitea
|
||||||
|
|
||||||
|
LBRYKillerPath := LibFolder . "\LBRY Process Killer.exe"
|
||||||
|
if(!FileExist(LBRYKillerPath)){
|
||||||
|
|
||||||
|
; Msgbox % "LBRYKillerPath: " LBRYKillerPath
|
||||||
|
; Msgbox % "LBRYProcessKillerURL: " LBRYProcessKillerURL
|
||||||
|
LBRYKillerPath = %A_ScriptDir%\Lib\LBRY Process Killer.exe
|
||||||
|
LBRYKillerUpdateURL = https://git.freedomainplaylists.com/attachments/7865dc8d-5aad-4f9f-8a30-94bab0192b1d
|
||||||
|
|
||||||
|
UrlDownloadToFile, %LBRYKillerUpdateURL%, %LBRYKillerPath%
|
||||||
|
; msgbox, work?
|
||||||
|
; UrlDownloadToFile, URL, Filename
|
||||||
|
Message = LBRY Process Killer Not Found. Automatically Downloading.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TooltipThis("Uploading Video through API")
|
||||||
|
; Variables of items that need to be replaced before argument is passed to API
|
||||||
|
Apostrophe = '
|
||||||
|
LBRYTags = ; Create empty variable
|
||||||
|
SingleQuotationmark = "
|
||||||
|
EscapedQuotationMark = \"
|
||||||
|
|
||||||
|
; Replace all items to make text passable to API
|
||||||
|
LBRYVideoTitle := StrReplace(VideoTitle, SingleQuotationmark, EscapedQuotationMark) ; replace all spaces with dashes
|
||||||
|
LBRYVideoDescription := StrReplace(VideoDescription, SingleQuotationmark, EscapedQuotationMark)
|
||||||
|
|
||||||
|
if(StrLen(LBRYVideoDescription) >= 5000){
|
||||||
|
LBRYVideoDescription := SubStr(LBRYVideoDescription, 1, 4990)
|
||||||
|
LBRYVideoDescription .= "...."
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LBRYUploadType = "Video"){
|
||||||
|
Message = Uploading through API with URL Slug: %LBRYURLSlug%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
FilePathForLBRYAPI := VideoFilepath
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LBRYUploadType = "Audio"){
|
||||||
|
; Replace all items to make text passable to API
|
||||||
|
LBRYVideoTitle .= " (Audio)"
|
||||||
|
LBRYURLSlug .= "_Audio"
|
||||||
|
Message = Uploading through API with URL Slug: %LBRYURLSlug%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
FilePathForLBRYAPI := WavAudioFilepath
|
||||||
|
}
|
||||||
|
|
||||||
|
; if no lbry slug, then error out
|
||||||
|
if(LBRYURLSlug = "" OR LBRYURLSlug = "_Audio"){
|
||||||
|
Message = Upload Failed because no URL Slug was provided.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; loops through array and creates a string of: --tags="tag1" --tags="tag2" --tags="tag3" so that it can be passed to lbrynet
|
||||||
|
Loop % KeywordsArray.Length(){
|
||||||
|
LBRYTags .= "--tags=" . SingleQuotationmark KeywordsArray[A_Index] . SingleQuotationmark . " "
|
||||||
|
}
|
||||||
|
|
||||||
|
; Msgbox % "FilePathForLBRYAPI: " FilePathForLBRYAPI
|
||||||
|
|
||||||
|
SplitPath, VideoThumbFilepath, ThumbnailFileNameWExt, OutDir, OutExtension, OutNameNoExt, OutDrive
|
||||||
|
|
||||||
|
FDRThumbnailURL = https://cdn.freedomainradio.com/%ThumbnailFileNameWExt%
|
||||||
|
message = FDRThumbnailURL: %FDRThumbnailURL%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
|
||||||
|
; Msgbox % "FDRThumbnailURL: " FDRThumbnailURL
|
||||||
|
; Create API Command and save it to variable
|
||||||
|
LBRYAPICommand = "%LBRYNetFilepath%" publish --name="%LBRYURLSlug%" --bid="%LBRYNewVideoStakeAmount%" --file_path="%FilePathForLBRYAPI%" --title="%LBRYVideoTitle%" --description="%LBRYVideoDescription%" %LBRYTags% --thumbnail_url="%FDRThumbnailURL%" --channel_id="%LBRYChannelID%"
|
||||||
|
|
||||||
|
|
||||||
|
; LogErrorToTextFile(LBRYAPICommand) ; Log to file
|
||||||
|
LogErrorToTextFile("LBRYAPICommand: " LBRYAPICommand)
|
||||||
|
|
||||||
|
; Parse returned API json for success status
|
||||||
|
UploadResult := StdOutToVar(LBRYAPICommand)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(InStr(UploadResult, "Could not connect")){
|
||||||
|
Message = Upload Failed. Reason: %UploadResult%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
if(UploadResult = ""){
|
||||||
|
Message = LBRYNet did not return anything. LBRY not running?
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
; Msgbox % "UploadResult: " UploadResult
|
||||||
|
try parsed := JSON.Load(UploadResult)
|
||||||
|
try UploadStatus := parsed.height
|
||||||
|
|
||||||
|
; Msgbox % "UploadStatus: " UploadStatus
|
||||||
|
|
||||||
|
; -2 is returned if upload was successful
|
||||||
|
if(UploadStatus != "-2"){
|
||||||
|
; msgbox, error
|
||||||
|
ErrorCode := parsed.message
|
||||||
|
ErrorCode := parsed.message
|
||||||
|
ErrorCode := StrSplit(ErrorCode, "code")
|
||||||
|
ErrorCode := ErrorCode[1]
|
||||||
|
|
||||||
|
Message = LBRY Upload Failed`nReason: %ErrorCode%
|
||||||
|
; Msgbox % "Message: " Message
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Clipboard := UploadResult
|
||||||
|
; Msgbox % "UploadResult: " UploadResult
|
||||||
|
|
||||||
|
|
||||||
|
LogErrorToTextFile("UploadResult: " UploadResult)
|
||||||
|
|
||||||
|
if(InStr(UploadResult, "Could not connect to daemon")){
|
||||||
|
if(LBRYAttemptNumber = 2){
|
||||||
|
|
||||||
|
Message = Upload Error (E#4081)`nVideo Upload Failed due to daemon not running.`nPlease start it manually and re-run the upload.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
try run, %LBRYKillerPath% "Kill"
|
||||||
|
catch e {
|
||||||
|
; Message = Unable to Kill LBRYKiller.ahk
|
||||||
|
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
}
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
else, { ; if attempt number 1
|
||||||
|
Process, Close, LBRY.exe ; terminate LBRY if it's running
|
||||||
|
LBRYAttemptNumber := 2
|
||||||
|
Message = Upload Failed (E#1980)`nDue to daemon not running.`nTrying to restart LBRY.exe and try the upload again.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
Goto, LBRYVideoUpload
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
; Clipboard := UploadResult
|
||||||
|
; Msgbox % "UploadResult: " UploadResult
|
||||||
|
|
||||||
|
/*if(DevMode){
|
||||||
|
Clipboard := UploadResult
|
||||||
|
Msgbox % "UploadResult: " UploadResult
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
; Create an object out of the API Return
|
||||||
|
LBRYJSONResult := JSON.Load(UploadResult)
|
||||||
|
|
||||||
|
if(!InStr(UploadResult, "permanent_url")){ ; if no permanent_url is generated then API issue
|
||||||
|
LBRYAPIError := LBRYJSONResult.message
|
||||||
|
; LBRYAPIError := GetLBRYAPIErrorFromString(UploadResult)
|
||||||
|
; if the returned string does not have "permanent_url" in it, then upload failed
|
||||||
|
Message = Upload Error (E#6930)`nVideo Upload Failed due to API Issue. Please send errorlog to Yuriy.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
if(KillLBRYAfterUpload){
|
||||||
|
try run, %LBRYKillerPath%
|
||||||
|
catch e {
|
||||||
|
Message = LBRYKiller not found. Unable to find File.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
; Transform the Upload Result json into the LBRY.tv link
|
||||||
|
; PermanentURL := GetPermanentLBRYURL(UploadResult) ; get permanentURL from the upload result json
|
||||||
|
LBRYPermanentURL := LBRYJSONResult.outputs[1].permanent_url
|
||||||
|
if(LBRYPermanentURL = ""){
|
||||||
|
Message = Failed to grab permanent_url with json.ahk. Please send errorlog to Yuriy.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Message = Claim Was Successfully Submitted to lbrynet with: %LBRYPermanentURL%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
; Message = LBRYPermanentURL: %LBRYPermanentURL%
|
||||||
|
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
if(CurrentSite = "LBRY Video"){
|
||||||
|
IniWrite, %LBRYPermanentURL%, %VideoLinksIniFile%, Misc, LBRYVideoPermanentURL
|
||||||
|
}
|
||||||
|
|
||||||
|
if(CurrentSite = "LBRY Audio"){
|
||||||
|
IniWrite, %LBRYPermanentURL%, %VideoLinksIniFile%, Misc, LBRYAudioPermanentURL
|
||||||
|
}
|
||||||
|
Return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LBRYGetURL:
|
||||||
|
;------------------------------------------------
|
||||||
|
if(LBRYUploadType = "Video"){
|
||||||
|
|
||||||
|
CurrentSite := "LBRY Video"
|
||||||
|
; IniWrite, %PermanentURL%, %VideoLinksIniFile%, URLs, LBRYVideoPermanentURL
|
||||||
|
IniRead, LBRYPermanentURL, %VideoLinksIniFile%, Misc, LBRYVideoPermanentURL, %A_Space%
|
||||||
|
}
|
||||||
|
if(LBRYUploadType = "Audio"){
|
||||||
|
|
||||||
|
CurrentSite := "LBRY Audio"
|
||||||
|
IniRead, LBRYPermanentURL, %VideoLinksIniFile%, Misc, LBRYAudioPermanentURL, %A_Space%
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LBRYPermanentURL = ""){
|
||||||
|
Message = Upload Skipped. LBRYPermanentURL is blank (Upload Failed due to some API issue)
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
; Message := "Waiting a couple of minutes for lbrynet blockchain to generate blockchain metadata for newest video"
|
||||||
|
Message = Waiting for LBRYNet to Generate LBRY URL
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
; sleep, 60000 ; 1 minute
|
||||||
|
; sleep, 300000 ; sleep for 5 minutes so LBRYNet blockchain has a chance to register the new video ; as recomended by LBRY Devs
|
||||||
|
; sleep, 360000 ; sleep for 6 minutes so LBRYNet blockchain has a chance to register the new video ; LBRY devs recommend 5 mins
|
||||||
|
|
||||||
|
|
||||||
|
LBRYResolveAPICommand = "%LBRYNetFilepath%" resolve %LBRYPermanentURL% ; create variable with the text that's needed for the API command
|
||||||
|
Message := "LBRYResolveAPICommand: " . LBRYResolveAPICommand ; Save the result to the errorlogging file
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
; msgbox
|
||||||
|
|
||||||
|
loop, 15 {
|
||||||
|
LBRYResolveResult := StdOutToVar(LBRYResolveAPICommand) ; Save API call to a variable
|
||||||
|
|
||||||
|
if(A_index = 1 OR a_index = 10){
|
||||||
|
Message := "LBRYResolveResult: " . LBRYResolveResult ; Save result to the errorlogging file
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
|
||||||
|
}
|
||||||
|
|
||||||
|
if(InStr(LBRYResolveResult, "could not find claim") AND A_Index < 10) ; try 4 times to get the resolveURL, sometimes the blockchain is quite slow
|
||||||
|
{
|
||||||
|
; @todo: Make it check every 2 minutes?
|
||||||
|
; TooltipThis("Not Able to Grab URL from API. `nWaiting another 5 for blockchain to sync claim before trying again")
|
||||||
|
; MessageNumber := A_index + 5
|
||||||
|
|
||||||
|
if(A_index < 5)
|
||||||
|
Message = Waiting for LBRYNet to Generate LBRY URL`nChecking Every 2 Minutes
|
||||||
|
if(A_index > 5)
|
||||||
|
Message = Still Waiting for LBRYNet to Generate LBRY URL`nLBRY Network is most likely congested.`nChecking Every 2 Minutes
|
||||||
|
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
; sleep, 300000 ; 5 minutes
|
||||||
|
sleep, 120000 ; 2 minute
|
||||||
|
|
||||||
|
Continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if(InStr(LBRYResolveResult, "could not find claim") AND A_index = 15){
|
||||||
|
Message = Failed to Grab URL from LBRY after 30 minutes. Either LBRY IS REALLY congested or there is a bug and the API commands were passed incorrectly.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
if(InStr(LBRYResolveResult, "canonical_url"))
|
||||||
|
Break
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(LBRYUploadType = "Video"){
|
||||||
|
LBRYVideoURL := GetLBRYCanonicalURL(LBRYResolveResult) ; Transform the API resulting json into the LBRY.tv link
|
||||||
|
if(LBRYVideoURL = ""){
|
||||||
|
Message = Failed to Grab LBRY URL from LBRYNet
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
; DevModeMsgBox(LBRYVideoURL)
|
||||||
|
|
||||||
|
Message = LBRYVideoURL from GetLBRYCanonicalURL: %LBRYVideoURL%
|
||||||
|
SaveOrPostProgress(Message, PostType:=",ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
OpenLBRYVideoURL := StrReplace(LBRYVideoURL, "https://lbry.tv", "https://open.lbry.com")
|
||||||
|
OpenLBRYVideoURL := StrReplace(OpenLBRYVideoURL, "#", ":")
|
||||||
|
|
||||||
|
|
||||||
|
OdyseeVideoURL := StrReplace(LBRYVideoURL, "https://lbry.tv", "https://odysee.com")
|
||||||
|
OdyseeVideoURL := StrReplace(OdyseeVideoURL, "#", ":")
|
||||||
|
|
||||||
|
Message = Upload Complete: <%OpenLBRYVideoURL%> + <%OdyseeVideoURL%>
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
IniWrite, %OpenLBRYVideoURL%, %VideoLinksIniFile%, URLs, LBRYVideoURL
|
||||||
|
IniWrite, %OdyseeVideoURL%, %VideoLinksIniFile%, URLs, OdyseeVideoURL
|
||||||
|
|
||||||
|
}
|
||||||
|
if(LBRYUploadType = "Audio"){
|
||||||
|
LBRYAudioURL := GetLBRYCanonicalURL(LBRYResolveResult) ; Transform the API resulting json into the LBRY.tv link
|
||||||
|
if(LBRYAudioURL = ""){
|
||||||
|
Message = Failed to Grab LBRY URL from LBRYNet
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
Message = LBRYAudioURL from GetLBRYCanonicalURL: %LBRYAudioURL%
|
||||||
|
SaveOrPostProgress(Message, PostType:=",ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
OpenLBRYAudioURL := StrReplace(LBRYAudioURL, "https://lbry.tv", "https://open.lbry.com")
|
||||||
|
OpenLBRYAudioURL := StrReplace(OpenLBRYAudioURL, "#", ":")
|
||||||
|
|
||||||
|
OdyseeAudioURL := StrReplace(LBRYAudioURL, "https://lbry.tv", "https://odysee.com")
|
||||||
|
OdyseeAudioURL := StrReplace(OdyseeAudioURL, "#", ":")
|
||||||
|
|
||||||
|
Message = Upload Complete: <%OpenLBRYAudioURL%> + <%OdyseeAudioURL%>
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
IniWrite, %OpenLBRYAudioURL%, %VideoLinksIniFile%, URLs, LBRYAudioURL
|
||||||
|
IniWrite, %OdyseeAudioURL%, %VideoLinksIniFile%, URLs, OdyseeAudioURL
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
; SaveDriverURL()
|
||||||
|
AddToTotalVideosUploadedCount()
|
||||||
|
Return
|
Loading…
Reference in New Issue