mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-21 12:34:08 +00:00
[globo] handle login errors
This commit is contained in:
parent
db2058f63e
commit
e518749300
@ -8,7 +8,10 @@ import random
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import compat_str
|
from ..compat import (
|
||||||
|
compat_HTTPError,
|
||||||
|
compat_str,
|
||||||
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
@ -71,16 +74,22 @@ class GloboIE(InfoExtractor):
|
|||||||
if email is None:
|
if email is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._download_json(
|
try:
|
||||||
'https://login.globo.com/api/authentication', None, data=json.dumps({
|
self._download_json(
|
||||||
'payload': {
|
'https://login.globo.com/api/authentication', None, data=json.dumps({
|
||||||
'email': email,
|
'payload': {
|
||||||
'password': password,
|
'email': email,
|
||||||
'serviceId': 4654,
|
'password': password,
|
||||||
},
|
'serviceId': 4654,
|
||||||
}).encode(), headers={
|
},
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
}).encode(), headers={
|
||||||
})
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
})
|
||||||
|
except ExtractorError as e:
|
||||||
|
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 401:
|
||||||
|
resp = self._parse_json(e.cause.read(), None)
|
||||||
|
raise ExtractorError(resp.get('userMessage') or resp['id'], expected=True)
|
||||||
|
raise
|
||||||
self._LOGGED_IN = True
|
self._LOGGED_IN = True
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
Loading…
Reference in New Issue
Block a user