Isayso/PlaylistEditorTV

f4mTester links

dobbelina opened this issue · 19 comments

Hi again Isayso!,

I have an issue when i want to import a f4mTester link.
I understand that it's a plugin link and not http, and therefore can not be
tested with the link-tester.
But it would be preferable if they could be imported anyway, but right now
it's not allowed.
In kodi some links wont play without it, example that don't play:

#EXTINF:-1  tvg-logo="https://www.digitaltveurope.com/files/2011/12/BBC-World-News1.jpg",BBC WORLD NEWS
http://ott-cdn.ucom.am/s24/index.m3u8

Example that does play:

#EXTINF:-1  tvg-logo="https://www.digitaltveurope.com/files/2011/12/BBC-World-News1.jpg",BBC WORLD NEWS 
plugin://plugin.video.f4mTester/?streamtype=HLSRETRY&url=http://ott-cdn.ucom.am/s24/index.m3u8

Here's an example playlist found on pastebin: https://pastebin.com/raw/sXRuvvAD

looks like a mixture of IPTV and video playlist.....
Does the whole plugin line has to go into the link column?

looks like a mixture of IPTV and video playlist.....
Does the whole plugin line has to go into the link column?

Yes, exactly as in the example above.
When executing that playlist item in kodi, it opens the url in the
f4mTester addon, which can resolve some stubborn streamlinks that
kodi can't handle.

It has this structure for m3u8 links:
plugin://plugin.video.f4mTester/?streamtype=HLSRETRY&url=
And this structure for .ts links:
plugin://plugin.video.f4mTester/?streamtype=TSDOWNLOADER&url=

Made a quick test version, I wasn't able to install this f4m plugin so I cannot test it on my system.
No dead link check, no vlc play, just plain import to the list.

https://github.com/Isayso/PlaylistEditorTV/blob/master/test/PlaylistEditorIPTV_v1.4.2_TEST1.zip

Wow that was fast!
Yes, that imports/opens perfect.
Little bit buggy when test playing in kodi, but it opens.
If you want f4mTester you can get it from my repo:
https://dobbelina.github.io/repository.dobbelina-1.0.0.zip
It's under Video add-ons.
I assume you already got LiveStreamsPro, if not, you got it there as well.
Once installed, you will notice that only the f4mtester link will work with
the example I posted in the first post,(Identical links to the same m3u8)
Please observe that you don't play f4mTester links by opening it's addon, but indirectly from other addons such as LiveStreamsPro.
In LiveStreamsPro you add new playlists from it's Settings page.
Settings=>Add Source

I now know why f4mTester works on some links that kodi can't handle direct.
It adds user agent which some streams require.
Example,
Don't work with only m3u8:
http://92.43.140.249/s27/04.m3u8
But with added user agent it does(kodi only link):
http://92.43.140.249/s27/04.m3u8|User-Agent=Mozilla/5.0 (X11; Linux i686; rv:42.0) Gecko/20100101 Firefox/42.0 Iceweasel/42.0

Found similar with dead link check. Some responds only with user agent set.
So, the link string has to be
plugin........//......;url=http://.....|User-Agent=Mozilla/5.0 (X11; Linux i686; rv:42.0) Gecko/20100101 Firefox/42.0 Iceweasel/42.0

I can add this as a general rule if you like.

UPDATE: Needs to be activated in settings
https://github.com/Isayso/PlaylistEditorTV/blob/master/test/PlaylistEditorIPTV_v1.4.2_TEST2.zip

If you use f4mTester you don't need to/shouldn't add user agent, it adds it by itself.
Eg,
plugin://plugin.video.f4mTester/?streamtype=HLSRETRY&url=http://92.43.140.249/s27/04.m3u8
But a cool feature maybe would be to have that option,
"add kodi user agent string for m3u8" to http links?
Eg,
http://92.43.140.249/s27/04.m3u8
Becomes:
http://92.43.140.249/s27/04.m3u8|User-Agent=Mozilla/5.0 (X11; Linux i686; rv:42.0) Gecko/20100101 Firefox/42.0 Iceweasel/42.0
(Above only works in kodi)
Preferably as a context menu option, so that one can add it on a link to link basis.
And in the options:
bild

The user agent string thing is perhaps not so important, but more feasible is,
when trying to play a url that starts with plugin:// with vlc,
maybe you can script a pop-up that says, "Plugin links only work in kodi".
And for the link-checker to simply ignore or skip url's that start with plugin://

I added a context menu for edit cell (F2)
I have problems with the dead link check. It doesn't work on the http links which needs the User-Agent string. With the string, I disabled it (grey) and without it returns an error (orange).

https://github.com/Isayso/PlaylistEditorTV/blob/master/test/PlaylistEditorIPTV_v1.4.2_TEST3.zip

Awesome work!
Perhaps a regex that sorts out links that start with "plugin" or contains a pipe
symbol "|", and skip those for the link-check.
This regex does the trick: https://regex101.com/r/9dTjpf/3

I don't know C#, but something like this maybe:

string pattern = @"^plugin|[|]";

Regex regex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);

string url= "http://77.54.71.66:9981/play/a02j/index.m3u8|User-Agent=Mozilla/5.0 (X11; Linux i686; rv:42.0) Gecko/20100101 Firefox/42.0 Iceweasel/42.0";

if(regex.IsMatch(url)
{
  //skip link check
  //vlc pop-up "Can only be played in kodi"
}

You will never find an un-encoded pipe symbol in an url, it's only a delimiter for kodi.
Or extract the url and let vlc and the link-checker work on that: https://regex101.com/r/IcNe2Z/1
And send the un-regexed string to kodi.
This is probably the best alternative.
There is no way to send user agent to vlc inside a url string anyway.
Those few links that require it, or are plugin links, one can assume that the
user will be aware of it, and only test them in kodi if the link-checker gives
a false positive.

Here's one that extracts the user agent string: https://regex101.com/r/RZAv13/1
Maybe you can parse that to the link-checker somehow?

The problem is that the http link who needs the |user-agent string in kodi is recognized as a dead link and therefore marked with orange, despite it works.
Have no solution yet.

Not checked links, plugin and user-agent, are now in grey.

Have a look at this, maybe something:
https://stackoverflow.com/questions/11841540/setting-the-user-agent-header-for-a-webclient-request
Not easy, I understand, difficult stuff.
If you get it to work, perhaps a cool feature would be to make the link-checker
retry dead links once more with an user agent, and if the link "comes alive" automatically add the agent to the link.
Like an option, + Shift "Dead link user agent test".
I am very grateful for your efforts, and there's no hurry.
It's awesome to follow your progress 🙂

I test the links with a default user agent until now. When I have to iterate through different user agents, the whole process can be very time consuming. Not sure if this kind of annoying process is a good idea to find only a few false negative links?
An optional "deep link check" or so can be a way, right.
I added a channel switch box in player mode now. If you want to try.

https://github.com/Isayso/PlaylistEditorTV/blob/master/test/PlaylistEditorIPTV_v1.4.2_TEST4.zip

Nice switch box!
I think it starts to work really nice now.
Having the option to add a user agent with F2 is enough.
If one can change the default in the editbox "Kodi user agent for *.m3u8 files",
even better.
I have one issue when playing plugin links, they open 2-3 instances in kodi
making it restart the stream several times.
Have this pop-up as seen below to.
You can try these working plugin links as i assume you got f4mtester installed.

plugin://plugin.video.f4mTester/?streamtype=TSDOWNLOADER&name=[COLOR lime]GreenTV[/COLOR];url=http://rocksat.ddns.net:25461/xmbdp2f8/NyRF5yPNtK/26169

plugin://plugin.video.f4mTester/?streamtype=TSDOWNLOADER&name=[COLOR lime]GreenTV[/COLOR];url=http://rocksat.ddns.net:25461/xmbdp2f8/NyRF5yPNtK/26166

plugin://plugin.video.f4mTester/?name=TWT SULAMERICANA&streamtype=TSDOWNLOADER&url=http://iptv-luxe.com:8789/live/filipemiranda/b5sh0Muzb7/320.ts

Untitled

Thanks for the links, will look into it.

The pop-up window appears only in the debug version, its the response string from kodi.
I have an issue with kodi 18.4 that the stream stops after 10s only when I send it. Started with kodi itself, its working. That's probably why I haven't noticed a re-send, will look into it.
Thanks for your help!

Update: The play json string is sent only once. I have also 3 starts in the f4m plugin, no explanation for this. The youtube plugin reacts normal.

Aha, pop-up is only debug version, understand.
The re-start issue is not a big deal, important is that one can see if the link works.
On rare occasions, when starting a plugin link it will stop.
But most of the times it plays fine after the "hickup", ha ha 😄
I also use kodi 18.4

I changed the code that the manually given user string is used for link check. Not sure if the false-invalid reply will be better. Plugin links are not checked and shown in grey.
New version 1.4.2 is online now. The combobox is not designed for very long lists, so it can be slow to open, but I think its acceptable.
Have fun!

Awesome work, thank you!
A big improvement from v1.4.1

Thanks!
Do you think a MRU list would be helpful? I'm doing this for the video editor right now.

Can't hurt, that's for sure.
Go for it.