Search This Blog

2018-07-20

PowerShell: Download Movies from IPTV http Stream Using Invoke-WebRequest

Product: PowerShell
Version: 2

It is often that IPTV provider which provides http URL to access the m3u file will contain following output:

#EXTINF:-1,RAAZI (2018)
http://server.internext.tv:8080/movie/4621036/4621036/29542.mp4
#EXTINF:-1,Pari (2018)
http://server.internext.tv:8080/movie/4621036/4621036/28274.mkv
...cut...

This post will show how to use PowerShell to download them in series.  The reason not download in parallel is because IPTV provider often limit number of concurrent connections

1. Convert the m3u file to CSV file, so that it looks like this

RAAZI (2018),http://server.internext.tv:8080/movie/4621036/4621036/29542.mp4
Pari (2018),http://server.internext.tv:8080/movie/4621036/4621036/28274.mkv

2. Adds a header called OutFile and Uri.  This will be how it looks like

OutFile,Uri
RAAZI (2018),http://server.internext.tv:8080/movie/4103600/4103699/29542.mp4
Pari (2018),http://server.internext.tv:8080/movie/4103600/4103699/28274.mkv

3. Adds the full directory to save the file, as well as extension, e.g. D:\Movies.  Keep the extension identical to the input video stream

OutFile,Uri
D:\Movies\RAAZI (2018).mp4,http://server.internext.tv:8080/movie/4103600/4103699/29542.mp4
D:\Movies\Pari (2018).mkv,http://server.internext.tv:8080/movie/4103600/4103699/28274.mkv

4. Save the file, e.g. download1.txt
5. Download the movies in sequence

import-csv download1.txt | foreach-object {  write-host $_.OutFile;  Invoke-WebRequest -UserAgent "Mozilla/5.0 (Windows NT 6.1; Win64; x64)" -Uri $_.Uri -OutFile $_.OutFile -verbose }

1 comment:

Mike said...

Thanks for sharing this iptv m3u list.
iptv m3u subscription