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

videoweedresolver.py 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # -*- coding: UTF-8 -*-
  2. #/*
  3. # * Copyright (C) 2011 Libor Zoubek
  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,util
  23. __name__ = 'videoweed'
  24. def supports(data):
  25. return not _regex(data) == None
  26. def resolve(url):
  27. if not _regex(url) == None:
  28. data = util.request(url.replace('&','&'))
  29. data = util.substr(data,'flashvars','params')
  30. domain = re.search('flashvars\.domain=\"([^\"]+)',data,re.IGNORECASE | re.DOTALL).group(1)
  31. file = re.search('flashvars\.file=\"([^\"]+)',data,re.IGNORECASE | re.DOTALL).group(1)
  32. key = re.search('flashvars\.filekey=\"([^\"]+)',data,re.IGNORECASE | re.DOTALL).group(1)
  33. data = util.request('%s/api/player.api.php?key=%s&file=%s&user=undefined&codes=undefined&pass=undefined'% (domain,key,file))
  34. m = re.search('url=(?P<url>[^\&]+)',data,re.IGNORECASE | re.DOTALL)
  35. if not m == None:
  36. return [{'url':m.group('url')}]
  37. def _regex(data):
  38. return re.search('http\://embed.videoweed.com(.+?)', data, re.IGNORECASE | re.DOTALL)