fixed tag input to Bitchute, Dailymotion, code cleanup

pull/49/head 3.31
Yuriy 10 months ago
parent 679e698435
commit 4940d18946

@ -16,6 +16,8 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,Disc
try TabUrl := driver.url try TabUrl := driver.url
if(InStr(TabUrl, "/accounts/login/")){ if(InStr(TabUrl, "/accounts/login/")){
if(AutoLogin){ if(AutoLogin){
Xpath = (//button[normalize-space()='Submit'])[1] Xpath = (//button[normalize-space()='Submit'])[1]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){ if(Status){
@ -124,15 +126,17 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,Disc
; Convert tags into #hasthtags ; Convert tags into #hasthtags
Loop, 3 { Loop, 3 {
Value := KeywordsArray[A_Index] BitchuteTags .= VideoTagsArray[A_Index] . " "
Value := StrReplace(Value, " ", "") ; Remove spaces if hashtag has two words
; HashTag := "#" . Value
BitchuteHashtags .= Value . " "
} }
; input hashtags ; input Search Terms (Tags)
Xpath = //input[@placeholder='Search Terms'] Xpath = //input[@placeholder='Search Terms']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BitchuteHashtags) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BitchuteTags)
if(Status){
Message = Failed to input search terms (tags)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
}
; Upload Thumbnail ; Upload Thumbnail
Message = Attaching Thumbnail Message = Attaching Thumbnail

@ -177,9 +177,6 @@ Loop, 10 {
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:="DiscordErrorLogging") ; SaveOrPostProgress(Message:=Message,PostType:="DiscordErrorLogging")
; SaveOrPostProgress(Message:="Inputting Video Description",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar")
; TooltipThis("Inputting Description)
Xpath = //div[@class='e-content e-lib e-keyboard'] Xpath = //div[@class='e-content e-lib e-keyboard']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoDescription) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoDescription)
if(Status){ if(Status){
@ -188,19 +185,6 @@ Loop, 10 {
; Return ; Return
} }
; DevModeMsgBox("pause")
; driver.FindElementByXPath(Xpath).SendKeys(VideoDescription)
; js = document.getElementById('description').value = "%JSBrighteonVideoDescription%";
; try driver.executeScript(js)
; sleep, 1000
; TooltipThis("checking description input")
; try driver.findElementsByID("description").item[1].SendKeys(driver.Keys.ENTER)
; sleep, 1000
sleep, 5000 sleep, 5000
@ -218,11 +202,9 @@ Loop, 10 {
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Break Break
} }
} }
; Thumbnail ; Thumbnail
if(VideoThumbFilepath != "") { if(VideoThumbFilepath != "") {
TooltipThis("Uploading Thumbnail") TooltipThis("Uploading Thumbnail")
@ -244,6 +226,8 @@ if(VideoTagsArray.Length() > 25){
else, else,
BrighteonKeywords := VideoTags BrighteonKeywords := VideoTags
TooltipThis("Inputting Keywords") TooltipThis("Inputting Keywords")
Loop, 5 { Loop, 5 {
XPath = //input[@id='keywords'] XPath = //input[@id='keywords']
@ -269,7 +253,6 @@ Loop, 5 {
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
break break
} }
; Msgbox % "status: " status
} }
@ -378,7 +361,6 @@ Loop % VideoTitleArray.Length(){
if(StrLen(VideoTitleLongWord) > 4) if(StrLen(VideoTitleLongWord) > 4)
Break Break
; MsgBox % VideoTitleArray[A_Index]
} }
@ -400,23 +382,6 @@ Loop, 4 {
jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].textContent; jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].textContent;
try InnerText := driver.executeScript(jsCheck) try InnerText := driver.executeScript(jsCheck)
; Message = Loop Number: %ElementIndexNumber% element's Text Content: %innerText%`nBrighteonURL: %BrighteonURL%
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; Message = InnerText: %InnerText%
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
; DevModeMsgBox(InnerText)
; Message = BrighteonURL: %BrighteonURL%
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
; Msgbox % "VideoTitleLongWord: " VideoTitleLongWord "`nInnerText: " InnerText
; clipboard := Message
; msgbox % Message
; Msgbox % "InnerText: " InnerText . "`n" . "BrighteonURL: " . BrighteonURL
if(InStr(InnerText, VideoTitleLongWord)){ if(InStr(InnerText, VideoTitleLongWord)){
Message = Title Keyword was found on %A_index% loop, within element: %innerText%`nTrying to pull out BrighteonURL from element's outerHTML Message = Title Keyword was found on %A_index% loop, within element: %innerText%`nTrying to pull out BrighteonURL from element's outerHTML
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -440,10 +405,6 @@ Loop, 4 {
} }
; 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. Message = Upload Completed Successfully but failed to grab Share URL. Please Copy and Paste it in.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")

@ -39,7 +39,7 @@ if(LoggedOutStatus){
try driver.FindElementByXPath(Xpath).click() try driver.FindElementByXPath(Xpath).click()
js = document.querySelector("button[type='submit']").click(); js = document.querySelector("button[type='submit']").click();
driver.executeScript(js) try driver.executeScript(js)
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
sleep, 1000 sleep, 1000
@ -243,13 +243,22 @@ Message = Inputting Tags
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; Append comma to end of tags ; Append comma to end of tags
; DailyMotion page automtically splits the tags into their little boxes when they're seperated by commas ; DailyMotion page automtically splits the tags into individual tags when they're seperated by commas
DailyMotionVideoTags := VideoTags . ","
; Iterate from one end of the array to another:
Loop % VideoTagsArray.Length(){
; ArrayItem := ARRAY[A_Index]
; MsgBox %
DailyMotionVideoTags .= VideoTagsArray[A_Index] . ","
}
; DailyMotionVideoTags := VideoTags . ","
Message = Video Tags: %DailyMotionVideoTags% Message = Video Tags: %DailyMotionVideoTags%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = //div[@class='ant-select-selection-search']//input[@role='combobox'] Xpath = (//input[@id='tags'])[1]
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=DailyMotionVideoTags) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=DailyMotionVideoTags)
; double check the input ; double check the input
@ -259,14 +268,12 @@ Message = Tags that got input: %inputTags% (Will be doubled b/c of js)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; msgbox
Message = Clicking Next Button to Move on to next input screen Message = Clicking Next Button to Move on to next input screen
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = //button[@type='button']//span[contains(text(),'Next')] Xpath = //button[@type='button']//span[contains(text(),'Next')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
; msgbox, click work?
Message = Selecting "Not For Kids" checkbox Message = Selecting "Not For Kids" checkbox
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -303,51 +310,6 @@ if(Status){
} }
/*
; Disable monitization for video
SaveOrPostProgress(Message:="Unchecking monetizaton checkbox",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //button[normalize-space()='Advanced'] ; advanced tab button
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status = "Failed"){
Message = Unable to Navigate to Advanced Settings Page to turn off monetization
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
*/
; SaveOrPostProgress(Message:="Unchecking monetizaton checkbox",PostType:="Tooltip,ErrorLoggingTextFile")
; switch over to advanced tab
; js = document.getElementsByName('advanced')[0].click();
; try driver.executeScript(js)
/*
sleep, 1000
Loop, 5 { ; Loop to uncheck the "monetization button"
if(A_index = 5){
Message = Failed to uncheck "monetization enabled" checkbox
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
}
Xpath = //input[@name='advertising_instream_blocked'] ; monetization checkbox
try Status := driver.FindElementByXPath(Xpath).isSelected()
if(Status = 0) ; -1 is checked, 0 is unchecked
Break
; Click to uncheck the "allow monetization" checkbox
Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
}
*/
/*
; Switch back to Basic tab
js = document.getElementsByName('basic')[0].click();
try driver.executeScript(js)
*/
Message = Clicking Next Button to Move on to third video settings screen Message = Clicking Next Button to Move on to third video settings screen
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -355,7 +317,6 @@ Xpath = //button[@type='button']//span[contains(text(),'Next')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
Message = Clicking Save Button to Finalize Upload Message = Clicking Save Button to Finalize Upload
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")

Loading…
Cancel
Save