34 lines
750 B
PowerShell
34 lines
750 B
PowerShell
function Save-VideoAsMp3 {
|
|
[CmdletBinding()]
|
|
[alias("2mp3")]
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[String]$Url
|
|
)
|
|
Push-Location ~/Music
|
|
yt-dlp.exe --throttled-rate=40K -N4 --extract-audio --audio-format mp3 $Url
|
|
Pop-Location
|
|
}
|
|
|
|
function Publish-File {
|
|
[CmdletBinding()]
|
|
[alias("ttmsh")]
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[String]$File
|
|
)
|
|
|
|
|
|
$RequestDetails = @{
|
|
Uri = 'https://ttm.sh'
|
|
SessionVariable = 'Session'
|
|
Method = 'POST'
|
|
Form = @{
|
|
file = Get-Item -Path $File
|
|
}
|
|
}
|
|
|
|
$Response = Invoke-WebRequest @RequestDetails
|
|
|
|
$Response.Content
|
|
} |