Skip to content

Commit e86288a

Browse files
committed
add yt-dlp script, unblock reddit host file, modify update-module
1 parent 87381f1 commit e86288a

File tree

3 files changed

+85
-2
lines changed

3 files changed

+85
-2
lines changed

SystemUpgrade.ps1

+6-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,12 @@ function UpdatePowershellModule() {
196196
#>
197197

198198
Write-Host "Checking update for all PowerShell modules..." -ForegroundColor Yellow
199-
Update-Module -AcceptLicense
199+
200+
if (Get-Command -Name pwsh) { # automatically answers yes to all prompt, powershell V7 is installed
201+
Write-Output A | pwsh -c Update-Module
202+
} else {
203+
Update-Module -AcceptLicense
204+
}
200205
}
201206

202207
# user add option to automatically answers yes or half yes or upgrade only

hosts

+29-1
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,32 @@ ff02::3 ip6-allhosts
197197
127.0.0.1 lmlicenses.wip4.adobe.com
198198
127.0.0.1 na2m-pr.licenses.adobe.com
199199
127.0.0.1 wwis-dubc1-vip60.adobe.com
200-
127.0.0.1 workflow-ui-prod.licensingstack.com
200+
127.0.0.1 workflow-ui-prod.licensingstack.com
201+
202+
203+
204+
# ALLOW REDDIT
205+
151.101.41.140 www.reddit.com
206+
207+
151.101.129.140 i.redditmedia.com
208+
52.34.230.181 www.reddithelp.com
209+
151.101.65.140 g.redditmedia.com
210+
151.101.65.140 a.thumbs.redditmedia.com
211+
151.101.1.140 redditgifts.com
212+
151.101.1.140 i.redd.it
213+
151.101.1.140 old.reddit.com
214+
151.101.1.140 new.reddit.com
215+
151.101.129.140 reddit.com
216+
151.101.129.140 gateway.reddit.com
217+
151.101.129.140 oauth.reddit.com
218+
151.101.129.140 sendbird.reddit.com
219+
151.101.129.140 v.redd.it
220+
151.101.1.140 b.thumbs.redditmedia.com
221+
151.101.1.140 events.reddit.com
222+
54.210.123.98 stats.redditmedia.com
223+
151.101.65.140 www.redditstatic.com
224+
151.101.193.140 www.reddit.com
225+
52.3.23.26 pixel.redditmedia.com
226+
151.101.65.140 www.redditmedia.com
227+
151.101.193.140 about.reddit.com
228+
52.203.76.9 out.reddit.com

ytdlpscript.ps1

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
$Path = "~/Downloads"
2+
3+
if (Get-Command -Name yt-dlp) {
4+
return "yt-dlp is not installed on your system or yt-dlp is not recognise as a command."
5+
}
6+
7+
Write-Host "---------------------------------------------------------"
8+
Write-Host " No | Option"
9+
Write-Host "---------------------------------------------------------"
10+
Write-Host " 1. | Download A Video"
11+
Write-Host " 2. | Download A Music Playlist Video"
12+
Write-Host " 3. | Download One Music Video"
13+
Write-Host "---------------------------------------------------------"
14+
Write-Host "Choose number 1 or 2 or 3 ? " -ForegroundColor Red -NoNewline
15+
$Option = Read-Host
16+
17+
Write-Host "`nLink : " -ForegroundColor Red -NoNewline
18+
$Link = Read-Host
19+
20+
21+
if ($Option -eq 1) {
22+
Write-Host "---------------------------------------------------------------------------------------------"
23+
Write-Host " Automated YouTube Downloader Script Using YT-DLP"
24+
Write-Host "---------------------------------------------------------------------------------------------"
25+
Write-Host " --> The best 1080p 'video only' and the best 'audio only' merged <--"
26+
27+
yt-dlp -F $Link
28+
yt-dlp -S "res:1080,ext" -f "bv*+ba/b" $Link -o "$Path/%(title)s.%(ext)s"
29+
}
30+
31+
# For Downloading Music Playlist
32+
if ($Option -eq 2) {
33+
Write-Host "---------------------------------------------------------------------------------------------"
34+
Write-Host " Automated YouTube Downloader Script Using YT-DLP"
35+
Write-Host "---------------------------------------------------------------------------------------------"
36+
Write-Host " --> Download The best 'audio only' format (.m4a) Into A Separate Directory <--"
37+
38+
yt-dlp -F $Link
39+
yt-dlp -f ba[ext=m4a] -o "$Path/%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" $Link
40+
41+
} elseif ($Option -eq 3) {
42+
Write-Host "---------------------------------------------------------------------------------------------"
43+
Write-Host " Automated YouTube Downloader Script Using YT-DLP"
44+
Write-Host "---------------------------------------------------------------------------------------------"
45+
Write-Host " --> Download The Best 'audio only' format (.m4a) <--"
46+
47+
yt-dlp -F $Link
48+
yt-dlp -f ba[ext=m4a] -o "$Path/%(title)s.%(ext)s" $Link
49+
50+
}

0 commit comments

Comments
 (0)