Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dcd947b136 | |||
| 4476bfdda6 | |||
| 5f63640185 | |||
| 6639c907c9 | |||
| 3492ecccee | |||
| 38a579c486 | |||
| 4beb83caa6 | |||
| b98ae5e190 |
@@ -67,7 +67,6 @@ global VideoFilepath
|
|||||||
global VideoThumbFilepath
|
global VideoThumbFilepath
|
||||||
global VideoTags
|
global VideoTags
|
||||||
global VideoDescription
|
global VideoDescription
|
||||||
global SocialMediaDescription
|
|
||||||
global DiscordErrorLoggingWebhookBotURL
|
global DiscordErrorLoggingWebhookBotURL
|
||||||
global DiscordVideosWebhookURL
|
global DiscordVideosWebhookURL
|
||||||
global VideoFolderDir
|
global VideoFolderDir
|
||||||
@@ -464,85 +463,87 @@ if(PassedInArgument2_Action = "Scheduled"){
|
|||||||
; }
|
; }
|
||||||
goto, StartScheduledPost
|
goto, StartScheduledPost
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
|
||||||
|
;---/Read Info From Previous Run And Set Upload Options---
|
||||||
|
;--------------------------------------------------------
|
||||||
|
|
||||||
;---/Read Info From Previous Run And Set Upload Options---
|
if(PassedInArgument2_Action = "ShowResults"){
|
||||||
;--------------------------------------------------------
|
goto, DisplayResults
|
||||||
|
}
|
||||||
if(PassedInArgument2_Action = "ShowResults"){
|
|
||||||
goto, DisplayResults
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; Main GUI Window
|
; Main GUI Window
|
||||||
; ------------------------------------------------
|
; ------------------------------------------------
|
||||||
gosub, SetAndShowMainGUI
|
; Write current project to ini file for easy reloading
|
||||||
|
IniWrite, %BodyTextFilePath%, %SettingsIniFilepath%, %ScriptSettingsSection%, LastPost
|
||||||
|
|
||||||
|
gosub, SetAndShowMainGUI
|
||||||
|
|
||||||
; Write current project to ini file for easy reloading
|
RunTimeToShowGui := round(((A_TickCount - UStartTime) / 1000), 2)
|
||||||
IniWrite, %BodyTextFilePath%, %SettingsIniFilepath%, %ScriptSettingsSection%, LastPost
|
|
||||||
|
|
||||||
|
Return
|
||||||
|
|
||||||
RunTimeToShowGui := round(((A_TickCount - UStartTime) / 1000), 2)
|
; -------------------------------GUI GoSubs-------------------------------
|
||||||
|
; Kill the script if user clicks on cancel button
|
||||||
|
KillScript:
|
||||||
|
; GuiClose:
|
||||||
|
ExitApp
|
||||||
|
Return
|
||||||
|
|
||||||
Return
|
PauseScript:
|
||||||
|
Pause,Toggle
|
||||||
|
Return
|
||||||
|
|
||||||
; -------------------------------GUI GoSubs-------------------------------
|
CancelPost:
|
||||||
; Kill the script if user clicks on cancel button
|
GuiClose:
|
||||||
KillScript:
|
; ExitApp
|
||||||
; GuiClose:
|
Gui, Submit,
|
||||||
ExitApp
|
Return
|
||||||
Return
|
|
||||||
|
|
||||||
PauseScript:
|
ReloadScript:
|
||||||
Pause,Toggle
|
Reload
|
||||||
Return
|
Return
|
||||||
|
|
||||||
CancelPost:
|
; Gets activated each time that text gets input into any of the text boxes
|
||||||
GuiClose:
|
; updates the variables with the new text
|
||||||
; ExitApp
|
UpdateVars:
|
||||||
Gui, Submit,
|
Gui, Submit, NoHide
|
||||||
Return
|
Return
|
||||||
|
|
||||||
ReloadScript:
|
SubmitDescription:
|
||||||
Reload
|
Gui, Submit, NoHide
|
||||||
Return
|
DescriptionCharCount := StrLen(VideoDescription)
|
||||||
|
GuiControl,, DescriptionCharCount, %DescriptionCharCount%
|
||||||
; Gets activated each time that text gets input into any of the text boxes
|
Return
|
||||||
; updates the variables with the new text
|
|
||||||
UpdateVars:
|
|
||||||
Gui, Submit, NoHide
|
|
||||||
Return
|
|
||||||
|
|
||||||
SubmitDescription:
|
|
||||||
Gui, Submit, NoHide
|
|
||||||
DescriptionCharCount := StrLen(VideoDescription)
|
|
||||||
GuiControl,, DescriptionCharCount, %DescriptionCharCount%
|
|
||||||
Return
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; Open folder of the project
|
; Open folder of the project
|
||||||
OpenProjectFolder:
|
OpenProjectFolder:
|
||||||
run, %VideoFolderDir%
|
if(FileExist(VideoFolderDir))
|
||||||
Return
|
run, %VideoFolderDir%
|
||||||
|
else,
|
||||||
|
msgbox, Cannot Open Folder as it no longer exists at:`n%VideoFolderDir%
|
||||||
|
Return
|
||||||
|
|
||||||
ClearVideoLinks:
|
ClearVideoLinks:
|
||||||
FileDelete, %VideoLinksIniFile%
|
FileDelete, %VideoLinksIniFile%
|
||||||
Return
|
Return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ToggleTestingMode:
|
ToggleTestingMode:
|
||||||
ToggleTestingMode()
|
ToggleTestingMode()
|
||||||
run, "%A_ScriptFullPath%" "LastPost"
|
run, "%A_ScriptFullPath%" "LastPost"
|
||||||
Return
|
Return
|
||||||
|
|
||||||
ToggleDevMode:
|
ToggleDevMode:
|
||||||
ToggleDevMode()
|
ToggleDevMode()
|
||||||
run, "%A_ScriptFullPath%" "LastPost"
|
run, "%A_ScriptFullPath%" "LastPost"
|
||||||
Return
|
Return
|
||||||
|
|
||||||
/*
|
/*
|
||||||
OpenGiteaPage:
|
OpenGiteaPage:
|
||||||
@@ -618,19 +619,6 @@ Return
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
CreateDescriptionForSocialMedia(){
|
|
||||||
SplitText = Free Documentaries:
|
|
||||||
|
|
||||||
SocialMediaDescription := StrSplit(VideoDescription, SplitText)
|
|
||||||
SocialMediaDescription := SocialMediaDescription[1]
|
|
||||||
|
|
||||||
if(strlen(SocialMediaDescription) > 1400){
|
|
||||||
SocialMediaDescription := SubStr(SocialMediaDescription, 1, 1400)
|
|
||||||
SocialMediaDescription .= "..."
|
|
||||||
}
|
|
||||||
|
|
||||||
Return
|
|
||||||
}
|
|
||||||
; -------------------------------Upload Video Functionality-------------------------------
|
; -------------------------------Upload Video Functionality-------------------------------
|
||||||
StartScript:
|
StartScript:
|
||||||
WinGetPos, XPosition, YPosition, , , A
|
WinGetPos, XPosition, YPosition, , , A
|
||||||
@@ -1190,6 +1178,10 @@ Return
|
|||||||
; ------------------------------------------------
|
; ------------------------------------------------
|
||||||
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Shared-GoTos.ahk
|
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Shared-GoTos.ahk
|
||||||
|
|
||||||
|
; Special Website Functions
|
||||||
|
; ------------------------------------------------
|
||||||
|
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Locals-Functions.ahk
|
||||||
|
|
||||||
; GUI Windows
|
; GUI Windows
|
||||||
; ------------------------------------------------
|
; ------------------------------------------------
|
||||||
#include C:\Users\%A_Username%\Syncthing\Git\Freedomain-Video-Uploader\Modules\GUI-Main-Window.ahk
|
#include C:\Users\%A_Username%\Syncthing\Git\Freedomain-Video-Uploader\Modules\GUI-Main-Window.ahk
|
||||||
|
|||||||
Submodule Lib/Freedomain-Posters-Shared-Functions updated: a3d89a9892...e654611bf3
@@ -200,8 +200,6 @@ Gui, Add, Button, x+%MarginSize% w%EditBoxFourthWidths% h%SecondaryButtonHeights
|
|||||||
|
|
||||||
Gui, Add, Button, x+%MarginSize% w%EditBoxHalfWidths% h%SecondaryButtonHeights% gScheduleUpload, Schedule for Later
|
Gui, Add, Button, x+%MarginSize% w%EditBoxHalfWidths% h%SecondaryButtonHeights% gScheduleUpload, Schedule for Later
|
||||||
|
|
||||||
; Gui, Add, Button, w%EditBoxFourthWidths% x%MarginSize% y+%MarginSize% h%SecondaryButtonHeights% gOpenProjectFolder, Open New Project
|
|
||||||
|
|
||||||
Gui, Add, Button, w%EditBoxFourthWidths% h%SecondaryButtonHeights% x%MarginSize% y+%MarginSize% vChromeUpdateAvailable gUpdateChrome, Chrome Up-to-Date
|
Gui, Add, Button, w%EditBoxFourthWidths% h%SecondaryButtonHeights% x%MarginSize% y+%MarginSize% vChromeUpdateAvailable gUpdateChrome, Chrome Up-to-Date
|
||||||
|
|
||||||
Gui, Add, Button, x+%MarginSize% yp+0 w%EditBoxFourthWidths% h%SecondaryButtonHeights% gDisplayResults, View Status
|
Gui, Add, Button, x+%MarginSize% yp+0 w%EditBoxFourthWidths% h%SecondaryButtonHeights% gDisplayResults, View Status
|
||||||
@@ -210,6 +208,9 @@ Gui, Add, Button, x+%MarginSize% w%EditBoxHalfWidths% h%SecondaryButtonHeights%
|
|||||||
Gui, Add, Button, w%EditBoxFourthWidths% h%SecondaryButtonHeights% x%MarginSize% y+%MarginSize% vPostSchedulerUpdateAvailable gUpdatePostScheduler, Post Scheduler Up-To-Date
|
Gui, Add, Button, w%EditBoxFourthWidths% h%SecondaryButtonHeights% x%MarginSize% y+%MarginSize% vPostSchedulerUpdateAvailable gUpdatePostScheduler, Post Scheduler Up-To-Date
|
||||||
; Gui, Add, Button, w%EditBoxFourthWidths% h%SecondaryButtonHeights% x%MarginSize% y+%MarginSize% vPostSchedulerUpdateAvailable, Post Scheduler Up-To-Date
|
; Gui, Add, Button, w%EditBoxFourthWidths% h%SecondaryButtonHeights% x%MarginSize% y+%MarginSize% vPostSchedulerUpdateAvailable, Post Scheduler Up-To-Date
|
||||||
|
|
||||||
|
Gui, Add, Button, x+%MarginSize% w%EditBoxFourthWidths% h%SecondaryButtonHeights%
|
||||||
|
Gui, Add, Button, x+%MarginSize% w%EditBoxHalfWidths% h%SecondaryButtonHeights% gReloadScript, Open New Project
|
||||||
|
|
||||||
|
|
||||||
if(DevMode){
|
if(DevMode){
|
||||||
Gui, Add, Button, x%MarginSize% w%EditBoxFourthWidths% h30 y+5 h%SecondaryButtonHeights% gOpenErrorLog, Open ErrorLog
|
Gui, Add, Button, x%MarginSize% w%EditBoxFourthWidths% h30 y+5 h%SecondaryButtonHeights% gOpenErrorLog, Open ErrorLog
|
||||||
@@ -432,7 +433,7 @@ Gui, Add, Button, x%MarginSize% w%ResultsEditAndCopyButtonWidth% h%SecondaryButt
|
|||||||
; Error Log Column
|
; Error Log Column
|
||||||
; ------------------------------------------------
|
; ------------------------------------------------
|
||||||
Gui, Font, s%GuiFontSize%
|
Gui, Font, s%GuiFontSize%
|
||||||
Gui, Add, Button, x+%MarginSize% y%MarginSize% w%ErrorLogEditBoxWidth% h%ButtonHeights% y%MarginSize%, Error Log
|
Gui, Add, Button, x+%MarginSize% y%MarginSize% w%ErrorLogEditBoxWidth% h%ButtonHeights% y%MarginSize% gOpenErrorLog, Error Log (Click to Open Detailed Log)
|
||||||
Gui, Add, Edit,x%ErrorLogEditBoxXPos% h%ErrorLogEditBoxHeight% w%ErrorLogEditBoxWidth% y+10, %ErrorLogVar%
|
Gui, Add, Edit,x%ErrorLogEditBoxXPos% h%ErrorLogEditBoxHeight% w%ErrorLogEditBoxWidth% y+10, %ErrorLogVar%
|
||||||
|
|
||||||
gui, font, Normal
|
gui, font, Normal
|
||||||
|
|||||||
@@ -100,6 +100,14 @@ Loop, 5 {
|
|||||||
sleep, 2000
|
sleep, 2000
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; click the "Hide Links Preview" checkbox to hide previews of hyperlinks
|
||||||
|
if(InStr(VideoDescription, "https")){
|
||||||
|
Xpath = (//div[@class='hide-switcher-container'])[1]
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
; SaveOrPostProgress(Message:="Waiting Video to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
|
; SaveOrPostProgress(Message:="Waiting Video to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
Message = Uploading Video File
|
Message = Uploading Video File
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
@@ -112,6 +120,17 @@ if(Status){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; make sure the "Notify Users" checkbox is selected
|
||||||
|
Xpath = (//input[contains(@name,'is_do_promo')])[1]
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=1000)
|
||||||
|
try, Status := driver.findelementbyxpath(Xpath).isSelected()
|
||||||
|
if(Status = "0"){
|
||||||
|
Message = Failed to Check ON the Notify Users Checkbox
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; check if the "Auto Submit Post" checkbox is checked, and if not check it
|
; check if the "Auto Submit Post" checkbox is checked, and if not check it
|
||||||
js = return document.querySelector("#autosubmit_enabled").checked;
|
js = return document.querySelector("#autosubmit_enabled").checked;
|
||||||
try AutoSubmitstatus := driver.executeScript(js)
|
try AutoSubmitstatus := driver.executeScript(js)
|
||||||
@@ -288,9 +307,9 @@ Loop % VideoTitleArray.Length(){
|
|||||||
|
|
||||||
|
|
||||||
; get longest word in video title to use for grabbing the share link from the raw page
|
; get longest word in video title to use for grabbing the share link from the raw page
|
||||||
RegExMatch(VideoTitle, "ms)\b\S+(?CFindLongestWordInString)\b(?R)", m)
|
; RegExMatch(VideoTitle, "ms)\b\S+(?CFindLongestWordInString)\b(?R)", m)
|
||||||
LongestWordInVideoTitle := longestWord
|
; LongestWordInVideoTitle := longestWord
|
||||||
Msgbox % "LongestWordInVideoTitle: " LongestWordInVideoTitle
|
; Msgbox % "LongestWordInVideoTitle: " LongestWordInVideoTitle
|
||||||
|
|
||||||
; MsgBox, Longest word: %longestWord%`, #%wordLength%
|
; MsgBox, Longest word: %longestWord%`, #%wordLength%
|
||||||
|
|
||||||
@@ -299,9 +318,23 @@ Msgbox % "LongestWordInVideoTitle: " LongestWordInVideoTitle
|
|||||||
|
|
||||||
; Grab Video Share Link From Page Source
|
; Grab Video Share Link From Page Source
|
||||||
; ------------------------------------------------
|
; ------------------------------------------------
|
||||||
|
ShareLink := GrabLocalsPostURLUsingTitle(VideoTitle)
|
||||||
|
|
||||||
|
if(!InStr(ShareLink, "https")){
|
||||||
|
Message = Couldn't find Video Share link in the first 10 posts. Is the video possibly still uploading?
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
; Msgbox % "ShareLink: " ShareLink
|
||||||
|
|
||||||
|
; Msgbox % "LocalsVideoURL: " LocalsVideoURL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; Iterate over the last couple of posts, find the post with the title that contains the Longest word from the uploaded video
|
; Iterate over the last couple of posts, find the post with the title that contains the Longest word from the uploaded video
|
||||||
; And grab the share URL for it
|
; And grab the share URL for it
|
||||||
|
/*
|
||||||
Message = Looking for - %LongestWordInVideoTitle% - within first 7 posts in order to grab share URL
|
Message = Looking for - %LongestWordInVideoTitle% - within first 7 posts in order to grab share URL
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
@@ -358,6 +391,7 @@ loop, 7 {
|
|||||||
ShareLink :=
|
ShareLink :=
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
if(ShareLink = ""){
|
if(ShareLink = ""){
|
||||||
Message = Video was published succsessfully, but failed to grab Share Link.
|
Message = Video was published succsessfully, but failed to grab Share Link.
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
|||||||
@@ -13,23 +13,11 @@ if(DiscordVideosWebhookURL = ""){
|
|||||||
Msgbox, Unable to Grab DiscordVideosWebhookURL from %SettingsIniFilepath%.`nPlease input the URL and then try again.
|
Msgbox, Unable to Grab DiscordVideosWebhookURL from %SettingsIniFilepath%.`nPlease input the URL and then try again.
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
; If description is longer than 2k chars, then API will error out. goto section that will allow user to edit video description to shorten it for posting
|
|
||||||
if(StrLen(SocialMediaDescription) > 2000 AND VideoDescriptionForVideosChannel = ""){
|
|
||||||
Goto, CreateDescriptionForVideosPosting
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
if(SocialMediaDescription = ""){
|
|
||||||
CreateDescriptionForSocialMedia()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SubmitDescriptionForDiscordVideosChannel:
|
|
||||||
Message := "**" . VideoTitle . "**" . "`n" . SocialMediaDescription . "`n"
|
|
||||||
; https://stackoverflow.com/questions/63160401/how-to-create-hyperlink-in-discord-in-an-embed-in-general
|
; https://stackoverflow.com/questions/63160401/how-to-create-hyperlink-in-discord-in-an-embed-in-general
|
||||||
|
|
||||||
|
|
||||||
|
Message :=
|
||||||
|
|
||||||
if(BitChuteURL != "")
|
if(BitChuteURL != "")
|
||||||
Message .= "[BitChute](<" . BitChuteURL . ">) \| "
|
Message .= "[BitChute](<" . BitChuteURL . ">) \| "
|
||||||
|
|
||||||
@@ -55,8 +43,23 @@ if(PodcastNumber != "")
|
|||||||
Message .= "[FDRPodcasts](<" . "https://fdrpodcasts.com/" . PodcastNumber . ">) \| "
|
Message .= "[FDRPodcasts](<" . "https://fdrpodcasts.com/" . PodcastNumber . ">) \| "
|
||||||
|
|
||||||
|
|
||||||
UploadImageToDiscord(DiscordVideosWebhookURL, Message, VideoThumbFilepath)
|
; StrLenOfDiscordMessage :=
|
||||||
|
|
||||||
|
; trim the video description if Title + Body + Links is longer than 2000 chars
|
||||||
|
if((StrLen(VideoTitle) + StrLen(VideoDescription) + StrLen(Message)) > 2000){
|
||||||
|
|
||||||
|
DiscordAPICharsLeft := 2000 - StrLen(VideoTitle) - StrLen(Message) - 15
|
||||||
|
|
||||||
|
DiscordVideoDescription := SubStr(VideoDescription, 1, DiscordAPICharsLeft) . "..."
|
||||||
|
}
|
||||||
|
else,
|
||||||
|
DiscordVideoDescription := VideoDescription
|
||||||
|
|
||||||
|
Message := "**" . VideoTitle . "**" . "`n" . Message . "`n" . DiscordVideoDescription
|
||||||
|
|
||||||
|
Status := UploadImageToDiscord(DiscordVideosWebhookURL, Message, VideoThumbFilepath)
|
||||||
|
Message = API Response:`n%Status%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
|
||||||
SaveOrPostProgress(Message:="Video Links posted to #Videos Successfully.",PostType:="Tooltip,ErrorLoggingTextFile")
|
SaveOrPostProgress(Message:="Video Links posted to #Videos Successfully.",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|||||||
@@ -83,6 +83,11 @@ StrLenOfMessageAndVideoLinks := StrLen(TelegramVideoTitle) + StrLen(TelegramBody
|
|||||||
; ------------------------------------------------
|
; ------------------------------------------------
|
||||||
if(StrLenOfMessageAndVideoLinks < 1024) {
|
if(StrLenOfMessageAndVideoLinks < 1024) {
|
||||||
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramMessage ) ; you could add more options; compare the Telegram API docs
|
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramMessage ) ; you could add more options; compare the Telegram API docs
|
||||||
|
|
||||||
|
; Output returned data to ErrorLog File
|
||||||
|
Message = API Response:`n%Status%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||||
|
|
||||||
if(InStr(Status, "error_code")){
|
if(InStr(Status, "error_code")){
|
||||||
Message = Telegram Post Failed due to an API Issue. Error was saved to ErrorLogging file. Please send it to Yuriy.
|
Message = Telegram Post Failed due to an API Issue. Error was saved to ErrorLogging file. Please send it to Yuriy.
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
@@ -104,48 +109,59 @@ if(StrLenOfMessageAndVideoLinks < 4096){
|
|||||||
; Photo and Video Title go into SendPhoto
|
; Photo and Video Title go into SendPhoto
|
||||||
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
|
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
|
||||||
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
|
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
|
||||||
|
; Output returned data to ErrorLog File
|
||||||
|
Message = API Response:`n%Status%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||||
|
|
||||||
; Video Description goes into TelegramMessage
|
; Video Description goes into TelegramMessage
|
||||||
Status2 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessage)
|
Status := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessage)
|
||||||
|
; Output returned data to ErrorLog File
|
||||||
} else, {
|
Message = API Response:`n%Status%
|
||||||
; If Title, links and message are longer than 4096 chars, we need to split them into multiple messages
|
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||||
; ------------------------------------------------
|
|
||||||
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
|
|
||||||
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
|
|
||||||
|
|
||||||
|
|
||||||
; Split the Description into 4096 character chunks while preserving sentences
|
} else, {
|
||||||
; Used 4095 because a ". " has to be put in at the end of the chunk.
|
; If Title, links and message are longer than 4096 chars, we need to split them into multiple messages
|
||||||
VideoDescriptionChunks := SplitStringWithSentences(TelegramBodymessage, 4094)
|
; ------------------------------------------------
|
||||||
|
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
|
||||||
|
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
|
||||||
|
|
||||||
|
|
||||||
; go through array and post each chunk as new message
|
; Split the Description into 4096 character chunks while preserving sentences
|
||||||
Loop % VideoDescriptionChunks.Length(){
|
; Used 4095 because a ". " has to be put in at the end of the chunk.
|
||||||
; ArrayItem := ARRAY[A_Index]
|
VideoDescriptionChunks := SplitStringWithSentences(TelegramBodymessage, 4094)
|
||||||
Description := VideoDescriptionChunks[A_Index]
|
|
||||||
|
|
||||||
|
|
||||||
SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := Description)
|
; go through array and post each chunk as new message
|
||||||
; Clipboard := Description
|
Loop % VideoDescriptionChunks.Length(){
|
||||||
; msgbox % Description
|
; ArrayItem := ARRAY[A_Index]
|
||||||
|
Description := VideoDescriptionChunks[A_Index]
|
||||||
|
|
||||||
}
|
|
||||||
|
Status := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := Description)
|
||||||
|
; Output returned data to ErrorLog File
|
||||||
|
Message = API Response:`n%Status%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
; Clipboard := Description
|
||||||
|
; msgbox % Description
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
; SaveOrPostProgress(Message:="Video Links posted to #Videos Successfully.",PostType:="Tooltip,ErrorLoggingTextFile")
|
; SaveOrPostProgress(Message:="Video Links posted to #Videos Successfully.",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
Message = Video Links Posted to Telegram Successfully
|
Message = Video Links Posted to Telegram Successfully
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
GuiControl,, PostToTelegramButton, Telegram - Posted Successfully
|
GuiControl,, PostToTelegramButton, Telegram - Posted Successfully
|
||||||
|
|
||||||
|
|
||||||
; sleep, 2000
|
; sleep, 2000
|
||||||
|
|
||||||
|
|
||||||
ToolTip
|
ToolTip
|
||||||
CurrentSite :=
|
CurrentSite :=
|
||||||
Return
|
Return
|
||||||
; -------------------------------/Telegram-------------------------------
|
; -------------------------------/Telegram-------------------------------
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ try CurrentURL := driver.URL
|
|||||||
if(InStr(CurrentURL, "/login.php")){
|
if(InStr(CurrentURL, "/login.php")){
|
||||||
|
|
||||||
if(AutoLogin){
|
if(AutoLogin){
|
||||||
Message = Logging in Automatically by clicking into the UN+PW fields for info to register
|
Message = Trying to Log in Automatically by clicking into the UN+PW fields for info to register from Password Manager
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
; have to click into username and password field for page to register that there's input
|
; have to click into username and password field for page to register that there's input
|
||||||
@@ -39,11 +39,12 @@ if(InStr(CurrentURL, "/login.php")){
|
|||||||
js = document.querySelector("button[type='submit']").click();
|
js = document.querySelector("button[type='submit']").click();
|
||||||
driver.executeScript(js)
|
driver.executeScript(js)
|
||||||
|
|
||||||
|
|
||||||
; Do a double check to make sure that login worked
|
; Do a double check to make sure that login worked
|
||||||
Message = Checking Login Status
|
Message = Checking Login Status
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
sleep, 5000
|
||||||
|
|
||||||
try CurrentURL := driver.URL
|
try CurrentURL := driver.URL
|
||||||
|
|
||||||
if(!InStr(CurrentURL, "/upload")){
|
if(!InStr(CurrentURL, "/upload")){
|
||||||
@@ -67,11 +68,10 @@ if(InStr(CurrentURL, "/login.php")){
|
|||||||
sleep, 5000
|
sleep, 5000
|
||||||
}
|
}
|
||||||
|
|
||||||
; CheckForAlerts()
|
|
||||||
|
|
||||||
Message = Uploading Video File
|
Message = Uploading Video File
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
|
||||||
|
|
||||||
Xpath = //input[@id='Filedata']
|
Xpath = //input[@id='Filedata']
|
||||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath)
|
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath)
|
||||||
@@ -84,6 +84,9 @@ if(Status){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Message = Inputting Video Information
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
; Input Title
|
; Input Title
|
||||||
try driver.findElementsByName("title").item[1].SendKeys(VideoTitle) ;selects element based on Name and sends variable to it.
|
try driver.findElementsByName("title").item[1].SendKeys(VideoTitle) ;selects element based on Name and sends variable to it.
|
||||||
catch e {
|
catch e {
|
||||||
@@ -117,30 +120,22 @@ Loop, 5 { ; Attempt to input video description a couple of times
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; Input Primary Category
|
||||||
|
Xpath = (//input[@placeholder='- Primary category -'])[1]
|
||||||
|
try, driver.FindElementByXPath(Xpath).SendKeys("Podcasts").SendKeys(driver.Keys.ENTER)
|
||||||
; sleep, 5000
|
|
||||||
|
|
||||||
|
|
||||||
Message = Selecting Channel
|
Message = Selecting Channel
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; try driver.findElementsByID("channelId").item[1].click()
|
|
||||||
|
|
||||||
; @todo replace with regex
|
; @todo replace with regex
|
||||||
js = return document.querySelector("#channelId").innerHTML;
|
js = return document.querySelector("#channelId").innerHTML;
|
||||||
try, ChannelIDNumber := driver.executeScript(js)
|
try, ChannelIDNumber := driver.executeScript(js)
|
||||||
; Msgbox % "ChannelIDNumber: " ChannelIDNumber
|
; Msgbox % "ChannelIDNumber: " ChannelIDNumber
|
||||||
ChannelIDNumber := StrSplit(ChannelIDNumber, "option value=")
|
ChannelIDNumber := StrSplit(ChannelIDNumber, "option value=")
|
||||||
|
|
||||||
; Msgbox % "ChannelIDNumber: " ChannelIDNumber
|
|
||||||
|
|
||||||
ChannelIDNumber := ChannelIDNumber[3]
|
ChannelIDNumber := ChannelIDNumber[3]
|
||||||
; Msgbox % "ChannelIDNumber: " ChannelIDNumber
|
|
||||||
|
|
||||||
SingleQuote = "
|
SingleQuote = "
|
||||||
ChannelIDNumber := StrSplit(ChannelIDNumber, "data-private")
|
ChannelIDNumber := StrSplit(ChannelIDNumber, "data-private")
|
||||||
ChannelIDNumber := ChannelIDNumber[1]
|
ChannelIDNumber := ChannelIDNumber[1]
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
[Video-Uploader]
|
[Video-Uploader]
|
||||||
Version=3.37
|
Version=3.39
|
||||||
Name=Freedomain Video Uploader
|
Name=Freedomain Video Uploader
|
||||||
|
|||||||
Reference in New Issue
Block a user