Enigma2 plugin to to play various online streams (mostly Latvian).

filmix_decode2.py 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import base64
  2. import re
  3. from collections import OrderedDict
  4. import sys
  5. def decode_uppod_text( text):
  6. Client_codec_a = ["l", "u", "T", "D", "Q", "H", "0", "3", "G", "1", "f", "M", "p", "U", "a", "I", "6", "k", "d", "s", "b", "W", "5", "e", "y", "="]
  7. Client_codec_b = ["w", "g", "i", "Z", "c", "R", "z", "v", "x", "n", "N", "2", "8", "J", "X", "t", "9", "V", "7", "4", "B", "m", "Y", "o", "L", "h"]
  8. text = text.replace("\n", "").strip()
  9. for i in range(len(Client_codec_a)):
  10. char1 = Client_codec_b[i]
  11. char2 = Client_codec_a[i]
  12. text = text.replace(char1, "___")
  13. text = text.replace(char2, char1)
  14. text = text.replace("___", char2)
  15. result = base64.b64decode(text)
  16. print result
  17. return result
  18. def get_streams(url0):
  19. res = re.search("\[([\d,]+)]",url0).group(1)
  20. streams=[]
  21. for res in res.split(","):
  22. if not res: continue
  23. url=re.sub("\[[\d,]+]",res,url0)
  24. streams.append((res,url))
  25. return streams
  26. if len(sys.argv)>1:
  27. text=sys.argv[1]
  28. else:
  29. text = """
  30. XRHzQZe3yMD8Bxn8oCYgDac3Qxl350Jlf0ts2jAz2WtG5W5LfmJl5jQL502z5i5sfZtMDj237aA3cm7wB1H0yW6WywftSJk2HCYzoRch
  31. """
  32. url = decode_uppod_text(text)
  33. m=re.search("http://.+?\[.+?\].+",url)
  34. if m:
  35. streams = get_streams(url)
  36. for s in streams: print s[0],s[1]