.strmlnk generator

Check out https://github.com/fancybits/strmlnk-generator

1 Like

OK, to help out installation:

(1) First, you need the "Go Programming Language" installed. Navigate to https://golang.org/doc/install and find the version related to your OS. Follow the directions there. Windows used a package installer I had no issues with, Mac looks about the same, Linux requires a few extra steps that don't look too bad. In the end, you should be able to run "Go" from anywhere:


(2) Go to the Github from above (https://github.com/fancybits/strmlnk-generator ) and download the whole thing.


(3) Unzip that file wherever you want. I think you could put in your Channels directory for reasons that will be clear later, but I decided to be safe and keep it outside. You will end up with something like this (don't mind if I have more files, they'll be generated later):


(4) Open up a Command Prompt (in Administrative Mode) or the Linux/Mac equivalent and navigate to the directory containing the unzipped folder. Once there, type "go build".


Most importantly, you will now have a file called image, which is the actual program you need to do anything.

(5) With this in place, staying in the Command Prompt, you can now type "strmlnk-generator" and the link the program you want to generate.

Note that the first time this runs, it will install Chromium if it is not already installed:

(6) You will now find the generated Stream Links under the main directory, "Imports", "TV":


This should look like the familiar structure of the Channels directories for Stream Links, which is why I said I think it could be put in that directory. If not, like me, you can move the files over later.

Now for the bugs.

(1) As seen in the installation instructions, if only generated links for the most recent season when dealing with Hulu. Assuming this is because Hulu defaults the view to the most recent season. This means it did not create directories for the Seasons, either.

(2) Netflix, DisneyPlus, and Reelgood were unrecognized. I'm sure others were, too, but I didn't check.


(3) Is it possible for single digits to have zeros in from of them so it would be "S02E01.strmlnk" instead of "S2E1.strmlnk".

(4) There is an extra row in the Stream Link files:


I followed the installation instructions to a "T" yet I keep getting this error message when I try to run it: [ERR] Failed: runtime error: invalid memory address or nil pointer dereference. Any ideas?

1 Like

I noticed this with Hulu recently, too. Assume something changed in Hulu's backend that is not agreeable to the program as written. Since this is basically an alpha demo proof of concept, someone would need to pick it up to get it working and keep it updated. I would, but I have neither the skill nor time to do so.

1 Like

I'm getting the same issue with HBO Max. I do wonder if the generator coding needs tweaking.
Unfortunately, I'm useless helping out in that area. @tmm1

My first attempt at writing a .strmlnk creator. So far this appears to work. Maybe others can expound upon.

Copy and paste to a .ps1 file.

Prompts for input from paramount+ URL i.e. https://www.paramountplus.com/shows/star-trek-strange-new-worlds

REMEMBER no trailing backslash "/"

It should create the directory of the show and subfolder the seasons with .strmlnk files.

#paramount+ .strmlnk creator using powershell

#URL to scan
$URL = Read-Host -Prompt 'Enter the URL of the show you intend to create .strmlnk links. Example; https://www.paramountplus.com/shows/mayor-of-kingstown ***NO TRAILING / ***'

#Create tmp dir
New-Item -Name tmp -ItemType Directory -Force

for ($i=1; $i -le 50; $i++) { Invoke-WebRequest -Uri "$URL/xhr/episodes/page/0/size/18/xs/0/season/$i/" | Select-Object -ExpandProperty Content | Out-File tmp\$i.season }
(get-childitem tmp\*.season | Select-String -Pattern 'display_seasons":false' | Select-Object -ExpandProperty path -Unique) | ForEach-Object{Remove-Item -Force -LiteralPath $_}

#Do for each season
Get-ChildItem -Filter tmp\*.season | % { $_.FullName } | Out-File tmp\process 

$files = Get-Content tmp\process
ForEach ($file in $files) {
    Get-Content $file | Out-file tmp\file1

    #Reorganize chaos
    (Get-Content tmp\file1) -replace ',"',"`r`n" | Out-file tmp\file2
    #Extract video links
    Select-String tmp\file2 -Pattern 'aaLink' | Out-File tmp\file3 -Width 1000
    #Remove empty lines
    (gc tmp\file3) | ? {$_.trim() -ne "" } | set-content tmp\file3
    #Create the video directory
    Get-Content -Path tmp\file3 | %{ $_.Split('|')[4]; } | select-object -first 1 | % {$_.replace(":"," -")} | out-file tmp\title
    $dir = Get-Content tmp\title
    ForEach-Object {New-Item -Name $dir -ItemType Directory -Force}
    #Create the video directory season
    Get-Content -Path tmp\file3 | %{ $_.Split('|')[6]; } | select-object -first 1 | % {$_.replace(":"," -")} | out-file tmp\season
    $season = Get-Content tmp\season
    ForEach-Object {New-Item -Name $dir\'S'$season -ItemType Directory -Force}
    Get-Content -Path tmp\file3 | ForEach-Object {
        $episode = "$($_.Split('|')[7])"
        $video = "$($_.Split('|')[16])"
        new-item $dir\'S'$season\$season'x'$episode.strmlnk -Force
        set-content $dir\'S'$season\$season'x'$episode.strmlnk https://www.paramountplus.com/shows/video/$video

Working here.
Can it be modified for other OTT services?

Attempting to work others like Disney+ and Peacock Premium are proving difficult as the front web page doesn't contain the links or GUIDs the videos are tied to. My limited knowledge of powershell could also hamper being able to download the web page that renders the links or GUIDs associated with the videos. Still searching though.

I'm thinking this has something to do with how those website function. So, let's say we wanted Ahsoka on Disney+. There is a series page available at https://www.disneyplus.com/series/ahsoka/pdpjs2TO4zJ4 that lists all the episodes as expected. The problem is that Powershell is not using the same browser where the user is logged in (or technically, any browser), so essentially it is as a non-logged in visitor. If you test that same page in a private window, the episode links are hidden. It's almost like the script would need to log in, but I don't know how practical that is.