Advertisement
Guest User

EurovisionSports

a guest
Aug 6th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. import urllib.request, json
  2. import os;
  3. from datetime import datetime
  4.  
  5. urlString = "https://www.eurovisionsports.tv/data.json";
  6. url = urllib.request.urlopen(urlString)
  7. data = json.loads(url.read().decode())
  8. url = data["live"][0]["video"][0]["hls"]
  9. anzahl = len(data["live"])
  10.  
  11. if anzahl > 0:
  12.     for i in range(0, anzahl):
  13.         y = int('-1') + int(i)
  14.         name = data["live"][i]['name']
  15.         unixtime = data["live"][i]['livedate']
  16.         policyid = data["live"][i]['policyid']
  17.         policykey = data["live"][i]['policykey']
  18.         fp = urllib.request.urlopen("https://ebu-it-fr.akamaized.net/gentoken.aka?key=" + policykey + "&domain=&streamtype=&path=")
  19.         mybytes = fp.read()
  20.         mystr = mybytes.decode("utf8")
  21.         value = mystr.split('"')
  22.         hdnea = value[3].split('?')
  23.         fp.close()
  24.         unixtime = datetime.fromtimestamp(int(unixtime)).strftime('%Y-%m-%d %H:%M:%S')
  25.         together = data["live"][i]["video"][0]["hls"]
  26.         seperate = together.split('@')
  27.         neu = "http://ebuompireland-lh.akamaihd.net/i/EBU" + policyid + "SPE_1@" + seperate[1] + '?' + hdnea[1]
  28.         print(unixtime + ' -- '  + neu)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement