Added general exception catch when tring to connect to deezer

This commit is contained in:
RemixDev 2020-12-30 15:21:33 +01:00
parent 1e9e28ec2c
commit 34b93de62c
No known key found for this signature in database
GPG key ID: B33962B465BDB51C
2 changed files with 8 additions and 4 deletions

4
app.py
View file

@ -96,7 +96,11 @@ class deemix:
def checkDeezerAvailability(self):
print("Pinging deezer.com...")
try:
body = requests.get("https://www.deezer.com/", headers={'Cookie': 'dz_lang=en; Domain=deezer.com; Path=/; Secure; hostOnly=false;'}).text
except Exception as e:
self.isDeezerAvailable = False
print(f"deezer.com not reached! {str(e)}")
title = body[body.find('<title>')+7:body.find('</title>')]
self.isDeezerAvailable = title.strip() != "Deezer will soon be available in your country."
print(f"deezer.com reached: {'Available' if self.isDeezerAvailable else 'Not Available'}")

2
webui

@ -1 +1 @@
Subproject commit 08064146d5242dadcece4cd0fbb910e7f302bad0
Subproject commit fd564547279dbcb8ff1eaf08afe728291e640b62