Added in ability to grab Locals.com Video URL after all videos are uploaded

pull/2/head
Yuriy 2 years ago
parent 409e93e7d1
commit e7d4b140e0

@ -29,7 +29,7 @@ global ScriptVersion
global FullScriptName global FullScriptName
ScriptName = Freedomain Video Uploader ScriptName = Freedomain Video Uploader
ScriptVersion = 2.99 ScriptVersion = 3.0
FullScriptName := ScriptName . " - " . ScriptVersion FullScriptName := ScriptName . " - " . ScriptVersion
@ -84,6 +84,8 @@ global ErrorLogSummary
global DiscordParlerWebhookURL global DiscordParlerWebhookURL
global ErrorLoggingFilePath global ErrorLoggingFilePath
; global TotalTabLoops
global ErrorLogVar global ErrorLogVar
ErrorLogVar := "Upload Errors:" . "`n" ErrorLogVar := "Upload Errors:" . "`n"
@ -399,7 +401,8 @@ OdyseeAudioThumbCheckStatus := 0
*/ */
(RumbleURL != "")?(RumbleCheckStatus := 0) : (RumbleCheckStatus := 1) (RumbleURL != "")?(RumbleCheckStatus := 0) : (RumbleCheckStatus := 1)
(LocalsURL != "")?(LocalsCheckStatus := 0) : (LocalsCheckStatus := 0) ; if user tried to upload to locals already and still needs to grab the url, check
(LocalsURL = "LocalsUploadStartedNeedToGrabURL")?(LocalsCheckStatus := 1) : (LocalsCheckStatus := 0)
(BrighteonURL != "")?(BrighteonCheckStatus := 0) : (BrighteonCheckStatus := 1) (BrighteonURL != "")?(BrighteonCheckStatus := 0) : (BrighteonCheckStatus := 1)
if(VideoFileSizeInMB > 6144){ if(VideoFileSizeInMB > 6144){
VideoFileSizeOver6GB := 1 VideoFileSizeOver6GB := 1
@ -716,10 +719,20 @@ Gui, Add, Checkbox, vPingOnCompletion gUpdateVars Checked%PingOnCompletionCheckS
GroupBoxCheckboxPos := PageTwoXStartPos + MarginSpace GroupBoxCheckboxPos := PageTwoXStartPos + MarginSpace
; -------------------------------PLATFORMS-------------------------------
Gui, Add, GroupBox,r8 y+15 x%PageTwoXStartPos% w%PageTwoGroupBoxWidth%, Platforms Gui, Add, GroupBox,r8 y+15 x%PageTwoXStartPos% w%PageTwoGroupBoxWidth%, Platforms
; Gui, Add, Text,y+25 x%PageTwoXStartPos%, ---Platforms---- ; Gui, Add, Text,y+25 x%PageTwoXStartPos%, ---Platforms----
; Gui, Font, Bold ; Gui, Font, Bold
; Msgbox % "LocalsURL: " LocalsURL
if(LocalsURL = "LocalsUploadStartedNeedToGrabURL"){
Gui, Add, Checkbox, xp+10 yp+25 vLocals Checked%LocalsCheckStatus%, Locals (Grab URL)
}
else, {
Gui, Add, Checkbox, xp+10 yp+25 vLocals Checked%LocalsCheckStatus%, Locals Gui, Add, Checkbox, xp+10 yp+25 vLocals Checked%LocalsCheckStatus%, Locals
}
; if(VideoFileSizeInMB < 1792) ; if(VideoFileSizeInMB < 1792)
; Gui, Add, Checkbox, x+%MarginSpaceDoubled% vFacebook Checked%FacebookCheckStatus%, Facebook ; Gui, Add, Checkbox, x+%MarginSpaceDoubled% vFacebook Checked%FacebookCheckStatus%, Facebook
@ -1143,7 +1156,6 @@ KeywordsArray := StrSplit(VideoTags,",")
if(Locals){ if(Locals){
UploadedToSites .= "Locals," UploadedToSites .= "Locals,"
gosub, LocalsUpload gosub, LocalsUpload
} }
if(BitChute){ if(BitChute){
@ -1199,12 +1211,17 @@ KeywordsArray := StrSplit(VideoTags,",")
Gosub, OdyseeAudioThumbUpload Gosub, OdyseeAudioThumbUpload
} }
if(LocalsGetURL OR LocalsURL = "LocalsUploadStartedNeedToGrabURL"){
Gosub, LocalsGetURL
}
if(URLOfLastErrorPage != ""){ if(URLOfLastErrorPage != ""){
Message = Activating Tab of last failed post. Message = Activating Tab of last failed post.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip") SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
FindAndActivateTab(URLOfLastErrorPage) ; @todo: replaceme with working funciton to activate tab
; FindAndActivateTab(URLOfLastErrorPage)
} }
CurrentSite := "" CurrentSite := ""
@ -1214,6 +1231,16 @@ KeywordsArray := StrSplit(VideoTags,",")
; this feels soooooooooooooo ineficient, but i'm not sure how else to do this ; this feels soooooooooooooo ineficient, but i'm not sure how else to do this
; if(StreamanityCheckStatus AND !InStr(StreamanityURL, "streamanity")) ; if checked and URL is blank, report error ; if(StreamanityCheckStatus AND !InStr(StreamanityURL, "streamanity")) ; if checked and URL is blank, report error
; Status := "Failures" ; Status := "Failures"
/*
if(URLOfLastErrorPage){
Status := "Failures"
}
else, {
Status := "Success"
}
if(OdyseeVideoCheckStatus and !InStr(OdyseeVideoURL, "odysee")) if(OdyseeVideoCheckStatus and !InStr(OdyseeVideoURL, "odysee"))
Status := "Failures" Status := "Failures"
else if(OdyseeAudioCheckStatus AND !InStr(OdyseeAudioURL, "odysee")) else if(OdyseeAudioCheckStatus AND !InStr(OdyseeAudioURL, "odysee"))
@ -1226,13 +1253,12 @@ KeywordsArray := StrSplit(VideoTags,",")
Status := "Failures" Status := "Failures"
else if(BrighteonCheckStatus AND !InStr(BrighteonURL, "brighteon")) else if(BrighteonCheckStatus AND !InStr(BrighteonURL, "brighteon"))
Status := "Failures" Status := "Failures"
else,
Status := "Success"
*/
; DevModeMsgBox(status) ; DevModeMsgBox(status)
; Msgbox % "status: " status ; Msgbox % "status: " status
if(Status = "Failures") if(URLOfLastErrorPage)
Message = Video Uploading Finished WITH Some Failures Message = Video Uploading Finished WITH Some Failures
else, else,
Message = All Videos Uploaded Successfully Message = All Videos Uploaded Successfully
@ -2220,6 +2246,7 @@ if(!InStr(LocalsPostPageURL, "/share/post")){
Status := NavigateFromBaseURLTo(LocalsPostPageURL) Status := NavigateFromBaseURLTo(LocalsPostPageURL)
if(Status = "Failed") if(Status = "Failed")
Return Return
/* /*
if(DevMode){ if(DevMode){
MsgBox 0x4, DevMode Skip, Skip uploading section and skip straight to grab URL? MsgBox 0x4, DevMode Skip, Skip uploading section and skip straight to grab URL?
@ -2275,8 +2302,9 @@ if(Status){
*/ */
; Input Description ; Input Description
Loop, 5 { ; Attempt to input video description a couple of times
TooltipThis("Inputting Description") TooltipThis("Inputting Description")
Loop, 5 { ; Attempt to input video description a couple of times
if(A_index = 5){ if(A_index = 5){
Clipboard := VideoDescription Clipboard := VideoDescription
@ -2289,7 +2317,7 @@ Loop, 5 { ; Attempt to input video description a couple of times
try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons. try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
; msgbox ; msgbox
driver.findElementsByName("body").item[1].SendKeys(driver.Keys.SPACE) try driver.findElementsByName("body").item[1].SendKeys(driver.Keys.SPACE)
; driver.findElementsByID("ELEMENTID").item[1].SendKeys(driver.Keys.ENTER) ; driver.findElementsByID("ELEMENTID").item[1].SendKeys(driver.Keys.ENTER)
; msgbox ; msgbox
@ -2319,7 +2347,7 @@ if(Status){
js = return document.querySelector("#autosubmit_enabled").checked; js = return document.querySelector("#autosubmit_enabled").checked;
try AutoSubmitstatus := driver.executeScript(js) try AutoSubmitstatus := driver.executeScript(js)
; DevModeMsgBox(status) ; DevModeMsgBox(status)
message = AutoSubmitstatus: %AutoSubmitstatus% ; message = AutoSubmitstatus: %AutoSubmitstatus%
; DevModeMsgBox(message) ; DevModeMsgBox(message)
if(AutoSubmitstatus = "0"){ if(AutoSubmitstatus = "0"){
@ -2379,7 +2407,7 @@ if(AutoSubmitstatus = "-1"){ ; if checked YES
Message = Upload Started Successfully Message = Upload Started Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
LocalsURL := "UploadStartedButNeedToGrabURL" LocalsURL := "LocalsUploadStartedNeedToGrabURL"
IniWrite, %LocalsURL%, %VideoLinksIniFile%, URLs, LocalsURL IniWrite, %LocalsURL%, %VideoLinksIniFile%, URLs, LocalsURL
AddToTotalVideosUploadedCount() AddToTotalVideosUploadedCount()
@ -2389,6 +2417,144 @@ if(AutoSubmitstatus = "-1"){ ; if checked YES
Return Return
} }
;--------------LocalsGrabURL----------------------------------
LocalsGetURL:
SaveOrPostProgress(Message:="Navigating to Locals Feed to grab URL",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")){
LocalsFeedPageURL := StrReplace(LocalsPostPageURL, "/share/post", "")
}
Status := ActivateChromeTab(LocalsPostPageURL)
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 = "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]
}
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()
; TakeScreenshotOfPage(ScreenShotSavePath)
Return
; GetLocals
; Xpath = //div[@class='uppy-StatusBar-statusPrimary'] ; Xpath = //div[@class='uppy-StatusBar-statusPrimary']
; sleep, 30000 ; wait 30 seconds ; sleep, 30000 ; wait 30 seconds
@ -2410,6 +2576,8 @@ if(VideoThumbFilepath != ""){
} }
*/ */
sleep, 10000 sleep, 10000
Loop, %Number_of_loops_to_Check_Upload_status% { Loop, %Number_of_loops_to_Check_Upload_status% {
sleep, %Time_Between_Loops_Upload_Status% sleep, %Time_Between_Loops_Upload_Status%

Loading…
Cancel
Save