Reworked Locals.com uploading
This commit is contained in:
@@ -29,7 +29,7 @@ global ScriptVersion
|
||||
global FullScriptName
|
||||
|
||||
ScriptName = Freedomain Video Uploader
|
||||
ScriptVersion = 2.98
|
||||
ScriptVersion = 2.99
|
||||
FullScriptName := ScriptName . " - " . ScriptVersion
|
||||
|
||||
|
||||
@@ -177,10 +177,10 @@ if(DiscordUsernameID = ""){
|
||||
;---Auto Updater Settings---
|
||||
;------------------------------------------------
|
||||
global GitReleasesAPIURL
|
||||
GitReleasesAPIURL = https://git.zinchuk.xyz/api/v1/repos/yuriy/Freedomain-Social-Media-Poster/releases
|
||||
GitReleasesAPIURL = https://git.zinchuk.xyz/api/v1/repos/yuriy/Freedomain-Video-Uploader/releases
|
||||
|
||||
global GitReleasesLBRYKillerAPIURL
|
||||
GitReleasesAPIURL = https://git.zinchuk.xyz/api/v1/repos/yuriy/LBRY-Process-Killer/releases
|
||||
GitReleasesLBRYKillerAPIURL = https://git.zinchuk.xyz/api/v1/repos/yuriy/LBRY-Process-Killer/releases
|
||||
|
||||
|
||||
|
||||
@@ -211,8 +211,34 @@ if(PassedParameter = "ShowResults"){
|
||||
IniRead, PassedParameter, %SettingsIniFilepath%, %ScriptSettingsSection%, LastPost, %A_Space%
|
||||
}
|
||||
|
||||
|
||||
; if passed argument is .exe file, then script has just been udpated and we need to move the old version
|
||||
if(InStr(PassedParameter,ScriptName) and InStr(PassedParameter,".exe")){
|
||||
|
||||
; create backups folder if it doesn't exist
|
||||
BackupsFolder = %LibFolder%\Backups\
|
||||
; Msgbox % "BackupsFolder: " BackupsFolder
|
||||
|
||||
if(!FileExist(BackupsFolder)){
|
||||
FileCreateDir, %BackupsFolder%
|
||||
}
|
||||
|
||||
; move old version to backups folder, overwrite if name conflict
|
||||
FileMove, %PassedParameter%, %BackupsFolder%\*, 1
|
||||
if(ErrorLevel){ ; most likely because the old version hasn't finished exiting yet
|
||||
SaveOrPostProgress(Message:="Starting Up: Moving Old Version",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar")
|
||||
sleep, 2000
|
||||
FileMove, %PassedParameter%, %BackupsFolder%\*, 1
|
||||
if(ErrorLevel){
|
||||
MsgBox,,Update Successful, Update was successful`, but unable to move old version to the Backups folder.`nPlease move it or delete it manually.
|
||||
}
|
||||
ToolTip
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PassedParameterLength := StrLen(PassedParameter)
|
||||
if(PassedParameterLength < 5){
|
||||
if(PassedParameterLength < 5 and !InStr(PassedParameter, ".exe")){
|
||||
FileSelectFile, BodyTextFilePath,,%RootDirToStartIn%,Please Select ANY File Within the Project Folder
|
||||
if(ErrorLevel)
|
||||
Return
|
||||
@@ -751,7 +777,8 @@ IniWrite, %BodyTextFilePath%, %SettingsIniFilepath%, %ScriptSettingsSection%, La
|
||||
|
||||
if(AutoUpdateCheck AND !UpdateAvailable And !SkipUpdateCheckThisRun){
|
||||
; msgbox, checkin for update
|
||||
; CheckForUpdates()
|
||||
; DevModeMsgBox(GitReleasesAPIURL)
|
||||
CheckForUpdates(GitReleasesAPIURL)
|
||||
}
|
||||
|
||||
Return
|
||||
@@ -1093,6 +1120,7 @@ JSVideoTitle := FormatTextToJSText(VideoTitle)
|
||||
; Create an array out of the keywords to be used in different places
|
||||
VideoTags := StrReplace(VideoTags, ", ",",")
|
||||
VideoTags := StrReplace(VideoTags, " ,",",")
|
||||
VideoTags := StrReplace(VideoTags, " ",",")
|
||||
|
||||
KeywordsArray := StrSplit(VideoTags,",")
|
||||
|
||||
@@ -1337,7 +1365,7 @@ Gui, Font, Normal
|
||||
Gui, Add, Edit, x+5 yp+0 h%ButtonHeights% vLocalsURL w%ResultEditBoxWidths% gUpdateVars, %LocalsURL%
|
||||
|
||||
Gui, Font, Bold
|
||||
Gui, Add, Button, x10 y+10 h%ButtonHeights% w%CopyButtonWidths% gCopyVideoTags, Video Tags
|
||||
Gui, Add, Button, x10 y+10 h%ButtonHeights% w%CopyButtonWidths% gCopyVideoTags, Video Tags)
|
||||
Gui, Font, Normal
|
||||
Gui, Add, Edit, x+5 yp+0 h%ButtonHeights% vVideoTags w%ResultEditBoxWidths% gUpdateVars , %VideoTags%
|
||||
|
||||
@@ -2170,6 +2198,7 @@ Return
|
||||
LocalsUpload:
|
||||
CurrentSite := "Locals"
|
||||
|
||||
|
||||
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
@@ -2180,46 +2209,62 @@ if(LocalsPostPageURL = ""){
|
||||
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 = "Failed")
|
||||
Return
|
||||
/*
|
||||
if(DevMode){
|
||||
MsgBox 0x4, DevMode Skip, Skip uploading section and skip straight to grab URL?
|
||||
|
||||
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")
|
||||
IfMsgBox Yes, {
|
||||
goto, Devmodeskip
|
||||
} Else IfMsgBox No, {
|
||||
|
||||
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")
|
||||
; TakeScreenshotOfPage(ScreenShotSavePath)
|
||||
|
||||
Return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
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")
|
||||
}
|
||||
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")
|
||||
; TakeScreenshotOfPage(ScreenShotSavePath)
|
||||
|
||||
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)
|
||||
@@ -2231,7 +2276,7 @@ if(Status){
|
||||
|
||||
; Input Description
|
||||
Loop, 5 { ; Attempt to input video description a couple of times
|
||||
TooltipThis("Inputting Description `nAttempt Number: " A_index)
|
||||
TooltipThis("Inputting Description")
|
||||
|
||||
if(A_index = 5){
|
||||
Clipboard := VideoDescription
|
||||
@@ -2259,6 +2304,90 @@ Loop, 5 { ; Attempt to input video description a couple of times
|
||||
}
|
||||
|
||||
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 := "UploadStartedButNeedToGrabURL"
|
||||
|
||||
IniWrite, %LocalsURL%, %VideoLinksIniFile%, URLs, LocalsURL
|
||||
AddToTotalVideosUploadedCount()
|
||||
|
||||
; LocalsTabURL := SaveDriverURL()
|
||||
|
||||
Return
|
||||
}
|
||||
|
||||
; Xpath = //div[@class='uppy-StatusBar-statusPrimary']
|
||||
|
||||
@@ -2360,7 +2489,11 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
|
||||
js = document.getElementsByName('submitPost')[0].click();
|
||||
try driver.executeScript(js)
|
||||
|
||||
sleep, %TimeBetweenPosts%
|
||||
|
||||
Message = Waiting 5 seconds for Video to Get Processed
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
sleep, 5000
|
||||
|
||||
|
||||
try currentpage := driver.url
|
||||
if(CUrrentpage = LocalsPostPageURL){
|
||||
@@ -2369,13 +2502,33 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
|
||||
Return
|
||||
}
|
||||
; sleep, 500
|
||||
ToolTip
|
||||
; ToolTip
|
||||
; AddToTotalPostsPostedCount()
|
||||
|
||||
|
||||
Devmodeskip:
|
||||
|
||||
Message = Trying to Grab Share Link
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
; Get First word in video title
|
||||
|
||||
; 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(){
|
||||
@@ -2388,8 +2541,10 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
|
||||
|
||||
}
|
||||
|
||||
Message = VideoTitleFirstWord: %VideoTitleFirstWord%
|
||||
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||
; DevModeMsgBox(VideoTitleFirstWord)
|
||||
|
||||
; Message = VideoTitleFirstWord: %VideoTitleFirstWord%
|
||||
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||
|
||||
; VideoTitleFirstWord := VideoTitleFirstWord[1]
|
||||
; Msgbox % "VideoTitleFirstWord: " VideoTitleFirstWord
|
||||
@@ -2406,38 +2561,53 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
|
||||
|
||||
|
||||
|
||||
LocalsBaseURL := StrReplace(LocalsURL, "/share/post")
|
||||
LocalsBaseURL := StrReplace(LocalsURL, "/share/post", "")
|
||||
; Msgbox % "LocalsPostPageURL: " LocalsPostPageURL
|
||||
; Msgbox % "LocalsURL: " LocalsURL
|
||||
; Msgbox % "LocalsBaseURL: " LocalsBaseURL
|
||||
loop, 3 {
|
||||
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, LocalsPostPageURL)
|
||||
|
||||
|
||||
|
||||
|
||||
ShareLink := StrSplit(OuterHTML, "data-url=")
|
||||
ShareLink := ShareLink[2]
|
||||
; DevModeMsgBox(ShareLink)
|
||||
; Msgbox % "ShareLink: " ShareLink
|
||||
ShareLink := StrSplit(ShareLink, " class")
|
||||
ShareLink := ShareLink[1]
|
||||
; Msgbox % "ShareLink: " ShareLink
|
||||
ShareLink := LocalsPostPageURL . ShareLink
|
||||
ShareLink := StrReplace(ShareLink, """", "")
|
||||
ShareLink := StrReplace(ShareLink, "#comments", "")
|
||||
; Msgbox % "ShareLink: " ShareLink
|
||||
|
||||
URLEndString = ">
|
||||
ShareLink := StrSplit(ShareLink, URLEndString)
|
||||
; ShareLink := ShareLink[1]
|
||||
|
||||
QuotationMark = "
|
||||
ShareLink := StrReplace(ShareLink,QuotationMark, "")
|
||||
|
||||
Break
|
||||
}
|
||||
|
||||
ShareLink :=
|
||||
}
|
||||
|
||||
DevModeMsgBox(ShareLink)
|
||||
|
||||
; ShareLink := "Successful"
|
||||
|
||||
@@ -3021,6 +3191,7 @@ if(InStr(CurrentTab, "login")) ; we're logged out
|
||||
|
||||
|
||||
; Keywords (Tags)
|
||||
; DevModeMsgBox(VideoTags)
|
||||
TooltipThis("Inputting Keywords")
|
||||
XPath = //input[@id='keywords']
|
||||
try driver.FindElementByXPath(Xpath).SendKeys(VideoTags) ;Sends Variable to an Xpath Item
|
||||
@@ -3266,6 +3437,36 @@ if(Status){
|
||||
; try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
|
||||
|
||||
; try driver.findElementsByName("title").item[1].clear()
|
||||
|
||||
Message = Inputting Title
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
loop, 5 { ; sometimes the pre-inserted title doesn't get cleaned out when inputting title
|
||||
|
||||
if(A_index = 5){
|
||||
Message = Failed to input title after 5 attempts.
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
; Return
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
|
||||
Xpath = (//input[@placeholder='Enter text'])[1]
|
||||
try, driver.FindElementByXPath(Xpath).click()
|
||||
|
||||
js = document.querySelector("input[placeholder='Enter text']").value = "%JSVideoTitle%";
|
||||
try driver.executeScript(js)
|
||||
|
||||
Xpath = (//input[@placeholder='Enter text'])[1]
|
||||
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.SPACE)
|
||||
|
||||
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.BackSpace)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Status := Selenium_LoopToSendValueByName(ElementName:="title",NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoTitle)
|
||||
if(Status){
|
||||
Message = Upload Failed: Check Login Status: Failed to Input Title
|
||||
@@ -3274,6 +3475,30 @@ if(Status){
|
||||
Return
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
; get text in title box and see if it matches video title
|
||||
js = return document.querySelector("input[placeholder='Enter text']").value;
|
||||
try CurrentTitle := driver.executeScript(js)
|
||||
; Msgbox % "CurrentTitle: " CurrentTitle
|
||||
|
||||
if(CurrentTitle != VideoTitle){
|
||||
Message = Failed to input title on attempt %A_index%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
sleep, 1000
|
||||
; DevModeMsgBox("title doesn't match")
|
||||
; msgbox, title doesn't match
|
||||
; continue
|
||||
}
|
||||
else,
|
||||
Break
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
; Make a couple attempts to Click on Drop down menu and select the "Education" Category
|
||||
TooltipThis("Selecting Education Category")
|
||||
|
||||
@@ -3450,8 +3675,14 @@ if(StrLen(DailyMotionJSDescription) > 3000){
|
||||
|
||||
|
||||
; Input Video Description
|
||||
|
||||
Message = Inputting Video Description
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
Loop, 15 { ; make a couple attempts to input description
|
||||
TooltipThis("Inputting Video Description`nMight take a couple of attempts due to DailyMotion's code`nAttempt Number:" A_index)
|
||||
Message = Video Description Input Attempt Number: %A_index%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
; TooltipThis("Inputting Video Description")
|
||||
|
||||
try driver.findElementsByName("description").item[1].SendKeys(driver.Keys.Space) ; send an ENTER keystroke to make it register that data has been input and refresh
|
||||
sleep, 500
|
||||
@@ -3460,10 +3691,10 @@ Loop, 15 { ; make a couple attempts to input description
|
||||
|
||||
; try driver.findElementsByName("description").item[1].SendKeys(driver.Keys.SPACE) ;;Clicks Item based on the Element Name
|
||||
|
||||
js = document.getElementsByName('description')[0].value = "%JSVideoDescription%";
|
||||
js = document.querySelector("textarea[placeholder='Enter a description']").value = "%JSVideoDescription%";
|
||||
try driver.executeScript(js)
|
||||
|
||||
try driver.findElementsByName("description").item[1].SendKeys(driver.Keys.Space) ; send an ENTER keystroke to make it register that data has been input and refresh
|
||||
; try driver.findElementsByName("description").item[1].SendKeys(driver.Keys.Space) ; send an ENTER keystroke to make it register that data has been input and refresh
|
||||
|
||||
sleep, 15000 ; Description dissapears for some reason instantly after inputting sometimes
|
||||
try Description := driver.findElementsByName("description").item[1].Attribute("value")
|
||||
@@ -3488,7 +3719,7 @@ Loop, 15 { ; make a couple attempts to input description
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; DevModeMsgBox("done")
|
||||
|
||||
/*
|
||||
; Input Video Description
|
||||
@@ -4005,14 +4236,14 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
|
||||
|
||||
; If LBRY Killer not found, then download it
|
||||
; @todo: Add LBRY kill download functionality from gitea
|
||||
/*
|
||||
|
||||
LBRYKillerPath := LibFolder . "\LBRY Process Killer.exe"
|
||||
if(!FileExist(LBRYKillerPath)){
|
||||
|
||||
; Msgbox % "LBRYKillerPath: " LBRYKillerPath
|
||||
; Msgbox % "LBRYProcessKillerURL: " LBRYProcessKillerURL
|
||||
LBRYKillerPath = %A_ScriptDir%\Lib\LBRY Process Killer.exe
|
||||
LBRYKillerUpdateURL = https://freedomainplaylists.com/wp-content/FreedomainScripts/LBRY`%20Process`%20Killer.exe
|
||||
LBRYKillerUpdateURL = https://git.zinchuk.xyz/attachments/7865dc8d-5aad-4f9f-8a30-94bab0192b1d
|
||||
|
||||
UrlDownloadToFile, %LBRYKillerUpdateURL%, %LBRYKillerPath%
|
||||
; msgbox, work?
|
||||
@@ -4021,7 +4252,7 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
TooltipThis("Uploading Video through API")
|
||||
; Variables of items that need to be replaced before argument is passed to API
|
||||
|
||||
@@ -24,70 +24,66 @@ DevModeMsgBox(Message){
|
||||
}
|
||||
|
||||
|
||||
CheckForUpdates(){
|
||||
CheckForUpdates(GitReleasesAPIURL){
|
||||
; msgbox, checking for updates
|
||||
Message = Checking For Updates
|
||||
SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile")
|
||||
|
||||
data := URLDownloadToVar(GitReleasesAPIURL)
|
||||
; Msgbox % "data: " data
|
||||
|
||||
parsed := JSON.Load(data)
|
||||
|
||||
UpdateVersionNumber := parsed.1.name
|
||||
|
||||
; DevModeMsgBox(UpdateVersionNumber)
|
||||
|
||||
|
||||
; Msgbox % "FreedomScriptsChangelogURL: " FreedomScriptsChangelogURL
|
||||
; Msgbox % "ChangelogIniFilepath: " ChangelogIniFilepath
|
||||
; Msgbox % "ScriptSettingsSectio: " ScriptSettingsSection
|
||||
; Msgbox % "SettingsIniFilepath: " SettingsIniFilepath
|
||||
if(ScriptVersion = UpdateVersionNumber OR ScriptVersion > UpdateVersionNumber){
|
||||
ToolTip
|
||||
return
|
||||
}
|
||||
else, {
|
||||
UpdateAvailable := 1
|
||||
; msgbox, update found!
|
||||
Message = Program Update Found
|
||||
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
|
||||
; IniWrite, 1, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
; ToolTip
|
||||
return
|
||||
}
|
||||
|
||||
UrlDownloadToFile, %FreedomScriptsChangelogURL%, %ChangelogIniFilepath%
|
||||
if(ErrorLevel){
|
||||
Message = Failed to Download Changelog
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
|
||||
IniRead, UpdateVersion, %ChangelogIniFilepath%, %ScriptSettingsSection%, ScriptVersion, %A_Space%
|
||||
if(UpdateVersion = ""){
|
||||
ToolTip
|
||||
; MsgBox, update version is blank.
|
||||
Return
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(ScriptVersion != UpdateVersion){
|
||||
; msgbox, update found!
|
||||
Message = Script Update Found
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
IniWrite, 1, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
|
||||
GuiControl,, UpdateAvailable, Update Available - Click to View
|
||||
}
|
||||
else, {
|
||||
Message = No Updates Found
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
|
||||
}
|
||||
ToolTip
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
UpdateScript(){
|
||||
; Msgbox % "ChangelogIniFilepath: " ChangelogIniFilepath
|
||||
; Msgbox % "ScriptSettingsSection: " ScriptSettingsSection
|
||||
data := URLDownloadToVar(GitReleasesAPIURL)
|
||||
|
||||
IniRead, Changelog, %ChangelogIniFilepath%, %ScriptSettingsSection%, Changelog, %A_Space%
|
||||
Changelog := StrReplace(Changelog, "--", "`n-")
|
||||
parsed := JSON.Load(data)
|
||||
|
||||
IniRead, UpdateVersion, %ChangelogIniFilepath%, %ScriptSettingsSection%, ScriptVersion, %A_Space%
|
||||
UpdateVersionNumber := parsed.1.name
|
||||
ChangeLog := parsed.1.body
|
||||
exename := parsed.1.assets.1.name
|
||||
exeURL := parsed.1.assets.1.browser_download_url
|
||||
|
||||
if(ScriptVersion = UpdateVersion){
|
||||
IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
; Msgbox % "UpdateVersionNumber: " UpdateVersionNumber
|
||||
; msgbox, Version: %Version%
|
||||
; Msgbox % "ChangeLog: " ChangeLog
|
||||
; Msgbox % "exeURL: " exeURL
|
||||
; Msgbox % "exename: " exename
|
||||
|
||||
ExeName := StrReplace(exename, ".exe", "")
|
||||
UpdateExeName = %exename% %UpdateVersionNumber%.exe
|
||||
UpdateExeFilepath = %A_ScriptDir%\%UpdateExeName%
|
||||
|
||||
if(ScriptVersion = UpdateVersionNumber){
|
||||
; IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
MsgBox, You are Up-To-Date
|
||||
; IniRead, UpdateAvailable, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable, 0
|
||||
return
|
||||
}
|
||||
|
||||
Changelog = %ScriptVersion% -> %UpdateVersion%`n`n-%Changelog%
|
||||
Changelog = %ScriptVersion% --> %UpdateVersionNumber%`n%Changelog%
|
||||
|
||||
OnMessage(0x44, "OnMsgBoxUpdateAvailable")
|
||||
MsgBox 0x44, Update Available, %Changelog%
|
||||
@@ -95,13 +91,16 @@ UpdateScript(){
|
||||
|
||||
IfMsgBox Yes, {
|
||||
Return
|
||||
} Else IfMsgBox No, {
|
||||
run, "%FreedomainProgramUpdaterFilepath%" "%ScriptSettingsSection%"
|
||||
; Return
|
||||
ExitApp
|
||||
}
|
||||
return
|
||||
}
|
||||
Else IfMsgBox No, {
|
||||
SaveOrPostProgress(Message:="Downloading Update",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
; Msgbox, downloading to: %A_ScriptDir%\%UpdateExeName%
|
||||
UrlDownloadToFile, %exeURL%, %UpdateExeFilepath%
|
||||
run, "%UpdateExeFilepath%" "%A_ScriptFullPath%"
|
||||
ExitApp
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1020,6 +1019,8 @@ if(TotalTabsFound = 1){
|
||||
|
||||
SaveDriverURL(){ ; save the url of the result page. That way if a tab is not found for a site, we can open up a tab from this tab instead of middle of nowhere. That way we can keep the tabs together
|
||||
try LastWebsitePostURL := driver.URL
|
||||
|
||||
return LastWebsitePostURL
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user