Version 0.11.2

This commit is contained in:
Paco8 committed 2025-07-01 12:57:07 +02:00
1 parent 4f738f61c7
commit bd0853e126
3 files changed
+17 -13

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.movistarplus" <addon id="plugin.video.movistarplus"
name="Movistar+" name="Movistar+"
version="0.11.1" version="0.11.2"
provider-name="Paco8"> provider-name="Paco8">
<requires> <requires>
<!--- <import addon="xbmc.python" version="2.25.0"/> --> <!--- <import addon="xbmc.python" version="2.25.0"/> -->
+6 -2
View File
@@ -1139,7 +1139,9 @@ class Movistar(object):
def get_subtitles(self, manifest_url): def get_subtitles(self, manifest_url):
base_url = os.path.dirname(manifest_url) base_url = os.path.dirname(manifest_url)
content = self.net.load_url(manifest_url) headers = self.net.headers.copy()
headers['x-tcdn-token'] = self.get_cdntoken()
content = self.net.load_url(manifest_url, headers)
rx = r'<AdaptationSet id="\d+" contentType="text" mimeType="application\/ttml\+xml" lang="(.*?)">.*?<BaseURL>(.*?)<\/BaseURL>' rx = r'<AdaptationSet id="\d+" contentType="text" mimeType="application\/ttml\+xml" lang="(.*?)">.*?<BaseURL>(.*?)<\/BaseURL>'
matches = re.findall(rx, content, flags=re.MULTILINE | re.DOTALL) matches = re.findall(rx, content, flags=re.MULTILINE | re.DOTALL)
res = [] res = []
@@ -1158,11 +1160,13 @@ class Movistar(object):
#LOG('output_dir: {}'.format(output_dir)) #LOG('output_dir: {}'.format(output_dir))
if not os.path.exists(output_dir): if not os.path.exists(output_dir):
os.makedirs(output_dir) os.makedirs(output_dir)
headers = self.net.headers.copy()
headers['x-tcdn-token'] = self.get_cdntoken()
res = [] res = []
for s in sublist: for s in sublist:
filename = output_dir + os.sep + s['lang'] + '.ttml' filename = output_dir + os.sep + s['lang'] + '.ttml'
LOG('filename: {}'.format(filename)) LOG('filename: {}'.format(filename))
content = self.net.load_url(s['url']) content = self.net.load_url(s['url'], headers)
with io.open(filename, 'w', encoding='utf-8', newline='') as handle: with io.open(filename, 'w', encoding='utf-8', newline='') as handle:
handle.write(content) handle.write(content)
res.append(filename) res.append(filename)
+10 -10
View File
@@ -11,18 +11,18 @@ from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import PoolManager from requests.packages.urllib3.poolmanager import PoolManager
class CustomAdapter(HTTPAdapter, object): class CustomAdapter(HTTPAdapter, object):
if sys.version_info[0] == 3: def init_poolmanager(self, connections, maxsize, block=False):
def init_poolmanager(self, connections, maxsize, block=False): ctx = ssl.create_default_context()
ctx = ssl.create_default_context() ctx.options |= 0x4 # OP_LEGACY_SERVER_CONNECT
self.poolmanager = PoolManager( self.poolmanager = PoolManager(
num_pools=connections, num_pools=connections,
maxsize=maxsize, maxsize=maxsize,
block=block, block=block,
ssl_context=ctx ssl_context=ctx
) )
class MySession(requests.Session, object): class MySession(requests.Session, object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(MySession, self).__init__(*args, **kwargs) super(MySession, self).__init__(*args, **kwargs)
if sys.platform.startswith("linux") and sys.version_info[0] == 3: if sys.platform.startswith("linux"):
self.mount('https://', CustomAdapter()) self.mount('https://', CustomAdapter())