iptv-org / iptv

Collection of publicly available IPTV channels from all over the world
https://iptv-org.github.io
The Unlicense
85.53k stars 2.56k forks source link

PHP script to allow adding dynamically generated links #1226

Closed ksl1989 closed 3 years ago

ksl1989 commented 4 years ago

I noticed a number of channels available publicly require an expiring publicly generated token or must be obtained through a (public) API so I made a simple script to have static links be redirected to the dynamically generated link. Right now it can be used to redirect to the Euronews' streams (all languages) and to the Portuguese network TVI's channels, but the idea is to eventually add other similar links so these public links can also be added to m3u playlists, it's such a loss if we can't use all of these public links just because they require a (public) token or API.

It would be great if somebody here had a bit of server space to host this script, bandwidth usage is minimal, it literally just gets the link (or token) and redirects to the correct link. I tried a free hosting provider but free hosting providers don't like their server space used for scripts.

ksl1989 commented 4 years ago

I have added Hong Kong Now TV channels now新聞台 (now News) and now直播台 (now Direct) to this script.

ksl1989 commented 4 years ago

I have added Taiwan's 民間全民電視(民視)Formosa Television channels to this script:

Nintendocustom commented 4 years ago

That is really interesting, I don't know anything about php. Can you tell me what it exactly does and how it works?

Nintendocustom commented 3 years ago

I think I can port this later to python and then I will post the links here, someone just has to add them to the repository.

Nintendocustom commented 3 years ago

Euronews HU https://iptv.repl.co/Hungarian/euronews_hu Euronews HU Backup https://iptv.repl.co/Hungarian/euronews_hu_backup Euronews IT https://iptv.repl.co/Italian/euronews_it Euronews IT Backup https://iptv.repl.co/Italian/euronews_it_backup Euronews RU https://iptv.repl.co/Russian/euronews_ru Euronews RU Backup https://iptv.repl.co/Russian/euronews_ru_backup Euronews ES https://iptv.repl.co/Spanish/euronews_es Euronews ES Backup https://iptv.repl.co/Spanish/euronews_es_backup

The other Euronews channels are blocked!

ksl1989 commented 3 years ago

@Nintendocustom, thanks for working on this. I've been really busy, and I got the notifications for you replies here but, honestly, I thought you missed the plot.

Do you have your script online? I couldn't find it on your repository but I might be able to help. My original idea is to have a public script to which more channels can be added, so that we can add all channels that are public but don't have a public static link.

I tried all the channels in my script again and all seem to still be working, including the other Euronews channels.

Nintendocustom commented 3 years ago

The script is working fine, but the server is running in the us and for some reason they only blocked some Euronews channels there. I also made a Python script based on your php script and merged it with my project that contains some other channel (aren't working at the moment).

ksl1989 commented 3 years ago

You're saying that Euronews are blocking some of the channels from being accessed in the US? That's weird but I guess it's possible.

Is the Python script available online, so I can take a look and maybe help?... Are the other channels working?

Nintendocustom commented 3 years ago

It's not directly available. It's just a function that can be added really easy, so it's easy to add new channels:

def euronews_en():
        response_url = requests.get("https://www.euronews.com/api/watchlive.json").json()["url"][2:]
        requests_m3u8 = requests.get("https://" + response_url).json()
        return redirect(requests_m3u8['primary'])
Nintendocustom commented 3 years ago

I hope it's understandable, maybe we should make an issue where people can post web pages with dynamically generated links. Do you understand Python @ksl1989 ?

ksl1989 commented 3 years ago

@Nintendocustom Sorry it took me so long to reply. I do understand Python but never used on the web, and I'm not sure where you are running this, which framework or service you use. But my point was that I intended this code to be available publicly so that people can review, add or correct other channels.