From a626ff17636960529cf2fe4b5d51796459e3668a Mon Sep 17 00:00:00 2001 From: yuriy Date: Fri, 17 Feb 2023 01:25:27 -0500 Subject: [PATCH] Fixed Locals.com URL grabbing not working and DailyMotion description check not working properly --- Freedomain Video Uploader.ahk | 51 ++++++++++++++++++++++++++++------- Lib/SharedFunctions.ahk | 2 +- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/Freedomain Video Uploader.ahk b/Freedomain Video Uploader.ahk index 662375c..a9e2009 100644 --- a/Freedomain Video Uploader.ahk +++ b/Freedomain Video Uploader.ahk @@ -728,7 +728,7 @@ Gui, Add, GroupBox,r8 y+15 x%PageTwoXStartPos% w%PageTwoGroupBoxWidth%, Platform ; Msgbox % "LocalsURL: " LocalsURL if(LocalsURL = "LocalsUploadStartedNeedToGrabURL"){ - Gui, Add, Checkbox, xp+10 yp+25 vLocals Checked%LocalsCheckStatus%, Locals (Grab URL) + Gui, Add, Checkbox, xp+10 yp+25 vLocalsGrabURL Checked%LocalsCheckStatus%, Locals (Grab URL) } else, { Gui, Add, Checkbox, xp+10 yp+25 vLocals Checked%LocalsCheckStatus%, Locals @@ -1211,8 +1211,8 @@ KeywordsArray := StrSplit(VideoTags,",") Gosub, OdyseeAudioThumbUpload } - if(LocalsGetURL OR LocalsURL = "LocalsUploadStartedNeedToGrabURL"){ - Gosub, LocalsGetURL + if(LocalsGrabURL OR LocalsURL = "LocalsUploadStartedNeedToGrabURL"){ + Gosub, LocalsGrabURL } @@ -2408,18 +2408,34 @@ if(AutoSubmitstatus = "-1"){ ; if checked YES 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---------------------------------- -LocalsGetURL: +LocalsGrabURL: SaveOrPostProgress(Message:="Navigating to Locals Feed to grab URL",PostType:="Tooltip,ErrorLoggingTextFile") ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") @@ -2437,7 +2453,12 @@ if(InStr(LocalsPostPageURL, "/share/post")){ Status := ActivateChromeTab(LocalsPostPageURL) -Msgbox % "Status: " Status +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 @@ -2445,7 +2466,7 @@ 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 +Return } @@ -2453,7 +2474,7 @@ SaveDriverURLOFErrorPage() ; check for "Retrieve Draft button" js = return document.querySelector("a[class='btn']").innerText; try, status := driver.executeScript(js) -if(status = "Retrieve Draft"){ +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() @@ -2547,6 +2568,7 @@ Return +;--------------/LocalsGrabURL---------------------------------- @@ -3800,7 +3822,7 @@ Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000 */ sleep, 1000 - +/* TooltipThis("Inputting Tags") ; Input Each tag one by one Loop % KeywordsArray.Length() @@ -3826,6 +3848,8 @@ Loop % KeywordsArray.Length() ; sleep, 100 } + +*/ ; DevModeMsgBox("tags input?") ; Grab the Share URL and pull out the Video Link from it and save it to the Video Linsk ini file, so double uploads are not tried if fialure occurs @@ -3885,14 +3909,21 @@ Loop, 5 { ; make a couple attempts to input description try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.BackSpace) + sleep, 1000 js = return document.querySelector("textarea[placeholder='Enter a description']").textContent; try, InputDescription := driver.executeScript(js) + message = InputDescription: %InputDescription% + DevModeMsgBox(InputDescription) + ; if input description is less than 15 chars, try again - if(StrLen(InputDescription)<15){ + if(StrLen(InputDescription) < 15){ Continue } + else, { + Break + } diff --git a/Lib/SharedFunctions.ahk b/Lib/SharedFunctions.ahk index d9cecdf..2ea4f00 100644 --- a/Lib/SharedFunctions.ahk +++ b/Lib/SharedFunctions.ahk @@ -843,7 +843,7 @@ CreateArrayOfChromeTabs() { if(TotalTabsFound = 1 AND A_index > TotalTabsFound){ Message = Exiting Early after 1 loop DevModeMsgBox(message) - + break }