Added ability to use portable version of Chrome for uploading

pull/2/head
Yuriy 1 year ago
parent 714d2c5822
commit a2c83e8261

1
.gitignore vendored

@ -13,3 +13,4 @@ Freedomain Social Media Poster*.exe
Compile Scripts to EXE.ahk Compile Scripts to EXE.ahk
Freedomain Video Uploader.exe Freedomain Video Uploader.exe
Lib/LBRY Process Killer.exe Lib/LBRY Process Killer.exe
Lib/chrome-win64

@ -29,7 +29,7 @@ global ScriptVersion
global FullScriptName global FullScriptName
ScriptName = Freedomain Video Uploader ScriptName = Freedomain Video Uploader
ScriptVersion = 3.17 ScriptVersion = 3.18
FullScriptName := ScriptName . " - " . ScriptVersion FullScriptName := ScriptName . " - " . ScriptVersion
@ -136,9 +136,9 @@ IniRead, ShowTooltipProgress, %SettingsIniFilepath%, General, ShowTooltipProgres
(ShowTooltipProgress)?(ShowTooltipProgressCheckStatus := 1) : (ShowTooltipProgressCheckStatus := 0) (ShowTooltipProgress)?(ShowTooltipProgressCheckStatus := 1) : (ShowTooltipProgressCheckStatus := 0)
Message = Reading Settings from .ini files ; Message = Reading Settings from .ini files
; ToolTip, reading settings ; ToolTip, reading settings
SaveOrPostProgress(Message:=Message,PostType:="Tooltip") ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
@ -264,7 +264,7 @@ else, {
} }
; Do this with an array. Add all filepaths to array and then pull out the ones with the extension. ; @todo Do this with an array. Add all filepaths to array and then pull out the ones with the extension.
; get directory from the filepath grabbed ; get directory from the filepath grabbed
SplitPath, BodyTextFilePath, OutFileName, VideoFolderDir, OutExtension, OutNameNoExt, OutDrive SplitPath, BodyTextFilePath, OutFileName, VideoFolderDir, OutExtension, OutNameNoExt, OutDrive
@ -2849,63 +2849,64 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
; ;
;------------------/Locals------------------------------ ;------------------/Locals------------------------------
/*
*/
;
;--------------------Telegram----------------------------
TelegramVideoUpload:
; if(VideoFileSizeInMB > 50){
;--------------------Telegram----------------------------
TelegramVideoUpload:
if(VideoFileSizeInMB > 50){
Message = Telegram Upload Skipped. Video is larger than 50MB Message = Telegram Upload Skipped. Video is larger than 50MB
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return Return
} }
CurrentSocialMediaPosting := "Telegram Video" CurrentSocialMediaPosting := "Telegram Video"
Message = Uploading Video to Telegram Message = Uploading Video to Telegram
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniRead, TelegramBotToken, %SettingsIniFilepath%, SocialMediaPoster, TelegramBotToken, %A_Space% IniRead, TelegramBotToken, %SettingsIniFilepath%, SocialMediaPoster, TelegramBotToken, %A_Space%
IniRead, TelegramBotChatID, %SettingsIniFilepath%, SocialMediaPoster, TelegramBotChatID, %A_Space% IniRead, TelegramBotChatID, %SettingsIniFilepath%, SocialMediaPoster, TelegramBotChatID, %A_Space%
LineBreakChar = `%0A ; Used for Telegram API LineBreakChar = `%0A ; Used for Telegram API
SaveOrPostProgress(Message:="Posting to Telegram",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Posting to Telegram",PostType:="Tooltip,ErrorLoggingTextFile")
if(TelegramBotToken = "" Or TelegramBotChatID =""){ if(TelegramBotToken = "" Or TelegramBotChatID =""){
Message = TelegramBotToken or TelegramBotChatID is missing from %SettingsIniFilepath%. `nPlease input them and click the button again. Message = TelegramBotToken or TelegramBotChatID is missing from %SettingsIniFilepath%. `nPlease input them and click the button again.
msgbox, 4096, Error!, %Message% msgbox, 4096, Error!, %Message%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; Msgbox, 4096, Error!, TelegramBotToken or TelegramBotChatID is missing from %SettingsIniFilepath%. `nPlease input them and rerun the script. ; Msgbox, 4096, Error!, TelegramBotToken or TelegramBotChatID is missing from %SettingsIniFilepath%. `nPlease input them and rerun the script.
Return Return
} }
; If description is longer than 2k chars, then API will error out. goto section that will allow user to edit video description to shorten it for posting ; If description is longer than 2k chars, then API will error out. goto section that will allow user to edit video description to shorten it for posting
if(StrLen(SocialMediaDescription) > 2000){ if(StrLen(SocialMediaDescription) > 2000){
TelegramVideoUploadDescription := SubStr(SocialMediaDescription, 1, 990) TelegramVideoUploadDescription := SubStr(SocialMediaDescription, 1, 990)
TelegramVideoUploadDescription .= "...." TelegramVideoUploadDescription .= "...."
; msgbox, here goes ; msgbox, here goes
; Goto, CreateDescriptionForVideosPosting ; Goto, CreateDescriptionForVideosPosting
} }
SubmitDescriptionForTelegramVideoUpload: SubmitDescriptionForTelegramVideoUpload:
TelegramVideoTitle := ASCIISTRReplace(VideoTitle) TelegramVideoTitle := ASCIISTRReplace(VideoTitle)
TelegramBodymessage := ASCIISTRReplace(TelegramVideoUploadDescription) TelegramBodymessage := ASCIISTRReplace(TelegramVideoUploadDescription)
LineBreakChar = `%0A ; Used for API LineBreakChar = `%0A ; Used for API
Message := "*" . TelegramVideoTitle . "*" . LineBreakChar . TelegramBodymessage . LineBreakChar Message := "*" . TelegramVideoTitle . "*" . LineBreakChar . TelegramBodymessage . LineBreakChar
Message := StrReplace(Message, "`n", LineBreakChar) ; replace all new line characters with the global charater Message := StrReplace(Message, "`n", LineBreakChar) ; replace all new line characters with the global charater
; Msgbox % "Message: " Message ; Msgbox % "Message: " Message
Status := SendTelegramVideo(TelegramBotToken, TelegramBotChatID, VideoFilepath, caption := Message ) ; you could add more options; compare the Telegram API docs Status := SendTelegramVideo(TelegramBotToken, TelegramBotChatID, VideoFilepath, caption := Message ) ; you could add more options; compare the Telegram API docs
if(InStr(Status, "error_code")){ if(InStr(Status, "error_code")){
Message = Telegram Post Failed due to an API Issue. Error was saved to ErrorLogging file. Please send it to Yuriy. Message = Telegram Post Failed due to an API Issue. Error was saved to ErrorLogging file. Please send it to Yuriy.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
@ -2915,35 +2916,35 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
ToolTip ToolTip
Return Return
} }
; msgbox ; msgbox
Message = Upload Complete to Telegram Message = Upload Complete to Telegram
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniWrite, Successful, %VideoLinksIniFile%, Misc, Telegram IniWrite, Successful, %VideoLinksIniFile%, Misc, Telegram
; SaveDriverURL() ; SaveDriverURL()
AddToTotalVideosUploadedCount() AddToTotalVideosUploadedCount()
Return Return
; -------------------------------BitChute------------------------------- ; -------------------------------BitChute-------------------------------
BitChuteUpload: BitChuteUpload:
CurrentSite := "Bitchute" CurrentSite := "Bitchute"
Message = Starting Upload Message = Starting Upload
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Status := NavigateFromBaseURLTo("https://www.bitchute.com/myupload", "BitChute Video Uploader") Status := NavigateFromBaseURLTo("https://www.bitchute.com/myupload", "BitChute Video Uploader")
if(Status) if(Status)
Return Return
Message = Checking Login Status Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
try TabUrl := driver.url try TabUrl := driver.url
if(InStr(TabUrl, "/accounts/login/")){ if(InStr(TabUrl, "/accounts/login/")){
if(AutoLogin){ if(AutoLogin){
Xpath = (//button[normalize-space()='Submit'])[1] Xpath = (//button[normalize-space()='Submit'])[1]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
@ -2961,16 +2962,16 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Return Return
} }
} }
CheckForAlerts() CheckForAlerts()
Message = Inputting Title Message = Inputting Title
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Try to input video title and if fail try to login again ; Try to input video title and if fail try to login again
loop, 5 { loop, 5 {
if(A_index = 5){ if(A_index = 5){
try CurrentURL := driver.url try CurrentURL := driver.url
; CurrentURL := ExtractBaseURL(URL) ; CurrentURL := ExtractBaseURL(URL)
@ -2987,23 +2988,23 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
if(!Status) if(!Status)
break break
} }
Message = Inputting Description Message = Inputting Description
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; trim description if it's too long ; trim description if it's too long
BitchuteDescription := VideoDescription BitchuteDescription := VideoDescription
if(StrLen(BitchuteDescription) > 2995){ if(StrLen(BitchuteDescription) > 2995){
BitchuteDescription := SubStr(BitchuteDescription, 1, 2995) BitchuteDescription := SubStr(BitchuteDescription, 1, 2995)
JSBitchuteDescription := FormatTextToJSText(BitchuteDescription) JSBitchuteDescription := FormatTextToJSText(BitchuteDescription)
} }
else, else,
JSBitchuteDescription := FormatTextToJSText(BitchuteDescription) JSBitchuteDescription := FormatTextToJSText(BitchuteDescription)
Loop, 10 { ; Attempt to input video description a couple of times Loop, 10 { ; Attempt to input video description a couple of times
Message = Inputting Description. Attempt #%A_index% Message = Inputting Description. Attempt #%A_index%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3027,29 +3028,29 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Break Break
sleep, 1000 sleep, 1000
} }
Message = Inputting Tags Message = Inputting Tags
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; Convert tags into #hasthtags ; Convert tags into #hasthtags
Loop, 3 { Loop, 3 {
Value := KeywordsArray[A_Index] Value := KeywordsArray[A_Index]
Value := StrReplace(Value, " ", "") ; Remove spaces if hashtag has two words Value := StrReplace(Value, " ", "") ; Remove spaces if hashtag has two words
; HashTag := "#" . Value ; HashTag := "#" . Value
BitchuteHashtags .= Value . " " BitchuteHashtags .= Value . " "
} }
; input hashtags ; input hashtags
Xpath = //input[@placeholder='Search Terms'] Xpath = //input[@placeholder='Search Terms']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BitchuteHashtags) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BitchuteHashtags)
; Upload Thumbnail ; Upload Thumbnail
Message = Attaching Thumbnail Message = Attaching Thumbnail
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
if(VideoThumbFilepath != ""){ if(VideoThumbFilepath != ""){
; Upload Cover Image Button ; Upload Cover Image Button
Message = Uploading Thumbnail Message = Uploading Thumbnail
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -3064,26 +3065,26 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Return Return
} }
; sleep, 5000 ; sleep, 5000
} }
; Upload Video button ; Upload Video button
Message = Uploading Video File Message = Uploading Video File
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = //input[@name='videoInput'] Xpath = //input[@name='videoInput']
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){
Message = Failed to Upload Video Message = Failed to Upload Video
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
Message = Waiting for Video to Finish Uploading`nChecking Progress Every 5 seconds Message = Waiting for Video to Finish Uploading`nChecking Progress Every 5 seconds
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //div[@role='progressbar'] ; Xpath to progress % Xpath = //div[@role='progressbar'] ; Xpath to progress %
Loop, %Number_of_loops_to_Check_Upload_status% { Loop, %Number_of_loops_to_Check_Upload_status% {
sleep, %Time_Between_Loops_Upload_Status% sleep, %Time_Between_Loops_Upload_Status%
if(A_index = 5){ ; while waiting for bitchute video to finish uploading, start up lbry if(A_index = 5){ ; while waiting for bitchute video to finish uploading, start up lbry
@ -3124,33 +3125,33 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Status := Check_For_Stuck_Video_Upload(A_index, BitChuteUploadProgress) Status := Check_For_Stuck_Video_Upload(A_index, BitChuteUploadProgress)
if(Status = "Failed") if(Status = "Failed")
Return Return
} }
try UploadPageURL := driver.url ; save the active URL to a variable try UploadPageURL := driver.url ; save the active URL to a variable
; Finish Uploading Button ; Finish Uploading Button
Xpath = //button[normalize-space()='Proceed'] ; Finish button Xpath = //button[normalize-space()='Proceed'] ; Finish button
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=5000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=5000)
if(Status){ if(Status){
Message = Failed to Click "Finish" button Message = Failed to Click "Finish" button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
} }
; try driver.FindElementByXPath(Xpath).click() ;Try to click on the "Finish" button ; try driver.FindElementByXPath(Xpath).click() ;Try to click on the "Finish" button
; Error Popup Location if something goes wrong. ; Error Popup Location if something goes wrong.
Xpath = /html/body/div[2]/div Xpath = /html/body/div[2]/div
try BitChuteError := driver.findelementbyxpath(Xpath).Attribute("innerText") ; Grabb innertext try BitChuteError := driver.findelementbyxpath(Xpath).Attribute("innerText") ; Grabb innertext
TooltipThis("Waiting for video page to finish loading") TooltipThis("Waiting for video page to finish loading")
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
; Loop for 2 minutes and keep checking if the active page has moved on to the video page ; 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 Message = Waiting 30 Seconds Before Refreshing Page to Find Newest Video
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Loop, 6 { ; 6 loops X 30 seconds Loop, 6 { ; 6 loops X 30 seconds
sleep, 5000 sleep, 5000
try CurrentWindow := driver.URL try CurrentWindow := driver.URL
if(CurrentWindow != UploadPageURL AND A_index = 6) ; could also check for: https://www.bitchute.com/channel in str if(CurrentWindow != UploadPageURL AND A_index = 6) ; could also check for: https://www.bitchute.com/channel in str
@ -3162,87 +3163,87 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
} }
try driver.executeScript("history.go(0)") ;refresh page try driver.executeScript("history.go(0)") ;refresh page
try FirstResultVideoTitle := driver.findElementsByClass("channel-videos-title").item[1].Attribute("innerText") ; Grabb innertext try FirstResultVideoTitle := driver.findElementsByClass("channel-videos-title").item[1].Attribute("innerText") ; Grabb innertext
; msgbox % FirstResultVideoTitle = VideoTitle ; msgbox % FirstResultVideoTitle = VideoTitle
try FirstResultIDAndTag := driver.findElementsByClass("channel-videos-title").item[1].Attribute("outerHTML") ;XPath: ID=site-title & span tag try FirstResultIDAndTag := driver.findElementsByClass("channel-videos-title").item[1].Attribute("outerHTML") ;XPath: ID=site-title & span tag
; Msgbox % "FirstResultIDAndTag: " FirstResultIDAndTag ; Msgbox % "FirstResultIDAndTag: " FirstResultIDAndTag
VideoHref := StrSplit(FirstResultIDAndTag, "<a href=")[2] VideoHref := StrSplit(FirstResultIDAndTag, "<a href=")[2]
VideoHref := StrSplit(VideoHref, " class=")[1] VideoHref := StrSplit(VideoHref, " class=")[1]
SingleQuote = " SingleQuote = "
VideoHref := StrReplace(VideoHref, SingleQuote, "") VideoHref := StrReplace(VideoHref, SingleQuote, "")
if(VideoHref = ""){ if(VideoHref = ""){
Message = Failed to Grab Video URL. Please Copy and Paste it into Result Window Message = Failed to Grab Video URL. Please Copy and Paste it into Result Window
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return Return
} }
BitChuteURL := "https://www.bitchute.com/" . VideoHref BitChuteURL := "https://www.bitchute.com/" . VideoHref
BitChuteURL := StrReplace(BitchuteURL, "//video", "/video") BitChuteURL := StrReplace(BitchuteURL, "//video", "/video")
; navigate to video page ; navigate to video page
try driver.Get(BitChuteURL) ;Open selected URL try driver.Get(BitChuteURL) ;Open selected URL
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
Xpath = //a[@data-toggle='tab'][normalize-space()='Settings'] Xpath = //a[@data-toggle='tab'][normalize-space()='Settings']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=15,SleepLength:=5000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=15,SleepLength:=5000)
if(Status){ if(Status){
Message = Failed to Navigate to Video Settings Page to Uncheck "Allow Comments" Message = Failed to Navigate to Video Settings Page to Uncheck "Allow Comments"
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
} }
; Unclick the "Discussion Allowed on This Video" checkbox ; Unclick the "Discussion Allowed on This Video" checkbox
js = document.querySelector("form[id='save-settings'] div div label span").click() js = document.querySelector("form[id='save-settings'] div div label span").click()
try driver.executeScript(js) try driver.executeScript(js)
try Status := driver.findElementsByID("id_is_discussable").item[1].isSelected() try Status := driver.findElementsByID("id_is_discussable").item[1].isSelected()
Message = Checked Status = %Status%`n-1 is checked. 0 is unchecked Message = Checked Status = %Status%`n-1 is checked. 0 is unchecked
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; Click the save button ; Click the save button
Xpath = //button[normalize-space()='Save'] Xpath = //button[normalize-space()='Save']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
Message = Upload Complete:`n%BitChuteURL% Message = Upload Complete:`n%BitChuteURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniWrite, %BitChuteURL%, %VideoLinksIniFile%, URLs, BitChuteURL IniWrite, %BitChuteURL%, %VideoLinksIniFile%, URLs, BitChuteURL
SaveDriverURL() SaveDriverURL()
AddToTotalVideosUploadedCount() AddToTotalVideosUploadedCount()
; TakeScreenshotOfPage(ScreenShotSavePath) ; TakeScreenshotOfPage(ScreenShotSavePath)
Return Return
; -------------------------------/BitChute Upload------------------------------- ; -------------------------------/BitChute Upload-------------------------------
; -------------------------------Brighteon Upload------------------------------- ; -------------------------------Brighteon Upload-------------------------------
BrighteonUpload: BrighteonUpload:
CurrentSite := "Brighteon" CurrentSite := "Brighteon"
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Status := NavigateFromBaseURLTo("https://www.brighteon.com/dashboard/video-upload") Status := NavigateFromBaseURLTo("https://www.brighteon.com/dashboard/video-upload")
if(Status) if(Status)
Return Return
JSBrighteonVideoDescription := FormatTextToJSText(VideoDescription) JSBrighteonVideoDescription := FormatTextToJSText(VideoDescription)
; Msgbox % "JSBrighteonVideoDescription: " JSBrighteonVideoDescription ; Msgbox % "JSBrighteonVideoDescription: " JSBrighteonVideoDescription
; descriptions longer than 5k characters just fail to get input so trim them to below 5000 characters ; descriptions longer than 5k characters just fail to get input so trim them to below 5000 characters
if(StrLen(VideoDescription) >= 5000){ if(StrLen(VideoDescription) >= 5000){
BrighteonVideoDescription := SubStr(VideoDescription, 1, 4800) BrighteonVideoDescription := SubStr(VideoDescription, 1, 4800)
BrighteonVideoDescription .= "...." BrighteonVideoDescription .= "...."
JSBrighteonVideoDescription := FormatTextToJSText(BrighteonVideoDescription) JSBrighteonVideoDescription := FormatTextToJSText(BrighteonVideoDescription)
@ -3252,16 +3253,16 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
BrighteonVideoDescription .= "...." BrighteonVideoDescription .= "...."
JSBrighteonVideoDescription := FormatTextToJSText(BrighteonVideoDescription) JSBrighteonVideoDescription := FormatTextToJSText(BrighteonVideoDescription)
} }
} }
Message = Checking Login Status Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
try CurrentTab := driver.url try CurrentTab := driver.url
if(InStr(CurrentTab, "login")) ; we're logged out if(InStr(CurrentTab, "login")) ; we're logged out
{ {
Message = Currently Logged Out`nClosing out of any popups that might appear before clicking Login button Message = Currently Logged Out`nClosing out of any popups that might appear before clicking Login button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -3320,43 +3321,43 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Return Return
} }
} }
} }
Message = Navigating to Upload Page Message = Navigating to Upload Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Navigate to Upload Page ; Navigate to Upload Page
try driver.executeScript("window.location = 'https://www.brighteon.com/dashboard/video-upload'") ;navigate using javascript try driver.executeScript("window.location = 'https://www.brighteon.com/dashboard/video-upload'") ;navigate using javascript
try driver.executeScript("return document.readyState").equals("complete") try driver.executeScript("return document.readyState").equals("complete")
TabURl := GetCurrentTabURlBase() 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")
; Click out of the "Support free speech" pop-up if it pops up ; 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'] Xpath = //body/div[@id='__next']/div[@id='modal-root']/div/div/div[1]//*[local-name()='svg']
try driver.FindElementByXPath(Xpath).click() try driver.FindElementByXPath(Xpath).click()
CheckForAlerts() CheckForAlerts()
Message = Uploading Video Message = Uploading Video
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Upload Video ; Upload Video
Xpath = //input[@type='file'] Xpath = //input[@type='file']
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){
Message = Failed to Upload Video, Please check Login Status Message = Failed to Upload Video, Please check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
loop, 3 { loop, 3 {
if(A_index = 3){ if(A_index = 3){
Message = Failed to input Video Title Message = Failed to input Video Title
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
@ -3388,15 +3389,15 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
break break
} }
TooltipThis("Inputting Video Description") TooltipThis("Inputting Video Description")
; Attempt to input video description a couple of times ; Attempt to input video description a couple of times
Loop, 10 { Loop, 10 {
if(A_index = 10){ if(A_index = 10){
Message = Failed to input Video Description after 10 attempts. Message = Failed to input Video Description after 10 attempts.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
@ -3450,12 +3451,12 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Break Break
} }
} }
; Thumbnail ; Thumbnail
if(VideoThumbFilepath != "") { if(VideoThumbFilepath != "") {
TooltipThis("Uploading Thumbnail") TooltipThis("Uploading Thumbnail")
Xpath = //input[@type='file'] Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath)
@ -3463,12 +3464,12 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Message = Failed to Upload Thumbnail Message = Failed to Upload Thumbnail
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
} }
} }
; DevModeMsgBox(VideoTags) ; DevModeMsgBox(VideoTags)
TooltipThis("Inputting Keywords") TooltipThis("Inputting Keywords")
Loop, 5 { Loop, 5 {
XPath = //input[@id='keywords'] XPath = //input[@id='keywords']
try driver.FindElementByXPath(Xpath).SendKeys(VideoTags) ;Sends Variable to an Xpath Item try driver.FindElementByXPath(Xpath).SendKeys(VideoTags) ;Sends Variable to an Xpath Item
catch e { catch e {
@ -3495,25 +3496,25 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
; Msgbox % "status: " status ; Msgbox % "status: " status
} }
; double check on video description after inputting tags ; double check on video description after inputting tags
js = return document.querySelector("div[class='e-content e-lib e-keyboard'] p").innerText; js = return document.querySelector("div[class='e-content e-lib e-keyboard'] p").innerText;
try Input_Description := driver.executeScript(JS) ;Execute Javascript try Input_Description := driver.executeScript(JS) ;Execute Javascript
; if text in description box is longer than x chars, then description input worked ; if text in description box is longer than x chars, then description input worked
if(StrLen(Input_Description) > 5){ if(StrLen(Input_Description) > 5){
SaveOrPostProgress(Message:="Video Description second double check was successful",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:="Video Description second double check was successful",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
} }
else, { else, {
SaveOrPostProgress(Message:="Secondary video description check failed",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:="Secondary video description check failed",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return Return
} }
TooltipThis("Waiting for Video to Finish Uploading") TooltipThis("Waiting for Video to Finish Uploading")
Loop, %Number_of_loops_to_Check_Upload_status% { Loop, %Number_of_loops_to_Check_Upload_status% {
sleep, %Time_Between_Loops_Upload_Status% sleep, %Time_Between_Loops_Upload_Status%
; Get progress status through javascript ; Get progress status through javascript
@ -3543,28 +3544,28 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Status := Check_For_Stuck_Video_Upload(A_index, UploadPercent) Status := Check_For_Stuck_Video_Upload(A_index, UploadPercent)
if(Status = "Failed") if(Status = "Failed")
Return Return
} }
; "Save Now" button ; "Save Now" button
js = return document.querySelector("button[class='mr-2 btn btn-primary btn-sm']").textContent; js = return document.querySelector("button[class='mr-2 btn btn-primary btn-sm']").textContent;
try, status := driver.executeScript(js) try, status := driver.executeScript(js)
if(!InStr(status, "Save Video")){ if(!InStr(status, "Save Video")){
Message = Save Video Button is not clickable. Please check page for errors. Message = Save Video Button is not clickable. Please check page for errors.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
; Save Video button ; Save Video button
TooltipThis("Clicking Save Video Button to finalize Upload") TooltipThis("Clicking Save Video Button to finalize Upload")
try BrighteonUploadPageURL := driver.url try BrighteonUploadPageURL := driver.url
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){
Message = Upload Failed: Clicking "Save Video" did not Finalize the Upload Message = Upload Failed: Clicking "Save Video" did not Finalize the Upload
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
@ -3579,42 +3580,42 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
try CurrentURL := driver.url try CurrentURL := driver.url
if(BrighteonUploadPageURL != CurrentURL) if(BrighteonUploadPageURL != CurrentURL)
Break Break
} }
Message = Trying to Grab Newest Video's URL Message = Trying to Grab Newest Video's URL
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 2000 sleep, 2000
; Navigate to Videos page to make sure it's refreshed with latest video ; 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.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 try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
sleep, 2000 sleep, 2000
; Get First word in video title to use in grabbing video URL ; Get First word in video title to use in grabbing video URL
VideoTitleArray := StrSplit(VideoTitle, " ") VideoTitleArray := StrSplit(VideoTitle, " ")
; Iterate from 1 to the end of the array: ; Iterate from 1 to the end of the array:
Loop % VideoTitleArray.Length(){ Loop % VideoTitleArray.Length(){
VideoTitleLongWord := VideoTitleArray[A_Index] VideoTitleLongWord := VideoTitleArray[A_Index]
; VideoTitleFirstWord := StrReplace(VideoTitleFirstWord, "_","-") ; VideoTitleFirstWord := StrReplace(VideoTitleFirstWord, "_","-")
if(StrLen(VideoTitleLongWord) > 4) if(StrLen(VideoTitleLongWord) > 4)
Break Break
; MsgBox % VideoTitleArray[A_Index] ; MsgBox % VideoTitleArray[A_Index]
} }
Message = VideoTitleLongWord: %VideoTitleLongWord% Message = VideoTitleLongWord: %VideoTitleLongWord%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile") ; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
try, CurrentURL := driver.url try, CurrentURL := driver.url
Message = Trying to Grab URL of latest upload containing keyword: %VideoTitleLongWord%. Tab's current URL: %CurrentURL% Message = Trying to Grab URL of latest upload containing keyword: %VideoTitleLongWord%. Tab's current URL: %CurrentURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; DevModeMsgBox(Message) ; DevModeMsgBox(Message)
Loop, 4 { Loop, 4 {
ElementIndexNumber := A_index - 1 ElementIndexNumber := A_index - 1
jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].outerHTML; jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].outerHTML;
@ -3660,60 +3661,60 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
} }
} }
; Convert dashboard URL to Public URL ; Convert dashboard URL to Public URL
; BrighteonURL := StrReplace(BrighteonURL, "dashboard/videos/", "") ; BrighteonURL := StrReplace(BrighteonURL, "dashboard/videos/", "")
if(BrighteonURL = ""){ if(BrighteonURL = ""){
Message = Upload Completed Successfully but failed to grab Share URL. Please Copy and Paste it in. Message = Upload Completed Successfully but failed to grab Share URL. Please Copy and Paste it in.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
Message = Upload Complete:`n%BrighteonURL% Message = Upload Complete:`n%BrighteonURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniWrite, %BrighteonURL%, %VideoLinksIniFile%, URLs, BrighteonURL IniWrite, %BrighteonURL%, %VideoLinksIniFile%, URLs, BrighteonURL
SaveDriverURL() SaveDriverURL()
AddToTotalVideosUploadedCount() AddToTotalVideosUploadedCount()
; TakeScreenshotOfPage(ScreenShotSavePath) ; TakeScreenshotOfPage(ScreenShotSavePath)
Return Return
; -------------------------------/Brighteon Upload------------------------------- ; -------------------------------/Brighteon Upload-------------------------------
; -------------------------------DailyMotion------------------------------- ; -------------------------------DailyMotion-------------------------------
DailyMotionUpload: DailyMotionUpload:
CurrentSite := "DailyMotion" CurrentSite := "DailyMotion"
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniRead, DailyMotionParnerUploadPage, %SettingsIniFilepath%, General, DailyMotionPostPageURL, %A_Space% IniRead, DailyMotionParnerUploadPage, %SettingsIniFilepath%, General, DailyMotionPostPageURL, %A_Space%
if(DailyMotionParnerUploadPage = ""){ 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 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") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return Return
} }
Status := NavigateFromBaseURLTo(DailyMotionParnerUploadPage,"Partner HQ - Dailymotion") Status := NavigateFromBaseURLTo(DailyMotionParnerUploadPage,"Partner HQ - Dailymotion")
if(Status) if(Status)
Return Return
Message = Waiting for Page to Finish Fully Loading Message = Waiting for Page to Finish Fully Loading
SaveOrPostProgress(Message:=Message,PostType:="Tooltip") SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
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
sleep, 1500 sleep, 1500
Message = Checking Log In Status Message = Checking Log In Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
LoggedOutStatus := CheckURLForSubstring("/sign-in") LoggedOutStatus := CheckURLForSubstring("/sign-in")
if(LoggedOutStatus){ if(LoggedOutStatus){
if(AutoLogin){ if(AutoLogin){
Message = Trying to Log Back in Automatically Message = Trying to Log Back in Automatically
@ -3756,80 +3757,80 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Message = Waiting 5 seconds for page to fully load Message = Waiting 5 seconds for page to fully load
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 5000 sleep, 5000
} }
status := CheckForAlerts() status := CheckForAlerts()
if(Status){ if(Status){
Message = Waiting for page to fully load Message = Waiting for page to fully load
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
sleep, 2000 sleep, 2000
} }
Message = Uploading Video Message = Uploading Video
SaveOrPostProgress(Message:=Message,PostType:="Tooltip") SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
Xpath = //input[@type='file'] Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=2000,StringTextContent:=VideoFilepath) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=2000,StringTextContent:=VideoFilepath)
if(Status){ if(Status){
Message = Failed to Upload Video. Please Check Login Status Message = Failed to Upload Video. Please Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
sleep, 2000 sleep, 2000
Message = Uploading Thumbnail Message = Uploading Thumbnail
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = //input[@type='file'] Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath)
if(Status){ if(Status){
Message = Failed to Upload Thumbnail: Check Login Status Message = Failed to Upload Thumbnail: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
} }
Message = Inputting Title Message = Inputting Title
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
loop, 5 { ; sometimes the pre-inserted title doesn't get cleaned out when inputting title loop, 5 { ; sometimes the pre-inserted title doesn't get cleaned out when inputting title
if(A_index = 5){ if(A_index = 5){
Message = Failed to input title after 5 attempts. Message = Failed to input title after 5 attempts.
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; Return ; Return
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
Xpath = (//input[@placeholder='Enter text'])[1] Xpath = (//input[@placeholder='Enter text'])[1]
try, driver.FindElementByXPath(Xpath).click() try, driver.FindElementByXPath(Xpath).click()
js = document.querySelector("input[placeholder='Enter text']").value = "%JSVideoTitle%"; js = document.querySelector("input[placeholder='Enter text']").value = "%JSVideoTitle%";
try driver.executeScript(js) try driver.executeScript(js)
Xpath = (//input[@placeholder='Enter text'])[1] Xpath = (//input[@placeholder='Enter text'])[1]
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.SPACE) try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.SPACE)
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.BackSpace) try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.BackSpace)
; get text in title box and see if it matches video title ; get text in title box and see if it matches video title
js = return document.querySelector("input[placeholder='Enter text']").value; js = return document.querySelector("input[placeholder='Enter text']").value;
try CurrentTitle := driver.executeScript(js) try CurrentTitle := driver.executeScript(js)
; Msgbox % "CurrentTitle: " CurrentTitle ; Msgbox % "CurrentTitle: " CurrentTitle
if(CurrentTitle != VideoTitle){ if(CurrentTitle != VideoTitle){
Message = Failed to input title on attempt %A_index% Message = Failed to input title on attempt %A_index%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
sleep, 1000 sleep, 1000
} }
else, else,
Break Break
} }
@ -4909,13 +4910,15 @@ Return
; -------------------------------Functions------------------------------- ; -------------------------------Functions-------------------------------
; Included Files ; Included Files
#include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\StdOutToVar.ahk #Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\General-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\General-Shared-Functions.ahk #Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Selenium-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Selenium-Shared-Functions.ahk #Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Chrome-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Gitea-Shared-Functions.ahk #Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Gitea-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\APIs-Shared-Functions.ahk #Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\API-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\JSON.ahk #Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\JSON.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\RunCMD.ahk #Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\RunCMD.ahk
#include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\StdOutToVar.ahk
; #Include %A_ScriptDir%\Lib\ChromeAutomationFunctions.ahk ; #Include %A_ScriptDir%\Lib\ChromeAutomationFunctions.ahk

@ -1 +1 @@
Subproject commit 3f559f2f81da580263ffcc72795c30f8c89a1603 Subproject commit 621127eaf039d2fb42d13c4ec0dc783a40ea3580
Loading…
Cancel
Save