added workaround to send text letter by letter when bitchute fails to input video title with javascript
This commit is contained in:
@@ -31,7 +31,7 @@ global FullScriptName
|
|||||||
|
|
||||||
|
|
||||||
ScriptName = Freedomain Video Uploader
|
ScriptName = Freedomain Video Uploader
|
||||||
ScriptVersion = 3.19
|
ScriptVersion = 3.20
|
||||||
FullScriptName := ScriptName . " - " . ScriptVersion
|
FullScriptName := ScriptName . " - " . ScriptVersion
|
||||||
|
|
||||||
|
|
||||||
@@ -2979,24 +2979,42 @@ CheckForAlerts()
|
|||||||
Message = Inputting Title
|
Message = Inputting Title
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
; Try to input video title and if fail try to login again
|
; Try to input video title, check if input and if not, try again
|
||||||
loop, 5 {
|
loop, 5 {
|
||||||
if(A_index = 5){
|
|
||||||
try CurrentURL := driver.url
|
|
||||||
; CurrentURL := ExtractBaseURL(URL)
|
|
||||||
; currentTabURL := SubStr(currentTabURL, 1, 40)
|
|
||||||
Message = Failed to input Video Title after %A_index% attempts.`nCurrent Tab URL: %currentTabURL%
|
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
||||||
SaveDriverURLOFErrorPage()
|
|
||||||
Return
|
|
||||||
}
|
|
||||||
|
|
||||||
status := js_SendAndCheckWithQuerySelector(Selector:="#title",ValueToCheck:="value",SleepLength:=1000,JSStringText:=VideoTitle)
|
status := js_SendAndCheckWithQuerySelector(Selector:="#title",ValueToCheck:="value",SleepLength:=1000,JSStringText:=VideoTitle)
|
||||||
; Msgbox % "status: " status
|
; Msgbox % "status: " status
|
||||||
|
|
||||||
if(!Status)
|
if(!Status)
|
||||||
break
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(Status){
|
||||||
|
Message = Failed to input Video Title with Javascript. Trying again with Manual Typing
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
Xpath = //input[@id='title']
|
||||||
|
Status := Selenium_TypeTextIntoElement(VideoTitle, Xpath)
|
||||||
|
if(Status){
|
||||||
|
Message = Failed to Input Video Title after trying two different ways. Please try Upload again and double check that the website hasn't been updated in a major way.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar, DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
try, TextInputted := driver.findelementbyxpath(Xpath).Attribute("value") ;XPath: ID=site-title & span tag
|
||||||
|
if(InStr(VideoTitle, TextInputted) OR VideoTitle = TextInputted){
|
||||||
|
; Title got input successfully
|
||||||
|
}
|
||||||
|
else, {
|
||||||
|
Message = Title that got input into Bitchute: %TextInputted%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
Message = Failed to Input Video Title after trying two different ways. Please try Upload again and double check that the website hasn't been updated in a major way.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar, DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Submodule Lib/Freedomain-Posters-Shared-Functions updated: 5d0932c150...c6cf2a408a
@@ -1,148 +0,0 @@
|
|||||||
; Information
|
|
||||||
;----------------------------------------------------------------------------------
|
|
||||||
; This script can be used to connect to your currently active Chrome tab and for quick debugging purposes
|
|
||||||
;---ENVIRONMENT---------------------------------------------------------------------
|
|
||||||
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
|
|
||||||
#SingleInstance, Force
|
|
||||||
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
|
|
||||||
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
|
|
||||||
CoordMode, ToolTip, Screen
|
|
||||||
CoordMode, Mouse, Screen
|
|
||||||
FileEncoding, UTF-8-RAW ; Needed for special symbols that are used in video descritions
|
|
||||||
;---VARIABLES-----------------------------------------------------------------------
|
|
||||||
global driver
|
|
||||||
global DevMode
|
|
||||||
DevMode := 1
|
|
||||||
|
|
||||||
; Get Title of current chrome window so Selenium can find and connect to it
|
|
||||||
WinActivate, ahk_class Chrome_WidgetWin_1
|
|
||||||
WinGetTitle, Chrome_Window_Title, A
|
|
||||||
Chrome_Window_Title := StrSplit(Chrome_Window_Title, " - Chromium")
|
|
||||||
Chrome_Window_Title := Chrome_Window_Title[1]
|
|
||||||
Driver := ConnectToChromeTab("", ConnectActiveTab := 1, ActiveTabTitle := Chrome_Window_Title) ; open new tab page with with specified profile
|
|
||||||
;---MAIN SCRIPT---------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ExitApp
|
|
||||||
Escape::ExitApp
|
|
||||||
|
|
||||||
|
|
||||||
; Libraries - All are included because they call on functions from each other
|
|
||||||
;-----------------------------------------------------------------------------------
|
|
||||||
#include %A_ScriptDir%\..\Lib\Freedomain-Posters-Shared-Functions\StdOutToVar.ahk
|
|
||||||
#Include %A_ScriptDir%\..\Lib\Freedomain-Posters-Shared-Functions\General-Functions.ahk
|
|
||||||
#Include %A_ScriptDir%\..\Lib\Freedomain-Posters-Shared-Functions\Chrome-Functions.ahk
|
|
||||||
#Include %A_ScriptDir%\..\Lib\Freedomain-Posters-Shared-Functions\Selenium-Functions.ahk
|
|
||||||
#Include %A_ScriptDir%\..\Lib\Freedomain-Posters-Shared-Functions\Gitea-Functions.ahk
|
|
||||||
#Include %A_ScriptDir%\..\Lib\Freedomain-Posters-Shared-Functions\API-Functions.ahk
|
|
||||||
#Include %A_ScriptDir%\..\Lib\Freedomain-Posters-Shared-Functions\JSON.ahk
|
|
||||||
#Include %A_ScriptDir%\..\Lib\Freedomain-Posters-Shared-Functions\RunCMD.ahk
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ConnectToChromeTab(URL := "", ConnectActiveTab := 0, WinGetActiveChromeTabTitle := ""){
|
|
||||||
; Msgbox % "WinGetActiveChromeTabTitle: " WinGetActiveChromeTabTitle
|
|
||||||
IP_Port := "127.0.0.1:9222"
|
|
||||||
IP_Port_Nr := RegExReplace(IP_Port, ".*:(\d*)", "$1")
|
|
||||||
if WinExist("ahk_exe Chrome.exe"){
|
|
||||||
WinGet, pid, PID, ahk_exe chrome.exe
|
|
||||||
for item in ComObjGet("winmgmts:").ExecQuery("SELECT * FROM Win32_Process WHERE ProcessId='" pid "'"){
|
|
||||||
if RegExMatch(item.CommandLine, "i)--remote-debugging-port=\K\d+", port){
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Port=""){
|
|
||||||
MsgBox, 36, ,Chrome Needs to be started in debugging mode in order for Autohotkey to connect to it.`nIs it ok to restart Chrome in debugmode to enable a connection?
|
|
||||||
IfMsgBox, Yes
|
|
||||||
{
|
|
||||||
Message = Restarting Chrome in Debug Mode
|
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
|
|
||||||
|
|
||||||
While(WinExist("ahk_exe chrome.exe")) {
|
|
||||||
WinClose, ahk_exe chrome.exe
|
|
||||||
}
|
|
||||||
Process, WaitClose, chrome.exe
|
|
||||||
}
|
|
||||||
Else{
|
|
||||||
Msgbox, 4096, Error, Cannot connect to Chrome profile if it is Not running in debug mode. Script Terminating
|
|
||||||
ExitApp
|
|
||||||
; @todo: Make this error out to the script result screen
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
; Establish Variable with Filepath to be used throughout the script
|
|
||||||
if(ChromeFilepath = ""){
|
|
||||||
if(FileExist("C:\Program Files\Google\Chrome\Application\chrome.exe")){
|
|
||||||
ChromeFilepath = C:\Program Files\Google\Chrome\Application\chrome.exe
|
|
||||||
}
|
|
||||||
else if (FileExist("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")){
|
|
||||||
ChromeFilepath = C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ChromeFilepath = ""){
|
|
||||||
Message = Failed to find chrome.exe in the usual locations.
|
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
|
|
||||||
MsgBox 0x30, Error!, Unable to find Chrome.exe in the usual locations. `nScript Exiting.
|
|
||||||
ExitApp
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!winExist("ahk_exe chrome.exe")){
|
|
||||||
run, %ChromeFilepath% --remote-debugging-port=%IP_Port_Nr% %URL%
|
|
||||||
}
|
|
||||||
|
|
||||||
Driver := ComObjCreate("Selenium.ChromeDriver")
|
|
||||||
Driver.SetCapability("debuggerAddress", IP_Port)
|
|
||||||
try Driver.Start()
|
|
||||||
catch e {
|
|
||||||
|
|
||||||
ShowSeleniumErrorMsgbox()
|
|
||||||
|
|
||||||
} ; end of catch
|
|
||||||
|
|
||||||
if(ConnectActiveTab){
|
|
||||||
try TotalTabsFound := Driver.Windows.Count
|
|
||||||
loop, %TotalTabsFound% {
|
|
||||||
try SeleniumActiveTabTitle := Driver.Title
|
|
||||||
|
|
||||||
; Msgbox % "Title: " Title
|
|
||||||
|
|
||||||
if(InStr(WinGetActiveChromeTabTitle, SeleniumActiveTabTitle)){
|
|
||||||
; msgbox, window match found
|
|
||||||
break
|
|
||||||
}
|
|
||||||
try driver.SwitchToNextWindow ;Focuses Selenium on the newly opened/next window.
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
; Save current chrome version to ini file
|
|
||||||
return Driver
|
|
||||||
}
|
|
||||||
; -------------------------------/SChrome_Get-------------------------------
|
|
||||||
Reference in New Issue
Block a user