reworked bitchute login status check, reworked Bitchute title input to use JS with double check

pull/2/head
Yuriy 2 years ago
parent 895192fd44
commit 4ad5fde4d4

@ -158,6 +158,10 @@ IniRead, ReuseTabs, %SettingsIniFilepath%, General, ReuseTabs, 1
IniRead, AutoUpdateCheck, %SettingsIniFilepath%, General, AutoUpdateCheck, 1 IniRead, AutoUpdateCheck, %SettingsIniFilepath%, General, AutoUpdateCheck, 1
(AutoUpdateCheck)?(AutoUpdateCheckCheckStatus := 1) : (AutoUpdateCheckCheckStatus := 0) (AutoUpdateCheck)?(AutoUpdateCheckCheckStatus := 1) : (AutoUpdateCheckCheckStatus := 0)
; AutoLogin setting
IniRead, AutoLogin, %SettingsIniFilepath%, General, AutoLogin, 1
(AutoUpdateCheck)?(AutoUpdateCheckCheckStatus := 1) : (AutoUpdateCheckCheckStatus := 0)
IniRead, PingOnCompletion, %SettingsIniFilepath%, General, PingOnCompletion, 1 IniRead, PingOnCompletion, %SettingsIniFilepath%, General, PingOnCompletion, 1
(PingOnCompletion)?(PingOnCompletionCheckStatus := 1) : (PingOnCompletionCheckStatus := 0) (PingOnCompletion)?(PingOnCompletionCheckStatus := 1) : (PingOnCompletionCheckStatus := 0)
@ -732,6 +736,7 @@ Gui, Add, Checkbox, xp+10 yp+20 vReuseTabs Checked%ReuseTabsCheckStatus% gUpdat
Gui, Add, Checkbox, vShowTooltipProgress Checked%ShowTooltipProgressCheckStatus% gUpdateVars,Show Tooltip Progress Gui, Add, Checkbox, vShowTooltipProgress Checked%ShowTooltipProgressCheckStatus% gUpdateVars,Show Tooltip Progress
Gui, Add, Checkbox, vKillLBRYAfterUpload Checked%KillLBRYAfterUploadCheckStatus% ,Kill LBRY After Uploading Gui, Add, Checkbox, vKillLBRYAfterUpload Checked%KillLBRYAfterUploadCheckStatus% ,Kill LBRY After Uploading
Gui, Add, Checkbox, vAutoUpdateCheck gUpdateVars Checked%AutoUpdateCheckCheckStatus%, Auto Update Check Gui, Add, Checkbox, vAutoUpdateCheck gUpdateVars Checked%AutoUpdateCheckCheckStatus%, Auto Update Check
Gui, Add, Checkbox, vAutoLogin gUpdateVars Checked%AutoLoginCheckStatus%, Try to Login Automatically
Gui, Add, Checkbox, vPingOnCompletion gUpdateVars Checked%PingOnCompletionCheckStatus%, Discord Ping Upon Finish Gui, Add, Checkbox, vPingOnCompletion gUpdateVars Checked%PingOnCompletionCheckStatus%, Discord Ping Upon Finish
; Gui, Add, Checkbox, vAutoUploadErrorLog gUpdateVars Checked%AutoUploadErrorLog%, Auto-Upload Large Errors ; Gui, Add, Checkbox, vAutoUploadErrorLog gUpdateVars Checked%AutoUploadErrorLog%, Auto-Upload Large Errors
@ -1065,6 +1070,7 @@ if(VideoDescription != OriginalVideoDescription){
IniWrite, %ReuseTabs%, %SettingsIniFilepath%, General, ReuseTabs IniWrite, %ReuseTabs%, %SettingsIniFilepath%, General, ReuseTabs
IniWrite, %ShowTooltipProgress%, %SettingsIniFilepath%, General, ShowTooltipProgress IniWrite, %ShowTooltipProgress%, %SettingsIniFilepath%, General, ShowTooltipProgress
IniWrite, %AutoUpdateCheck%, %SettingsIniFilepath%, General, AutoUpdateCheck IniWrite, %AutoUpdateCheck%, %SettingsIniFilepath%, General, AutoUpdateCheck
IniWrite, %AutoLogin%, %SettingsIniFilepath%, General, AutoLogin
IniWrite, %PingOnCompletion%, %SettingsIniFilepath%, General, PingOnCompletion IniWrite, %PingOnCompletion%, %SettingsIniFilepath%, General, PingOnCompletion
IniWrite, %KillLBRYAfterUpload%, %SettingsIniFilepath%, General, KillLBRYAfterUpload IniWrite, %KillLBRYAfterUpload%, %SettingsIniFilepath%, General, KillLBRYAfterUpload
@ -1542,7 +1548,7 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
; https://www.autohotkey.com/boards/viewtopic.php?t=59882 ; https://www.autohotkey.com/boards/viewtopic.php?t=59882
Message = Calculating MP3 File Size and Length Message = Calculating MP3 File Size and Length
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile, DiscordErrorLogging")
Obj := Filexpro(MP3AudioFilepath,, Obj := Filexpro(MP3AudioFilepath,,
, "Length" , "Length"
@ -1552,9 +1558,16 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
; MsgBox % obj["Size"] ; MsgBox % obj["Size"]
AudioLengthArray := StrSplit(MP3AudioLength,":") AudioLengthArray := StrSplit(MP3AudioLength,":")
AudioLength_Hours := AudioLengthArray[1]
AudioLength_Minutes := AudioLengthArray[2] Message = MP3 Audio Length: %MP3AudioLength%
AudioLength_Seconds := AudioLengthArray[3] 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_Hours := AudioLengthArray[1]
; AudioLength_Minutes := AudioLengthArray[2]
; AudioLength_Seconds := AudioLengthArray[3]
; AudioLength_SecondsOriginal := AudioLength_Seconds ; AudioLength_SecondsOriginal := AudioLength_Seconds
; AudioLength_Seconds := (AudioLength_Minutes * 60) + ((AudioLength_Hours * 60) * 60) + AudioLength_Seconds ; AudioLength_Seconds := (AudioLength_Minutes * 60) + ((AudioLength_Hours * 60) * 60) + AudioLength_Seconds
@ -1567,7 +1580,7 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
FIlesizeInBytes := OutputVar * 1024 FIlesizeInBytes := OutputVar * 1024
Message = Uploading Podcast Information Message = Inputting Podcast Information
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -1690,6 +1703,8 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
Xpath = //input[@id='lengthSeconds'] Xpath = //input[@id='lengthSeconds']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Seconds) 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 Message = Inputting Description
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -2919,43 +2934,56 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
} }
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Message = Uploading Video try TabUrl := driver.url
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") if(InStr(TabUrl, "/accounts/login/")){
; sleep, 5000 if(AutoLogin){
Xpath = (//button[normalize-space()='Submit'])[1]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
Message = Failed to click Login Button. Please Log Back In
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
}
else, {
Message = Login Expired. Please Log Back In
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; Try to input video title and if fail try to login again }
loop, 2 {
Xpath = //input[@id='title']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=1000,StringTextContent:=VideoTitle)
if(!Status)
Break
; Try to login
Message = Checking Login Status Message = Inputting Title
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //input[@id='id_username']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=1000)
if(!Status){
Xpath = //button[normalize-space()='Submit']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
Message = Waiting for Upload Page to Load ; Try to input video title and if fail try to login again
SaveOrPostProgress(Message:=Message,PostType:="Tooltip") loop, 5 {
try driver.executeScript("return document.readyState").equals("complete") if(A_index = 5){
sleep, 5000 try CurrentURL := driver.url
Continue currentTabURL := SubStr(currentTabURL, 1, 40)
Message = Failed to input Video Title after %A_index% attempts.`nCurrent Tab URL: %currentTabURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
} }
} status := js_SendAndCheckWithQuerySelector(Selector:="#title",ValueToCheck:="value",SleepLength:=1000,JSStringText:=VideoTitle)
; Msgbox % "status: " status
if(!Status)
break
; DevModeMsgBox("stop") }
; BitchuteDescription := SubStr(VideoDescription, 0, 2995) . "..."
; JSBitchuteDescription := FormatTextToJSText(BitchuteDescription)
; 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)
@ -2967,7 +2995,21 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Message = Inputting Description Message = Inputting Description
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Loop, 10 { ; Attempt to input video description a couple of times Loop, 10 { ; Attempt to input video description a couple of times
LogErrorToTextFile("Inputting Description") Message = Inputting Description. Attempt #%A_index%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
if(A_index = 10){
try currentTabURL := driver.url
currentTabURL := SubStr(currentTabURL, 1, 40)
Message = Failed to input Video Description after %A_index% attempts`n `nCurrent Tab URL Beginning: %currentTabURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; LogErrorToTextFile("Inputting Description")
; Input text ; Input text
; try BitChuteUploadProgress := driver.executeScript("return document.getElementsByClassName('progress-bar')[0].innerHTML;") ;navigate using javascript ; try BitChuteUploadProgress := driver.executeScript("return document.getElementsByClassName('progress-bar')[0].innerHTML;") ;navigate using javascript
@ -2986,18 +3028,17 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
; check contents of page ; check contents of page
try VideoDescriptionOnPage := driver.executeScript(jsCheck) ;Executes a Javascript on the webpage, mostly used for buttons. try VideoDescriptionOnPage := driver.executeScript(jsCheck) ;Executes a Javascript on the webpage, mostly used for buttons.
if (A_index = 1){ if(StrLen(VideoDescription) > 5){
message := SubStr(VideoDescriptionOnPage, 1, 250) Message = Video Description input successfully
message = Bitchute Inputted description: %message% SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging") break
} }
if(VideoDescriptionOnPage = ""){ ; if (A_index = 1){
Message = Failed to input Video Description ; message := SubStr(VideoDescriptionOnPage, 1, 250)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") ; message = Description that got input: %message%
SaveDriverURLOFErrorPage() ; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging")
Return ; }
}
} }
@ -3039,6 +3080,9 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
} }
; Upload Video button ; Upload Video button
Message = Uploading Video File
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){
@ -3202,8 +3246,12 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
CurrentSite := "Brighteon" CurrentSite := "Brighteon"
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
URLAttempt := NavigateFromBaseURLTo("https://www.brighteon.com/dashboard/video-upload") URLAttempt := NavigateFromBaseURLTo("https://www.brighteon.com/dashboard/video-upload")
if(URLAttempt = "Failed") if(URLAttempt = "Failed"){
Message = Failed to Navigate to Upload Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return Return
}
; 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
@ -3224,20 +3272,7 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
} }
} }
/*; Closing any popups that might appear
loop, 3 {
Xpath = //body/div[@id='__next']/div[@id='modal-root']/div/div/div[1] ; get our free newsletter
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=1000)
; try driver.FindElementByXPath(Xpath).click()
; If newsletter pop up exists then close it.
Xpath = //div[@class='overlay__close inside']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=1000)
}
*/
Message = Checking Login Status Message = Checking Login Status
@ -3323,20 +3358,38 @@ if(Status){
Return Return
} }
loop, 3 {
if(A_index = 3){
Message = Failed to input Video Title
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
; Input Title of the Video ; Input Title of the Video
Xpath = /html/body/div/section[2]/div[2]/div/form/div[1]/div[1]/div[2]/div[1]/div/input Xpath = /html/body/div/section[2]/div[2]/div/form/div[1]/div[1]/div[2]/div[1]/div/input
try driver.FindElementByXPath(Xpath).SendKeys(VideoTitle) ;Sends Variable to an Xpath Item try driver.FindElementByXPath(Xpath).SendKeys(VideoTitle) ;Sends Variable to an Xpath Item
TooltipThis("Inputting Video Description") js = return document.querySelector("#name").value;
try, status := driver.executeScript(js)
; sleep, 5000 if(status = ""){
; @todo this doesn't do anything anymore. Message = Failed to input Title
; DevModeMsgBox("rework me here") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; Xpath = //textarea[@id='description'] continue
; try, driver.FindElementByXPath(XPATH).SendKeys(driver.Keys.SPACE) }
Message = Title that got input: %status%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
break
}
; Msgbox % "status: " status
TooltipThis("Inputting Video Description")
; sleep, 1000
; Attempt to input video description a couple of times ; Attempt to input video description a couple of times
@ -3375,9 +3428,13 @@ Loop, 10 {
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
Input_DescriptionStrLen := StrLen(Input_Description)
Message = Length of Description that got input: %Input_DescriptionStrLen%
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
; if text in description box is longer than x chars, then description input worked ; if text in description box is longer than x chars, then description input worked
if(StrLen(Input_Description) > 15){ if(StrLen(Input_Description) > 15){
Input_Description := SubStr(Description, 1, 200) Input_Description := SubStr(Input_Description, 1, 20)
Message = Description that got input: %Input_Description% ... Message = Description that got input: %Input_Description% ...
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Break Break
@ -3399,9 +3456,9 @@ if(VideoThumbFilepath != "") {
} }
; Keywords (Tags)
; DevModeMsgBox(VideoTags) ; DevModeMsgBox(VideoTags)
TooltipThis("Inputting Keywords") TooltipThis("Inputting Keywords")
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 {
@ -3409,6 +3466,26 @@ catch e {
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
} }
; click into video title to get focus away from inputbox
Xpath = /html/body/div/section[2]/div[2]/div/form/div[1]/div[1]/div[2]/div[1]/div/input
try, driver.FindElementByXPath(Xpath).click() ;Sends Variable to an Xpath Item
; check that the tags got input
js = return document.querySelector("#keywords").value;
try, status := driver.executeScript(js)
if(status){
Message = Failed to input tags.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
}
else, {
Message = Tags that got input: %status%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
break
}
; Msgbox % "status: " status
}
; double check on video description after inputting tags ; 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;
@ -4054,381 +4131,6 @@ Return
; -------------------------------/DailyMotion------------------------------- ; -------------------------------/DailyMotion-------------------------------
; -------------------------------streamanity-------------------------------
StreamanityUpload:
Return
CurrentSite := "Streamanity"
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
URLAttempt := NavigateFromBaseURLTo("https://streamanity.com/upload", "Upload - Streamanity")
if(URLAttempt = "Failed")
Return
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
/*
; Connect Wallet Button - if it exists than not logged in
Xpath = /html/body/div[1]/div[3]/div[2]/div/div/div/div[2]/div/div/button
try LoginStatus := driver.findelementbyxpath(Xpath).Attribute("innerText") ;GREAT FOR GRABBING INNER CONTENTS/Values
if(LoginStatus != ""){
Message = Upload Failed (E#8755)`nLogin Cookies have expired. Please Re-login
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
*/
/*; Close button on "A new Beginning" popup
; this can probably be removed now. Popup was around as of 2020-10ish or so
Xpath = /html/body/div[3]/div[2]/div/div/a/i
try driver.FindElementByXPath(Xpath).click() ;Clicks on Xpath based on variable.
sleep, 500
try driver.FindElementByXPath(Xpath).click() ;Clicks on Xpath based on variable.
; sleep, 2000 ; wait for pop up to go away
*/
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
; Check the page for "Connect Wallet" text which means the user is logged out
try html := driver.pagesource ; save page's entire HTML to a variable
if(InStr(HTML, "Connect Wallet"))
{
Message = Upload Failed: Please Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
Message = Selecting Video File
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //div[@class='uploader-body']//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
}
/*Xpath = //div[@class='uploader-body']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Upload Failed:`nUnable to Find "Open File" window to input filepath into
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
Status := InputFilePathIntoOpenWindow(VideoFilepath)
if(Status)
{
Message = Upload Failed:`nUnable to Find "Open File" window to input filepath into
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
*/
if(VideoThumbFilepath != "") {
Message = Uploading Thumbnail
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //input[@accept='image/*']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath)
if(Status){
Message = Failed to Upload Thumbnail
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
/*
Xpath = //div[@class='thumb-cover has-preview']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Xpath = /html/body/div[1]/div[3]/div[2]/div/div/div/div[1]/div/div[2]/div/div/div[2]/div[2]/div[1]/div[1] ; Upload thumbnail
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message =Upload Error (#5803): Unable to click on Upload Thumbnail button with Relative and Direct Xpath
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
}
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
}
*/
}
; Input Title
TooltipThis("Inputting Video Title")
Status := js_SendAndCheckWithClassName(ClassName:="ivu-input",ClassIndexNum:=1,ValueToCheck:="value",SleepLength:=1000,JSStringText:=JSVideoTitle)
if(Status){
Message = Upload Failed: Failed to input Video Title
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
Xpath = //input[@placeholder="What's the name of your video"]
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.SPACE)
/*Xpath = //input[@placeholder="What's the name of your video"]
try driver.FindElementByXPath(Xpath).clear() ; clear the auto generated video title
catch e {
sleep, 5000
try driver.FindElementByXPath(Xpath).clear() ; clear the auto generated video title
catch e {
Message = Failed to clear Auto Generated Video Title.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
}
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=VideoTitle)
if(Status){
Xpath = /html/body/div[1]/div[3]/div[2]/div/div/div/div[1]/div/div[3]/div/div/div/div[2]/div[1]/form/div[1]/div/div/input
try driver.FindElementByXPath(Xpath).clear()
try driver.FindElementByXPath(Xpath).SendKeys(VideoTitle) ;Sends Variable to an Xpath Item
catch e {
Message = Failed to input Video Title through both Relative and Direct Xpath
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
}
}
*/
; Input Description
Message = Inputting Description
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
/*Loop, 5 { ; Attempt to input video description a couple of times
Status := js_SendAndCheckWithClassName(ClassName:="ivu-input",ClassIndexNum:=2,ValueToCheck:="value",SleepLength:=2000,JSStringText:=JSVideoDescription)
if(!Status) ; if no errors then text got input correctly, break out of loop
Break
}
*/
; Input Description
Loop, 5 { ; Attempt to input video description a couple of times
Message = Inputting Description `nAttempt Number: %A_index%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; TooltipThis("Inputting Description `nAttempt Number: " A_index)
Xpath = //textarea[@placeholder='What is this video about?']
try DescriptionContents := driver.findelementbyxpath(Xpath).Attribute("value") ;XPath: ID=site-title & span tag
/* if(A_index = 5){
Clipboard := VideoDescription
Message = Unable to Input Video Description`nDescription copied to clipboard, please paste it in at your earliest convenience.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
*/
StreamanityVidDescjs = document.getElementsByClassName('ivu-input')[2].value = "%JSVideoDescription%"; ; Send content through javascript (Great for getting around emoji chrome limitaitons)
try driver.executeScript(StreamanityVidDescjs) ;Executes a Javascript on the webpage, mostly used for buttons.
sleep, 1000
Xpath = //textarea[@placeholder='What is this video about?']
try DescriptionContents := driver.findelementbyxpath(Xpath).SendKeys(driver.Keys.SPACE) ;XPath: ID=site-title & span tag
/* try driver.executeScript(StreamanityVidDescjs) ;Executes a Javascript on the webpage, mostly used for buttons.
try StreamanityDescription := driver.findElementsByClass("ivu-input").item[3].Attribute("value")
if(StreamanityDescription != ""){
try driver.findElementsByClass("ivu-input").item[3].SendKeys(driver.Keys.ENTER) ; Send enter to add extra line to end of description. This is the fix for description not dissapearing upon moneybutton swipe
Break
}
*/
sleep, 2000
jscheck = return document.getElementsByClassName('ivu-input')[2].value;
if(strlen(jscheck) > 10) ; if no errors then text got input correctly, break out of loop
Break
; sleep, 2000
}
; Input Video Tags. We need to send them one item at a time to Streamanity
; StreamanityTagsArray := StrSplit(VideoTags,",")
Message = Inputting Video Tags
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Xpath to Tags Input Box
; Xpath = /html/body/div[1]/div[3]/div[2]/div/div/div/div[1]/div/div[3]/div/div/div/div[2]/div[1]/form/div[3]/div/div/div/div/div/input
Xpath = /html/body/div[1]/div[3]/div[2]/div/div/div/div[1]/div/div[3]/div/div/div/div[2]/div[1]/form/div[3]/div/div/div/div/div/input
; Input Each tag one by one
Loop % KeywordsArray.Length()
{
Tag := KeywordsArray[A_Index]
; Msgbox % "Tag: " Tag
try driver.FindElementByXPath(Xpath).SendKeys(Tag) ;Sends Variable to an Xpath Item
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.Enter) ;Sends Enter key to Xpath.
; msgbox, pause
sleep, 250
}
; ASK STEF FOR INPUT HERE
TooltipThis("Waiting for User to Swipe Payment Button")
Xpath = //div[@class='video-title']
; MsgBox,,Xpath Value,% driver.findelementbyxpath(Xpath).Attribute("value") ;XPath: ID=site-title & span tag
Loop, 20 {
if(A_index = 20){
Message = Payment was not swiped. Skipping to Next Website
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
try Status := driver.findelementbyxpath(Xpath).Attribute("innerText") ; Grabb innertext
if !InStr(Status, "Waiting for payment")
break
; otherwise sleep and re-run check
sleep, 5000
}
; Status := StrSplit(status, "`n")
; msgbox % Status[1]
; msgbox % Status[2]
; MsgBox,,XPATH Text Content,% driver.findelementbyxpath(Xpath).Attribute("textContent") ;XPath: ID=site-title & span tag
; MsgBox,,HREF Link Location: ,% driver.findelementbyxpath(Xpath).Attribute("href") ;XPath: Href (Link location) value
; MsgBox,,XPATH-ID & Tag,% driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPath: ID=site-title & span tag
; MsgBox,,XPATH Option Value,% driver.findelementbyxpath(Xpath).Attribute("option value") ;XPath: ID=site-title & span tag
TooltipThis("Waiting for Video to Finish Uploading")
; Upload status text at the top left of the page
Xpath = /html/body/div[1]/div[3]/div[2]/div/div/div/div[1]/div/div[1]/div/div[1]/span
Loop, %Number_of_loops_to_Check_Upload_status% {
sleep, %Time_Between_Loops_Upload_Status%
jsCheck = return document.querySelector("div[class='video-title'] span").textContent;
try UploadStatus := driver.executeScript(jsCheck)
; try UploadStatus := driver.findelementbyxpath(Xpath).Attribute("innerText") ; Grab innertext
if(UploadStatus = ""){
Message = Failed to Grab Video Upload Status. Upload Most Likely Failed
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; Msgbox % "UploadStatus: " UploadStatus
if(InStr(UploadStatus, "Complete")){ ; If upload is complete then we're ready to click the Publish Button
sleep, 5000 ; 5 seconds
Break
Status := Check_For_Stuck_Video_Upload(A_index, UploadStatus)
if(Status = "Failed")
Return
; if(A_index = 240){
; Message = Upload Failed. Upload did not complete after 2 hours of waiting. Something possibly went wrong?
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; SaveDriverURLOFErrorPage()
; Return
; }
; if(HasVal(Array_Index_Num_of_Upload_StatusChecks, A_index)) { ; 30 minutes and 60 minutes - send a notification message
; Message = Upload Status: %UploadStatus%
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; }
}
}
; Publish Button at the very bottom
SaveOrPostProgress(Message:="Trying to Click Publish Button",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //span[normalize-space()='P U B L I S H']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Streamanity Upload Incomplete (E#4701)`nVideo Uploaded But Unable to click final "Publish" button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
}
; Wait for Confirmation Page to load and grab the Video URL from here
Message = Waiting for Confirmation Page to Load
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //div[@class='link'] ; Xpath to URL of the video
Loop, 60 { ; loop for a couple of minutes to wait for confirmation page to load
jsCheck = return document.getElementsByClassName('link')[0].textContent;
try StreamanityURL := driver.executeScript(jsCheck)
if(InStr(StreamanityURL, "https://streamanity.com"))
Break
if(A_index = 60){
try PageURL := driver.URL
Message = Upload Complete: But Failed to Grab Video Link`nPage Stuck At at: %PageURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniWrite, Failed to Grab Link. Please copy and paste into here, %VideoLinksIniFile%, URLs, StreamanityURL
SaveDriverURLOFErrorPage()
Return
}
Sleep, 1000
}
if(StreamanityURL = ""){
Message = Upload Successfull but unable to automatically grab URL.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
Message = Upload Complete:`n%StreamanityURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniWrite, %StreamanityURL%, %VideoLinksIniFile%, URLs, StreamanityURL
SaveDriverURL()
AddToTotalVideosUploadedCount()
; TakeScreenshotOfPage(ScreenShotSavePath)
Return
; -------------------------------/streamanity-------------------------------
; -------------------------------LBRY------------------------------- ; -------------------------------LBRY-------------------------------
LBRYVideoUpload: LBRYVideoUpload:
LBRYAudioUpload: LBRYAudioUpload:
@ -5143,7 +4845,7 @@ try CurrentURL := driver.URL
if(InStr(CurrentURL, "/login.php")){ if(InStr(CurrentURL, "/login.php")){
AutoLogin := 1 ; AutoLogin := 1
; Msgbox % "AutoLogin: " AutoLogin ; Msgbox % "AutoLogin: " AutoLogin
if(AutoLogin){ if(AutoLogin){

Loading…
Cancel
Save