rumble functionality, bug fixes, gui improvements

This commit is contained in:
2024-05-08 13:58:37 -04:00
parent aae8820e37
commit 4bd4e1f7c3
9 changed files with 459 additions and 133 deletions

View File

@@ -7,8 +7,8 @@ Try, PageURL := driver.Url
if(InStr(PageURL, "/register"))
{
LoginPageURL := LocalsPostPageURL . "/login"
Message = Website Login Expired. Trying to log back in. Navigating to: %LoginPageURL%
Message = Website Login Expired. Please log back in and then try again.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
try, driver.Get(LoginPageURL) ;Open selected URL
Return
}

View File

@@ -37,6 +37,12 @@ Xpath = //input[@id='title']
; try, driver.FindElementByXPath(Xpath).SendKeys("TEST STRINGHERE")
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=LivestreamTitle)
if(Status){
Message = Failed to input Livestream Title
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
Xpath = //textarea[@id='body']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=LivestreamDescription)
@@ -50,7 +56,7 @@ Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000
; Create a Livestream - Second Screen
; ------------------------------------------------
; check if "Schedule Livestream" checkbox is checked, check it if not
LivestreamScheduledCheckbox := driver.findElementByID("is_scheduled_livestream").isSelected() ;Checks if a checkbox is ticked or not and saves it to a variable, usually: 0 = Unchecked, -1 = Checked
try, LivestreamScheduledCheckbox := driver.findElementByID("is_scheduled_livestream").isSelected() ;Checks if a checkbox is ticked or not and saves it to a variable, usually: 0 = Unchecked, -1 = Checked
if(LivestreamScheduledCheckbox = 0){
Xpath = //label[normalize-space()='Schedule this live stream?']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
@@ -63,12 +69,12 @@ if(LivestreamScheduledCheckbox = 0){
}
; Make sure the "Notify Users" checkbox is checked
NotifyUsersCheckbox := driver.findElementByID("is_do_promo").isSelected() ;Checks if a checkbox is ticked or not and saves it to a variable, usually: 0 = Unchecked, -1 = Checked
try, NotifyUsersCheckbox := driver.findElementByID("is_do_promo").isSelected() ;Checks if a checkbox is ticked or not and saves it to a variable, usually: 0 = Unchecked, -1 = Checked
if(NotifyUsersCheckbox = 0){
Xpath = //label[@for='is_do_promo']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
NotifyUsersCheckbox := driver.findElementByID("is_do_promo").isSelected()
try, NotifyUsersCheckbox := driver.findElementByID("is_do_promo").isSelected()
if(NotifyUsersCheckbox = 0){
Message = Failed to select the "Notify Users" checkbox
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")

154
Modules/Odysee-Grab-URL.ahk Normal file
View File

@@ -0,0 +1,154 @@
OdyseeGrabURL:
Iniread, OdyseeURLSLUG, %PostStatusesFilepath%, Livestream,OdyseeURLSLUG, %A_Space%
if(OdyseeURLSLUG = ""){
Message = OdyseeURLSLug is empty in the Livestream.ini file.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
Status := NavigateFromBaseURLTo("https://odysee.com/$/livestream")
if(Status)
Return
; click on Local Setup button to switch windows
Xpath = //span[contains(text(),'Local Setup')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
Xpath = //label[normalize-space()='Stream server']
try, Status := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
if(!Status){
Message = Failed to switch to "Stream Server" page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
/*
Message = Waiting for Livestream Created Confirmation Popup
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = //h2[normalize-space()='Livestream Created']
Loop, 60 {
try, Status := ElementInnerText := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
if(Status = "Livestream Created")
break
else, {
sleep, 1000
Continue
}
}
*/
Message = Grabbing Livestream URL from Livestream Settings Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
/*
; Grab and Format the livestream URL
Xpath = //li[@role='link']
Loop, 60 {
URLSLUG := GetHTMLValueFromXpathOuterHTML(XPATH, "href")
if(URLSLug = "Failed"){
Message = Failed to Grab URL SLug from confirmation popup
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
; Msgbox % "URLSLug: " URLSLug
if(InStr(URLSLug, OdyseeLivestreamSlug))
break
if(A_Index = 60){
Message = Odysee did not generate permanant livestream URL after 1 minute of waiting. Congestion Issues?
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
sleep, 1000
}
*/
/*; Message =
Xpath = //span[contains(text(),'View Livestream Settings')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Failed to click on View Livestream Settigns Button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
; Double check that we're on the right page.
Xpath = //label[normalize-space()='Stream server']
try InnerText := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
if(InnerText != "Stream server"){
Message = Failed to Navigate to View Livestream Settings Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
*/
Message = Waiting for Livestream to get confirmed and URL to be generated`nWill Give up after 5 minutes
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = //div[@class='section']//li[1]
Loop, 100 {
if(A_Index = 100){
Message = Failed to grab URL after 5 minutes of waiting.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
Try ElementOuterHTML := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
if(!InStr(ElementOuterHTML, OdyseeURLSLUG)){
Sleep, 5000
Continue
; Message = Failed to Grab Livestream URL. Please copy and paste it manually.
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; return
}
else, {
break
}
}
; Clipboard := OdyseeURLSLUG
; Msgbox % "OdyseeURLSLUG: " OdyseeURLSLUG
; Clipboard := ElementOuterHTML
; Msgbox % "ElementOuterHTML: " ElementOuterHTML
Xpath = //div[@class='section']//li[1]
URLSLUG := GetHTMLValueFromXpathOuterHTML(XPATH, "href")
if(URLSLUG = "Failed"){
Message = Failed to Grab Livestream URL from outerHTML of livestream element.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
OdyseeLivestreamURL := "https://odysee.com" . URLSLug
; Msgbox % "OdyseeLivestreamURL: " OdyseeLivestreamURL
; Message = URL Slug Grabbed from Confirmation Popup: %URLSLug%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; OdyseeLivestreamURL := "https://odysee.com" . URLSLug
IniWrite, %OdyseeLivestreamURL%, %PostStatusesFilepath%, Livestream,OdyseeLivestreamURL

View File

@@ -41,6 +41,11 @@ if(InStr(Status, "Clear")){
FormatTime, OdyseeLivestreamDate , %LivestreamDate%, MM-dd-yyyy ; _hhmmss
OdyseeLivestreamSlug := "livestream-" . OdyseeLivestreamDate
OdyseeURLSLUG := LBRYCMDTextReplacement(OdyseeLivestreamSlug)
IniWrite, %OdyseeURLSLUG%, %PostStatusesFilepath%, Livestream,OdyseeURLSLUG
Xpath = (//div[@class='form-field__prefix'])[1]
try OdyseeChannelURL := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
Message = Inputting Livestream Information
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@@ -235,104 +240,9 @@ Xpath = //button[@aria-label='Confirm']//span[@class='button__content']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
Message = Waiting for Livestream Created Confirmation Popup
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = //h2[normalize-space()='Livestream Created']
Loop, 60 {
try, Status := ElementInnerText := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
if(Status = "Livestream Created")
break
else, {
sleep, 1000
Continue
}
}
OdyseeLivestreamURL := "https://" . OdyseeChannelURL . OdyseeURLSLUG
; OdyseeURL := "https://" . OdyseeURL
IniWrite, %OdyseeLivestreamURL%, %PostStatusesFilepath%, Livestream,OdyseeLivestreamURL
Message = Grabbing Livestream URL from Livestream Settings Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
/*
; Grab and Format the livestream URL
Xpath = //li[@role='link']
Loop, 60 {
URLSLUG := GetHTMLValueFromXpathOuterHTML(XPATH, "href")
if(URLSLug = "Failed"){
Message = Failed to Grab URL SLug from confirmation popup
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
; Msgbox % "URLSLug: " URLSLug
if(InStr(URLSLug, OdyseeLivestreamSlug))
break
if(A_Index = 60){
Message = Odysee did not generate permanant livestream URL after 1 minute of waiting. Congestion Issues?
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
sleep, 1000
}
*/
; Message =
Xpath = //span[contains(text(),'View Livestream Settings')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Failed to click on View Livestream Settigns Button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
; Double check that we're on the right page.
Xpath = //label[normalize-space()='Stream server']
try InnerText := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
if(InnerText != "Stream server"){
Message = Failed to Navigate to View Livestream Settings Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
Xpath = //div[@class='section']//li[1]
Try ElementOuterHTML := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
; Clipboard := OdyseeURLSLUG
; Msgbox % "OdyseeURLSLUG: " OdyseeURLSLUG
; Clipboard := ElementOuterHTML
; Msgbox % "ElementOuterHTML: " ElementOuterHTML
if(!InStr(ElementOuterHTML, OdyseeURLSLUG)){
Message = Failed to Grab Livestream URL. Please copy and paste it manually.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
return
}
Xpath = //div[@class='section']//li[1]
URLSLUG := GetHTMLValueFromXpathOuterHTML(XPATH, "href")
if(URLSLUG = "Failed"){
Message = Failed to Grab Livestream URL from outerHTML of livestream element.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
OdyseeLivestreamURL := "https://odysee.com" . URLSLug
; Msgbox % "OdyseeLivestreamURL: " OdyseeLivestreamURL
; Message = URL Slug Grabbed from Confirmation Popup: %URLSLug%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; OdyseeLivestreamURL := "https://odysee.com" . URLSLug
IniWrite, %OdyseeLivestreamURL%, %PostStatusesFilepath%, Livestream,OdyseeLivestreamURL
Return
Return

View File

@@ -1,5 +1,5 @@
RumbleUpload:
RumbleSchedule:
;------------------------------------------------
CurrentSite := "Rumble"
@@ -38,6 +38,215 @@ if(InStr(CurrentURL, "/sso/auth/consent")){
; Schedule New Stream
; ------------------------------------------------
Message = Scheduling new stream and inputting information
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Schedule new stream
; Schedule a stream button
Xpath = //div[normalize-space()='Schedule a stream']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
Xpath = (//h2[normalize-space()='Select a template (optional)'])
try ElementInnerText := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
if(!ElementInnerText){
Message = Templates Subwindow did not show up
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
}
loop, 3 {
Xpath = (//div[@class='flex items-center justify-between gap-x-8 p-4 bg-indigo rounded-xl'])[%A_Index%]
try, ElementText := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
; use the template with "Freedomain Livestream in the name"
if(InStr(ElementText, "Freedomain Livestream")){
Xpath = (//span[contains(text(),'Select')])[1]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
Message = Failed to Select Livestream Template
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
}
}
; input thumbnail
if(Livestreamthumbnail){
Xpath = //input[@id='room-thumbnail']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=Livestreamthumbnail)
if(Status){
Message = Faied to upload custom thubmanil
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
}
; input Livestream Title
Xpath = //input[@placeholder='Give your stream a name']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=LivestreamTitle, ClearElement:=1)
; input Livestream Description
Xpath = //textarea[@placeholder='Tell the audience more about your stream']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=LivestreamDescription, ClearElement:=1)
; Input Date & Time
; ------------------------------------------------
; Create variables with time and date of timestream
FormatTime, RumbleLivestreamDate , %LivestreamDate%, dddd, MMMM
FormatTime, LivestreamOrdinalDay , %LivestreamDate%, d
FormatTime, RumbleLivestreamYear , %LivestreamDate%, yyyy
LivestreamOrdinalDay := GetDateOrdinalSuffix(LivestreamOrdinalDay)
; Msgbox % "LivestreamOrdinalDay: " LivestreamOrdinalDay
RumbleLivestreamDate := RumbleLivestreamDate . " " . LivestreamOrdinalDay . ", " . RumbleLivestreamYear
; Msgbox % "RumbleLivestreamDate: " RumbleLivestreamDate
; Msgbox % "RumbleLivestreamDate: " RumbleLivestreamDate
FormatTime, RumbleLivestreamTime , %LivestreamTime%, h:mm tt
; Msgbox % "RumbleLivestreamTime: " RumbleLivestreamTime
; FormatTime, RumbleLivestreamYear , %LivestreamDate%, yyyy
; click on box to open time picker dialogue
Xpath = //input[@placeholder='Pick a time']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
; generate xpath based on date and click element
Xpath = //div[@aria-label='Choose %RumbleLivestreamDate%']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
Message = Failed to select date from popup menu using generated xpath.`nXpath = %Xpath%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
; generate xpath based on time and click element
Xpath = //li[normalize-space()='%RumbleLivestreamTime%']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
Message = Failed to select time from popup menu using generated xpath.`nXpath = %Xpath%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
; Select Channel for Upload
; ------------------------------------------------
; click channel dropdown
Xpath = //span[@class='text-light truncate text-mini']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
Message = Failed to click on Channel dropdown menu
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
; Grab inner text of all items in the channel select drop down menu
xpath = (//div[@class='shadow-md rounded-lg overflow-x-hidden bg-indigo'])[1]
try ElementInnerText := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
; pull out name of first channel in dropdown
FirstChannelName := StrSplit(ElementInnerText, "`n")[1]
Xpath = (//span[normalize-space()='%FirstChannelName%'])[1]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
Message = Failed to select the channel -%FirstChannelName%- from Channel dropdown menu
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
return
}
; Select each Secondary Platform checkbox
; ------------------------------------------------
Loop, 10 {
IndexPlusOne := A_index + 1
Xpath = (//div[@class='flex shrink-0 items-center gap-x-4'])[%A_index%]
XpathCheckbox = (//div[@class='relative shrink-0'])[%IndexPlusOne%]
try SecondaryPlatformCheckboxName := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
if(SecondaryPlatformCheckboxName = "Add new destination" OR SecondaryPlatformCheckboxName = ""){
Break
}
Status := Selenium_LoopToClickXpath(Xpath:=XpathCheckbox,NumOfLoops:=2,SleepLength:=1000)
if(Status){
Message = Failed to check off the checkbox for: %SecondaryPlatformCheckboxName%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
sleep, 250
}
if(ConfirmBeforeSubmit){
OnMessage(0x44, "OnMsgBoxUserConfirmation")
MsgBox 0x21, User Confirmation, Please check that all data was input correctly and fix any mistakes and then click PROCEED to finalize the Upload.`n`nClick STOP to cancel the rest of this Upload and move on to the next website.
OnMessage(0x44, "")
IfMsgBox OK, {
} Else IfMsgBox Cancel, {
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of automation for this site.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
}
/*
*/
; click the "next" button to finalize the upload
Xpath = (//button[@class='rounded-full px-6 py-2 bg-primary hover:brightness-[0.92] cursor-pointer'])[1]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
Message = Failed to click "Next" to finalize the upload
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
try, driver.get("https://rumble.com/account/live-streaming")
Xpath = (//a[normalize-space()='Livestream Coming Soonish!'])[1]
; Try ElementOuterHTML := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
RumbleURLSlug := GetHTMLValueFromXpathOuterHTML(XPATH, "href")
if(RumbleURLSlug = "" or RumbleURLSlug = "Failed"){
Message = Failed to grab Rumble URL Slug from Livestreams Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
RumbleLivestreamURL := "https://rumble.com" . RumbleURLSlug
IniWrite, %RumbleLivestreamURL%, %PostStatusesFilepath%, Livestream,RumbleLivestreamURL
return