mirror of
https://github.com/yaronzz/Tidal-Media-Downloader.git
synced 2026-06-13 04:05:07 +03:00
check api key
This commit is contained in:
@@ -78,7 +78,10 @@ def main():
|
||||
Printf.logo()
|
||||
Printf.settings()
|
||||
|
||||
if not loginByConfig():
|
||||
if not apiKey.isItemValid(SETTINGS.apiKeyIndex):
|
||||
changeApiKey()
|
||||
loginByWeb()
|
||||
elif not loginByConfig():
|
||||
loginByWeb()
|
||||
|
||||
Printf.checkVersion()
|
||||
|
||||
@@ -60,12 +60,12 @@ __KEYS_JSON__ = '''
|
||||
'''
|
||||
__API_KEYS__ = json.loads(__KEYS_JSON__)
|
||||
__ERROR_KEY__ = {
|
||||
'platform': 'None',
|
||||
'formats': '',
|
||||
'clientId': '',
|
||||
'clientSecret': '',
|
||||
'platform': 'None',
|
||||
'formats': '',
|
||||
'clientId': '',
|
||||
'clientSecret': '',
|
||||
'valid': 'False',
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
def getNum():
|
||||
@@ -78,6 +78,11 @@ def getItem(index: int):
|
||||
return __API_KEYS__['keys'][index]
|
||||
|
||||
|
||||
def isItemValid(index: int):
|
||||
item = getItem(index)
|
||||
return item['valid'] == 'True'
|
||||
|
||||
|
||||
def getItems():
|
||||
return __API_KEYS__['keys']
|
||||
|
||||
@@ -92,7 +97,8 @@ def getLimitIndexs():
|
||||
def getVersion():
|
||||
return __API_KEYS__['version']
|
||||
|
||||
#Load from gist
|
||||
|
||||
# Load from gist
|
||||
try:
|
||||
respond = requests.get('https://api.github.com/gists/48d01f5a24b4b7b37f19443977c22cd6')
|
||||
if respond.status_code == 200:
|
||||
@@ -100,5 +106,3 @@ try:
|
||||
__API_KEYS__ = json.loads(content)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -290,6 +290,8 @@ class TidalAPI(object):
|
||||
ret.encryptionKey = manifest['keyId'] if 'keyId' in manifest else ""
|
||||
ret.url = manifest['urls'][0]
|
||||
return ret
|
||||
# else:
|
||||
# manifest = json.loads(base64.b64decode(resp.manifest).decode('utf-8'))
|
||||
raise Exception("Can't get the streamUrl, type is " + resp.manifestMimeType)
|
||||
|
||||
def getVideoStreamUrl(self, id, quality: VideoQuality):
|
||||
|
||||
Reference in New Issue
Block a user