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

mojevideosk.py 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # -*- coding: UTF-8 -*-
  2. # /*
  3. # * Copyright (C) 2016 Jose Riha
  4. # *
  5. # *
  6. # * This Program is free software; you can redistribute it and/or modify
  7. # * it under the terms of the GNU General Public License as published by
  8. # * the Free Software Foundation; either version 2, or (at your option)
  9. # * any later version.
  10. # *
  11. # * This Program is distributed in the hope that it will be useful,
  12. # * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # * GNU General Public License for more details.
  15. # *
  16. # * You should have received a copy of the GNU General Public License
  17. # * along with this program; see the file COPYING. If not, write to
  18. # * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19. # * http://www.gnu.org/copyleft/gpl.html
  20. # *
  21. # */
  22. import re
  23. import util
  24. import time
  25. import pickle
  26. __author__ = 'Jose Riha'
  27. __name__ = 'mojevideo.sk'
  28. def supports(url):
  29. return re.search(r'mojevideo\.sk/video/\w+/.+\.html', url) is not None
  30. def resolve(url):
  31. cookies = {}
  32. util.init_urllib(cookies)
  33. data = util.request(url)
  34. view = pickle.loads(util._cookie_jar.dump())[
  35. '.mojevideo.sk']['/'].keys()[0]
  36. st = re.search(r'vHash=\[\'([^\']+)', data)
  37. if not st:
  38. return None
  39. st = st.group(1)
  40. tim = int(time.time())
  41. base = 'http://fs5.mojevideo.sk:8080/securevd/'
  42. return [{'url': base + view.replace('view', '') + '.mp4?st=%s&e=%s|Cookie=%s=1' % (st, tim, view)}]