diff --git a/Freedomain Video Uploader.ahk b/Freedomain Video Uploader.ahk index 18f81a5..a49d4e7 100644 --- a/Freedomain Video Uploader.ahk +++ b/Freedomain Video Uploader.ahk @@ -931,7 +931,6 @@ UpdateScript: UpdateScript() ; @todo: Save any changes made to the script before installing update -; Changelog := FindUpdateChangeLog(ScriptUpdateFilepath) Return ; now defunt, safe to remove @@ -1215,15 +1214,17 @@ KeywordsArray := StrSplit(VideoTags,",") Gosub, LBRYGetURL } - if(OdyseeVideoThumb){ +/* if(OdyseeVideoThumb){ OdyseeUploadType := "Video" Gosub, OdyseeVideoThumbUpload } - if(OdyseeAudioThumb){ + */ +/* if(OdyseeAudioThumb){ OdyseeUploadType := "Audio" Gosub, OdyseeAudioThumbUpload } + */ if(LocalsGrabURL OR LocalsURL = "LocalsUploadStartedNeedToGrabURL"){ Gosub, LocalsGrabURL @@ -1489,309 +1490,306 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){ ; msgbox %SocialMediaPosterFilepath% run, %SocialMediaPosterFilepath% "%VideoLinksIniFile%" Return - ; Podcast Upload - ;------------------------------------------------ - UploadPodcast: - CurrentSite := "Podcast" - PodcastTags := StrReplace(PodcastTags, " ,", ",") - PodcastTags := StrReplace(PodcastTags, ", ", ",") - PodcastTags := StrReplace(PodcastTags, " ", "-") - PodcastTags := StrReplace(PodcastTags, "--", "-") - PodcastTags := StrReplace(PodcastTags, "--", "-") - ; Msgbox % "PodcastTags: " PodcastTags +/* +*/ +; -------------------------------Podcast------------------------------- +UploadPodcast: +CurrentSite := "Podcast" +PodcastTags := StrReplace(PodcastTags, " ,", ",") +PodcastTags := StrReplace(PodcastTags, ", ", ",") +PodcastTags := StrReplace(PodcastTags, " ", "-") +PodcastTags := StrReplace(PodcastTags, "--", "-") +PodcastTags := StrReplace(PodcastTags, "--", "-") +; Msgbox % "PodcastTags: " PodcastTags - IniRead, FDRRadioURL, %SettingsIniFilepath%, General, FDRRadioURL, %A_Space% - if(FDRRadioURL = ""){ - Message = FDRRadioURL is blank.`nPlease add URL to Settings.ini file under:`n`n[General]`nFDRRadioURL= - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - MsgBox 0x10,, %Message% - Return - } - IniRead, Username, %SettingsIniFilepath%, General, FDRRadioUN, %A_Space% - IniRead, Password, %SettingsIniFilepath%, General, FDRRadioPW, %A_Space% +IniRead, FDRRadioURL, %SettingsIniFilepath%, General, FDRRadioURL, %A_Space% +if(FDRRadioURL = ""){ + Message = FDRRadioURL is blank.`nPlease add URL to Settings.ini file under:`n`n[General]`nFDRRadioURL= + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + MsgBox 0x10,, %Message% + Return +} - if(Username = "" or Password = ""){ - Message = Username and/or Password are blank.`nPlease add Login to Settings.ini file under:`n`n[General]`nFDRRadioUN=`nFDRRadioPW= - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - } +IniRead, Username, %SettingsIniFilepath%, General, FDRRadioUN, %A_Space% +IniRead, Password, %SettingsIniFilepath%, General, FDRRadioPW, %A_Space% + +if(Username = "" or Password = ""){ + Message = Username and/or Password are blank.`nPlease add Login to Settings.ini file under:`n`n[General]`nFDRRadioUN=`nFDRRadioPW= + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") +} - if(MP3AudioFilepath = ""){ - MsgBox 0x33, Unable to Upload Podcast, No MP3 File Was Found/Selected. `nWould you like to select one now? +if(MP3AudioFilepath = ""){ + MsgBox 0x33, Unable to Upload Podcast, No MP3 File Was Found/Selected. `nWould you like to select one now? - IfMsgBox Yes, { - FileSelectFile, MP3AudioFilepath,, %RootDirToStartIn%, Please Select MP3 File - if(ErrorLevel) + IfMsgBox Yes, { + FileSelectFile, MP3AudioFilepath,, %RootDirToStartIn%, Please Select MP3 File + if(ErrorLevel) + Return + } Else IfMsgBox No, { Return - } Else IfMsgBox No, { + } Else IfMsgBox Cancel, { Return - } Else IfMsgBox Cancel, { - Return - } } + } +/* +Sublime Indentation Reset +*/ - if(!InStr(MP3AudioFilepath, ".mp3")){ +if(!InStr(MP3AudioFilepath, ".mp3")){ - Message = Unable to upload podcast, no mp3 file was selected. - MsgBox 0x40, Error, %Message% - Return - } + Message = Unable to upload podcast, no mp3 file was selected. + MsgBox 0x40, Error, %Message% + Return +} - Message = Grabbing MP3 file data - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") +; Message = Grabbing MP3 file data +; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - ; https://www.autohotkey.com/boards/viewtopic.php?t=59882 - Message = Calculating MP3 File Size and Length - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile, DiscordErrorLogging") +; https://www.autohotkey.com/boards/viewtopic.php?t=59882 +Message = Calculating MP3 File Size and Length +SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile, DiscordErrorLogging") - Obj := Filexpro(MP3AudioFilepath,, - , "Length" - , "Size" ) - MP3AudioFilesize := obj["Size"] - MP3AudioLength := obj["Length"] - ; MsgBox % obj["Size"] +Obj := Filexpro(MP3AudioFilepath,, + , "Length" + , "Size" ) +MP3AudioFilesize := obj["Size"] +MP3AudioLength := obj["Length"] +; MsgBox % obj["Size"] - AudioLengthArray := StrSplit(MP3AudioLength,":") +AudioLengthArray := StrSplit(MP3AudioLength,":") - Message = MP3 Audio Length: %MP3AudioLength% - SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging") +Message = MP3 Audio Length: %MP3AudioLength% +SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging") - AudioLength_Seconds := ((AudioLengthArray[1] * 60 ) * 60) + (AudioLengthArray[2] * 60) + AudioLengthArray[3] - Message = MP3 Audio Length in Seconds: %TotalTimeInSeconds% +AudioLength_Seconds := ((AudioLengthArray[1] * 60 ) * 60) + (AudioLengthArray[2] * 60) + AudioLengthArray[3] +Message = MP3 Audio Length in Seconds: %TotalTimeInSeconds% +SaveOrPostProgress(Message:="Message",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - ; AudioLength_Hours := AudioLengthArray[1] - ; AudioLength_Minutes := AudioLengthArray[2] - ; AudioLength_Seconds := AudioLengthArray[3] - ; AudioLength_SecondsOriginal := AudioLength_Seconds - ; AudioLength_Seconds := (AudioLength_Minutes * 60) + ((AudioLength_Hours * 60) * 60) + AudioLength_Seconds +; AudioLength_Hours := AudioLengthArray[1] +; AudioLength_Minutes := AudioLengthArray[2] +; AudioLength_Seconds := AudioLengthArray[3] +; AudioLength_SecondsOriginal := AudioLength_Seconds +; AudioLength_Seconds := (AudioLength_Minutes * 60) + ((AudioLength_Hours * 60) * 60) + AudioLength_Seconds - ; Msgbox % "AudioLength_Hours: " AudioLength_Hours - ; Msgbox % "AudioLength_Minutes: " AudioLength_Minutes - ; Msgbox % "AudioLength_Seconds: " AudioLength_Seconds - ; Msgbox % "AudioLength_SecondsOriginal: " AudioLength_SecondsOriginal +; Msgbox % "AudioLength_Hours: " AudioLength_Hours +; Msgbox % "AudioLength_Minutes: " AudioLength_Minutes +; Msgbox % "AudioLength_Seconds: " AudioLength_Seconds +; Msgbox % "AudioLength_SecondsOriginal: " AudioLength_SecondsOriginal - FileGetSize, OutputVar, %MP3AudioFilepath%, K ; Retrieve the size in Kbytes. - FIlesizeInBytes := OutputVar * 1024 +FileGetSize, OutputVar, %MP3AudioFilepath%, K ; Retrieve the size in Kbytes. +FIlesizeInBytes := OutputVar * 1024 - Message = Inputting Podcast Information - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") +Message = Inputting Podcast Information +SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") +Status := NavigateFromBaseURLTo(FDRRadioURL) +if(Status) +Return - Status := NavigateFromBaseURLTo(FDRRadioURL) - if(Status){ - Message = Upload Failed (E#7295)`nUnable to Navigate to Upload Page`nChrome was closed or Internet down possibly? - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - Return - } +Status := CheckForAlerts() +if(Status){ - Message = Logging in - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") +} - Xpath = //input[@id='email'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=Username) - if(!Status){ ; if inputting email did NOT fail, then we are on the login page, input the password and then click login. - Xpath = //input[@id='password'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=Password) +Message = Logging in +SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - Xpath = //a[@id='loginButton'] - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) +Xpath = //input[@id='email'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=Username) +if(!Status){ ; if inputting email did NOT fail, then we are on the login page, input the password and then click login. + Xpath = //input[@id='password'] + Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=Password) - driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding + Xpath = //a[@id='loginButton'] + Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) - sleep, 2000 + driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding - try driver.Get(FDRRadioURL) ;Open selected URL - catch e { - Message = Upload Failed (E#7295)`nUnable to Navigate to Upload Page`nChrome was closed or Internet down possibly? - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + sleep, 2000 - } - } + try driver.Get(FDRRadioURL) ;Open selected URL + catch e { + Message = Upload Failed (E#7295)`nUnable to Navigate to Upload Page`nChrome was closed or Internet down possibly? + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + } +} - Message = Waiting for Page to Load - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - Xpath = //input[@id='num'] - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=60,SleepLength:=1000) - if(Status){ - Message = New Podcast Page did not load after 60 seconds. Check Login Status - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - Return - } +Message = Waiting for Page to Load +SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - Message = Inputting Podcast Info - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") +Xpath = //input[@id='num'] +Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=60,SleepLength:=1000) +if(Status){ + Message = New Podcast Page did not load after 60 seconds. Check Login Status + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + Return +} - ; Click the "Is Active?" Checkbox - Xpath = //input[@id='isActive'] - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) +Message = Inputting Podcast Info +SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - ; Input Podcast Number - Xpath = //input[@id='num'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PodcastNumber) +; Click the "Is Active?" Checkbox +Xpath = //input[@id='isActive'] +Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) - ; Input Podcast Title - Xpath = //input[@id='title'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoTitle) +; Input Podcast Number +Xpath = //input[@id='num'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PodcastNumber) - ; INput Audio URL - Xpath = //input[@id='url-audio'] - SplitPath, MP3AudioFilepath, MP3AudioNameWithExt - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=MP3AudioNameWithExt) +; Input Podcast Title +Xpath = //input[@id='title'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoTitle) - ; INput thumbnail URL - Xpath = //input[@id='url-thumbnail'] - SplitPath, VideoThumbFilepath, VideoThumbnailFilenameWithExt - ThumbnailURL = https://cdn.freedomainradio.com/%VideoThumbnailFilenameWithExt% - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ThumbnailURL) +; INput Audio URL +Xpath = //input[@id='url-audio'] +SplitPath, MP3AudioFilepath, MP3AudioNameWithExt +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=MP3AudioNameWithExt) - ; Input BitChute URL - Xpath = //input[@id='url-bitchute'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BitChuteURL) +; INput thumbnail URL +Xpath = //input[@id='url-thumbnail'] +SplitPath, VideoThumbFilepath, VideoThumbnailFilenameWithExt +ThumbnailURL = https://cdn.freedomainradio.com/%VideoThumbnailFilenameWithExt% +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ThumbnailURL) - ; Input Brighteon URL - Xpath = //input[@id='url-brighteon'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BrighteonURL) +; Input BitChute URL +Xpath = //input[@id='url-bitchute'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BitChuteURL) - ; Input DailyMotion URL - Xpath = //input[@id='url-dailymotion'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=DailyMotionURL) +; Input Brighteon URL +Xpath = //input[@id='url-brighteon'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BrighteonURL) - ; Input LBRY URL - Xpath = //input[@id='url-lbry'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=OdyseeVideoURL) +; Input DailyMotion URL +Xpath = //input[@id='url-dailymotion'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=DailyMotionURL) - ; Input LBRY URL - Xpath = //input[@id='url-locals'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=LocalsURL) +; Input LBRY URL +Xpath = //input[@id='url-lbry'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=OdyseeVideoURL) - ; Input Rumble URL - Xpath = //input[@id='url-rumble'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=RumbleURL) +; Input LBRY URL +Xpath = //input[@id='url-locals'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=LocalsURL) +; Input Rumble URL +Xpath = //input[@id='url-rumble'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=RumbleURL) - ; Soundcloud but actually LBRY Audio URL - Xpath = //input[@id='url-lbry-audio'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=OdyseeAudioURL) +; Soundcloud but actually LBRY Audio URL +Xpath = //input[@id='url-lbry-audio'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=OdyseeAudioURL) - ; INput filesize - Xpath = //input[@id='fileSize'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=FIlesizeInBytes) - ; Msgbox % "FIlesizeInBytes2: " FIlesiz +; INput filesize +Xpath = //input[@id='fileSize'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=FIlesizeInBytes) - ; ToolTip +Xpath = //input[@id='lengthHours'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Hours) - Xpath = //input[@id='lengthHours'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Hours) +Xpath = //input[@id='lengthMinutes'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Minutes) - Xpath = //input[@id='lengthMinutes'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Minutes) +Xpath = //input[@id='lengthSeconds'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Seconds) +; Message = Audio Length in Seconds that got input: %AudioLength_Seconds% +; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - Xpath = //input[@id='lengthSeconds'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Seconds) - ; Message = Audio Length in Seconds that got input: %AudioLength_Seconds% - ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") +Message = Inputting Description +SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - Message = Inputting Description - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") +Xpath = //textarea[@id='description'] +Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) - Xpath = //textarea[@id='description'] - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) +; Input Description +JSVideoDescription := FormatTextToJSText(VideoDescription) - ; Input Description - JSVideoDescription := FormatTextToJSText(VideoDescription) +js = document.getElementById('description').value = "%JSVideoDescription%"; +try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons. - js = document.getElementById('description').value = "%JSVideoDescription%"; - try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons. +Message = Inputting Tags +SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - Message = Inputting Tags - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") +Podcasttags := StrReplace(Podcasttags, " , ", ",") +Podcasttags := StrReplace(Podcasttags, " ,", ",") +Podcasttags := StrReplace(Podcasttags, ", ", ",") - Podcasttags := StrReplace(Podcasttags, " , ", ",") - Podcasttags := StrReplace(Podcasttags, " ,", ",") - Podcasttags := StrReplace(Podcasttags, ", ", ",") +ArrayOfPodcastTags := StrSplit(Podcasttags,",") +LengthOfArrayOfPodcastTags := ArrayOfPodcastTags.Length() ; Save total number of items in the array - ArrayOfPodcastTags := StrSplit(Podcasttags,",") - LengthOfArrayOfPodcastTags := ArrayOfPodcastTags.Length() ; Save total number of items in the array +try pagehtml := driver.pagesource +; Msgbox % "pagehtml: " pagehtml +Loop, %LengthOfArrayOfPodcastTags% { + Tag := ArrayOfPodcastTags[A_Index] ; find value from position in array - try pagehtml := driver.pagesource - ; Msgbox % "pagehtml: " pagehtml - Loop, %LengthOfArrayOfPodcastTags% { - Tag := ArrayOfPodcastTags[A_Index] ; find value from position in array + SpanID = title">%Tag%
  • %Tag%
  • ")){ - Message = Upload Failed: Unable to Find Edit Button: Check Login Status - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() - Return -} +SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") +CheckForAlerts() -Message = Clicking "Edit" on PageURL %OdyseeURLToUploadThumbnailFor% -SaveOrPostProgress(Message:=Message,PostType:="DiscordErrorLogging") +try CurrentURL := driver.URL +if(InStr(CurrentURL, "/login.php")){ -; Click Edit button to check if logged in or not. -Xpath = //span[contains(text(),'Edit')] -loop, 3 { - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=5000) - if(Status){ - ; msgbox, click failed - Sleep, 60000 - try driver.executeScript("history.go(0)") ;refresh page - } - else, - Break -} -if(Status){ - try CurrentPage := driver.url - Message = Unable to click "Edit" button. Most likely Reason is Video is Still Confirming OR Login Cookies Have Expired. - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() - Return -} + ; AutoLogin := 1 + ; Msgbox % "AutoLogin: " AutoLogin + if(AutoLogin){ + Message = Logging in Automatically by clicking into the UN+PW fields for info to register + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") -/* -; Close the video preview floating window -Xpath = //button[@title='Close'] -Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) + ; 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[@id='login-username'] + driver.FindElementByXPath(Xpath).click() -*/ + Xpath = //input[@id='login-password'] + driver.FindElementByXPath(Xpath).click() -; "Use thumbnail upload tool" -TooltipThis("Selecting Thumbnail Upload Tool") -Xpath = //span[contains(text(),'Use thumbnail upload tool')] -Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) -if(Status){ - Message = Thumbnail Upload Failed (E#5617)`nUnable to click on "Use thumbnail upload tool" - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() - Return -} -/* -try CurrentPage := driver.url -Message = Trying to Click Browse for Thumbnail Button on Page: %CurrentPage% -SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + js = document.querySelector("button[type='submit']").click(); + driver.executeScript(js) -*/ -/* -Xpath = /html/body/div/div/div[1]/main/div/div/section[2]/div/div/fieldset-section/input-submit/button/span/span -Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) -if(Status){ - Message = Failed to Click "Browse" button with Direct Xpath to input thumbnail filepath. Trying with Relative - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - -} + ; Do a double check to make sure that login worked + Message = Checking Login Status + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") -*/ + try CurrentURL := driver.URL -/*; Select Use Thumbnail upload tool button -Xpath = //span[contains(text(),'Use thumbnail upload tool')] -Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) -if(Status){ - Message = Failed to click "Use Thumbanil Upload Tool" - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") -} + if(!InStr(CurrentURL, "/upload")){ + Message = Failed to log back in. Please Log Back In Manually + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + SaveDriverURLOFErrorPage() + Return + } -*/ -/* -Xpath = //div[@class='card__main-actions']//div//span[@class='button__label'][normalize-space()='Browse'] -Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) -if(Status){ - Message = Failed to click "Browse" button using relative and direct Xpath - Xpath = //div[@class='card__main-actions']//div//button[@aria-label='Browse'] - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) - if(Status){ - Message = Failed to click "Browse" button using Relative Xpath of parent element as well + } + else, { ; notify user and return + Message = Login Expired. Please Log Back in SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + SaveDriverURLOFErrorPage() Return } -} - -*/ - -/* -Message = Trying to select thumbnail to upload -SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - -*/ - -/* -Status := InputFilePathIntoOpenWindow(VideoThumbFilepath) -if(Status) -{ - Message = Upload Failed:`nUnable to Find "Open File" window to input filepath into - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - Return + Message = Waiting 5 seconds for page to fully load + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + sleep, 5000 } -*/ +CheckForAlerts() -Xpath = //input[@accept='.png, .jpg, .jpeg, .gif'] -Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath) +Message = Uploading Video File +SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") +; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + +Xpath = //input[@id='Filedata'] +Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath) if(Status){ - Message = Failed to Upload Thumbnail Image + Message = Failed to Upload Video File SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveDriverURLOFErrorPage() Return - ; Return } -; try driver.FindElementByXPath(Xpath).SendKeys(VideoThumbFilepath) -; "Upload thumbnail" popup -; Confirmation Upload Popup - popup box -Xpath = //span[contains(text(),'Upload')] -Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) -if(Status){ - Message = Thumbnail Upload Failed (E#2866)`nUnable to click upload confirmation button - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") +; Input Title +try driver.findElementsByName("title").item[1].SendKeys(VideoTitle) ;selects element based on Name and sends variable to it. +catch e { + Message = Video Upload Failed, Please Check Login Status + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveDriverURLOFErrorPage() Return } -/* -Xpath = /html/body/div[4]/div/div/div/button[1]/span/span -loop, 15 { - if(A_index = 15){ - Message = Thumbnail Upload Failed (E#2866)`nUnable to click upload confirmation button - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - Break - } - try driver.FindElementByXPath(Xpath).click() ;click on confirmaiton button - catch e { - Sleep, 1000 - Continue - } - Break -} +; Input Description +Loop, 5 { ; Attempt to input video description a couple of times + TooltipThis("Inputting Description `nAttempt Number: " A_index) -*/ -/*; "Upload Complete" Text -Xpath = /html/body/div/div/div[1]/main/div/div/section[2]/div/div/div/div[2]/p -Loop, 15 { - if(A_index = 15){ - Message = Thumbnail Upload Failed (E#5580)`nUnable to find upload confirmation text on page. - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - Break - } - try UploadStatus := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text - if(!InStr(UploadStatus, "Complete")) - { - sleep, 2000 - Continue - } + status := js_SendAndCheckWithID(Element:="description",ValueToCheck:="value",SleepLength:=3000,JSStringText:=JSVideoDescription) + if(!Status) Break -} -*/ - -; sleep, 5000 ; sleep 5 seconds for everything to catch up. - -Message = Waiting for Thumbnail to Finish Uploading -SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") -sleep, 5000 - -; Hit the save button -Xpath = //button[@class='button button--primary'] ; Save button popup -Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=5000) -if(Status = Failed){ -/* Message = Failed to click last "Save" button. Please click it to finalize the upload. - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - Return - */ -} - -sleep, 5000 - -; Click off the confirmation popup and Check the "Skip Preview and Confirmation" checkbox -; xpath = //label[normalize-space()='Skip preview and confirmation'] -; try SkipPreviewCheck := driver.findelementbyxpath(Xpath).Attribute("innerText") ; Grabb innertext - -; if(SkipPreviewCheck != ""){ - ; Check skip preview checkbox so the box doesn't pop up again - - TooltipThis("Checking for Confirmation Popup") - xpath = //label[normalize-space()='Skip preview and confirmation'] - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) - - Message = Unchecked "Confirm Edit" on each video Checkbox - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - ; msgbox ? - - ; Save Button - Xpath = //button[@aria-label='Save'] - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=1000) - ; } - - - Message = Thumbnail Uploaded Successfully - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - - if(OdyseeUploadType = "Video") - IniWrite, Successful, %VideoLinksIniFile%, Misc, OdyseeVideoThumb - if(OdyseeUploadType = "Audio") - IniWrite, Successful, %VideoLinksIniFile%, Misc, OdyseeAudioThumb - - ; TakeScreenshotOfPage(ScreenShotSavePath) - - Return - - - ; ---------------------/LBRY Thumb--------/Odysee Thumb----------------------- - - - - - - ; -------------------------------Rumble------------------------------- - RumbleUpload: - CurrentSite := "Rumble" - SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - URLAttempt := NavigateFromBaseURLTo("https://rumble.com/upload.php") - if(URLAttempt) - Return - try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding - - - Message = Checking Login Status - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - - CheckForAlerts() - - try CurrentURL := driver.URL - if(InStr(CurrentURL, "/login.php")){ - - - ; AutoLogin := 1 - ; Msgbox % "AutoLogin: " AutoLogin - - if(AutoLogin){ - Message = Logging in Automatically by clicking into the UN+PW fields for info to register - 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[@id='login-username'] - driver.FindElementByXPath(Xpath).click() - - Xpath = //input[@id='login-password'] - driver.FindElementByXPath(Xpath).click() - - - js = document.querySelector("button[type='submit']").click(); - driver.executeScript(js) - - - ; Do a double check to make sure that login worked - Message = Checking Login Status - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - - try CurrentURL := driver.URL - - if(!InStr(CurrentURL, "/upload")){ - 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 - } - - CheckForAlerts() - - Message = Uploading Video File - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - - Xpath = //input[@id='Filedata'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath) - if(Status){ - Message = Failed to Upload Video File - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() - Return - } - - - ; Input Title - try driver.findElementsByName("title").item[1].SendKeys(VideoTitle) ;selects element based on Name and sends variable to it. - catch e { - Message = Video Upload Failed, Please Check Login Status - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() - Return - } - ; Input Description - Loop, 5 { ; Attempt to input video description a couple of times - TooltipThis("Inputting Description `nAttempt Number: " A_index) - - status := js_SendAndCheckWithID(Element:="description",ValueToCheck:="value",SleepLength:=3000,JSStringText:=JSVideoDescription) - if(!Status) - Break /* if(A_index = 5){ Clipboard := VideoDescription @@ -5116,9 +4785,11 @@ Return FacebookUpload: CurrentSite := "Facebook" SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") -URLAttempt := NavigateFromBaseURLTo("https://www.facebook.com/") -if(URLAttempt) +Status := NavigateFromBaseURLTo("https://www.facebook.com/") +if(Status) Return + + try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding diff --git a/Lib/Freedomain-Posters-Shared-Functions b/Lib/Freedomain-Posters-Shared-Functions index 89c1042..694c440 160000 --- a/Lib/Freedomain-Posters-Shared-Functions +++ b/Lib/Freedomain-Posters-Shared-Functions @@ -1 +1 @@ -Subproject commit 89c1042e013f14eda16477c719e9427045ddfa1e +Subproject commit 694c440a6a89b0b84fee0c49370d95150667c7a9