udemy-userAPI 0.2.6__tar.gz → 0.2.7__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {udemy_userapi-0.2.6/udemy_userAPI.egg-info → udemy_userapi-0.2.7}/PKG-INFO +2 -2
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/README.md +1 -1
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/README_PYPI.md +1 -1
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI/__version__.py +1 -1
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI/authenticate.py +70 -26
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7/udemy_userAPI.egg-info}/PKG-INFO +2 -2
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/LICENSE +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/MANIFEST.in +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/setup.cfg +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/setup.py +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI/.cache/.udemy_userAPI +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI/__init__.py +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI/api.py +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI/bultins.py +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI/exeptions.py +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI/mpd_analyzer/__init__.py +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI/mpd_analyzer/bin.wvd +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI/mpd_analyzer/mpd_parser.py +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI/sections.py +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI/udemy.py +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI.egg-info/SOURCES.txt +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI.egg-info/dependency_links.txt +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI.egg-info/not-zip-safe +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI.egg-info/requires.txt +0 -0
- {udemy_userapi-0.2.6 → udemy_userapi-0.2.7}/udemy_userAPI.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: udemy_userAPI
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.7
|
4
4
|
Summary: Obtenha detalhes de cursos que o usuário esteja inscrito da plataforma Udemy,usando o EndPoint de usuário o mesmo que o navegador utiliza para acessar e redenrizar os cursos.
|
5
5
|
Author: PauloCesar-dev404
|
6
6
|
Author-email: paulocesar0073dev404@gmail.com
|
@@ -19,7 +19,7 @@ Requires-Dist: pywidevine
|
|
19
19
|
# udemy-userAPI
|
20
20
|
|
21
21
|
|
22
|
-

|
23
23
|

|
24
24
|
[](https://apoia.se/paulocesar-dev404)
|
25
25
|
[](https://github.com/PauloCesar-dev404/udemy-userAPI/wiki)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<img src="assets/udemy_userAPI-logo.png" alt="udemy_userAPI-logo" width="200"/>
|
3
3
|
|
4
4
|
|
5
|
-

|
6
6
|

|
7
7
|
[](https://apoia.se/paulocesar-dev404)
|
8
8
|
[](https://github.com/PauloCesar-dev404/udemy-userAPI/wiki)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# udemy-userAPI
|
2
2
|
|
3
3
|
|
4
|
-

|
5
5
|

|
6
6
|
[](https://apoia.se/paulocesar-dev404)
|
7
7
|
[](https://github.com/PauloCesar-dev404/udemy-userAPI/wiki)
|
@@ -2,6 +2,9 @@ import json
|
|
2
2
|
import os
|
3
3
|
import pickle
|
4
4
|
import traceback
|
5
|
+
import hashlib
|
6
|
+
import hmac
|
7
|
+
import math
|
5
8
|
from datetime import datetime
|
6
9
|
import requests
|
7
10
|
from .exeptions import UnhandledExceptions, UdemyUserApiExceptions, LoginException
|
@@ -13,7 +16,7 @@ DEBUG = False
|
|
13
16
|
class UdemyAuth:
|
14
17
|
def __init__(self):
|
15
18
|
"""Autenticação na plataforma udemy de maneira segura, atencao ao limite de logins,recomendo que apos logar
|
16
|
-
nao use
|
19
|
+
nao use novamnete o metodo login use apenas o verifcador de login para evitar bloqueios temporários..."""
|
17
20
|
self.__cookie_dict = {}
|
18
21
|
# Diretório do arquivo atual
|
19
22
|
current_directory = os.path.dirname(__file__)
|
@@ -185,7 +188,6 @@ class UdemyAuth:
|
|
185
188
|
raise LoginException(f"Erro ao carregar cookies: {e}")
|
186
189
|
|
187
190
|
def remove_cookies(self):
|
188
|
-
"""remove os cookies salvos"""
|
189
191
|
if os.path.exists(self.__file_path):
|
190
192
|
with open(self.__file_path, 'wb') as f:
|
191
193
|
f.write(b'')
|
@@ -241,30 +243,45 @@ class UdemyAuth:
|
|
241
243
|
login_url = "https://www.udemy.com/api-2.0/auth/code-generation/login/4.0/"
|
242
244
|
response = session.post(login_url, data=data, allow_redirects=False)
|
243
245
|
if 'error_message' in response.text:
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
246
|
+
erro_data: dict = response.json()
|
247
|
+
error_message = erro_data.get('error_message', {})
|
248
|
+
raise LoginException(error_message)
|
249
|
+
for attempt in range(3):
|
250
|
+
# Solicita o código OTP ao usuário
|
251
|
+
otp = input("Digite o código de 6 dígitos enviado ao seu e-mail: ")
|
252
|
+
# Realiza o login com o código OTP
|
253
|
+
otp_login_url = "https://www.udemy.com/api-2.0/auth/udemy-passwordless/login/4.0/"
|
254
|
+
otp_data = {
|
255
|
+
"email": email,
|
256
|
+
"fullname": "",
|
257
|
+
"otp": otp,
|
258
|
+
"subscribeToEmails": "false",
|
259
|
+
"upow": J(email, 'login')
|
260
|
+
}
|
261
|
+
session.headers.update({
|
262
|
+
"Referer": f"https://www.udemy.com/join/passwordless-auth/?locale={locale}&next="
|
263
|
+
f"https%3A%2F%2Fwww.udemy.com%2Fmobile%2Fipad%2F&response_type=html"
|
264
|
+
})
|
265
|
+
response = session.post(otp_login_url, otp_data, allow_redirects=False)
|
266
|
+
# Verifica se o login foi bem-sucedido
|
267
|
+
if response.status_code == 200:
|
268
|
+
self._save_cookies(session.cookies)
|
269
|
+
else:
|
270
|
+
if 'error_message' in response.text:
|
271
|
+
erro_data: dict = response.json()
|
272
|
+
error_message = erro_data.get('error_message', {})
|
273
|
+
error_code = erro_data.get('error_code', {})
|
274
|
+
if error_code == '1538':
|
275
|
+
raise LoginException(error_message)
|
276
|
+
elif error_code == '2550':
|
277
|
+
print(error_message)
|
278
|
+
continue
|
279
|
+
elif error_code == '1330':
|
280
|
+
raise LoginException(error_message)
|
281
|
+
elif error_code == '1149':
|
282
|
+
LoginException(f"Erro interno ao enviar os dados veja os detalhes: '{error_message}'")
|
283
|
+
raise LoginException(response.text)
|
284
|
+
break
|
268
285
|
except Exception as e:
|
269
286
|
if DEBUG:
|
270
287
|
error_details = traceback.format_exc()
|
@@ -273,3 +290,30 @@ class UdemyAuth:
|
|
273
290
|
raise LoginException(error_details)
|
274
291
|
|
275
292
|
|
293
|
+
def J(e, t):
|
294
|
+
r = datetime.now()
|
295
|
+
s = r.isoformat()[:10]
|
296
|
+
return s + X(e, s, t)
|
297
|
+
|
298
|
+
|
299
|
+
def X(e, t, r):
|
300
|
+
s = 0
|
301
|
+
while True:
|
302
|
+
o = ee(s)
|
303
|
+
a = hmac.new(r.encode(), (e + t + o).encode(), hashlib.sha256).digest()
|
304
|
+
if te(16, a):
|
305
|
+
return o
|
306
|
+
s += 1
|
307
|
+
|
308
|
+
|
309
|
+
def ee(e):
|
310
|
+
if e < 0:
|
311
|
+
return ""
|
312
|
+
return ee(e // 26 - 1) + chr(65 + e % 26)
|
313
|
+
|
314
|
+
|
315
|
+
def te(e, t):
|
316
|
+
r = math.ceil(e / 8)
|
317
|
+
s = t[:r]
|
318
|
+
o = ''.join(format(byte, '08b') for byte in s)
|
319
|
+
return o.startswith('0' * e)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: udemy_userAPI
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.7
|
4
4
|
Summary: Obtenha detalhes de cursos que o usuário esteja inscrito da plataforma Udemy,usando o EndPoint de usuário o mesmo que o navegador utiliza para acessar e redenrizar os cursos.
|
5
5
|
Author: PauloCesar-dev404
|
6
6
|
Author-email: paulocesar0073dev404@gmail.com
|
@@ -19,7 +19,7 @@ Requires-Dist: pywidevine
|
|
19
19
|
# udemy-userAPI
|
20
20
|
|
21
21
|
|
22
|
-

|
23
23
|

|
24
24
|
[](https://apoia.se/paulocesar-dev404)
|
25
25
|
[](https://github.com/PauloCesar-dev404/udemy-userAPI/wiki)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|