Version 0.8.11
This commit is contained in:
1 parent
826791476b
commit
8a1fb36228
5 files changed
+50
-20
No files matched your search
+31
-15
@@ -18,6 +18,7 @@ from .log import LOG, print_json
|
||||
from .network import Network
|
||||
from .cache import Cache
|
||||
from .timeconv import *
|
||||
from .useragent import useragent
|
||||
|
||||
class Movistar(object):
|
||||
account = {'username': '', 'password': '',
|
||||
@@ -45,7 +46,7 @@ class Movistar(object):
|
||||
'Accept-Language': 'es-ES,es;q=0.9',
|
||||
'Origin': 'https://ver.movistarplus.es',
|
||||
'Referer': 'https://ver.movistarplus.es/',
|
||||
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0'
|
||||
'User-Agent': useragent
|
||||
}
|
||||
self.net = Network()
|
||||
self.net.headers = headers
|
||||
@@ -445,20 +446,34 @@ class Movistar(object):
|
||||
self.cache.save_file('profile_id.conf', self.account['profile_id'])
|
||||
self.cache.remove_file('tokens.json')
|
||||
|
||||
def get_epg(self):
|
||||
cache_filename = 'epg_{}.json'.format(self.quality)
|
||||
content = self.cache.load(cache_filename, 6*60)
|
||||
if content:
|
||||
data = json.loads(content)
|
||||
def load_epg_data(self, date_str, duration=2, channels=''):
|
||||
demarcation = self.account['demarcation']
|
||||
url = self.endpoints['rejilla'].format(deviceType='webplayer', profile=self.account['platform'], UTCDATETIME=date_str, DURATION=duration, CHANNELS=channels, NETWORK='movistarplus', mdrm='true', demarcation=demarcation)
|
||||
if self.quality == 'UHD': url += '&filterQuality=UHD'
|
||||
#LOG(url)
|
||||
data = self.net.load_data(url)
|
||||
return data
|
||||
|
||||
def get_epg(self, date=None, duration=2, channels=None):
|
||||
if channels:
|
||||
if not date:
|
||||
today = datetime.today()
|
||||
date_str = today.strftime('%Y-%m-%dT00:00:00')
|
||||
ch_data = self.load_epg_data(date_str, duration, channels)
|
||||
if not ch_data: return []
|
||||
data = []
|
||||
data.append(ch_data)
|
||||
else:
|
||||
today = datetime.today()
|
||||
str_now = today.strftime('%Y-%m-%dT00:00:00')
|
||||
url = self.endpoints['rejilla'].format(deviceType='webplayer', profile=self.account['platform'], UTCDATETIME=str_now, DURATION=2, CHANNELS='', NETWORK='movistarplus', mdrm='true', demarcation=self.account['demarcation'])
|
||||
if self.quality == 'UHD': url += '&filterQuality=UHD'
|
||||
#print(url)
|
||||
data = self.net.load_data(url)
|
||||
if not 'error' in data:
|
||||
self.cache.save_file(cache_filename, json.dumps(data, ensure_ascii=False))
|
||||
cache_filename = 'epg_{}.json'.format(self.quality)
|
||||
content = self.cache.load(cache_filename, 6*60)
|
||||
if content:
|
||||
data = json.loads(content)
|
||||
else:
|
||||
today = datetime.today()
|
||||
str_now = today.strftime('%Y-%m-%dT00:00:00')
|
||||
data = self.load_epg_data(str_now)
|
||||
if not 'error' in data:
|
||||
self.cache.save_file(cache_filename, json.dumps(data, ensure_ascii=False))
|
||||
|
||||
epg = {}
|
||||
if 'error' in data: return epg
|
||||
@@ -1011,7 +1026,8 @@ class Movistar(object):
|
||||
return None
|
||||
|
||||
def epg_to_movies(self, channel_id):
|
||||
epg = self.get_epg()
|
||||
LOG('epg_to_movies: {}'.format(channel_id))
|
||||
epg = self.get_epg(channels=channel_id)
|
||||
res = []
|
||||
if not channel_id in epg: return res
|
||||
for p in epg[channel_id]:
|
||||
|
||||
@@ -27,6 +27,7 @@ from .log import LOG
|
||||
from .movistar import *
|
||||
from .addon import *
|
||||
from .gui import *
|
||||
from .useragent import useragent
|
||||
|
||||
kodi_version= int(xbmc.getInfoLabel('System.BuildVersion')[:2])
|
||||
|
||||
@@ -99,12 +100,12 @@ def play(params):
|
||||
LOG("url: {}".format(url))
|
||||
|
||||
headers = 'Content-Type=application/octet-stream'
|
||||
headers += '&User-Agent=Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0'
|
||||
headers += '&User-Agent=' + useragent
|
||||
headers += '&Accept=*/*&Accept-Language=es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3'
|
||||
headers += '&Referer=https://ver.movistarplus.es/'
|
||||
headers += '&Origin=https://ver.movistarplus.es'
|
||||
#headers += '&Host=wv-ottlic-f3.imagenio.telefonica.net'
|
||||
manifest_headers = 'User-Agent=Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0'
|
||||
manifest_headers = 'User-Agent=' + useragent
|
||||
|
||||
if stype == 'tv':
|
||||
cdn_token = m.get_cdntoken()
|
||||
@@ -204,6 +205,10 @@ def play(params):
|
||||
subpaths.append(filename_srt)
|
||||
play_item.setSubtitles(subpaths)
|
||||
|
||||
if True:
|
||||
m.unregister_device()
|
||||
m.register_device()
|
||||
|
||||
xbmcplugin.setResolvedUrl(_handle, True, listitem=play_item)
|
||||
|
||||
LOG('**** session_opened: {}'.format(session_opened))
|
||||
|
||||
@@ -44,12 +44,13 @@ import xbmcaddon
|
||||
from .b64 import encode_base64
|
||||
from .log import LOG
|
||||
from .addon import profile_dir
|
||||
from .useragent import useragent
|
||||
|
||||
from ttml2ssa import Ttml2SsaAddon
|
||||
ttml = Ttml2SsaAddon()
|
||||
|
||||
session = requests.Session()
|
||||
session.headers.update({'user-agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0'})
|
||||
session.headers.update({'user-agent': useragent})
|
||||
previous_tokens = []
|
||||
|
||||
reregister_needed = False
|
||||
@@ -192,7 +193,7 @@ class RequestHandler(BaseHTTPRequestHandler):
|
||||
previous_tokens.append(token)
|
||||
|
||||
headers = {
|
||||
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0',
|
||||
'User-Agent': useragent,
|
||||
'Accept': '*/*',
|
||||
'Accept-Language': 'es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||
'Referer': 'https://ver.movistarplus.es/',
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import unicode_literals, absolute_import, division
|
||||
|
||||
useragent = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0'
|
||||
Reference in new issue
Block a user