die aktuellen Livestreams der öffentlich rechtlichen Sender auslesen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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]}') | |
Möglicherweise ist deine Python Version zu alt und kennt keine f-strings.
Versuche Mal
print(chList[x], urlList[x])
Hallo,
mit der geänderten Zeile habe ich ein brauchbares Ergebnis erzielt.
Nach Installation von Python 3.7.7 neben 2.7.7 aber eine Fehlermeldung
mit der ursprünglichen Zeile. Hat das wirklich etwas mit »neuerem«
Python zu tun?
Anyway, wenn ich in Zukunft bei Änderungen der URL’s so mein
kodi, vlc, mpv aktuell halten kann, bin ich zufrieden.
Danke
_t
Von: Schneider Axel <notifications@github.com>
Antworten: Axel-Erfurt <reply@reply.github.com>
Datum: 28. Juni 2020 at 17:41:25
An: Axel-Erfurt <axel-erfurt@noreply.github.com>
CC: crucco37 <crucco@riseup.net>, Comment <comment@noreply.github.com>
Betreff: Re: Axel-Erfurt/LiveStreamsDeutscheSender.py
@Axel-Erfurt commented on this gist.
Möglicherweise ist deine Python Version zu alt und kennt keine f-strings.
Versuche Mal
print(chList[x], urlList[x])
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Ausgabe mit »print(chList[x], urlList[x])« und python 2.7.7:
(u'ARD', u'http://mcdn.daserste.de/daserste/de/master.m3u8')
(u'ARD ONE', u'http://onelivestream-lh.akamaihd.net/i/one_livestream@568814/master.m3u8')
(u'ARD Alpha', u'http://brlive-lh.akamaihd.net/i/bralpha_germany@119899/master.m3u8')
(u'ARD Tagesschau', u'http://tagesschau-lh.akamaihd.net/i/tagesschau_1@119231/master.m3u8')
(u'ZDF', u'http://zdf-hls-01.akamaized.net/hls/live/2002460/de/high/master.m3u8')
(u'ZDF info', u'http://zdfhls17-i.akamaihd.net/hls/live/744750/de/high/master.m3u8')
(u'ZDF neo', u'http://zdf-hls-02.akamaized.net/hls/live/2002461/de/high/master.m3u8')
(u'MDR Sachsen', u'http://mdrsnhls-lh.akamaihd.net/i/livetvmdrsachsen_de@513998/master.m3u8')
(u'MDR Sachsen-Anhalt', u'http://mdrsahls-lh.akamaihd.net/i/livetvmdrsachsenanhalt_de@513999/master.m3u8')
(u'MDR Th\xfcringen', u'http://mdrthuhls-lh.akamaihd.net/i/livetvmdrthueringen_de@514027/master.m3u8')
(u'PHOENIX', u'http://zdfhls19-i.akamaihd.net/hls/live/744752/de/high/master.m3u8')
(u'RBB Berlin', u'http://rbblive-lh.akamaihd.net/i/rbb_berlin@144674/master.m3u8')
(u'RBB Brandenburg', u'http://rbblive-lh.akamaihd.net/i/rbb_brandenburg@349369/master.m3u8')
(u'BR S\xfcd', u'http://mcdn.br.de/bfs_sued/de/master.m3u8')
(u'BR Nord', u'http://brlive-lh.akamaihd.net/i/bfsnord_germany@119898/master.m3u8')
(u'HR', u'http://hrlive1-lh.akamaihd.net/i/hr_fernsehen@75910/master.m3u8')
(u'SR', u'http://srlive24-lh.akamaihd.net/i/sr_universal02@107595/master.m3u8')
(u'SWR', u'https://swrbwhls-i.akamaihd.net/hls/live/667638/swrbwd/master.m3u8')
(u'NDR', u'http://ndrfs-lh.akamaihd.net/i/ndrfs_nds@430233/master.m3u8')
(u'DW', u'http://dwstream6-lh.akamaihd.net/i/dwstream6_live@123962/master.m3u8')
(u'WDR', u'http://wdrfsgeo-lh.akamaihd.net/i/wdrfs_geogeblockt@530016/master.m3u8')
(u'ARTE FR', u'http://artelive-lh.akamaihd.net/i/artelive_fr@344805/master.m3u8')
(u'ARTE DE', u'http://artelive-lh.akamaihd.net/i/artelive_de@393591/master.m3u8')
(u'3Sat', u'http://zdfhls18-i.akamaihd.net/hls/live/744751/dach/high/master.m3u8')
('KiKA', u'http://kikade-lh.akamaihd.net/i/livetvkika_de@450035/master.m3u8')
(u'ORF-2', u'https://orf2.mdn.ors.at/out/u/orf2/qxb/manifest.m3u8')
(u'ORF-1', u'https://orf1.mdn.ors.at/out/u/orf1/qxb/manifest.m3u8')
(u'ORF-3', u'https://orf3.mdn.ors.at/out/u/orf3/qxb/manifest.m3u8')
(u'ORF-Sport', u'https://orfs.mdn.ors.at/out/u/orfs/qxb/manifest.m3u8')
Ausgabe mit »print(f"{chList[x]}:\n{urlList[x]}")« und python 3.7.7:
python3.7 ./LiveStreamsDeutscheSender.py
Traceback (most recent call last):
File "./LiveStreamsDeutscheSender.py", line 3, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Ergänzung: mit dieser ZDF-Adresse http://zdf-hls-02.akamaized.net/hls/live/2002461/de/high/master.m3u8
die der Script auswirft, wäre bei mir kein Empfang möglich.
Es braucht die: https://zdf-hls-15.akamaized.net/hls/live/2016498/de/high/master.m3u8
Quelle: https://wiki.ubuntuusers.de/Internet-TV/Stationen/
Welche ist denn eigentlich aktueller?
_t
Von: Schneider Axel <notifications@github.com>
Antworten: Axel-Erfurt <reply@reply.github.com>
Datum: 28. Juni 2020 at 17:41:25
An: Axel-Erfurt <axel-erfurt@noreply.github.com>
CC: crucco37 <crucco@riseup.net>, Comment <comment@noreply.github.com>
Betreff: Re: Axel-Erfurt/LiveStreamsDeutscheSender.py
@Axel-Erfurt commented on this gist.
Möglicherweise ist deine Python Version zu alt und kennt keine f-strings.
Versuche Mal
print(chList[x], urlList[x])
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Da MediathekView leider of veraltete Links hat hier eine andere Möglichkeit
#!/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()
stream_url = url_json["widgets"][0]["playerConfig"]["embedded"]["_pixelConfig"][0]["clipUrl"]
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)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hallo, was muss an diesem Script noch vervollständigt werden, dass er ein Ergebnis ausspuckt? Ich habe keinerlei Ahnung vom Programmieren, mir scheint aber in den Zeilen 6, 7 und 41 etwas zu fehlen, was unbedingt gesetzt werden muss: chList = [], urlList = [], print(f"{chList[x]}:\n{urlList[x]}"). Vielen Dank im Voraus. _t