Created
November 14, 2016 21:44
-
-
Save wietze/947848308d258c382e05e7fb42ea9e66 to your computer and use it in GitHub Desktop.
Get FilmOn Streams
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
### Simple PowerShell script that gets FilmOn stream URL based on channel id. | |
### A picker for some populare UK channels is provided. | |
### | |
### :: HOW TO RUN | |
### Run the following to watch FilmOn channel 14 (= BBC One) | |
### & ./filmon.ps1 14 | |
### Run the following to see the channel picker, and manually select the channel | |
### & ./filmon.ps1 | |
################################################################################ | |
function FilmonPicker { | |
$channels = @{"Channel 5" = 22; "BBC One" = 14; "BBC Two" = 25; "BBC Four" = 103; "ITV" = 11; "ITV2" = 67; "Channel 4" = 2} | |
foreach ($h in $channels.GetEnumerator() | Sort-Object Name) { | |
Write-Host ("{0,5} {1}" -f ("("+$($h.Value)+")"), $($h.Name)) | |
} | |
$id = Read-Host -Prompt 'Enter channel ID' | |
return $id | |
} | |
function Filmon ([int]$id) { | |
$response = Invoke-WebRequest -Uri "http://www.filmon.com/" -Method Get | |
$web = new-object net.webclient | |
$web.Headers.add("Cookie", $response.Headers['Set-Cookie']) | |
$web.Headers.add("X-Requested-With", "XMLHttpRequest") | |
$web.Headers.add("User-Agent", "Mozilla/5.0") | |
$result = $web.DownloadString("https://www.filmon.com/ajax/getChannelInfo?channel_id={0}" -f $id) | |
$elems = $result | ConvertFrom-Json | |
start-process "C:\Program Files (x86)\DAUM\PotPlayer\PotPlayer.exe" -argumentlist ('"{0}"' -f $elems.streams[1].url) -windowstyle hidden | |
} | |
if($args.Length -ge 1){ | |
$id = $args[0] | |
} else { | |
$id = FilmonPicker | |
} | |
Filmon $id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello...thanks for the script.. where do i install this script and pass command ? and requirements .. thanks for you time