Fixed Bitchute video link broken by string replace, removed no longer relevant odysee thumbnail Selenium upload code, added extra error logging to discord, added extra check to Tab Switching function

pull/2/head
Yuriy 2 years ago
parent 6ca022c223
commit f7b4a9e04c

@ -931,7 +931,6 @@ UpdateScript:
UpdateScript()
; @todo: Save any changes made to the script before installing update
; Changelog := FindUpdateChangeLog(ScriptUpdateFilepath)
Return
; now defunt, safe to remove
@ -1215,15 +1214,17 @@ KeywordsArray := StrSplit(VideoTags,",")
Gosub, LBRYGetURL
}
if(OdyseeVideoThumb){
/* if(OdyseeVideoThumb){
OdyseeUploadType := "Video"
Gosub, OdyseeVideoThumbUpload
}
if(OdyseeAudioThumb){
*/
/* if(OdyseeAudioThumb){
OdyseeUploadType := "Audio"
Gosub, OdyseeAudioThumbUpload
}
*/
if(LocalsGrabURL OR LocalsURL = "LocalsUploadStartedNeedToGrabURL"){
Gosub, LocalsGrabURL
@ -1489,9 +1490,11 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
; msgbox %SocialMediaPosterFilepath%
run, %SocialMediaPosterFilepath% "%VideoLinksIniFile%"
Return
; Podcast Upload
;------------------------------------------------
/*
*/
; -------------------------------Podcast-------------------------------
UploadPodcast:
CurrentSite := "Podcast"
PodcastTags := StrReplace(PodcastTags, " ,", ",")
@ -1533,6 +1536,9 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
Return
}
}
/*
Sublime Indentation Reset
*/
if(!InStr(MP3AudioFilepath, ".mp3")){
@ -1542,8 +1548,8 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
}
Message = Grabbing MP3 file data
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; Message = Grabbing MP3 file data
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; https://www.autohotkey.com/boards/viewtopic.php?t=59882
@ -1564,6 +1570,7 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
AudioLength_Seconds := ((AudioLengthArray[1] * 60 ) * 60) + (AudioLengthArray[2] * 60) + AudioLengthArray[3]
Message = MP3 Audio Length in Seconds: %TotalTimeInSeconds%
SaveOrPostProgress(Message:="Message",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; AudioLength_Hours := AudioLengthArray[1]
; AudioLength_Minutes := AudioLengthArray[2]
@ -1584,13 +1591,14 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Status := NavigateFromBaseURLTo(FDRRadioURL)
if(Status)
Return
Status := NavigateFromBaseURLTo(FDRRadioURL)
Status := CheckForAlerts()
if(Status){
Message = Upload Failed (E#7295)`nUnable to Navigate to Upload Page`nChrome was closed or Internet down possibly?
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
Message = Logging in
@ -1690,10 +1698,6 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
Xpath = //input[@id='fileSize']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=FIlesizeInBytes)
; Msgbox % "FIlesizeInBytes2: " FIlesiz
; ToolTip
Xpath = //input[@id='lengthHours']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Hours)
@ -1782,16 +1786,10 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
}
}
; Message = Podcast Upload Complete
; msgbox,4096, Done., Input Done.`n`nPlease confirm input and click the final "Save" button.
; ToolTip,
/*
OnMessage(0x44, "OnMsgBoxPodcastFinish")
MsgBox 0x40, Finished!, Input Complete!`n`nPlease confirm input and click the final "Save" button on the page.
OnMessage(0x44, "")
Sublime Indentation Reset
*/
Message = Input Complete! `nPlease Confirm and click Final "Save" Button on Podcast Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -2267,7 +2265,7 @@ if(!InStr(LocalsPostPageURL, "/share/post")){
Status := NavigateFromBaseURLTo(LocalsPostPageURL)
if(Status = "Failed")
if(Status)
Return
/*
@ -2926,13 +2924,8 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
Status := NavigateFromBaseURLTo("https://www.bitchute.com/myupload", "BitChute Video Uploader")
if(Status){
Message = Upload Failed (E#7295)`nUnable to Navigate to Upload Page`nChrome was closed or Internet down possibly?
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
if(Status)
Return
}
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3179,7 +3172,7 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
}
BitChuteURL := "https://www.bitchute.com/" . VideoHref
BitChuteURL := StrReplace(BitchuteURL, "//video", "/")
BitChuteURL := StrReplace(BitchuteURL, "//video", "/video")
; navigate to video page
try driver.Get(BitChuteURL) ;Open selected URL
@ -3227,15 +3220,9 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
CurrentSite := "Brighteon"
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
URLAttempt := NavigateFromBaseURLTo("https://www.brighteon.com/dashboard/video-upload")
if(URLAttempt = "Failed"){
Message = Failed to Navigate to Upload Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Status := NavigateFromBaseURLTo("https://www.brighteon.com/dashboard/video-upload")
if(Status)
Return
}
; try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
JSBrighteonVideoDescription := FormatTextToJSText(VideoDescription)
@ -3674,12 +3661,9 @@ if(DailyMotionParnerUploadPage = ""){
}
Status := NavigateFromBaseURLTo(DailyMotionParnerUploadPage,"Partner HQ - Dailymotion")
if(Status){
SaveDriverURLOFErrorPage()
if(Status)
Return
}
Message = Waiting for Page to Finish Fully Loading
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
@ -3825,7 +3809,7 @@ DailyMotionDescription := VideoDescription
DailyMotionJSDescription := FormatTextToJSText(DailyMotionDescription)
Message = DailyMotionJSDescription String Length := StrLen(DailyMotionJSDescription)
Message := "DailyMotionJSDescription String Length: " . StrLen(DailyMotionJSDescription)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3911,7 +3895,7 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,Disc
; DailyMotion page automtically splits the tags into their little boxes when they're seperated by commas
DailyMotionVideoTags := VideoTags . ","
Message = DailyMotion Video Tags: %DailyMotionVideoTags%
Message = Video Tags: %DailyMotionVideoTags%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = //div[@class='ant-select-selection-search']//input[@role='combobox']
@ -4468,331 +4452,16 @@ Return
; -------------------------------LBRY Thumb---Odysee Thumb-----------------------
OdyseeVideoThumbUpload:
OdyseeAudioThumbUpload:
if(VideoThumbFilepath = "") {
Message = Thumbnail Upload Skipped. Thumbnail Filepath not provided
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
if(OdyseeUploadType = "Audio"){
OdyseeURLToUploadThumbnailFor := OdyseeAudioURL
CurrentSite := "Odysee Audio"
}
if(OdyseeUploadType = "Video"){
OdyseeURLToUploadThumbnailFor := OdyseeVideoURL
CurrentSite := "Odysee Video"
}
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
if(OdyseeUploadType = "Audio" AND OdyseeAudioURL = "")
{
Message = Audio Thumbnail Upload Skipped. OdyseeAudioURL is blank.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
if(OdyseeUploadType = "Video" AND OdyseeVideoURL = "")
{
Message = Video Thumbnail Upload Skipped. OdyseeVideoURL is blank.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
; Msgbox % "LBRYAudioURL: " LBRYAudioURL
; Msgbox % "LBRYUploadType: " LBRYUploadType
; Msgbox % "OdyseeURLToUploadThumbnailFor: " OdyseeURLToUploadThumbnailFor
/*Message = Uploading %OdyseeUploadType% Thumbnail through Odysee. `nNavigating to: %OdyseeURLToUploadThumbnailFor%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
*/
Message = Uploading Thumbnail through Odysee
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
/*try driver.ExecuteScript("window.open();") ;Opens a new Window or tab (Depends on your Chrome Prefs)
catch e {
Message = Failed to Open New Window
}
try driver.SwitchToNextWindow
*/
URLAttempt := NavigateFromBaseURLTo(OdyseeURLToUploadThumbnailFor)
if(URLAttempt = "Failed"){
Message =Unable to Navigate to Video Page (E#2816)`nInternet Connectivity issue or LBRY link not properly grabbed from API`nPlease upload Thumbnail manually at your earliest convenience.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
TooltipThis("Waiting 10 Seconds for Video Page to Fully Load")
sleep, 10000
/*; Check login status
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
try LoginStatus := driver.findelementbyxpath(Xpath).Attribute("innerText") ; Grabb innertext
if(!LoginStatus){
Message = Upload Failed (E#3985)`nLogin Cookies have expired. Please Re-login
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
*/
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
try html := driver.pagesource ; save page's entire HTML to a variable
if(!InStr(HTML, "Edit</span>")){
Message = Upload Failed: Unable to Find Edit Button: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
Message = Clicking "Edit" on PageURL %OdyseeURLToUploadThumbnailFor%
SaveOrPostProgress(Message:=Message,PostType:="DiscordErrorLogging")
; Click Edit button to check if logged in or not.
Xpath = //span[contains(text(),'Edit')]
loop, 3 {
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=5000)
if(Status){
; msgbox, click failed
Sleep, 60000
try driver.executeScript("history.go(0)") ;refresh page
}
else,
Break
}
if(Status){
try CurrentPage := driver.url
Message = Unable to click "Edit" button. Most likely Reason is Video is Still Confirming OR Login Cookies Have Expired.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
/*
; Close the video preview floating window
Xpath = //button[@title='Close']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
*/
; "Use thumbnail upload tool"
TooltipThis("Selecting Thumbnail Upload Tool")
Xpath = //span[contains(text(),'Use thumbnail upload tool')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Thumbnail Upload Failed (E#5617)`nUnable to click on "Use thumbnail upload tool"
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
/*
try CurrentPage := driver.url
Message = Trying to Click Browse for Thumbnail Button on Page: %CurrentPage%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
*/
/*
Xpath = /html/body/div/div/div[1]/main/div/div/section[2]/div/div/fieldset-section/input-submit/button/span/span
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Failed to Click "Browse" button with Direct Xpath to input thumbnail filepath. Trying with Relative
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
}
*/
/*; Select Use Thumbnail upload tool button
Xpath = //span[contains(text(),'Use thumbnail upload tool')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Failed to click "Use Thumbanil Upload Tool"
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
}
*/
/*
Xpath = //div[@class='card__main-actions']//div//span[@class='button__label'][normalize-space()='Browse']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Failed to click "Browse" button using relative and direct Xpath
Xpath = //div[@class='card__main-actions']//div//button[@aria-label='Browse']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Failed to click "Browse" button using Relative Xpath of parent element as well
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
}
*/
/*
Message = Trying to select thumbnail to upload
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
*/
/*
Status := InputFilePathIntoOpenWindow(VideoThumbFilepath)
if(Status)
{
Message = Upload Failed:`nUnable to Find "Open File" window to input filepath into
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
*/
Xpath = //input[@accept='.png, .jpg, .jpeg, .gif']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoThumbFilepath)
if(Status){
Message = Failed to Upload Thumbnail Image
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
; Return
}
; try driver.FindElementByXPath(Xpath).SendKeys(VideoThumbFilepath)
; "Upload thumbnail" popup
; Confirmation Upload Popup - popup box
Xpath = //span[contains(text(),'Upload')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Thumbnail Upload Failed (E#2866)`nUnable to click upload confirmation button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
/*
Xpath = /html/body/div[4]/div/div/div/button[1]/span/span
loop, 15 {
if(A_index = 15){
Message = Thumbnail Upload Failed (E#2866)`nUnable to click upload confirmation button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Break
}
try driver.FindElementByXPath(Xpath).click() ;click on confirmaiton button
catch e {
Sleep, 1000
Continue
}
Break
}
*/
/*; "Upload Complete" Text
Xpath = /html/body/div/div/div[1]/main/div/div/section[2]/div/div/div/div[2]/p
Loop, 15 {
if(A_index = 15){
Message = Thumbnail Upload Failed (E#5580)`nUnable to find upload confirmation text on page.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Break
}
try UploadStatus := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
if(!InStr(UploadStatus, "Complete"))
{
sleep, 2000
Continue
}
Break
}
*/
; sleep, 5000 ; sleep 5 seconds for everything to catch up.
Message = Waiting for Thumbnail to Finish Uploading
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 5000
; Hit the save button
Xpath = //button[@class='button button--primary'] ; Save button popup
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=5000)
if(Status = Failed){
/* Message = Failed to click last "Save" button. Please click it to finalize the upload.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
*/
}
sleep, 5000
; Click off the confirmation popup and Check the "Skip Preview and Confirmation" checkbox
; xpath = //label[normalize-space()='Skip preview and confirmation']
; try SkipPreviewCheck := driver.findelementbyxpath(Xpath).Attribute("innerText") ; Grabb innertext
; if(SkipPreviewCheck != ""){
; Check skip preview checkbox so the box doesn't pop up again
TooltipThis("Checking for Confirmation Popup")
xpath = //label[normalize-space()='Skip preview and confirmation']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
Message = Unchecked "Confirm Edit" on each video Checkbox
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; msgbox ?
; Save Button
Xpath = //button[@aria-label='Save']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=1000)
; }
Message = Thumbnail Uploaded Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
if(OdyseeUploadType = "Video")
IniWrite, Successful, %VideoLinksIniFile%, Misc, OdyseeVideoThumb
if(OdyseeUploadType = "Audio")
IniWrite, Successful, %VideoLinksIniFile%, Misc, OdyseeAudioThumb
; TakeScreenshotOfPage(ScreenShotSavePath)
Return
; ---------------------/LBRY Thumb--------/Odysee Thumb-----------------------
; -------------------------------Rumble-------------------------------
RumbleUpload:
CurrentSite := "Rumble"
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
URLAttempt := NavigateFromBaseURLTo("https://rumble.com/upload.php")
if(URLAttempt)
Status := NavigateFromBaseURLTo("https://rumble.com/upload.php")
if(Status)
Return
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
@ -5116,9 +4785,11 @@ Return
FacebookUpload:
CurrentSite := "Facebook"
SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
URLAttempt := NavigateFromBaseURLTo("https://www.facebook.com/")
if(URLAttempt)
Status := NavigateFromBaseURLTo("https://www.facebook.com/")
if(Status)
Return
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding

@ -1 +1 @@
Subproject commit 89c1042e013f14eda16477c719e9427045ddfa1e
Subproject commit 694c440a6a89b0b84fee0c49370d95150667c7a9
Loading…
Cancel
Save