Fixed AUTH_REQUIRED issue when downloading multiple tracks

This commit is contained in:
RemixDev 2020-11-19 16:53:25 +01:00
parent f53c991622
commit 8840855a96
No known key found for this signature in database
GPG Key ID: B33962B465BDB51C
3 changed files with 6 additions and 5 deletions

View File

@ -1,3 +1,3 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
__version__ = "1.5.20" __version__ = "1.5.21"

View File

@ -75,6 +75,7 @@ class Deezer:
self.checksums = None self.checksums = None
self.session = requests.Session() self.session = requests.Session()
self.mobile_session = requests.Session()
self.logged_in = False self.logged_in = False
self.session.mount('http://', requests.adapters.HTTPAdapter(pool_maxsize=100)) self.session.mount('http://', requests.adapters.HTTPAdapter(pool_maxsize=100))
@ -92,11 +93,11 @@ class Deezer:
def get_track_filesizes(self, sng_id): def get_track_filesizes(self, sng_id):
try: try:
response = requests.post("https://www.deezer.com/", response = self.mobile_session.post("https://www.deezer.com/",
headers=self.http_headers, headers=self.http_headers,
timeout=30) timeout=30)
guest_sid = response.cookies.get('sid') guest_sid = self.mobile_session.cookies.get('sid')
site = requests.post( site = self.mobile_session.post(
"https://api.deezer.com/1.0/gateway.php", "https://api.deezer.com/1.0/gateway.php",
params={ params={
'api_key': "4VCYIJUCDLOUELGD1V8WBVYBNVDYOXEWSLLZDONGBBDFVXTZJRXPR29JRLQFO6ZE", 'api_key': "4VCYIJUCDLOUELGD1V8WBVYBNVDYOXEWSLLZDONGBBDFVXTZJRXPR29JRLQFO6ZE",

View File

@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text()
setup( setup(
name="deemix", name="deemix",
version="1.5.20", version="1.5.21",
description="A barebone deezer downloader library", description="A barebone deezer downloader library",
long_description=README, long_description=README,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",