This commit is contained in:
Alhaziel01
2021-06-01 17:08:58 +02:00
parent 4b24d7e794
commit a77f659593
2 changed files with 9 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ if sys.version_info[0] >= 3:
from urllib.request import Request, urlopen
else:
from urllib2 import Request, urlopen
str = unicode
class Cursor(object):
@@ -62,6 +63,7 @@ class Cursor(object):
if len(self._file.cursors) == 0: self._file.cursor = False
def decode(self, data):
if type(data) == str: data = data.encode()
return self.decryptor.decrypt(data)
def prepare_decoder(self,offset):

View File

@@ -48,15 +48,15 @@ def test_video_exists(page_url):
-17: 'The request exceeds your allowable transfer fee',
-18: types + ' temporarily unavailable, please try again later'
}
api = 'https://g.api.mega.co.nz/cs?id=%d%s' % (seqno, get)
req_api = httptools.downloadpage(api, post=json.dumps([post])).data
api = 'https://g.api.mega.co.nz/cs?id={}{}'.format(seqno, get)
req_api = httptools.downloadpage(api, post=json.dumps([post])).json
if isfolder:
req_api = json.loads(req_api)
req_api = req_api
else:
try:
req_api = json.loads(req_api)[0]
req_api = req_api[0]
except:
req_api = json.loads(req_api)
req_api = req_api
logger.error(req_api)
if isinstance(req_api, (int, long)):
if req_api in codes:
@@ -82,8 +82,8 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
logger.debug("(page_url='%s')" % page_url)
video_urls = []
# si hay mas de 5 archivos crea un playlist con todos
# Esta función (la de la playlist) no va, hay que ojear megaserver/handler.py aunque la llamada este en client.py
# If there are more than 5 files create a playlist with all
# This function (the playlist) does not go, you have to browse megaserver / handler.py although the call is in client.py
if len(files) > 5:
media_url = c.get_play_list()
video_urls.append([scrapertools.get_filename_from_url(media_url)[-4:] + " [mega]", media_url])