Skip to content

Instantly share code, notes, and snippets.

@einstein95
Last active March 25, 2021 11:45
Show Gist options
  • Save einstein95/684e90a88671dcf298c46c8c2fd31d01 to your computer and use it in GitHub Desktop.
Save einstein95/684e90a88671dcf298c46c8c2fd31d01 to your computer and use it in GitHub Desktop.

ABC

import requests

r = requests.get('http://program.abcradio.net.au/api/v1/services.json?filter=has_live_stream&include=outlets%2Coutlet_audio').json()
for i in r['items']:
    print(f"* [{i['title']}]({i['outlets'][0]['audio_streams'][0]['url']})")

SBS

  • SBS Arabic24: rtmp://cp129455.live.edgefcs.net/live/DAB8@24519
  • SBS Chill: rtmp://cp129455.live.edgefcs.net/live/SBSChill@59092
  • SBS PopAsia: rtmp://cp129455.live.edgefcs.net/live/SBSPopAsia@59093
  • SBS PopDesi: rtmp://cp129455.live.edgefcs.net/live/DAB7@36694
  • SBS Radio 1: rtmp://cp129455.live.edgefcs.net/live/SBS1@59090
  • SBS Radio 2: rtmp://cp129455.live.edgefcs.net/live/SBS2@59091
  • SBS Radio 3: rtmp://cp129455.live.edgefcs.net/live/SBS3@108225
  • SBS Radio 4: rtmp://cp187361.live.edgefcs.net/live/SBS6@82343
import json
import requests
import re

r = requests.get('https://www.sbs.com.au/radio/').text
j = json.loads(re.findall('config: (.+?) +\};', r)[0])
for i in j['channels']:
    print(f"* [{i['label']}]({i['player']['streamingUrls']['rtmpa']})")

Misc

sc.kofm.com.au

import requests
import urllib.parse
from bs4 import BeautifulSoup

r = requests.get('http://sc.kofm.com.au/status.xsl')
host = '{0.scheme}://{0.netloc}'.format(urllib.parse.urlsplit(r.url))
s = BeautifulSoup(r.text, 'lxml')
l = s.findAll('div', class_='roundcont')
for i in l[1:]:
    i = i.findAll('tr')
    streamurl = i[0].find('a', text='M3U')['href']
    streamtitle = i[1].find('td', class_='streamdata').text
    print(f"* [{streamtitle}]({host+streamurl})")
import requests
import urllib.parse
from bs4 import BeautifulSoup

r = requests.get('http://legacy.scahw.com.au/status.xsl')
host = '{0.scheme}://{0.netloc}'.format(urllib.parse.urlsplit(r.url))
s = BeautifulSoup(r.text, 'lxml')
l = s.findAll('div', class_='roundbox')
for i in l:
    i = i.findAll('div')
    streamurl = i[0].find('a', text='M3U')['href']
    streamtitle = i[2].findAll('td')[1].text
    if streamtitle == '0':
        streamtitle = streamurl[1:-4]
    print(f"* [{streamtitle}]({host+streamurl})")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment