further modularization of individual upload sites and functions
parent
781ca473ba
commit
3e79e11f2a
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,595 @@
|
||||
LocalsUpload:
|
||||
;------------------------------------------------
|
||||
CurrentSite := "Locals"
|
||||
|
||||
|
||||
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
IniRead, LocalsPostPageURL, %SettingsIniFilepath%, General, LocalsPostPageURL, %A_Space%
|
||||
if(LocalsPostPageURL = ""){
|
||||
Message = LocalsURL is blank.`nPlease add Locals URL to Settings.ini file under:`n`n[General]`nLocalsPostPageURL=
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
|
||||
if(!InStr(LocalsPostPageURL, "/share/post")){
|
||||
LocalsPostPageURL .= "/share/post"
|
||||
}
|
||||
|
||||
; replace any double slashes that migth have come from the combining
|
||||
; LocalsPostPageURL := StrReplace(LocalsPostPageURL, "//", "/")
|
||||
|
||||
|
||||
Status := NavigateFromBaseURLTo(LocalsPostPageURL)
|
||||
if(Status)
|
||||
Return
|
||||
|
||||
/*
|
||||
if(DevMode){
|
||||
MsgBox 0x4, DevMode Skip, Skip uploading section and skip straight to grab URL?
|
||||
|
||||
IfMsgBox Yes, {
|
||||
goto, Devmodeskip
|
||||
} Else IfMsgBox No, {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
Message = Waiting for Page to fully load
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
Xpath = //textarea[@id='body']
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1000)
|
||||
if(Status){
|
||||
Message = Page did not load after 10 seconds. Force stopping refresh and trying to continue
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
send, {Escape} ; Temporary workaround, as Page seems to endlessly load for Stef
|
||||
|
||||
Xpath = //textarea[@id='body']
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||
if(Status){
|
||||
SaveOrPostProgress(Message:="Post Failed: Check Login Status, or Website is Down",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
|
||||
Return
|
||||
}
|
||||
}
|
||||
|
||||
Message = Inputting Title
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
Xpath = //input[@id='title']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=VideoTitle)
|
||||
if(Status){
|
||||
Message = Failed to input Title
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
}
|
||||
|
||||
sleep, 1000
|
||||
|
||||
/*Xpath = //textarea[@id='body']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=VideoDescription)
|
||||
if(Status){
|
||||
Message = Failed to input Body
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
}
|
||||
*/
|
||||
|
||||
; Input Description
|
||||
TooltipThis("Inputting Description")
|
||||
Loop, 5 { ; Attempt to input video description a couple of times
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
js = document.getElementsByName('body')[0].value = "%JSVideoDescription%"; ; Send content through javascript (Great for getting around emoji chrome limitaitons)
|
||||
try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
|
||||
|
||||
; msgbox
|
||||
try driver.findElementsByName("body").item[1].SendKeys(driver.Keys.SPACE)
|
||||
; driver.findElementsByID("ELEMENTID").item[1].SendKeys(driver.Keys.ENTER)
|
||||
; msgbox
|
||||
|
||||
jsCheck = return document.getElementsByName('body')[0].value; ; Send content through javascript (Great for getting around emoji chrome limitaitons)
|
||||
try Description := driver.executeScript(jsCheck) ;Executes a Javascript on the webpage, mostly used for buttons.
|
||||
|
||||
|
||||
; try Description := driver.findElementsByName("body").item[1].Attribute("value") ;XPath: ID=site-title & span tag
|
||||
if(Description != "")
|
||||
Break
|
||||
sleep, 2000
|
||||
}
|
||||
|
||||
SaveOrPostProgress(Message:="Waiting Video to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
Message = Uploading Video File
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
Xpath = //div[@class='uploadvideo-wrapper']//input[@name='Filedata']
|
||||
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")
|
||||
Return
|
||||
}
|
||||
|
||||
|
||||
; check if the "Auto Submit Post" checkbox is checked, and if not check it
|
||||
js = return document.querySelector("#autosubmit_enabled").checked;
|
||||
try AutoSubmitstatus := driver.executeScript(js)
|
||||
; DevModeMsgBox(status)
|
||||
; message = AutoSubmitstatus: %AutoSubmitstatus%
|
||||
; DevModeMsgBox(message)
|
||||
|
||||
if(AutoSubmitstatus = "0"){
|
||||
js = document.querySelector("li[id='autosubmit_container'] small").click() ; ; CHECK YES
|
||||
try driver.executeScript(js) ; DevModeMsgBox(status)
|
||||
|
||||
; double check that it got selected
|
||||
js = return document.querySelector("#autosubmit_enabled").checked;
|
||||
try AutoSubmitstatus := driver.executeScript(js)
|
||||
|
||||
Message = AutoSubmitstatus after clicking checkbox: %AutoSubmitstatus%
|
||||
DevModeMsgBox(message)
|
||||
|
||||
if(AutoSubmitstatus != "-1"){
|
||||
Message = Failed to check Auto-Submit Post checkbox
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DevModeMsgBox("autosubmit status -1 string here")
|
||||
; msgbox % AutoSubmitstatus = "-1"
|
||||
if(AutoSubmitstatus = "-1"){ ; if checked YES
|
||||
|
||||
; check that there are no error messages
|
||||
js = return document.querySelector("div[class='form-error']").textContent;
|
||||
try status := driver.executeScript(js)
|
||||
; DevModeMsgBox(status)
|
||||
if(status){ ;if element contains error text
|
||||
Message = Auto Publish failed: %status%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
|
||||
if(VideoThumbFilepath){
|
||||
Message = Uploading Thumbnail
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
Xpath = //div[contains(@class,'post-video-attachments post-video-attachments_upd')]//div[contains(@class,'uploadfile-wrapper')]//input[contains(@name,'Filedata')]
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath)
|
||||
if(Status){
|
||||
Message = Failed to Attach Thumbnail
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
}
|
||||
|
||||
; otherwise everything is good and we can move on to the next site and come back to grab the URL later
|
||||
; LocalsURL := "UploadedButNeedToGrabLink"
|
||||
; Return
|
||||
|
||||
|
||||
Message = Upload Started Successfully
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
LocalsURL := "LocalsUploadStartedNeedToGrabURL"
|
||||
; Msgbox % "LocalsURL: " LocalsURL
|
||||
IniWrite, %LocalsURL%, %VideoLinksIniFile%, URLs, LocalsURL
|
||||
AddToTotalVideosUploadedCount()
|
||||
|
||||
; Msgbox % "LocalsURL: " LocalsURL
|
||||
; Msgbox % "VideoLinksIniFile: " VideoLinksIniFile
|
||||
;
|
||||
; FileRead, inicontents, %VideoLinksIniFile% ; , Filename
|
||||
; Msgbox % "inicontents: " inicontents
|
||||
|
||||
; IniWrite, Value, Filename, Section, Key
|
||||
|
||||
; LocalsTabURL := SaveDriverURL()
|
||||
|
||||
Return
|
||||
}
|
||||
Return
|
||||
|
||||
|
||||
|
||||
;--------------\Locals----------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;--------------LocalsGrabURL----------------------------------
|
||||
LocalsGrabURL:
|
||||
|
||||
CurrentSite := Locals
|
||||
|
||||
SaveOrPostProgress(Message:="Navigating to Locals Feed to grab URL",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
IniRead, LocalsPostPageURL, %SettingsIniFilepath%, General, LocalsPostPageURL, %A_Space%
|
||||
if(LocalsPostPageURL = ""){
|
||||
Message = LocalsURL is blank.`nPlease add Locals URL to Settings.ini file under:`n`n[General]`nLocalsPostPageURL=
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
|
||||
if(InStr(LocalsPostPageURL, "/share/post")){
|
||||
LocalsFeedPageURL := StrReplace(LocalsPostPageURL, "/share/post", "")
|
||||
}
|
||||
|
||||
|
||||
Status := ActivateChromeTab(LocalsPostPageURL)
|
||||
if(Status = "Failed"){
|
||||
Message = Failed to Activate Locals Tab. Please grab URL manually
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
; Msgbox % "Status: " Status
|
||||
|
||||
|
||||
try currentpageURL := driver.url
|
||||
if(InStr(currentpageURL,"share/post")){ ; we're still on create new post page
|
||||
Message = Locals is still on the Create New Post page. Please double check if post was published successfully.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
|
||||
; otherwise we should be on locals.com home feed page
|
||||
; check for "Retrieve Draft button"
|
||||
js = return document.querySelector("a[class='btn']").innerText;
|
||||
try, status := driver.executeScript(js)
|
||||
if(status){
|
||||
Message = Video was uploaded but Locals saved it as a draft instead of instantly publishing it. Please go to the Locals Page and Retrieve Draft and manually Publish it.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
|
||||
|
||||
; Get word that's longer than 4 characters in video title
|
||||
VideoTitleArray := StrSplit(VideoTitle, " ")
|
||||
; Iterate from 1 to the end of the array:
|
||||
Loop % VideoTitleArray.Length(){
|
||||
VideoTitleFirstWord := VideoTitleArray[A_Index]
|
||||
VideoTitleFirstWord := StrReplace(VideoTitleFirstWord, "_","-")
|
||||
if(StrLen(VideoTitleFirstWord) > 4)
|
||||
Break
|
||||
|
||||
; MsgBox % VideoTitleArray[A_Index]
|
||||
|
||||
}
|
||||
|
||||
|
||||
loop, 7 {
|
||||
ElementIndexNum := A_index - 1
|
||||
Message = ElementIndexNum: %ElementIndexNum%
|
||||
DevModeMsgBox(Message)
|
||||
; Msgbox % "ElementIndexNum: " ElementIndexNum
|
||||
|
||||
|
||||
jscheck = return document.getElementsByClassName('post-bottom')[%ElementIndexNum%].outerHTML;
|
||||
try outerHTML := driver.executeScript(jsCheck)
|
||||
|
||||
if(DevMode){
|
||||
Message = Looking for VideoTitleFirstWord: %VideoTitleFirstWord% `nwithin outerHTML
|
||||
DevModeMsgBox(message)
|
||||
Clipboard := outerHTML
|
||||
DevModeMsgBox(outerHTML)
|
||||
}
|
||||
|
||||
|
||||
; msgbox % "outerHTML: " . outerHTML
|
||||
|
||||
if(InStr(OuterHTML,VideoTitleFirstWord)){
|
||||
; @todo replace with regex
|
||||
Message = %VideoTitleFirstWord% is in`n`n %OuterHTML%
|
||||
DevModeMsgBox(Message)
|
||||
|
||||
Message = Found at at index: %A_index%
|
||||
DevModeMsgBox(message)
|
||||
; MsgBox, found match at %A_index%
|
||||
|
||||
|
||||
DevModeMsgBox("Pulling out url from outerhtml")
|
||||
|
||||
ShareLink := StrSplit(OuterHTML, "data-url=")
|
||||
ShareLink := ShareLink[2]
|
||||
|
||||
DevModeMsgBox(ShareLink)
|
||||
; Msgbox % "ShareLink: " ShareLink
|
||||
|
||||
URLEndString = ">
|
||||
ShareLink := StrSplit(ShareLink, URLEndString)
|
||||
ShareLink := ShareLink[1]
|
||||
DevModeMsgBox(ShareLink)
|
||||
|
||||
QuotationMark = "
|
||||
ShareLink := StrReplace(ShareLink,QuotationMark, "")
|
||||
DevModeMsgBox(ShareLink)
|
||||
Break
|
||||
}
|
||||
|
||||
ShareLink :=
|
||||
}
|
||||
|
||||
DevModeMsgBox(ShareLink)
|
||||
|
||||
; ShareLink := "Successful"
|
||||
|
||||
Message = Upload Complete: %ShareLink%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
|
||||
IniWrite, %ShareLink%, %VideoLinksIniFile%, URLs, LocalsURL
|
||||
AddToTotalVideosUploadedCount()
|
||||
|
||||
SaveDriverURL()
|
||||
|
||||
|
||||
Return
|
||||
|
||||
|
||||
|
||||
;--------------/LocalsGrabURL----------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; GetLocals
|
||||
; Xpath = //div[@class='uppy-StatusBar-statusPrimary']
|
||||
|
||||
; sleep, 30000 ; wait 30 seconds
|
||||
; sleep, 2000
|
||||
|
||||
/*; Attach Custom Thumbnail
|
||||
if(VideoThumbFilepath != ""){
|
||||
Message = Attaching Custom Thumbnail
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
Xpath = //div[@class='custom-thumb-uploader']//input[@name='Filedata']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath)
|
||||
|
||||
if(Status){
|
||||
Message = Failed to Attach Custom Thumbnail
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
sleep, 10000
|
||||
Loop, %Number_of_loops_to_Check_Upload_status% {
|
||||
sleep, %Time_Between_Loops_Upload_Status%
|
||||
|
||||
jscheck = return document.getElementsByClassName('uppy-StatusBar-statusPrimary')[0].textContent;
|
||||
try UploadStatus := driver.executeScript(jsCheck)
|
||||
|
||||
; UploadStatus := StrSplit(UploadStatus, ": ")
|
||||
; UploadStatus := UploadStatus[2]
|
||||
|
||||
|
||||
; message = Waiting for Video To Finish Uploading. `nCurrent Status: %UploadStatus%
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
|
||||
; Clipboard := jsCheck
|
||||
; msgbox % "textContent: " . textContent
|
||||
|
||||
|
||||
/* try UploadStatus := driver.findelementbyxpath(Xpath).Attribute("innerText") ; Grabb innertext
|
||||
catch e {
|
||||
if(A_index = 1){
|
||||
Message = Unable to find Progress Upload Percentage. Upload Most Likely Failed.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
}
|
||||
else,
|
||||
Break
|
||||
}
|
||||
*/
|
||||
|
||||
if(InStr(UploadStatus, "100%")){
|
||||
Message = Video Upload Complete. Waiting 20 seconds for Video to finalize before submitting.
|
||||
sleep, 20000
|
||||
break
|
||||
}
|
||||
|
||||
; if(UploadStatus != ""){
|
||||
; Message =
|
||||
; sleep, 30000 ; 30 seconds
|
||||
; Continue
|
||||
|
||||
; }
|
||||
|
||||
if(UploadStatus = "" and A_index = 1){
|
||||
Message = Upload Failed. Unable to Grab Upload Status
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
; if(UploadStatus = ""){
|
||||
; Break
|
||||
; }
|
||||
|
||||
|
||||
Status := Check_For_Stuck_Video_Upload(A_index, UploadStatus)
|
||||
if(Status = "Failed")
|
||||
Return
|
||||
}
|
||||
|
||||
/*; attach custom thumbnail
|
||||
xpath = //label[normalize-space()='Upload Custom Video Thumbnail']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath)
|
||||
if(Status){
|
||||
Message = Failed to Attach Thumbnail
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
; SaveDriverURLOFErrorPage()
|
||||
; Return
|
||||
}
|
||||
Status := InputFilePathIntoOpenWindow(VideoThumbFilepath)
|
||||
|
||||
*/
|
||||
|
||||
; DevModeMsgBox("pause")
|
||||
|
||||
; Click the publish button
|
||||
js = document.getElementsByName('submitPost')[0].click();
|
||||
try driver.executeScript(js)
|
||||
|
||||
|
||||
Message = Waiting 5 seconds for Video to Get Processed
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
sleep, 5000
|
||||
|
||||
|
||||
try currentpage := driver.url
|
||||
if(CUrrentpage = LocalsPostPageURL){
|
||||
Message = Final page is same as post page. Please double check if post was published successfully.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
; sleep, 500
|
||||
; ToolTip
|
||||
; AddToTotalPostsPostedCount()
|
||||
|
||||
|
||||
Devmodeskip:
|
||||
|
||||
Message = Trying to Grab Share Link
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
|
||||
; refresh page
|
||||
try driver.executeScript("history.go(0)")
|
||||
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
|
||||
|
||||
; check for "Retrieve Draft button"
|
||||
js = return document.querySelector("a[class='btn']").innerText;
|
||||
try, status := driver.executeScript(js)
|
||||
if(status = "Retrieve Draft"){
|
||||
Message = Video was uploaded but Locals saved it as a draft instead of instantly publishing it. Please go to the Locals Page and Retrieve Draft and manually Publish it.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
|
||||
|
||||
; Get word that's longer than 4 characters in video title
|
||||
VideoTitleArray := StrSplit(VideoTitle, " ")
|
||||
; Iterate from 1 to the end of the array:
|
||||
Loop % VideoTitleArray.Length(){
|
||||
VideoTitleFirstWord := VideoTitleArray[A_Index]
|
||||
VideoTitleFirstWord := StrReplace(VideoTitleFirstWord, "_","-")
|
||||
if(StrLen(VideoTitleFirstWord) > 4)
|
||||
Break
|
||||
|
||||
; MsgBox % VideoTitleArray[A_Index]
|
||||
|
||||
}
|
||||
|
||||
; DevModeMsgBox(VideoTitleFirstWord)
|
||||
|
||||
; Message = VideoTitleFirstWord: %VideoTitleFirstWord%
|
||||
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||
|
||||
; VideoTitleFirstWord := VideoTitleFirstWord[1]
|
||||
; Msgbox % "VideoTitleFirstWord: " VideoTitleFirstWord
|
||||
|
||||
/* ; Format the post title to remove all spaces and special characters to match with Locals Post
|
||||
ShareLinkFormatted := StrReplace(VideoTitle, " ", "-")
|
||||
ShareLinkFormatted := StrReplace(ShareLinkFormatted, "?", "")
|
||||
ShareLinkFormatted := StrReplace(ShareLinkFormatted, "!", "")
|
||||
ShareLinkFormatted := StrReplace(ShareLinkFormatted, ".", "")
|
||||
ShareLinkFormatted := StrReplace(ShareLinkFormatted, "", "")
|
||||
ShareLinkFormattedFirst5Chars := SubStr(ShareLinkFormatted, 1, 5)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
LocalsBaseURL := StrReplace(LocalsURL, "/share/post", "")
|
||||
; Msgbox % "LocalsPostPageURL: " LocalsPostPageURL
|
||||
; Msgbox % "LocalsURL: " LocalsURL
|
||||
; Msgbox % "LocalsBaseURL: " LocalsBaseURL
|
||||
loop, 5 {
|
||||
ElementIndexNum := A_index - 1
|
||||
DevModeMsgBox(ElementIndexNum)
|
||||
; Msgbox % "ElementIndexNum: " ElementIndexNum
|
||||
|
||||
|
||||
jscheck = return document.getElementsByClassName('post-bottom')[%ElementIndexNum%].outerHTML;
|
||||
try outerHTML := driver.executeScript(jsCheck)
|
||||
|
||||
; Clipboard := outerHTML
|
||||
; DevModeMsgBox(outerHTML)
|
||||
|
||||
; msgbox % "outerHTML: " . outerHTML
|
||||
|
||||
if(InStr(OuterHTML,VideoTitleFirstWord)){
|
||||
|
||||
Message = %VideoTitleFirstWord% is in %OuterHTML%
|
||||
; DevModeMsgBox(Message)
|
||||
|
||||
; MsgBox, found match at %A_index%
|
||||
|
||||
|
||||
|
||||
|
||||
ShareLink := StrSplit(OuterHTML, "data-url=")
|
||||
ShareLink := ShareLink[2]
|
||||
; DevModeMsgBox(ShareLink)
|
||||
; Msgbox % "ShareLink: " ShareLink
|
||||
|
||||
URLEndString = ">
|
||||
ShareLink := StrSplit(ShareLink, URLEndString)
|
||||
; ShareLink := ShareLink[1]
|
||||
|
||||
QuotationMark = "
|
||||
ShareLink := StrReplace(ShareLink,QuotationMark, "")
|
||||
|
||||
Break
|
||||
}
|
||||
|
||||
ShareLink :=
|
||||
}
|
||||
|
||||
DevModeMsgBox(ShareLink)
|
||||
|
||||
; ShareLink := "Successful"
|
||||
|
||||
Message = Upload Complete: %ShareLink%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
|
||||
IniWrite, %ShareLink%, %VideoLinksIniFile%, URLs, LocalsURL
|
||||
AddToTotalVideosUploadedCount()
|
||||
|
||||
SaveDriverURL()
|
||||
|
||||
|
||||
Return
|
||||
|
||||
;
|
||||
;------------------/Locals------------------------------
|
@ -0,0 +1,237 @@
|
||||
|
||||
; -------------------------------Functions-------------------------------
|
||||
CheckLBRYProcess(){
|
||||
; Check if LBRY Process exists
|
||||
Process, Exist,LBRY.exe
|
||||
if(ErrorLevel = 0) ; if doesn't exist
|
||||
{
|
||||
Message = Not Running. Starting up LBRY.exe
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
LBRYExeFilepath = C:\Program Files\LBRY\LBRY.exe
|
||||
if(!FileExist(LBRYExeFilepath)){
|
||||
Message = Failed to Find LBRY.exe executable. LBRY not installed?
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
|
||||
Message = Checking LBRY daemon_settings.yml file for Odysee Wallet Servers
|
||||
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
FileRead, daemon_settingsFileContent, C:\Users\%A_UserName%\AppData\Local\lbry\lbrynet\daemon_settings.yml
|
||||
|
||||
if(!InStr(daemon_settingsFileContent, "a-hub1.odysee.com")){
|
||||
Message = Odysee wallet server is not in daemon_settings.yml. Replacing File with required settings.
|
||||
SaveOrPostProgress(Message:=Message,PostType:=",DiscordErrorLogging")
|
||||
|
||||
LBRYDaemonSettingsFP = C:\Users\%A_UserName%\AppData\Local\lbry\lbrynet\daemon_settings.yml
|
||||
LBRYDaemonSettingsBackupFP = C:\Users\%A_UserName%\AppData\Local\lbry\lbrynet\daemon_settings_BU.yml
|
||||
|
||||
|
||||
; Msgbox % "daemon_settingsText: " daemon_settingsText
|
||||
FileMove, %LBRYDaemonSettingsFP%, %LBRYDaemonSettingsBackupFP%, 1 ; Dest [, Flag (1 = overwrite)]
|
||||
|
||||
UrlDownloadToFile, https://git.freedomainplaylists.com/yuriy/Freedomain-Video-Uploader/raw/branch/main/Assets/daemon_settings.yml , %LBRYDaemonSettingsFP%
|
||||
|
||||
sleep, 1000
|
||||
|
||||
if(!FileExist(LBRYDaemonSettingsFP)){
|
||||
Message = Failed to download the custom daemon_settings.yml file from git. Restoring Original File
|
||||
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
FileMove,%LBRYDaemonSettingsBackupFP%,%LBRYDaemonSettingsFP%, 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try run, "%LBRYExeFilepath%"
|
||||
Message = Waiting 1 Minute for LBRY to start up
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
|
||||
Sleep, 60000 ; 1 minute
|
||||
|
||||
Process, Exist,LBRY.exe
|
||||
if(ErrorLevel = 0) ; if doesn't exist
|
||||
{
|
||||
Message = Failed to Start LBRY.exe after 60 seconds of waiting
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
WinMinimize, LBRY
|
||||
}
|
||||
Return
|
||||
}
|
||||
|
||||
|
||||
GetPermanentLBRYURL(UploadResult){
|
||||
SingleQuotationmark = "
|
||||
|
||||
UploadResult := StrSplit(UploadResult, "`n") ; split results by new line
|
||||
|
||||
; Iterate through the array of the results
|
||||
Loop % UploadResult.Length() {
|
||||
PermanentURL := UploadResult[A_Index]
|
||||
if(InStr(PermanentURL, "permanent_url"))
|
||||
Break
|
||||
}
|
||||
|
||||
; Starting Result: "permanent_url": "lbry://Test-Video-161-Numbered#c9ad9afe54c7178d6f870b59bbe129aef8efc3ff",
|
||||
PermanentURL := StrSplit(PermanentURL, "lbry:")
|
||||
PermanentURL := "lbry:" . PermanentURL[2]
|
||||
PermanentURL := StrReplace(PermanentURL, ",", "")
|
||||
PermanentURL := StrReplace(PermanentURL, SingleQuotationmark, "")
|
||||
PermanentURL := StrReplace(PermanentURL, "`n", "")
|
||||
PermanentURL := StrReplace(PermanentURL, "`r", "")
|
||||
|
||||
; End Result lbry://Test-Video-161-Numbered#c9ad9afe54c7178d6f870b59bbe129aef8efc3ff
|
||||
Return PermanentURL
|
||||
}
|
||||
|
||||
|
||||
GetLBRYCanonicalURL(LBRYJSONObject){ ; input json string
|
||||
; ResolveURL := StrSplit(LBRYResolveAPICommand, "lbry://")
|
||||
; ResolveURL := "lbry://" . ResolveURL[2]
|
||||
; StrReplace(Haystack, SearchText [, ReplaceText, OutputVarCount, Limit := -1])
|
||||
LBRYPermanentURLJsonOBJ := StrReplace(LBRYJSONObject, LBRYPermanentURL, "LBRYPermanentURL")
|
||||
; clipboard := LBRYPermanentURLJsonOBJ
|
||||
; DevModeMsgBox(LBRYPermanentURLJsonOBJ)
|
||||
|
||||
try parsed := JSON.Load(LBRYPermanentURLJsonOBJ)
|
||||
try LBRYCanonicalURL := parsed.LBRYPermanentURL.canonical_url
|
||||
|
||||
; DevModeMsgBox(LBRYCanonicalURL)
|
||||
|
||||
if(LBRYCanonicalURL = ""){
|
||||
Return "" ; return blank
|
||||
}
|
||||
|
||||
; otherwise return the LBRY url
|
||||
LBRYCanonicalURL := StrReplace(LBRYCanonicalURL, "lbry://", "https://lbry.tv/")
|
||||
Return LBRYCanonicalURL
|
||||
}
|
||||
|
||||
|
||||
LBRYCMDTextReplacement(LBRYURLSlug){
|
||||
SingleQUote = "
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, " ", "_") ; replace all spaces with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, ":", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, ",", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "?", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "!", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "`;", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "/", "_") ; replace all colons with dashes
|
||||
; LBRYURLSlug := StrReplace(LBRYURLSlug, "?", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "<", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, ">", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, SingleQUote, "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "'", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "=", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, ";", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, ")", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "(", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "___", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "__", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "__", "_") ; replace all colons with dashes
|
||||
Return LBRYURLSlug
|
||||
}
|
||||
|
||||
GetLBRYAPIErrorFromString(UploadResult){
|
||||
UploadResultArray := StrSplit(UploadResult, "message")
|
||||
LBRYAPIError := UploadResultArray[2]
|
||||
; LBRYAPIErrorStrLen := StrLen(LBRYAPIError)
|
||||
|
||||
; LBRYAPIErrorStrToTrim := LBRYAPIErrorStrLen - 3
|
||||
; Msgbox % "LBRYAPIErrorStrToTrim: " LBRYAPIErrorStrToTrim
|
||||
LBRYAPIError := SubStr(LBRYAPIError, 4)
|
||||
LBRYAPIError := StrReplace(LBRYAPIError, "}", "")
|
||||
|
||||
|
||||
; Msgbox % "LBRYAPIError: " LBRYAPIError
|
||||
Return LBRYAPIError
|
||||
|
||||
}
|
||||
|
||||
|
||||
LogErrorToTextFile(Error){
|
||||
/* if(LogErrorsToTextFile != 1)
|
||||
Return
|
||||
*/
|
||||
ErrorLoggingFile := VideoFolderDir . "\" . "ErrorLogging.txt"
|
||||
FormatTime, TodayDate , YYYYMMDDHH24MISS, yyyyMMdd_hhmmss
|
||||
text =
|
||||
(
|
||||
|
||||
|
||||
---------------%TodayDate%---------------
|
||||
%CurrentSite%: %Error%
|
||||
|
||||
|
||||
)
|
||||
if(LogErrorsToMsgbox)
|
||||
Msgbox % "Text: " Text
|
||||
|
||||
FileAppend, %Text%, %ErrorLoggingFile%
|
||||
} ; End of Function
|
||||
|
||||
|
||||
|
||||
SaveDriverURL()
|
||||
AddToTotalVideosUploadedCount(){
|
||||
IniRead, TotalVideosUploaded, %SettingsIniFilepath%, General, TotalVideosUploaded, %A_Space%
|
||||
TotalVideosUploaded += 1
|
||||
IniWrite, %TotalVideosUploaded%, %SettingsIniFilepath%, General, TotalVideosUploaded
|
||||
}
|
||||
|
||||
|
||||
|
||||
OnMsgBoxPodcastFinish() {
|
||||
DetectHiddenWindows, On
|
||||
Process, Exist
|
||||
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
|
||||
WinMove,, 0
|
||||
}
|
||||
}
|
||||
|
||||
OnMsgBoxSocialMediaPoster() {
|
||||
DetectHiddenWindows, On
|
||||
Process, Exist
|
||||
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
|
||||
ControlSetText Button1, Yes
|
||||
ControlSetText Button2, Not Now
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Check_For_Stuck_Video_Upload(Index_Number, Upload_Status){
|
||||
if(A_index = 1){ ; Create a blank array
|
||||
ProgressStatusArray := []
|
||||
Return
|
||||
}
|
||||
|
||||
Message = Upload Status: %Upload_Status%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
|
||||
|
||||
; if we reached the last loop number:
|
||||
if(A_index = %Number_of_loops_to_Check_Upload_status%){
|
||||
Message = Upload Most Likely Failed: Video Hasn't Finished Uploading after 1 hour.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return "Failed"
|
||||
}
|
||||
|
||||
; If progress is still the same after a ten minute interval then error out
|
||||
if(HasVal(Array_Index_Num_of_Upload_StatusChecks, A_index)){ ; if current index is in Array of index numbers to check status during
|
||||
|
||||
; Send a notification message of upload status
|
||||
Message = Upload Status: %Upload_Status%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
; if current upload_status is in the array of values that are updated every 10 mins
|
||||
if(HasVal(ProgressStatusArray, Upload_Status)){
|
||||
Message = Upload Failed (E#4508)`nUpload Stuck at same point for 10 minutes. Stuck Status: %ProgressStatus%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return "Failed"
|
||||
}
|
||||
ProgressStatusArray.Push(Upload_Status) ; append current status to array
|
||||
}
|
||||
} ; end of func
|
@ -0,0 +1,311 @@
|
||||
UploadPodcast:
|
||||
;------------------------------------------------
|
||||
CurrentSite := "Podcast"
|
||||
PodcastTags := StrReplace(PodcastTags, " ,", ",")
|
||||
PodcastTags := StrReplace(PodcastTags, ", ", ",")
|
||||
PodcastTags := StrReplace(PodcastTags, " ", "-")
|
||||
PodcastTags := StrReplace(PodcastTags, "--", "-")
|
||||
PodcastTags := StrReplace(PodcastTags, "--", "-")
|
||||
; Msgbox % "PodcastTags: " PodcastTags
|
||||
|
||||
|
||||
Message = Starting Upload
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
|
||||
IniRead, FDRRadioURL, %SettingsIniFilepath%, General, FDRRadioURL, %A_Space%
|
||||
if(FDRRadioURL = ""){
|
||||
Message = FDRRadioURL is blank.`nPlease add URL to Settings.ini file under:`n`n[General]`nFDRRadioURL=
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
MsgBox 0x10,, %Message%
|
||||
Return
|
||||
}
|
||||
|
||||
IniRead, Username, %SettingsIniFilepath%, General, FDRRadioUN, %A_Space%
|
||||
IniRead, Password, %SettingsIniFilepath%, General, FDRRadioPW, %A_Space%
|
||||
|
||||
if(Username = "" or Password = ""){
|
||||
Message = Username and/or Password are blank.`nPlease add Login to Settings.ini file under:`n`n[General]`nFDRRadioUN=`nFDRRadioPW=
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
}
|
||||
|
||||
|
||||
if(MP3AudioFilepath = ""){
|
||||
MsgBox 0x33, Unable to Upload Podcast, No MP3 File Was Found/Selected. `nWould you like to select one now?
|
||||
|
||||
IfMsgBox Yes, {
|
||||
FileSelectFile, MP3AudioFilepath,, %RootDirToStartIn%, Please Select MP3 File
|
||||
if(ErrorLevel)
|
||||
Return
|
||||
} Else IfMsgBox No, {
|
||||
Return
|
||||
} Else IfMsgBox Cancel, {
|
||||
Return
|
||||
}
|
||||
}
|
||||
/*
|
||||
Sublime Indentation Reset
|
||||
*/
|
||||
|
||||
if(!InStr(MP3AudioFilepath, ".mp3")){
|
||||
|
||||
Message = Unable to upload podcast, no mp3 file was selected.
|
||||
MsgBox 0x40, Error, %Message%
|
||||
Return
|
||||
}
|
||||
|
||||
|
||||
; Message = Grabbing MP3 file data
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
|
||||
; https://www.autohotkey.com/boards/viewtopic.php?t=59882
|
||||
Message = Calculating MP3 File Size and Length
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile, DiscordErrorLogging")
|
||||
|
||||
Obj := Filexpro(MP3AudioFilepath,,
|
||||
, "Length"
|
||||
, "Size" )
|
||||
MP3AudioFilesize := obj["Size"]
|
||||
MP3AudioLength := obj["Length"]
|
||||
; MsgBox % obj["Size"]
|
||||
|
||||
AudioLengthArray := StrSplit(MP3AudioLength,":")
|
||||
|
||||
Message = MP3 Audio Length: %MP3AudioLength%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
; AudioLength_Seconds := ((AudioLengthArray[1] * 60 ) * 60) + (AudioLengthArray[2] * 60) + AudioLengthArray[3]
|
||||
; Message = MP3 Audio Length in Seconds: %AudioLength_Seconds%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
AudioLength_Hours := AudioLengthArray[1]
|
||||
AudioLength_Minutes := AudioLengthArray[2]
|
||||
AudioLength_Seconds := AudioLengthArray[3]
|
||||
|
||||
Message = AudioLength_Hours: %AudioLength_Hours%`nAudioLength_Minutes: %AudioLength_Minutes%`nAudioLength_Seconds: %AudioLength_Seconds%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
; AudioLength_SecondsOriginal := AudioLength_Seconds
|
||||
; AudioLength_Seconds := (AudioLength_Minutes * 60) + ((AudioLength_Hours * 60) * 60) + AudioLength_Seconds
|
||||
|
||||
; Msgbox % "AudioLength_Hours: " AudioLength_Hours
|
||||
; Msgbox % "AudioLength_Minutes: " AudioLength_Minutes
|
||||
; Msgbox % "AudioLength_Seconds: " AudioLength_Seconds
|
||||
; Msgbox % "AudioLength_SecondsOriginal: " AudioLength_SecondsOriginal
|
||||
|
||||
FileGetSize, OutputVar, %MP3AudioFilepath%, K ; Retrieve the size in Kbytes.
|
||||
FIlesizeInBytes := OutputVar * 1024
|
||||
|
||||
|
||||
Message = Inputting Podcast Information
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
|
||||
Status := NavigateFromBaseURLTo(FDRRadioURL)
|
||||
if(Status)
|
||||
Return
|
||||
|
||||
|
||||
Status := CheckForAlerts()
|
||||
if(Status){
|
||||
|
||||
}
|
||||
|
||||
Message = Logging in
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
Xpath = //input[@id='email']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=Username)
|
||||
if(!Status){ ; if inputting email did NOT fail, then we are on the login page, input the password and then click login.
|
||||
Xpath = //input[@id='password']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=Password)
|
||||
|
||||
Xpath = //a[@id='loginButton']
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||
|
||||
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
|
||||
|
||||
sleep, 2000
|
||||
|
||||
try driver.Get(FDRRadioURL) ;Open selected URL
|
||||
catch e {
|
||||
Message = Upload Failed (E#7295)`nUnable to Navigate to Upload Page`nChrome was closed or Internet down possibly?
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Message = Waiting for Page to Load
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
Xpath = //input[@id='num']
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=60,SleepLength:=1000)
|
||||
if(Status){
|
||||
Message = New Podcast Page did not load after 60 seconds. Check Login Status
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
|
||||
Message = Inputting Podcast Info
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
; Click the "Is Active?" Checkbox
|
||||
Xpath = //input[@id='isActive']
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||
|
||||
; Input Podcast Number
|
||||
Xpath = //input[@id='num']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PodcastNumber)
|
||||
|
||||
; Input Podcast Title
|
||||
Xpath = //input[@id='title']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoTitle)
|
||||
|
||||
; INput Audio URL
|
||||
Xpath = //input[@id='url-audio']
|
||||
SplitPath, MP3AudioFilepath, MP3AudioNameWithExt
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=MP3AudioNameWithExt)
|
||||
|
||||
; INput thumbnail URL
|
||||
Xpath = //input[@id='url-thumbnail']
|
||||
SplitPath, VideoThumbFilepath, VideoThumbnailFilenameWithExt
|
||||
ThumbnailURL = https://cdn.freedomainradio.com/%VideoThumbnailFilenameWithExt%
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ThumbnailURL)
|
||||
|
||||
; Input BitChute URL
|
||||
Xpath = //input[@id='url-bitchute']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BitChuteURL)
|
||||
|
||||
; Input Brighteon URL
|
||||
Xpath = //input[@id='url-brighteon']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BrighteonURL)
|
||||
|
||||
; Input DailyMotion URL
|
||||
Xpath = //input[@id='url-dailymotion']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=DailyMotionURL)
|
||||
|
||||
; Input LBRY URL
|
||||
Xpath = //input[@id='url-lbry']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=OdyseeVideoURL)
|
||||
|
||||
; Input LBRY URL
|
||||
Xpath = //input[@id='url-locals']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=LocalsURL)
|
||||
|
||||
; Input Rumble URL
|
||||
Xpath = //input[@id='url-rumble']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=RumbleURL)
|
||||
|
||||
|
||||
; Soundcloud but actually LBRY Audio URL
|
||||
Xpath = //input[@id='url-lbry-audio']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=OdyseeAudioURL)
|
||||
|
||||
|
||||
; INput filesize
|
||||
Xpath = //input[@id='fileSize']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=FIlesizeInBytes)
|
||||
|
||||
|
||||
Xpath = //input[@id='lengthHours']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Hours)
|
||||
|
||||
Xpath = //input[@id='lengthMinutes']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Minutes)
|
||||
|
||||
Xpath = //input[@id='lengthSeconds']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Seconds)
|
||||
; Message = Audio Length in Seconds that got input: %AudioLength_Seconds%
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
Message = Inputting Description
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
Xpath = //textarea[@id='description']
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||
|
||||
; Input Description
|
||||
JSVideoDescription := FormatTextToJSText(VideoDescription)
|
||||
|
||||
js = document.getElementById('description').value = "%JSVideoDescription%";
|
||||
try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
|
||||
|
||||
|
||||
Message = Inputting Tags
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
Podcasttags := StrReplace(Podcasttags, " , ", ",")
|
||||
Podcasttags := StrReplace(Podcasttags, " ,", ",")
|
||||
Podcasttags := StrReplace(Podcasttags, ", ", ",")
|
||||
|
||||
ArrayOfPodcastTags := StrSplit(Podcasttags,",")
|
||||
LengthOfArrayOfPodcastTags := ArrayOfPodcastTags.Length() ; Save total number of items in the array
|
||||
|
||||
try pagehtml := driver.pagesource
|
||||
; Msgbox % "pagehtml: " pagehtml
|
||||
Loop, %LengthOfArrayOfPodcastTags% {
|
||||
Tag := ArrayOfPodcastTags[A_Index] ; find value from position in array
|
||||
|
||||
SpanID = title">%Tag%</span></div></li><li><div id="_easyui_tree_
|
||||
|
||||
if(InStr(pagehtml, SpanID)){ ; if tag found in page, do this
|
||||
number := StrSplit(pagehtml, SpanID)
|
||||
Number := Number[2]
|
||||
; Msgbox % "number: " number
|
||||
|
||||
var = " class=
|
||||
Number := StrSplit(Number, var)
|
||||
|
||||
Number := Number[1]
|
||||
; Msgbox % "Grabbed Number from page source: " Number
|
||||
Number := Number - 1
|
||||
|
||||
Message = Tag: %Tag% is tag number %number% in the list.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
if(number = "" or Number < 0){
|
||||
Message = Tag Number for "%tag%" is blank or less than 0. Skipping.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
Continue
|
||||
}
|
||||
|
||||
Xpath = //div[@id='_easyui_tree_%number%']//span[@class='tree-checkbox tree-checkbox0']
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||
|
||||
}
|
||||
else, { ; otherwise input the tag and click the plus button. It will automatically get checked when the plus button is clicked
|
||||
Xpath = //input[@id='tagSearch']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=Tag)
|
||||
|
||||
Xpath = //a[@id='addPodcastTagInPodcastEdit']
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||
|
||||
Loop, 10 {
|
||||
Xpath = //input[@id='tagSearch']
|
||||
|
||||
try CurrentValue := driver.findelementbyxpath(Xpath).Attribute("value") ;XPath: ID=site-title & span tag
|
||||
if(CurrentValue != "")
|
||||
{
|
||||
sleep, 1000
|
||||
Continue
|
||||
}
|
||||
break ; otherwise break out of the loop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Sublime Indentation Reset
|
||||
*/
|
||||
|
||||
Message = Input Complete! `nPlease Confirm and click Final "Save" Button on Podcast Page
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
sleep, 5000
|
||||
|
||||
CurrentSite :=
|
||||
ToolTip
|
||||
Return
|
@ -0,0 +1,324 @@
|
||||
|
||||
RumbleUpload:
|
||||
;------------------------------------------------
|
||||
|
||||
CurrentSite := "Rumble"
|
||||
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
Status := NavigateFromBaseURLTo("https://rumble.com/upload.php")
|
||||
if(Status)
|
||||
Return
|
||||
|
||||
|
||||
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
|
||||
|
||||
|
||||
|
||||
CheckForAlerts()
|
||||
|
||||
|
||||
Message = Checking Login Status
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
try CurrentURL := driver.URL
|
||||
if(InStr(CurrentURL, "/login.php")){
|
||||
|
||||
if(AutoLogin){
|
||||
Message = Logging in Automatically by clicking into the UN+PW fields for info to register
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
; have to click into username and password field for page to register that there's input
|
||||
; clicking with JS doesn't make it register, but with xpath selenium it does
|
||||
Xpath = //input[@id='login-username']
|
||||
driver.FindElementByXPath(Xpath).click()
|
||||
|
||||
Xpath = //input[@id='login-password']
|
||||
driver.FindElementByXPath(Xpath).click()
|
||||
|
||||
|
||||
js = document.querySelector("button[type='submit']").click();
|
||||
driver.executeScript(js)
|
||||
|
||||
|
||||
; Do a double check to make sure that login worked
|
||||
Message = Checking Login Status
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
try CurrentURL := driver.URL
|
||||
|
||||
if(!InStr(CurrentURL, "/upload")){
|
||||
Message = Failed to log back in. Please Log Back In Manually
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else, { ; notify user and return
|
||||
Message = Login Expired. Please Log Back in
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
Message = Waiting 5 seconds for page to fully load
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
sleep, 5000
|
||||
}
|
||||
|
||||
; CheckForAlerts()
|
||||
|
||||
Message = Uploading Video File
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
Xpath = //input[@id='Filedata']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath)
|
||||
if(Status){
|
||||
try, CurrentURL := GetCurrentTabURlBase()
|
||||
Message = Failed to Upload Video File`nCurrent Tab URL: %CurrentURL%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
|
||||
; Input Title
|
||||
try driver.findElementsByName("title").item[1].SendKeys(VideoTitle) ;selects element based on Name and sends variable to it.
|
||||
catch e {
|
||||
Message = Video Upload Failed, Please Check Login Status
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
; Input Description
|
||||
Loop, 5 { ; Attempt to input video description a couple of times
|
||||
TooltipThis("Inputting Description `nAttempt Number: " A_index)
|
||||
|
||||
status := js_SendAndCheckWithID(Element:="description",ValueToCheck:="value",SleepLength:=3000,JSStringText:=JSVideoDescription)
|
||||
if(!Status)
|
||||
Break
|
||||
|
||||
/* if(A_index = 5){
|
||||
Clipboard := VideoDescription
|
||||
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
|
||||
}
|
||||
|
||||
js = document.getElementsByName('description')[1].value = "%JSVideoDescription%"; ; Send content through javascript (Great for getting around emoji chrome limitaitons)
|
||||
try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
|
||||
|
||||
try Description := driver.findElementsByName("description").item[2].Attribute("value") ;XPath: ID=site-title & span tag
|
||||
if(Description != "")
|
||||
Break
|
||||
sleep, 2000
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
; sleep, 5000
|
||||
|
||||
|
||||
Message = Selecting Channel
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
|
||||
|
||||
; try driver.findElementsByID("channelId").item[1].click()
|
||||
|
||||
; @todo replace with regex
|
||||
js = return document.querySelector("#channelId").innerHTML;
|
||||
try, ChannelIDNumber := driver.executeScript(js)
|
||||
; Msgbox % "ChannelIDNumber: " ChannelIDNumber
|
||||
ChannelIDNumber := StrSplit(ChannelIDNumber, "option value=")
|
||||
|
||||
; Msgbox % "ChannelIDNumber: " ChannelIDNumber
|
||||
|
||||
ChannelIDNumber := ChannelIDNumber[3]
|
||||
; Msgbox % "ChannelIDNumber: " ChannelIDNumber
|
||||
|
||||
SingleQuote = "
|
||||
ChannelIDNumber := StrSplit(ChannelIDNumber, "data-private")
|
||||
ChannelIDNumber := ChannelIDNumber[1]
|
||||
ChannelIDNumber := StrReplace(ChannelIDNumber, SingleQuote, "")
|
||||
ChannelIDNumber := StrReplace(ChannelIDNumber, " ", "")
|
||||
|
||||
; Msgbox % "ChannelIDNumber: " ChannelIDNumber
|
||||
|
||||
|
||||
; js = return document.querySelector("#channelId").value;
|
||||
; try, ChannelIDNumber := driver.executeScript(js)
|
||||
; Msgbox % "ChannelIDNumber: " ChannelIDNumber
|
||||
if(ChannelIDNumber = ""){
|
||||
Message = ChannelIDNumber is blank. Unable to select Upload Channel
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
|
||||
; //option[@value='762377'] ; freedomain
|
||||
Xpath = //option[@value='%ChannelIDNumber%']
|
||||
try driver.FindElementByXPath(Xpath).click()
|
||||
catch e {
|
||||
Message = Failed to click on Channel using %ChannelIDNumber%.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
}
|
||||
|
||||
|
||||
|
||||
; Input Tags
|
||||
Message = Inputting Tags
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
try driver.findElementsByName("tags").item[1].SendKeys(VideoTags) ;selects element based on Name and sends variable to it.
|
||||
|
||||
|
||||
|
||||
; Custom Thumbnail
|
||||
if(VideoThumbFilepath != "") {
|
||||
TooltipThis("Uploading Thumbnail")
|
||||
Xpath = //input[@name='customThumb']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath)
|
||||
if(Status){
|
||||
Message = Failed to Upload Thumbanil
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
}
|
||||
|
||||
|
||||
; @todo: Add a check to see if progress gets stuck
|
||||
; Check Upload Percentage
|
||||
TooltipThis("Waiting for Video to Finish Uploading")
|
||||
Loop, %Number_of_loops_to_Check_Upload_status% {
|
||||
sleep, %Time_Between_Loops_Upload_Status%
|
||||
|
||||
jscheck = return document.getElementsByClassName('num_percent')[0].textContent;
|
||||
try RumbleUploadPercent := driver.executeScript(jsCheck)
|
||||
|
||||
; try RumbleUploadPercent := driver.findelementbyxpath(Xpath).Attribute("textContent")
|
||||
RumbleUploadPercent := StrSplit(RumbleUploadPercent, " ")
|
||||
RumbleUploadPercent := RumbleUploadPercent[1]
|
||||
|
||||
if(InStr(RumbleUploadPercent, "100%")) ; once variable contains 100%, then we can break out of loop and continue
|
||||
Break
|
||||
|
||||
|
||||
Status := Check_For_Stuck_Video_Upload(A_index, RumbleUploadPercent)
|
||||
if(Status = "Failed")
|
||||
Return
|
||||
; if(HasVal(Array_Index_Num_of_Upload_StatusChecks, A_index)) { ; 30 minutes and 60 minutes - send a notification message
|
||||
; Message = Upload Progress: %RumbleUploadPercent%
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
; }
|
||||
|
||||
}
|
||||
|
||||
; Msgbox % "RumbleUploadPercent: " RumbleUploadPercent
|
||||
|
||||
; Click on one of the video thumbnail options first
|
||||
; Seems to be a bug on rumble, in order to be able to select a custom thumb through js, gotta select on of the generated ones first.
|
||||
; Xpath = /html/body/main/div/div/div/section/form[1]/div/div[2]/div[3]/a[2] ; thumbnail option #3
|
||||
; try driver.FindElementByXPath(Xpath).click() ;Clicks on Xpath based on variable.
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
js = document.getElementById('customThumb').click();
|
||||
driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
|
||||
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
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
try UploadPageURL := driver.URL
|
||||
|
||||
; Submit Button
|
||||
js = document.getElementById('submitForm').click();
|
||||
try driver.executeScript(js) ;
|
||||
|
||||
|
||||
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
|
||||
|
||||
|
||||
; Select Rumble Only Licensing
|
||||
js = document.getElementsByClassName('greenLink mRight last')[0].click(); ; Send content through javascript (Great for getting around emoji chrome limitaitons)
|
||||
try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
|
||||
|
||||
; Check off condition 1
|
||||
js = document.getElementById("crights").click()
|
||||
try driver.executeScript(js)
|
||||
|
||||
; Check off condition 2
|
||||
js = document.getElementById("cterms").click()
|
||||
try driver.executeScript(js)
|
||||
|
||||
; Click the Submit Button
|
||||
js = document.getElementById("submitForm2").click()
|
||||
try driver.executeScript(js)
|
||||
|
||||
|
||||
; Loop until able to grab the direct link from the result page.
|
||||
Loop, 24 {
|
||||
TooltipThis("Waiting for Result Page to load to grab Video URL")
|
||||
Sleep, 5000
|
||||
|
||||
js = return document.getElementById("error_files_2").textContent;
|
||||
RumbleError := driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
|
||||
if(RumbleError != "") {
|
||||
Message = Rumble Upload Failed due to:`n%RumbleError%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
js = return document.getElementById('direct').value;
|
||||
try RumbleURL := driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
|
||||
|
||||
/* try RumbleURL := driver.findElementsByID("direct").item[1].Attribute("value") ;grab Direct Link from the result page
|
||||
catch e { ; if not able to grab it, then sleep for 5 seconds and then loop again
|
||||
Continue
|
||||
}
|
||||
*/
|
||||
if(RumbleURL != ""){ ; If URL is grabbed from result page, then kick out of loop
|
||||
Break
|
||||
}
|
||||
if(A_Index = 10) ; if looped for 5 minutes and still no URL grabbed
|
||||
{ ; @todo: add error check if submit button clicked and error appears
|
||||
|
||||
Xpath = /html/body/main/div/div/div/section/form[2]/div/div[9] ; grab inner content of where error usually appears.
|
||||
try RumbleUploadError := driver.findelementbyxpath(Xpath).Attribute("innerText") ; Grabb innertext
|
||||
; Msgbox % "UseThumbUploadToolTextExist: " UseThumbUploadToolTextExist
|
||||
|
||||
|
||||
Message = Upload Error (E#1341)`nVideo Uploaded but not able to be finalized.`nPlease fix the issue and click the final submit button. `nError: %RumbleUploadError%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
}
|
||||
|
||||
IniWrite, %RumbleURL%, %VideoLinksIniFile%, URLs, RumbleURL
|
||||
|
||||
Message = Upload Complete: %RumbleURL%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
SaveDriverURL()
|
||||
AddToTotalVideosUploadedCount()
|
||||
|
||||
Return
|
Loading…
Reference in New Issue