/
AYClient.bat
179 lines (150 loc) · 4.35 KB
/
AYClient.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
@echo off
:: Advanced Youtube Client - AYC
:: Copyright (C) 2024 Adithya S Sekhar
::
:: This program is free software: you can redistribute it and/or modify
:: it under the terms of the GNU General Public License as published by
:: the Free Software Foundation, either version 3 of the License, or
:: (at your option) any later version.
::
:: This program is distributed in the hope that it will be useful,
:: but WITHOUT ANY WARRANTY; without even the implied warranty of
:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
:: GNU General Public License for more details.
::
:: You should have received a copy of the GNU General Public License
:: along with this program. If not, see <https://www.gnu.org/licenses/>.
set ayc.arg1=%1
set ayc.arg2=%2
set ayc.arg3=%3
set aycroot=%cd%
set path=%path%;%aycroot%\resources\bin;%aycroot%\resources\scripts
:begin
call envsetup
call custom
if not defined ayc.arg1 if /i %ytupd_onstart% == 1 start yt-dlpUpdatePopup
:checkParameter
if not defined ayc.arg3 goto checkParameter2
if /i %ayc.arg3% equ "1" set cookie_loaded=0 & call toggleCookie
:checkParameter2
if /i %ayc.arg1%p equ p goto start
if /i %ayc.arg1% equ "b" goto batch
set url=%ayc.arg1%
set url=%url:"=%
if /i %ayc.arg2% == "youtube" goto youtube
if /i %ayc.arg2% == "ytsearch" goto ytsearch
if /i %ayc.arg2% == "generic" goto generic
if /i %ayc.arg2% == "bili" goto bili
if /i %ayc.arg2% == "twitch" goto twitch
:start
call tui windowSize %medium_width% 23
color %theme_colors%
set cleaner_input=null
set url=null
title Saving to %loc%
cls
call tui bannerMedium
echo.
echo - Enter ^(m^) for more options.
echo.
echo - Paste any URL or search term or QuickKey and press Enter.
echo.
if /i %aria2_status% == 0 echo - Multithreaded downloads ^(a^): Disabled
if /i %aria2_status% == 1 echo - Multithreaded downloads ^(a^): Enabled for non-youtube downloads
if /i %aria2_status% == 2 echo - Multithreaded downloads ^(a^): Enabled for all downloads
echo.
echo - QuickKeys: ^(o^) - Open downloads, ^(c^) - Load/Unload cookies.txt, ^(b^) - Batch mode
echo.
if /i %no_cookie_found% == 1 (
echo ! Error: cookies.txt not present in ayc folder.
echo.
)
if /i %cookie_loaded% == 1 (
echo ! Info: cookies.txt loaded. Enter ^(c^) to unload cookie.
echo.
)
if exist cookies.txt if /i %cookie_loaded% == 0 (
echo ! Info: cookies.txt detected but not loaded. Enter ^(c^) to load cookie.
echo.
)
if /i %url_invalid% == 1 (
echo ! %url_validation_msg%
echo.
)
call cleaner "input"
set /p cleaner_input="ayc:/> "
call cleaner "dq"
if /i "%cleaner_input%" equ "null" goto start
if /i "%cleaner_input%" equ "" goto start
if /i "%cleaner_input%" equ " =" goto start
call cleaner "lws"
if not defined cleaner_input goto start
call cleaner "tws"
if not defined cleaner_input goto start
set url=%cleaner_input%
set no_cookie_found=0
call linkValidator "%url%"
if /i %link_validator% == 1 goto linkValid
call quickKeyRedirector "%url%"
if /i %quickkey_validator% == 0 (
set youtube_link=1
start AYClient.bat "%url%" "ytsearch" "%cookie_loaded%"
)
goto start
:linkValid
if /i %youtube_link% == 1 start AYClient.bat "%url%" "youtube" "%cookie_loaded%"
if /i %bilibili_link% == 1 start AYClient.bat "%url%" "bili" "%cookie_loaded%"
if /i %twitch_link% == 1 start AYClient.bat "%url%" "twitch" "%cookie_loaded%"
if /i %generic_link% == 1 start AYClient.bat "%url%" "generic" "%cookie_loaded%"
set url_invalid=0
goto start
:youtube
call youtube
if /i %youtube_download_status% == 1 (
call downloadSuccess
) else (
call downloadError
)
goto exit
:ytsearch
call ytsearch
if /i %youtube_download_status% == 1 (
call downloadSuccess
) else (
call downloadError
)
goto exit
:generic
call generic
if /i %generic_download_status% == 1 (
call downloadSuccess
) else (
call downloadError
)
goto exit
:bili
call bilibili
if /i %bilibili_download_status% == 1 (
call downloadSuccess
) else (
call downloadError
)
goto exit
:twitch
call twitch
if /i %twitch_download_status% == 1 (
call downloadSuccess
) else (
call downloadError
)
goto exit
:batch
call batch
if /i %batch_download_status% == 1 (
call downloadSuccess
) else (
call downloadError
)
goto exit
:exit
exit