From 5f636401858fbdbe42a3b7669d0cc8b2d0de2ce8 Mon Sep 17 00:00:00 2001 From: yuriy Date: Fri, 21 Jun 2024 22:50:29 -0400 Subject: [PATCH] fixed grabbing Locals Video Share Link --- Modules/Locals-Upload.ahk | 23 +++++++++++++++++++---- Modules/Post-To-Discord.ahk | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Modules/Locals-Upload.ahk b/Modules/Locals-Upload.ahk index 5b33c6d..fc416bf 100644 --- a/Modules/Locals-Upload.ahk +++ b/Modules/Locals-Upload.ahk @@ -296,9 +296,9 @@ Loop % VideoTitleArray.Length(){ ; 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) -LongestWordInVideoTitle := longestWord -Msgbox % "LongestWordInVideoTitle: " LongestWordInVideoTitle +; RegExMatch(VideoTitle, "ms)\b\S+(?CFindLongestWordInString)\b(?R)", m) +; LongestWordInVideoTitle := longestWord +; Msgbox % "LongestWordInVideoTitle: " LongestWordInVideoTitle ; MsgBox, Longest word: %longestWord%`, #%wordLength% @@ -307,9 +307,23 @@ Msgbox % "LongestWordInVideoTitle: " LongestWordInVideoTitle ; 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 ; And grab the share URL for it - +/* Message = Looking for - %LongestWordInVideoTitle% - within first 7 posts in order to grab share URL SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") @@ -366,6 +380,7 @@ loop, 7 { ShareLink := } +*/ if(ShareLink = ""){ Message = Video was published succsessfully, but failed to grab Share Link. SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") diff --git a/Modules/Post-To-Discord.ahk b/Modules/Post-To-Discord.ahk index 6ef4784..1605731 100644 --- a/Modules/Post-To-Discord.ahk +++ b/Modules/Post-To-Discord.ahk @@ -55,7 +55,7 @@ if((StrLen(VideoTitle) + StrLen(VideoDescription) + StrLen(Message)) > 2000){ else, DiscordVideoDescription := VideoDescription -Message := "**" . VideoTitle . "**" . "`n" . DiscordVideoDescription . "`n" . Message +Message := "**" . VideoTitle . "**" . "`n" . Message . "`n" . DiscordVideoDescription Status := UploadImageToDiscord(DiscordVideosWebhookURL, Message, VideoThumbFilepath) Message = API Response:`n%Status%