Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#CHECK THE PATH ON LINE 2 and the FEED on LINE 3
cd "C:\users\scott\Downloads"
$a = ([xml](new-object net.webclient).downloadstring("https://channel9.msdn.com/Series/CSharp-101/feed/mp4"))
$a.rss.channel.item | foreach{
$url = New-Object System.Uri($_.enclosure.url)
$file = $url.Segments[-1]
$file
if (!(test-path $file)) {
(New-Object System.Net.WebClient).DownloadFile($url, $file)
}
}
@ArkNieckarz

This comment has been minimized.

Copy link

ArkNieckarz commented Sep 29, 2019

# This will download high quality mp4 video files, ~1.14GB in total!!!
# Prepend sequence numbers to each file.
#CHECK THE PATH ON LINE 2 and the FEED on LINE 3
cd "c:\TEMP"
$a = ([xml](new-object net.webclient).downloadstring("https://channel9.msdn.com/Series/CSharp-101/feed/mp4"))
$cnt = 20
$a.rss.channel.item | foreach{  
    $url = New-Object System.Uri($_.enclosure.url)
    $file = $url.Segments[-1]
    $cnt = $cnt - 1
    $file_name = "$cnt" + "_" + $file
    if (!(test-path $file)) {
    $f = $url.OriginalString
    $n = $f.Replace(".mp4", "_high.mp4")
        echo $n, $file_name
        (New-Object System.Net.WebClient).DownloadFile($n, $file_name)
    }
}
@liuning0820

This comment has been minimized.

Copy link

liuning0820 commented Sep 29, 2019

#CHECK THE PATH ON LINE 2 and the FEED on LINE 3
cd "$env:USERPROFILE\Downloads"

@MarioBinder

This comment has been minimized.

Copy link

MarioBinder commented Oct 22, 2019

Import-Module BitsTransfer

$path =  $env:USERPROFILE + "\Downloads\"
$feedContent = ([xml](new-object net.webclient).downloadstring("https://channel9.msdn.com/Series/CSharp-101/feed/mp4"))
$cnt = 20
$feedContent.rss.channel.item | foreach{  
    $url = New-Object System.Uri($_.enclosure.url)
    $file = $url.Segments[-1]
    $cnt = $cnt - 1
    $file_name = $path + "$cnt" + "_" + $file
    if (!(test-path $file)) {
        $f = $url.OriginalString
        $n = $f.Replace(".mp4", "_high.mp4")
            echo $n, $file_name
            Start-BitsTransfer -Source $n -Destination $file_name           
    }
}
@KUTlime

This comment has been minimized.

Copy link

KUTlime commented Oct 26, 2019

General, more robust, more PS way. Suitable for building a collection of favourite shows/series, e.g. for home entertainment system.

function Update-dotNETVideo
{
    [CmdletBinding()]
    param (
        # A path to subtitle file of folder where the subtitles are located.
        [Parameter(Mandatory = $true,
            ValueFromPipeline = $true,
            ValueFromPipelineByPropertyName = $true,
            ValueFromRemainingArguments = $false,
            Position = 0,
            ParameterSetName = 'Basic')]
        [ValidateNotNullOrEmpty()]
        [ValidateScript( {
                if ( -Not ($_ | Test-Path) )
                {
                    throw "The path does not exist."
                }
                return $true
            })]
        [System.IO.FileInfo]
        $Path,

        # A show-to-download name.
        [Parameter(Mandatory = $true,
            ValueFromPipeline = $true,
            ValueFromPipelineByPropertyName = $true,
            ValueFromRemainingArguments = $false,
            Position = 1)]
        [ValidateNotNullOrEmpty()]
        [String]
        $Name,

        # A switch for high quality video download
        [Parameter(Mandatory = $false)]
        [Switch]
        $HighQuality

    )
    Process
    {
        if(!(Test-Path -Path "$Path\$Name"))
        {
            New-Item -Path $Path -Name $Name -ItemType Directory -Force | Write-Verbose
        }
        Set-Location -Path "$Path\$Name"

        if ($HighQuality)
        {
            $suffix = "high"
        }
        $urlToRss = "https://channel9.msdn.com/Series/$Name/feed/mp4$suffix"
        try
        {
            ([System.Net.WebRequest]::Create($urlToRss)).GetResponse() | Write-Verbose # Test if it is show or series.
        }
        catch
        {
            $urlToRss = "https://channel9.msdn.com/Shows/$Name/feed/mp4$suffix"
        }
        Write-Verbose -Message "RSS URL: $urlToRss"
        $a = ([xml](new-object net.webclient).downloadstring($urlToRss))
        $a.rss.channel.item |
            ForEach-Object {
                $url = New-Object System.Uri($_.enclosure.url)
                $file = $url.Segments[-1]
                $file
                $file = "$Path\$Name\$file"
                if (!(test-path $file))
                {   
                    (New-Object -TypeName ([System.Net.WebClient])).DownloadFile($url, $file)
                }
            }
    }
}


@('XamarinShow','CSharp-101','ASPNET-Core-101','Xamarin-101','Entity-Framework-Core-101','NET-Core-101','Desktop-and-NET-Core-101','Docker-and-NET-Core-101') |
Update-dotNETVideo -Path "$env:USERPROFILE\Downloads" -HighQuality -Verbose
@amnaseo

This comment has been minimized.

Copy link

amnaseo commented Jan 25, 2020

Therefore, it is a must that dissertation services provide their complete street address.healthymomkids.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.