Hi all
I'm looking for a way to pull the streams from the broadcaster in my country (SABC) to a m3u format, so that I can connect them into my PVR.
They seem to be in mp4 segments. I have attached a screenshot detailing one channel
[Attachment 68267 - Click to enlarge]
There's probably about 4 channels needing to be pulled to a m3u format and streamed. If the steaming token expires, I would need something to renew the token automatically.
Interlark has designed something similar for another service https://github.com/interlark/ustvgo-iptv
Assuming I would need something like this, unfortunately I have no idea how to use Python, or where to even start, but I love to learn.
So if anyone can offer me detailed info, on how to do this please let me know.
If I need to submit more info, please let me know what.
Thanks in advance. (:
+ Reply to Thread
Results 1 to 21 of 21
-
-
Hi paul92, you can help your cause greatly if you provide URL of the streams that you desire.
If login is required then any action for your cause will be greatly demished.
If your provider, SABC, uses encryption then you may be SOL as these require keys and these keys usually expire.
unfortunately I have no idea how to use Python, or where to even start, but I love to learn -
Ok, I did some checking on my own
Need mobile number to access.
I know of fake email addresses but fake mobile numbers with sms eludes me. -
Try this:
https://receive-sms.cc/France-Phone-Number/33644623966
France and European numbers worked for me where others didn't. -
-
it's been quite a while since I last even thought about this - but had a look at this again, this time my knowledge is slightly better. First thing is that the channels are geoblocked to South African IP address, so one would need a South African VPN. Secondly from what I've found is that there seems to be some sort of token protection, as a unique token is provided, upon each connection, which seems to be valid for at least close to 4 hours. Using an extension called The Stream detector, I was able to grab the stream URL (which eventually expire) pasted it into VLC, and it played immediately - which would seem to me that the only protection there, is that there needs to be a tokenID.
-
Out of curiosity, what's the site and could you give a few stream URLs? The link @jack wrote is dead
--[----->+<]>.++++++++++++.---.--------.
[*drm mass downloader: widefrog*]~~~~~~~~~~~[*how to make your own mass downloader: guide*] -
website isCode:https://sabc-plus.com/
URLs to streams
SABC1Code:https://sabc-plus.com/live/320/SABC-1
Code:https://sabc-plus.com/live/321/SABC-2
Code:https://sabc-plus.com/live/322/S3
Code:https://sabc-plus.com/live/323/SABC-Sport
Code:https://sabc-plus.com/live/325/SABC-Education
Code:https://sabc-plus.com/live/324/SABC-News
Code:https://sabc-plus.com/live/326/SABC-Lehae
SABC1Code:https://sabconeta.cdn.mangomolo.com/sabc1/smil:sabc1.stream.smil/chunklist_b1600000_t64NzIwcA==.m3u8
Code:https://sabctwota.cdn.mangomolo.com/sabc2/smil:sabc2.stream.smil/chunklist_b1600000_t64NzIwcA==.m3u8
Code:https://sabctreta.cdn.mangomolo.com/sabc3/smil:sabc3.stream.smil/chunklist_b1600000_t64NzIwcA==.m3u8
Code:https://sabctwotasp.cdn.mangomolo.com/sport/smil:sport.stream.smil/chunklist_b1600000_t64NzIwcA==.m3u8
Code:https://sabctretaed.cdn.mangomolo.com/edu/smil:edu.stream.smil/chunklist_b2000000_t64NzIwcA==.m3u8
Code:https://sabconetanw.cdn.mangomolo.com/news/smil:news.stream.smil/chunklist_b250000_t64MjQwcA==.m3u8
Code:https://sabctretalh.cdn.mangomolo.com/lehae/smil:lehae.stream.smil/chunklist_b2000000_t64NzIwcA==.m3u8
so need a way to in a way ) at least from my understanding
Automatically directCode:https://sabc-plus.com/live/320/SABC-1
Code:https://sabconeta.cdn.mangomolo.com/sabc1/smil:sabc1.stream.smil/chunklist_b1600000_t64NzIwcA==.m3u8
Last edited by paul92; 11th Aug 2024 at 09:46.
-
I wrote a forwarder for these channels a while ago (except SABC Education and SABC Lehae that I missed before they enforced registration). It uses the embedded players (hosted at Mangomolo) and extracts a tokenized m3u8 url from it. I just tested it real quick and as long as both the player domain and the m3u8 domain are called with a South African ip, things still work fine for those channels.
Someone else is going to have to write the code as I'm really bad with Python, but here's how to do it:
Open this url, filling in two fixed id's (this is the player page):
Code:https://player.mangomolo.com/v1/live?id=MTk0&channelid=<channelid>&countries=Q0M=&filter=DENY&signature=<signature>
The resulting html pages will have the tokenized m3u8 link in them, in a long block of Javascript. Really easy to extract with e.g. this regular expression (this is a Python regular expression):
Code:r"src: \"(.+)\""
Code:import got from 'got' export default async function (req, res) { const channelParameters = { news: { channelid: 'MzI0', signature: '54e386ff3a9b282f709bdbe3cb7f026f' }, 1: { channelid: 'MzIw', signature: 'afef9c2e6bf161cd3b3d929cfa9d51cb' }, 2: { channelid: 'MzIx', signature: '9d92dff59c1eddf29e8f8d87ee3e78da' }, 3: { channelid: 'MzIy', signature: 'c8cb953e450cc1b2b851663b64928cfe' }, sport: { channelid: 'MzIz', signature: 'bce106f2fb94504e2a3d19cd0c0175cc' } } const { id } = req.params // Get url from player page const { channelid, signature } = channelParameters[id] const playerPage = await got(`https://player.mangomolo.com/v1/live?id=MTk0&channelid=${channelid}&countries=Q0M=&filter=DENY&signature=${signature}`) const url = /src: "(.+)"/g.exec(playerPage.body)[1] res.redirect(url) }
-
--[----->+<]>.++++++++++++.---.--------.
[*drm mass downloader: widefrog*]~~~~~~~~~~~[*how to make your own mass downloader: guide*] -
Code:
news http://127.0.0.1:3000/MzI0/54e386ff3a9b282f709bdbe3cb7f026f/hls.m3u8 1 http://127.0.0.1:3000/MzIw/afef9c2e6bf161cd3b3d929cfa9d51cb/hls.m3u8 2 http://127.0.0.1:3000/MzIx/9d92dff59c1eddf29e8f8d87ee3e78da/hls.m3u8 3 http://127.0.0.1:3000/MzIy/c8cb953e450cc1b2b851663b64928cfe/hls.m3u8 sport http://127.0.0.1:3000/MzIz/bce106f2fb94504e2a3d19cd0c0175cc/hls.m3u8
Code:from flask import Flask, redirect, Response import re import requests app = Flask(__name__) @app.route('/<path:url>', methods=['GET']) def on_fetch(url): parts = url.split('/') if len(parts) < 3: return Response('Invalid URL', status=400) channelid = parts[-3] signature = parts[-2] api_response = requests.get(f'https://player.mangomolo.com/v1/live?id=MTk0&channelid={channelid}&countries=Q0M=&filter=DENY&signature={signature}') if api_response.status_code != 200: return Response('geo blocked', status=403) match = re.search(r'src: "(.*)"', api_response.text) if match: m3u8 = match.group(1) return redirect(m3u8, code=301) else: return Response('m3u8 URL not found', status=404) if __name__ == '__main__': app.run(port=3000)
-
Thanks everyone - was able to get this up and running. No buffering, and works brilliantly.
Next thing is how can I convert the EPG to an epg_xml file or whatever, so I can add the EPG as a guide source.
Thanks in advance. -
Thanks imr_saleh! Also: I should make it a habit some day to check for and report errors in this kind of code
paul92: where would you get EPG info for these channels? From the SABC site itself? I'm currently writing some scripts to get EPG data from a few channels that I watch on a regular basis and always interested to add more. -
Should be easy enough get make a XMLTV script to pull from the SABC-plus website, if going by how easy it was to get the live channels working after I figured out what to do. Even Education works now. I asked ChatGPT to make a flask script, installed it as a service on my JHB VPS, pointed NextPVR installed on JHB VPS to those links (to deal with geo-blocking) then forwarded that nextpvr m3u8 to my main PVR VPS. (I have a netmaker WAN which is essentially a high speed Wireguard mesh network)
and likewise. Not much of a TV person, but there a few channels I watch, but also enjoy the technology side, and building things, and makings work. I use Tinuva has a good EPG which covers a lot of DStv channels, but so much SABC. -
Hi any idea what's changed - this was working beautifully but when I checked again - the streams were failing to load
here's my scriptCode:from flask import Flask, redirect, abort import requests import re app = Flask(__name__) # Define the channel parameters channel_parameters = { 'news': { 'channelid': 'MzI0', 'signature': '54e386ff3a9b282f709bdbe3cb7f026f' }, '1': { 'channelid': 'MzIw', 'signature': 'afef9c2e6bf161cd3b3d929cfa9d51cb' }, '2': { 'channelid': 'MzIx', 'signature': '9d92dff59c1eddf29e8f8d87ee3e78da' }, '3': { 'channelid': 'MzIy', 'signature': 'c8cb953e450cc1b2b851663b64928cfe' }, 'sport': { 'channelid': 'MzIz', 'signature': 'bce106f2fb94504e2a3d19cd0c0175cc' }, 'education': { 'channelid': 'MzI5', 'signature': 'b7b9cef40ca3743a4bb32e528da2df67' }, 'lehae': { 'channelid': 'MzI2', 'signature': '414ba5b272e6c9bdfc96faafa454406a' } } @app.route('/stream/<channel_id>') def stream(channel_id): params = channel_parameters.get(channel_id) if not params: abort(404) # Channel not found channelid = params['channelid'] signature = params['signature'] # Get URL from player page url = f"https://player.mangomolo.com/v1/live?id=MTk0&channelid={channelid}&countries=Q0M=&filter=DENY&signature={signature}" response = requests.get(url) # Extract the streaming URL from the response match = re.search(r'src: "(.+)"', response.text) if match: stream_url = match.group(1) return redirect(stream_url) else: abort(500) # Error extracting URL if __name__ == '__main__': app.run(debug=True)
Code:paul@paul-Lenovo-ideapad-510-15ISK:~$ curl http://127.0.0.1:5000/stream/3 <!doctype html> <html lang=en> <title>500 Internal Server Error</title> <h1>Internal Server Error</h1> <p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
Hopefully someone here will be able to figure out just what changed exactly. I would have a look, but my brain isn't in code mode at the moment....
Thanks -
Well, now I'm paranoid. I'd been using this method with these exact same parameters for the last 8 months, always worked just fine. Now, just a short while after sharing the id's and signatures things have been changed around.
So while I found a pretty easy solution, I'm a bit hesitant to share it here. Because it's probably just as easy to patch. On the other hand, I'm pretty new here, so I'm not sure if being 'secretive' and only sharing things by PM is appreciated on this forum. -
--[----->+<]>.++++++++++++.---.--------.
[*drm mass downloader: widefrog*]~~~~~~~~~~~[*how to make your own mass downloader: guide*] -
Similar Threads
-
Need help finding video download url and key
By code47 in forum Video Streaming DownloadingReplies: 39Last Post: 25th Jan 2023, 05:11 -
How do I get the HTTPS source URL for this stream?
By paul92 in forum Video Streaming DownloadingReplies: 2Last Post: 3rd Apr 2022, 05:42 -
How to extract stream URL??
By sharyngol in forum DVB / IPTVReplies: 1Last Post: 22nd Apr 2019, 17:07 -
Trying to get stream url for this radio station
By jimdagys in forum Video Streaming DownloadingReplies: 8Last Post: 30th Aug 2018, 10:20 -
How to extract stream URL
By masster in forum Video Streaming DownloadingReplies: 21Last Post: 16th Apr 2018, 11:51