-
Notifications
You must be signed in to change notification settings - Fork 0
/
ytdl.ps1
117 lines (98 loc) · 1.98 KB
/
ytdl.ps1
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
#Get-Command ffmpeg
#Get-Command yt-dlp
function Best {
param (
$Arguments
)
Write-Output "best video(mp4) + best audio(m4a) + substitle"
Write-Output "URL: $Video_URL"
yt-dlp `
-f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' `
--embed-thumbnail `
--embed-metadata `
$Arguments
}
function Top {
param (
$Arguments
)
Write-Output "best video + best audio + substitle"
Write-Output "URL: $Video_URL"
yt-dlp `
-f 'bestvideo+bestaudio' `
--write-sub `
--write-auto-sub `
--sub-lang en `
--embed-subs `
$Arguments
}
function Music {
param (
$Arguments
)
Write-Output "downloading music..."
Write-Output "URL: $Video_URL"
yt-dlp `
-o %\(track\)s\ -\ %\(artist\)s.%\(ext\)s `
-f bestaudio `
--extract-audio `
--audio-format mp3 `
--audio-quality 0 `
--embed-thumbnail `
--add-metadata `
--metadata-from-title %\(track\)s\ -\ %\(artist\)s `
$Arguments
}
function Thumbnail {
param (
$Arguments
)
Write-Output "Download thumbnail"
Write-Output "URL: $Video_URL"
yt-dlp `
--write-thumbnail `
--skip-download `
$Arguments
}
function Subtitle {
param (
$Arguments
)
Write-Output "Download Subtitles"
Write-Output "URL: $Video_URL"
yt-dlp `
--write-auto-subs `
--write-subs `
--sub-langs en `
--convert-subtitles srt `
--skip-download `
$Arguments
}
function main {
param (
$Options,
$Video_URL
)
switch ($Options) {
"best" {
Best $Video_URL
}
"top" {
Top $Video_URL
}
"music" {
Music $Video_URL
}
"thumbnail" {
Thumbnail $Video_URL
}
"subtitle" {
Subtitle $Video_URL
}
Default {
yt-dlp $Options
}
}
Write-Output "test"
}
main $args[0] $args[1]