Version 0.11.2
This commit is contained in:
1 parent
4f738f61c7
commit
bd0853e126
3 files changed
+17
-13
No files matched your search
@@ -1139,7 +1139,9 @@ class Movistar(object):
|
||||
|
||||
def get_subtitles(self, 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>'
|
||||
matches = re.findall(rx, content, flags=re.MULTILINE | re.DOTALL)
|
||||
res = []
|
||||
@@ -1158,11 +1160,13 @@ class Movistar(object):
|
||||
#LOG('output_dir: {}'.format(output_dir))
|
||||
if not os.path.exists(output_dir):
|
||||
os.makedirs(output_dir)
|
||||
headers = self.net.headers.copy()
|
||||
headers['x-tcdn-token'] = self.get_cdntoken()
|
||||
res = []
|
||||
for s in sublist:
|
||||
filename = output_dir + os.sep + s['lang'] + '.ttml'
|
||||
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:
|
||||
handle.write(content)
|
||||
res.append(filename)
|
||||
|
||||
+10
-10
@@ -11,18 +11,18 @@ from requests.adapters import HTTPAdapter
|
||||
from requests.packages.urllib3.poolmanager import PoolManager
|
||||
|
||||
class CustomAdapter(HTTPAdapter, object):
|
||||
if sys.version_info[0] == 3:
|
||||
def init_poolmanager(self, connections, maxsize, block=False):
|
||||
ctx = ssl.create_default_context()
|
||||
self.poolmanager = PoolManager(
|
||||
num_pools=connections,
|
||||
maxsize=maxsize,
|
||||
block=block,
|
||||
ssl_context=ctx
|
||||
)
|
||||
def init_poolmanager(self, connections, maxsize, block=False):
|
||||
ctx = ssl.create_default_context()
|
||||
ctx.options |= 0x4 # OP_LEGACY_SERVER_CONNECT
|
||||
self.poolmanager = PoolManager(
|
||||
num_pools=connections,
|
||||
maxsize=maxsize,
|
||||
block=block,
|
||||
ssl_context=ctx
|
||||
)
|
||||
|
||||
class MySession(requests.Session, object):
|
||||
def __init__(self, *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())
|
||||
Reference in new issue
Block a user