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
Freedomain Video Uploader.exe
Lib/LBRY Process Killer.exe
Lib/chrome-win64

@ -29,7 +29,7 @@ global ScriptVersion
global FullScriptName
ScriptName = Freedomain Video Uploader
ScriptVersion = 3.17
ScriptVersion = 3.18
FullScriptName := ScriptName . " - " . ScriptVersion
@ -136,9 +136,9 @@ IniRead, ShowTooltipProgress, %SettingsIniFilepath%, General, ShowTooltipProgres
(ShowTooltipProgress)?(ShowTooltipProgressCheckStatus := 1) : (ShowTooltipProgressCheckStatus := 0)
Message = Reading Settings from .ini files
; Message = Reading Settings from .ini files
; 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
SplitPath, BodyTextFilePath, OutFileName, VideoFolderDir, OutExtension, OutNameNoExt, OutDrive
@ -2849,63 +2849,64 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
;
;------------------/Locals------------------------------
/*
*/
;
;--------------------Telegram----------------------------
TelegramVideoUpload:
;
;--------------------Telegram----------------------------
TelegramVideoUpload:
if(VideoFileSizeInMB > 50){
if(VideoFileSizeInMB > 50){
Message = Telegram Upload Skipped. Video is larger than 50MB
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
}
CurrentSocialMediaPosting := "Telegram Video"
Message = Uploading Video to Telegram
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
CurrentSocialMediaPosting := "Telegram Video"
Message = Uploading Video to Telegram
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniRead, TelegramBotToken, %SettingsIniFilepath%, SocialMediaPoster, TelegramBotToken, %A_Space%
IniRead, TelegramBotChatID, %SettingsIniFilepath%, SocialMediaPoster, TelegramBotChatID, %A_Space%
IniRead, TelegramBotToken, %SettingsIniFilepath%, SocialMediaPoster, TelegramBotToken, %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.
msgbox, 4096, Error!, %Message%
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.
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(StrLen(SocialMediaDescription) > 2000){
; 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){
TelegramVideoUploadDescription := SubStr(SocialMediaDescription, 1, 990)
TelegramVideoUploadDescription .= "...."
; msgbox, here goes
; Goto, CreateDescriptionForVideosPosting
}
}
SubmitDescriptionForTelegramVideoUpload:
TelegramVideoTitle := ASCIISTRReplace(VideoTitle)
SubmitDescriptionForTelegramVideoUpload:
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
if(InStr(Status, "error_code")){
Status := SendTelegramVideo(TelegramBotToken, TelegramBotChatID, VideoFilepath, caption := Message ) ; you could add more options; compare the Telegram API docs
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.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
@ -2915,35 +2916,35 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
ToolTip
Return
}
; msgbox
}
; msgbox
Message = Upload Complete to Telegram
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniWrite, Successful, %VideoLinksIniFile%, Misc, Telegram
; SaveDriverURL()
AddToTotalVideosUploadedCount()
Message = Upload Complete to Telegram
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniWrite, Successful, %VideoLinksIniFile%, Misc, Telegram
; SaveDriverURL()
AddToTotalVideosUploadedCount()
Return
Return
; -------------------------------BitChute-------------------------------
BitChuteUpload:
CurrentSite := "Bitchute"
; -------------------------------BitChute-------------------------------
BitChuteUpload:
CurrentSite := "Bitchute"
Message = Starting Upload
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Message = Starting Upload
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Status := NavigateFromBaseURLTo("https://www.bitchute.com/myupload", "BitChute Video Uploader")
if(Status)
Return
Status := NavigateFromBaseURLTo("https://www.bitchute.com/myupload", "BitChute Video Uploader")
if(Status)
Return
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
try TabUrl := driver.url
if(InStr(TabUrl, "/accounts/login/")){
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)
@ -2961,16 +2962,16 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Return
}
}
}
CheckForAlerts()
CheckForAlerts()
Message = Inputting Title
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Message = Inputting Title
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Try to input video title and if fail try to login again
loop, 5 {
; Try to input video title and if fail try to login again
loop, 5 {
if(A_index = 5){
try CurrentURL := driver.url
; CurrentURL := ExtractBaseURL(URL)
@ -2987,23 +2988,23 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
if(!Status)
break
}
}
Message = Inputting Description
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Message = Inputting Description
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; trim description if it's too long
BitchuteDescription := VideoDescription
if(StrLen(BitchuteDescription) > 2995){
; 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)
}
else,
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%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3027,29 +3028,29 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Break
sleep, 1000
}
}
Message = Inputting Tags
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Message = Inputting Tags
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; Convert tags into #hasthtags
Loop, 3 {
; 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)
; 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")
; Upload Thumbnail
Message = Attaching Thumbnail
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
if(VideoThumbFilepath != ""){
if(VideoThumbFilepath != ""){
; Upload Cover Image Button
Message = Uploading Thumbnail
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -3064,26 +3065,26 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Return
}
; sleep, 5000
}
}
; Upload Video button
Message = Uploading Video File
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; 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){
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% {
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
@ -3124,33 +3125,33 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Status := Check_For_Stuck_Video_Upload(A_index, BitChuteUploadProgress)
if(Status = "Failed")
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
Xpath = //button[normalize-space()='Proceed'] ; Finish button
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=5000)
if(Status){
; 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
}
; 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
; 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
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
; 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")
Message = Waiting 30 Seconds Before Refreshing Page to Find Newest Video
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Loop, 6 { ; 6 loops X 30 seconds
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
@ -3162,87 +3163,87 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
SaveDriverURLOFErrorPage()
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
; Msgbox % "FirstResultIDAndTag: " FirstResultIDAndTag
VideoHref := StrSplit(FirstResultIDAndTag, "<a href=")[2]
VideoHref := StrSplit(VideoHref, " class=")[1]
SingleQuote = "
VideoHref := StrReplace(VideoHref, SingleQuote, "")
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 = ""){
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")
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
; 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){
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)
; 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")
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)
; 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
Message = Upload Complete:`n%BitChuteURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniWrite, %BitChuteURL%, %VideoLinksIniFile%, URLs, BitChuteURL
SaveDriverURL()
AddToTotalVideosUploadedCount()
; TakeScreenshotOfPage(ScreenShotSavePath)
SaveDriverURL()
AddToTotalVideosUploadedCount()
; TakeScreenshotOfPage(ScreenShotSavePath)
Return
; -------------------------------/BitChute Upload-------------------------------
Return
; -------------------------------/BitChute Upload-------------------------------
; -------------------------------Brighteon Upload-------------------------------
BrighteonUpload:
; -------------------------------Brighteon Upload-------------------------------
BrighteonUpload:
CurrentSite := "Brighteon"
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Status := NavigateFromBaseURLTo("https://www.brighteon.com/dashboard/video-upload")
if(Status)
Return
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
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){
; 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)
@ -3252,16 +3253,16 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
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 = 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")
@ -3320,43 +3321,43 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Return
}
}
}
}
Message = Navigating to Upload Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
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
; 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")
try driver.executeScript("return document.readyState").equals("complete")
TabURl := GetCurrentTabURlBase()
Message = Current Tab URL: %TabURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
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()
; 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()
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 = 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 {
loop, 3 {
if(A_index = 3){
Message = Failed to input Video Title
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")
break
}
}
TooltipThis("Inputting Video Description")
TooltipThis("Inputting Video Description")
; Attempt to input video description a couple of times
Loop, 10 {
; 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")
@ -3450,12 +3451,12 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Break
}
}
}
; Thumbnail
if(VideoThumbFilepath != "") {
; Thumbnail
if(VideoThumbFilepath != "") {
TooltipThis("Uploading Thumbnail")
Xpath = //input[@type='file']
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
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
}
}
; DevModeMsgBox(VideoTags)
TooltipThis("Inputting Keywords")
Loop, 5 {
; 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 {
@ -3495,25 +3496,25 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
; 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
; 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){
; 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, {
}
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% {
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
@ -3543,28 +3544,28 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
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")){
; "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
; 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
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")
@ -3579,42 +3580,42 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
try CurrentURL := driver.url
if(BrighteonUploadPageURL != CurrentURL)
Break
}
}
Message = Trying to Grab Newest Video's URL
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 2000
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
; 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(){
; 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")
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)
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 {
Loop, 4 {
ElementIndexNumber := A_index - 1
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
; BrighteonURL := StrReplace(BrighteonURL, "dashboard/videos/", "")
; Convert dashboard URL to Public URL
; 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.
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()
; TakeScreenshotOfPage(ScreenShotSavePath)
Message = Upload Complete:`n%BrighteonURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniWrite, %BrighteonURL%, %VideoLinksIniFile%, URLs, BrighteonURL
SaveDriverURL()
AddToTotalVideosUploadedCount()
; TakeScreenshotOfPage(ScreenShotSavePath)
Return
; -------------------------------/Brighteon Upload-------------------------------
Return
; -------------------------------/Brighteon Upload-------------------------------
; -------------------------------DailyMotion-------------------------------
DailyMotionUpload:
; -------------------------------DailyMotion-------------------------------
DailyMotionUpload:
CurrentSite := "DailyMotion"
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
CurrentSite := "DailyMotion"
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniRead, DailyMotionParnerUploadPage, %SettingsIniFilepath%, General, DailyMotionPostPageURL, %A_Space%
if(DailyMotionParnerUploadPage = ""){
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
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 = 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")
Message = Checking Log In Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
LoggedOutStatus := CheckURLForSubstring("/sign-in")
if(LoggedOutStatus){
LoggedOutStatus := CheckURLForSubstring("/sign-in")
if(LoggedOutStatus){
if(AutoLogin){
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
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 5000
}
}
status := CheckForAlerts()
if(Status){
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")
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){
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
}
sleep, 2000
Message = Uploading Thumbnail
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
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){
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")
Message = Inputting Title
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.
; 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()
Xpath = (//input[@placeholder='Enter text'])[1]
try, driver.FindElementByXPath(Xpath).click()
js = document.querySelector("input[placeholder='Enter text']").value = "%JSVideoTitle%";
try driver.executeScript(js)
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)
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
; 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){
if(CurrentTitle != VideoTitle){
Message = Failed to input title on attempt %A_index%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
sleep, 1000
}
else,
Break
}
else,
Break
}
@ -4909,13 +4910,15 @@ Return
; -------------------------------Functions-------------------------------
; Included Files
#include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\StdOutToVar.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\General-Shared-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Selenium-Shared-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Gitea-Shared-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\APIs-Shared-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\General-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Selenium-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Chrome-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Gitea-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\RunCMD.ahk
#include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\StdOutToVar.ahk
; #Include %A_ScriptDir%\Lib\ChromeAutomationFunctions.ahk

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