Skip to content

Instantly share code, notes, and snippets.

@Axel-Erfurt
Last active July 13, 2023 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Axel-Erfurt/5106f9bbef1fca1d63bb74a849607128 to your computer and use it in GitHub Desktop.
Save Axel-Erfurt/5106f9bbef1fca1d63bb74a849607128 to your computer and use it in GitHub Desktop.
die aktuellen Livestreams der öffentlich rechtlichen Sender auslesen
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import requests
import json
url = "https://raw.githubusercontent.com/mediathekview/MServer/master/dist/live-streams.json"
data = requests.get(url).text
js = json.loads(data)
def parse_object_pairs(pairs):
return pairs
decoder = json.JSONDecoder(object_pairs_hook=parse_object_pairs)
obj = decoder.decode(data)
for value in obj[2:]:
print(f'{value[1][2].replace(" Livestream", "")}:\n{value[1][8]}')
@Axel-Erfurt
Copy link
Author

#!/usr/bin/python3
# -*- coding: utf-8 -*-

import requests

haupt_url = "https://api.ardmediathek.de/page-gateway/pages/ard/item/Y3JpZDovL2Rhc2Vyc3RlLmRlL0xpdmVzdHJlYW0tRGFzRXJzdGU?devicetype=pc"
haupt_json = requests.get(haupt_url).json()

name_list = []
api_urls = []

for x in range(len(haupt_json["widgets"][0]["relates"])):
    name_list.append(haupt_json["widgets"][0]["relates"][x]["mediumTitle"])
    api_urls.append(haupt_json["widgets"][0]["relates"][x]["links"]["target"][("href")])

tv_result = ""

for x in range(len(api_urls)):
    stream_url = ""
    name = name_list[x]
    url = api_urls[x]
    url_json = requests.get(url).json()

    if '_alternativeMediaArray' in url_json["widgets"][0]['mediaCollection']['embedded']:
        stream_url = url_json["widgets"][0]['mediaCollection']['embedded']['_alternativeMediaArray'][0]['_mediaArray'][0]['_mediaStreamArray'][0]['_stream']
    else:
         stream_url = url_json["widgets"][0]['mediaCollection']['embedded']['_mediaArray'][0]['_mediaStreamArray'][0]['_stream']

    if not stream_url.startswith("https:"):
        stream_url = f'https:{stream_url}'
    tv_result += f'{name},{stream_url}\n'
    
    liste = requests.get(stream_url).text
    
print(tv_result)
Das Erste,https://mcdn.daserste.de/daserste/de/master.m3u8
BR Fernsehen,https://mcdn.br.de/br/fs/bfs_sued/hls/de/master.m3u8
hr-fernsehen,https://hrhlsde.akamaized.net/hls/live/2024526/hrhlsde/index.m3u8
MDR,https://mdrtvsnhls.akamaized.net/hls/live/2016928/mdrtvsn/index.m3u8
NDR Fernsehen,https://mcdn.ndr.de/ndr/hls/ndr_fs/ndr_nds/master.m3u8
Radio Bremen,https://rbhlslive.akamaized.net/hls/live/2020435/rbfs/master.m3u8
rbb,https://rbb-hls-brandenburg.akamaized.net/hls/live/2017825/rbb_brandenburg/index.m3u8
SR,https://srfs.akamaized.net/hls/live/689649/srfsgeo/index.m3u8
SWR,https://swrbwd-hls.akamaized.net/hls/live/2018672/swrbwd/master.m3u8
WDR,https://mcdn.wdr.de/wdr/wdrfs/de/master.m3u8
ONE,https://mcdn.one.ard.de/ardone/hls/master.m3u8
arte,https://arteliveext.akamaized.net/hls/live/2030993/artelive_de/index.m3u8
KiKA,https://kikageohls.akamaized.net/hls/live/2022693-b/livetvkika_de/master.m3u8
3sat,https://zdf-hls-18.akamaized.net/hls/live/2016501/dach/high/master.m3u8
ARD alpha,https://mcdn.br.de/br/fs/ard_alpha/hls/de/master.m3u8
tagesschau24,https://tagesschau.akamaized.net/hls/live/2020115/tagesschau/tagesschau_1/master.m3u8
phoenix,https://zdf-hls-19.akamaized.net/hls/live/2016502/de/high/master.m3u8
Deutsche Welle,https://dwamdstream102.akamaized.net/hls/live/2015525/dwstream102/index.m3u8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment