Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Proxy Support #39

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Meilleure gestion des erreurs
  • Loading branch information
remzouille committed Nov 5, 2023
commit 7f904530f54dab7db0d7de68382fa5db927ca6b2
10 changes: 8 additions & 2 deletions resources/lib/provider_templates/orange.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,28 @@ def _auth_urlopen(self, url: str, headers: dict = None) -> tuple:
if res.code == 200:
return res.read(), auth['cookie'], auth['tv_token']
except HTTPError as error:
if error.code in (401, 403):
if error.code == 401:
log(f"cookie/token invalide, âge = {int(timestamp - auth['timestamp'])}", LogLevel.INFO)
if error.code == 403:
log(f"cette chaine ne fait pas partie de votre offre.", LogLevel.INFO)
break
else:
log(f"erreur {error}", LogLevel.INFO)
raise

_, auth['cookie'], auth['tv_token'] = self._get_auth()

return None
return None, None, None

def get_stream_info(self, channel_id: int) -> dict:
res, cookie, tv_token = self._auth_urlopen(self.endpoint_stream_info.format(channel_id=channel_id), headers={
'User-Agent': random_ua(),
'Host': urlparse(self.endpoint_stream_info).netloc
})

if res is None:
return False

stream_info = json.loads(res)

drm = get_drm()
Expand Down
Loading