udemy-userAPI 0.2.4__py3-none-any.whl → 0.2.5__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- animation_consoles/__init__.py +1 -0
- animation_consoles/animation.py +64 -0
- ffmpeg_for_python/__config__.py +118 -0
- ffmpeg_for_python/__init__.py +8 -0
- ffmpeg_for_python/__utils.py +78 -0
- ffmpeg_for_python/__version__.py +6 -0
- ffmpeg_for_python/exeptions.py +91 -0
- ffmpeg_for_python/ffmpeg.py +203 -0
- m3u8_analyzer/M3u8Analyzer.py +807 -0
- m3u8_analyzer/__init__.py +7 -0
- m3u8_analyzer/__version__.py +1 -0
- m3u8_analyzer/exeptions.py +82 -0
- udemy_userAPI/__version__.py +1 -1
- udemy_userAPI/authenticate.py +23 -18
- udemy_userAPI/udemy.py +0 -2
- {udemy_userAPI-0.2.4.dist-info → udemy_userAPI-0.2.5.dist-info}/METADATA +1 -1
- udemy_userAPI-0.2.5.dist-info/RECORD +29 -0
- udemy_userAPI-0.2.5.dist-info/top_level.txt +4 -0
- udemy_userAPI-0.2.4.dist-info/RECORD +0 -17
- udemy_userAPI-0.2.4.dist-info/top_level.txt +0 -1
- {udemy_userAPI-0.2.4.dist-info → udemy_userAPI-0.2.5.dist-info}/LICENSE +0 -0
- {udemy_userAPI-0.2.4.dist-info → udemy_userAPI-0.2.5.dist-info}/WHEEL +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = '1.0.4.1'
|
@@ -0,0 +1,82 @@
|
|
1
|
+
class M3u8AnalyzerExceptions(Exception):
|
2
|
+
def __init__(self, message="Erro na análise da playlist M3U8", errors=None):
|
3
|
+
"""
|
4
|
+
Exceção base para erros relacionados à análise de playlists M3U8.
|
5
|
+
|
6
|
+
Args:
|
7
|
+
message (str): Mensagem descritiva do erro. Padrão é "Erro na análise da playlist M3U8".
|
8
|
+
errors (list, optional): Lista de erros adicionais ou detalhes para diagnóstico. Padrão é None.
|
9
|
+
"""
|
10
|
+
super().__init__(message)
|
11
|
+
self.errors = errors
|
12
|
+
|
13
|
+
def __str__(self):
|
14
|
+
"""
|
15
|
+
Retorna a representação em string da exceção.
|
16
|
+
|
17
|
+
Returns:
|
18
|
+
str: Mensagem de erro formatada com detalhes adicionais, se presentes.
|
19
|
+
"""
|
20
|
+
if self.errors:
|
21
|
+
return f"{super().__str__()} | Erros adicionais: {self.errors}"
|
22
|
+
return super().__str__()
|
23
|
+
|
24
|
+
|
25
|
+
class M3u8DownloadError(M3u8AnalyzerExceptions):
|
26
|
+
def __init__(self, message="Erro durante o download da playlist M3U8", errors=None):
|
27
|
+
"""
|
28
|
+
Exceção para erros específicos ocorridos durante o download de uma playlist M3U8.
|
29
|
+
|
30
|
+
Args:
|
31
|
+
message (str): Mensagem descritiva do erro. Padrão é "Erro durante o download da playlist M3U8".
|
32
|
+
errors (list, optional): Lista de erros adicionais ou detalhes para diagnóstico. Padrão é None.
|
33
|
+
"""
|
34
|
+
super().__init__(message, errors)
|
35
|
+
|
36
|
+
|
37
|
+
class M3u8FfmpegDownloadError(M3u8AnalyzerExceptions):
|
38
|
+
def __init__(self, message="Erro durante o download da playlist M3U8 com ffmpeg", errors=None):
|
39
|
+
"""
|
40
|
+
Exceção para erros específicos ocorridos durante o download de uma playlist M3U8 usando ffmpeg.
|
41
|
+
|
42
|
+
Args:
|
43
|
+
message (str): Mensagem descritiva do erro. Padrão é "Erro durante o download da playlist M3U8 com ffmpeg".
|
44
|
+
errors (list, optional): Lista de erros adicionais ou detalhes para diagnóstico. Padrão é None.
|
45
|
+
"""
|
46
|
+
super().__init__(message, errors)
|
47
|
+
|
48
|
+
|
49
|
+
class M3u8NetworkingError(M3u8AnalyzerExceptions):
|
50
|
+
def __init__(self, message="Erro de rede durante o download da playlist M3U8", errors=None):
|
51
|
+
"""
|
52
|
+
Exceção para erros relacionados à rede durante o download de uma playlist M3U8.
|
53
|
+
|
54
|
+
Args:
|
55
|
+
message (str): Mensagem descritiva do erro. Padrão é "Erro de rede durante o download da playlist M3U8".
|
56
|
+
errors (list, optional): Lista de erros adicionais ou detalhes para diagnóstico. Padrão é None.
|
57
|
+
"""
|
58
|
+
super().__init__(message, errors)
|
59
|
+
|
60
|
+
|
61
|
+
class M3u8Error(M3u8AnalyzerExceptions):
|
62
|
+
def __init__(self, message="Erro inesperado na análise de playlist M3U8", errors=None):
|
63
|
+
"""
|
64
|
+
Exceção para erros inesperados que não se encaixam em outras categorias.
|
65
|
+
|
66
|
+
Args:
|
67
|
+
message (str): Mensagem descritiva do erro. Padrão é "Erro inesperado na análise de playlist M3U8".
|
68
|
+
errors (list, optional): Lista de erros adicionais ou detalhes para diagnóstico. Padrão é None.
|
69
|
+
"""
|
70
|
+
super().__init__(message, errors)
|
71
|
+
|
72
|
+
|
73
|
+
class M3u8FileError(M3u8AnalyzerExceptions):
|
74
|
+
def __init__(self, message="Erro ao manipular o arquivo da playlist M3U8", errors=None):
|
75
|
+
"""
|
76
|
+
Exceção para erros ocorridos ao manipular arquivos relacionados a playlists M3U8.
|
77
|
+
|
78
|
+
Args:
|
79
|
+
message (str): Mensagem descritiva do erro. Padrão é "Erro ao manipular o arquivo da playlist M3U8".
|
80
|
+
errors (list, optional): Lista de erros adicionais ou detalhes para diagnóstico. Padrão é None.
|
81
|
+
"""
|
82
|
+
super().__init__(message, errors)
|
udemy_userAPI/__version__.py
CHANGED
udemy_userAPI/authenticate.py
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
import json
|
2
2
|
import os
|
3
3
|
import pickle
|
4
|
+
import traceback
|
5
|
+
|
4
6
|
import requests
|
5
7
|
from .exeptions import UnhandledExceptions, UdemyUserApiExceptions, LoginException
|
6
8
|
import cloudscraper
|
7
9
|
|
10
|
+
DEBUG = False
|
11
|
+
|
8
12
|
|
9
13
|
class UdemyAuth:
|
10
14
|
def __init__(self):
|
@@ -23,14 +27,6 @@ class UdemyAuth:
|
|
23
27
|
file_name = '.udemy_userAPI' # Nome do arquivo
|
24
28
|
self.__file_path = os.path.join(self.__user_dir, file_name)
|
25
29
|
|
26
|
-
def __make_cookies(self, client_id: str, access_token: str, csrf_token: str):
|
27
|
-
self.__cookie_dict = {
|
28
|
-
'client_id': client_id,
|
29
|
-
'access_token': access_token,
|
30
|
-
'csrf_token': csrf_token
|
31
|
-
}
|
32
|
-
|
33
|
-
@property
|
34
30
|
def verif_login(self):
|
35
31
|
"""verificar se o usuario estar logado."""
|
36
32
|
|
@@ -43,6 +39,9 @@ class UdemyAuth:
|
|
43
39
|
cookies_str = "; ".join([f"{key}={value}" for key, value in cookies_dict.items()])
|
44
40
|
return cookies_str
|
45
41
|
except Exception as e:
|
42
|
+
if DEBUG:
|
43
|
+
e = traceback.format_exc()
|
44
|
+
raise LoginException(e)
|
46
45
|
return False
|
47
46
|
|
48
47
|
log = verif_config()
|
@@ -70,7 +69,7 @@ class UdemyAuth:
|
|
70
69
|
resp = requests.get(url=url, headers=headers)
|
71
70
|
if resp.status_code == 200:
|
72
71
|
convert = json.loads(resp.text)
|
73
|
-
isLoggedIn = convert.get('header', {}).get('isLoggedIn',False)
|
72
|
+
isLoggedIn = convert.get('header', {}).get('isLoggedIn', False)
|
74
73
|
if isLoggedIn:
|
75
74
|
if isLoggedIn == True:
|
76
75
|
return True
|
@@ -143,7 +142,6 @@ class UdemyAuth:
|
|
143
142
|
|
144
143
|
# Verifica a resposta para determinar se o login foi bem-sucedido
|
145
144
|
if "returnUrl" in r.text:
|
146
|
-
self.__make_cookies(r.cookies.get("client_id"), r.cookies.get("access_token"), csrf_token)
|
147
145
|
self.__save_cookies(s.cookies)
|
148
146
|
else:
|
149
147
|
login_error = r.json().get("error", {}).get("data", {}).get("formErrors", [])[0]
|
@@ -156,30 +154,37 @@ class UdemyAuth:
|
|
156
154
|
|
157
155
|
return s
|
158
156
|
except Exception as e:
|
159
|
-
|
157
|
+
if DEBUG:
|
158
|
+
e = traceback.format_exc()
|
159
|
+
raise LoginException(e)
|
160
160
|
|
161
161
|
def __save_cookies(self, cookies):
|
162
162
|
try:
|
163
163
|
with open(fr'{self.__file_path}', 'wb') as f:
|
164
164
|
pickle.dump(cookies, f)
|
165
165
|
except Exception as e:
|
166
|
-
LoginException(e)
|
166
|
+
raise LoginException(e)
|
167
167
|
|
168
168
|
@property
|
169
169
|
def load_cookies(self) -> str:
|
170
|
-
"""
|
170
|
+
"""Carrega cookies e retorna-os em uma string formatada"""
|
171
171
|
try:
|
172
|
-
file = os.path.join(
|
173
|
-
if os.path.exists(file):
|
174
|
-
with open(
|
172
|
+
file = os.path.join(self.__file_path)
|
173
|
+
if os.path.exists(file) and os.path.getsize(file) > 0: # Verifica se o arquivo existe e não está vazio
|
174
|
+
with open(file, 'rb') as f:
|
175
175
|
cookies = pickle.load(f)
|
176
|
+
# Converte cookies em formato de string
|
176
177
|
cookies_dict = {cookie.name: cookie.value for cookie in cookies}
|
177
178
|
cookies_str = "; ".join([f"{key}={value}" for key, value in cookies_dict.items()])
|
178
179
|
return cookies_str
|
179
180
|
else:
|
180
|
-
return
|
181
|
+
return "" # Retorna uma string vazia se o arquivo não existir ou estiver vazio
|
182
|
+
except (EOFError, pickle.UnpicklingError): # Trata arquivos vazios ou corrompidos
|
183
|
+
return "" # Retorna uma string vazia
|
181
184
|
except Exception as e:
|
182
|
-
|
185
|
+
if DEBUG:
|
186
|
+
e = traceback.format_exc()
|
187
|
+
raise LoginException(f"Erro ao carregar cookies: {e}")
|
183
188
|
|
184
189
|
def remove_cookies(self):
|
185
190
|
if os.path.exists(self.__file_path):
|
udemy_userAPI/udemy.py
CHANGED
@@ -19,7 +19,6 @@ class Udemy:
|
|
19
19
|
if verif_login is None:
|
20
20
|
raise LoginException("User Not Logged!")
|
21
21
|
|
22
|
-
@property
|
23
22
|
def my_subscribed_courses_by_plan(self) -> list[dict]:
|
24
23
|
"""obtém os cursos que o usuário esatá inscrito, obtidos atraves de planos(assinatura)"""
|
25
24
|
try:
|
@@ -28,7 +27,6 @@ class Udemy:
|
|
28
27
|
except UdemyUserApiExceptions as e:
|
29
28
|
UnhandledExceptions(e)
|
30
29
|
|
31
|
-
@property
|
32
30
|
def my_subscribed_courses(self) -> list[dict]:
|
33
31
|
"""Obtém os cursos que o usuário está inscrito, excluindo listas vazias ou nulas"""
|
34
32
|
try:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: udemy_userAPI
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.5
|
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
|
@@ -0,0 +1,29 @@
|
|
1
|
+
animation_consoles/__init__.py,sha256=5uHhe-PVZ54FHWxbF1sNvNt4fuQf3FtZWVo2Mjo11a8,40
|
2
|
+
animation_consoles/animation.py,sha256=ZreNtdD0HYeqlRx-f1d1twUU4sOFTR7vJ3S6tMQpnHM,2122
|
3
|
+
ffmpeg_for_python/__config__.py,sha256=nCPrYs1NkMnyfyg5ITw9wOar4nUJOxwONrItVpVBVBM,4719
|
4
|
+
ffmpeg_for_python/__init__.py,sha256=-BMtoX8Yof_pnHra2OzoV3faxMubpMvUedMy8TqI8dc,214
|
5
|
+
ffmpeg_for_python/__utils.py,sha256=Qy3J5f4lOIPcSNbTwiawfiHjYPdZ_tq7hafStnnqwA4,3263
|
6
|
+
ffmpeg_for_python/__version__.py,sha256=HLFuN4n_leeJE5twr7yH2AAFyfIcEHzxElLRP1FUKmQ,422
|
7
|
+
ffmpeg_for_python/exeptions.py,sha256=tg-TBdaq_NHxZOCAhkMttzwtJVILPAQPLOKqofe5PPA,3627
|
8
|
+
ffmpeg_for_python/ffmpeg.py,sha256=G2VGHOIhErsqQI4OVlUnIQGmleNCjxyFqzNAMNnoD6I,7920
|
9
|
+
m3u8_analyzer/M3u8Analyzer.py,sha256=aUgxk2jS84MFDNbjlOT8FRiJerFI_jGcKMu9uv1EwcE,36620
|
10
|
+
m3u8_analyzer/__init__.py,sha256=v7CiVqsCq2YH347C-QR1kHPJtXFFdru8qole3E9adCY,217
|
11
|
+
m3u8_analyzer/__version__.py,sha256=YP3yT87ZKrU3eARUUdQ_pg4xAXLGfBXjH4ZgEoZSq1I,25
|
12
|
+
m3u8_analyzer/exeptions.py,sha256=fK6bU3YxNSbfsPmCp4yudUvmwy_g6dj2KwIkH0dW4LI,3672
|
13
|
+
udemy_userAPI/__init__.py,sha256=BPle89xE_CMTKKe_Lw6jioYLgpH-q_Lpho2S-n1PIUA,206
|
14
|
+
udemy_userAPI/__version__.py,sha256=av-dYivm9FvwaeydwdCTzwY6FYMnAjRiqjIqUkZFNAs,405
|
15
|
+
udemy_userAPI/api.py,sha256=dpwFtXewQmKwgG1IvzDFYZoEHNTwZbLIuv4WKgbqjOg,18817
|
16
|
+
udemy_userAPI/authenticate.py,sha256=faIoOZdU5StQvUZfLEwZ3xfPba2FrFbc2HKEOeVY7w4,8246
|
17
|
+
udemy_userAPI/bultins.py,sha256=XCXMe_5qKig_q5vbSFXBtx1vM87pE3UvEMKyUy6JCRo,12202
|
18
|
+
udemy_userAPI/exeptions.py,sha256=nuZoAt4i-ctrW8zx9LZtejrngpFXDHOVE5cEXM4RtrY,508
|
19
|
+
udemy_userAPI/sections.py,sha256=zPyDhvTIQCL0nbf7OJZG28Kax_iooILQ_hywUwvHoL8,4043
|
20
|
+
udemy_userAPI/udemy.py,sha256=2UIy70wxWJAU7qZxvMDb3sHd1uQaffUXhib04ShIuI8,2124
|
21
|
+
udemy_userAPI/.cache/.udemy_userAPI,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
|
+
udemy_userAPI/mpd_analyzer/__init__.py,sha256=i3JVWyvcFLaj5kPmx8c1PgjsLht7OUIQQClD4yqYbo8,102
|
23
|
+
udemy_userAPI/mpd_analyzer/bin.wvd,sha256=1rAJdCc120hQlX9qe5KUS628eY2ZHYxQSmyhGNefSzo,2956
|
24
|
+
udemy_userAPI/mpd_analyzer/mpd_parser.py,sha256=_vw1feJXDjw5fQLOmA5-H3UklX_30Pbl__HtDUqvp3c,17283
|
25
|
+
udemy_userAPI-0.2.5.dist-info/LICENSE,sha256=l4jdKYt8gSdDFOGr09vCKnMn_Im55XIcQKqTDEtFfNs,1095
|
26
|
+
udemy_userAPI-0.2.5.dist-info/METADATA,sha256=jx7z2l2U-YUTezhxrBjEgC6Ohq01YsqjjRXJ5jPYoGM,1394
|
27
|
+
udemy_userAPI-0.2.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
28
|
+
udemy_userAPI-0.2.5.dist-info/top_level.txt,sha256=SrUygl6WJt34qYigm-FiGqKCs2M4S_f-aU2i6oJ3nDM,65
|
29
|
+
udemy_userAPI-0.2.5.dist-info/RECORD,,
|
@@ -1,17 +0,0 @@
|
|
1
|
-
udemy_userAPI/__init__.py,sha256=BPle89xE_CMTKKe_Lw6jioYLgpH-q_Lpho2S-n1PIUA,206
|
2
|
-
udemy_userAPI/__version__.py,sha256=yRNB4bHSJhN7ugz9iJp6x2b-P_k3yGzI60MkeoyisfQ,405
|
3
|
-
udemy_userAPI/api.py,sha256=dpwFtXewQmKwgG1IvzDFYZoEHNTwZbLIuv4WKgbqjOg,18817
|
4
|
-
udemy_userAPI/authenticate.py,sha256=JWqDHgcBh7pnRrHOL_RP3Lx32txrdCtS4biUsHq49LE,7950
|
5
|
-
udemy_userAPI/bultins.py,sha256=XCXMe_5qKig_q5vbSFXBtx1vM87pE3UvEMKyUy6JCRo,12202
|
6
|
-
udemy_userAPI/exeptions.py,sha256=nuZoAt4i-ctrW8zx9LZtejrngpFXDHOVE5cEXM4RtrY,508
|
7
|
-
udemy_userAPI/sections.py,sha256=zPyDhvTIQCL0nbf7OJZG28Kax_iooILQ_hywUwvHoL8,4043
|
8
|
-
udemy_userAPI/udemy.py,sha256=ceaXVTbQhSYkHnPIpYWUVtT6IT6jBvzYO_k4B7EFyj8,2154
|
9
|
-
udemy_userAPI/.cache/.udemy_userAPI,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
udemy_userAPI/mpd_analyzer/__init__.py,sha256=i3JVWyvcFLaj5kPmx8c1PgjsLht7OUIQQClD4yqYbo8,102
|
11
|
-
udemy_userAPI/mpd_analyzer/bin.wvd,sha256=1rAJdCc120hQlX9qe5KUS628eY2ZHYxQSmyhGNefSzo,2956
|
12
|
-
udemy_userAPI/mpd_analyzer/mpd_parser.py,sha256=_vw1feJXDjw5fQLOmA5-H3UklX_30Pbl__HtDUqvp3c,17283
|
13
|
-
udemy_userAPI-0.2.4.dist-info/LICENSE,sha256=l4jdKYt8gSdDFOGr09vCKnMn_Im55XIcQKqTDEtFfNs,1095
|
14
|
-
udemy_userAPI-0.2.4.dist-info/METADATA,sha256=IWt_ESRHpa9rDwcg3Kgsm3KlE7pvY1NyDCHdBZEaE3s,1394
|
15
|
-
udemy_userAPI-0.2.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
16
|
-
udemy_userAPI-0.2.4.dist-info/top_level.txt,sha256=ijTINaSDRKhdahY_X7dmSRFTxBIwQErWv9ATCG55mog,14
|
17
|
-
udemy_userAPI-0.2.4.dist-info/RECORD,,
|
@@ -1 +0,0 @@
|
|
1
|
-
udemy_userAPI
|
File without changes
|
File without changes
|