udemy-userAPI 0.3.8__py3-none-any.whl → 0.3.10__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- udemy_userAPI/.cache/.udemy_userAPI +0 -0
- udemy_userAPI/__version__.py +1 -1
- udemy_userAPI/bultins.py +115 -4
- {udemy_userAPI-0.3.8.dist-info → udemy_userAPI-0.3.10.dist-info}/METADATA +1 -1
- {udemy_userAPI-0.3.8.dist-info → udemy_userAPI-0.3.10.dist-info}/RECORD +8 -8
- {udemy_userAPI-0.3.8.dist-info → udemy_userAPI-0.3.10.dist-info}/LICENSE +0 -0
- {udemy_userAPI-0.3.8.dist-info → udemy_userAPI-0.3.10.dist-info}/WHEEL +0 -0
- {udemy_userAPI-0.3.8.dist-info → udemy_userAPI-0.3.10.dist-info}/top_level.txt +0 -0
Binary file
|
udemy_userAPI/__version__.py
CHANGED
udemy_userAPI/bultins.py
CHANGED
@@ -49,7 +49,6 @@ class DRM:
|
|
49
49
|
except Exception as e:
|
50
50
|
raise Exception(f"Não foi possível obter as chaves!\n{e}")
|
51
51
|
|
52
|
-
|
53
52
|
class Files:
|
54
53
|
def __init__(self, files: list[dict], id_course):
|
55
54
|
"""
|
@@ -104,6 +103,112 @@ class Files:
|
|
104
103
|
'data-file': da['download_urls']}
|
105
104
|
download_urls.append(dt_file)
|
106
105
|
return download_urls
|
106
|
+
class Caption:
|
107
|
+
"""Representa uma legenda."""
|
108
|
+
|
109
|
+
def __init__(self, caption: dict):
|
110
|
+
"""
|
111
|
+
Inicializa uma instância de Caption.
|
112
|
+
|
113
|
+
Args:
|
114
|
+
caption (dict): Dados da legenda.
|
115
|
+
"""
|
116
|
+
self._caption = caption
|
117
|
+
|
118
|
+
@property
|
119
|
+
def locale(self) -> str:
|
120
|
+
"""Retorna o idioma."""
|
121
|
+
return self._caption.get('video_label', '')
|
122
|
+
|
123
|
+
@property
|
124
|
+
def status(self) -> str:
|
125
|
+
"""Retorna o status da legenda 1 ou 0"""
|
126
|
+
return self._caption.get('status')
|
127
|
+
|
128
|
+
@property
|
129
|
+
def title(self) -> str:
|
130
|
+
"""Retorna o título da legenda."""
|
131
|
+
return self._caption.get('title', '')
|
132
|
+
|
133
|
+
@property
|
134
|
+
def created(self) -> str:
|
135
|
+
"""Retorna a data de criação da legenda."""
|
136
|
+
return self._caption.get('created', '')
|
137
|
+
|
138
|
+
@property
|
139
|
+
def id(self) -> int:
|
140
|
+
"""Retorna o ID da legenda."""
|
141
|
+
return self._caption.get('id', 0)
|
142
|
+
|
143
|
+
@property
|
144
|
+
def url(self) -> str:
|
145
|
+
"""Retorna a URL da legenda."""
|
146
|
+
return self._caption.get('url', '')
|
147
|
+
|
148
|
+
@property
|
149
|
+
def content(self) -> str:
|
150
|
+
"""Obtém o conteúdo da legenda."""
|
151
|
+
if self.url:
|
152
|
+
r = requests.get(headers=HEADERS_USER, url=self.url)
|
153
|
+
if r.status_code == 200:
|
154
|
+
return r.text
|
155
|
+
else:
|
156
|
+
raise ConnectionError(
|
157
|
+
f'status_code: {r.status_code}, Não foi possível obter o conteúdo da legenda!'
|
158
|
+
)
|
159
|
+
else:
|
160
|
+
raise FileNotFoundError(
|
161
|
+
'Não foi possível obter a URL da legenda!'
|
162
|
+
)
|
163
|
+
|
164
|
+
class Captions:
|
165
|
+
"""Gerencia as legendas de um vídeo."""
|
166
|
+
|
167
|
+
def __init__(self, caption_data: list):
|
168
|
+
"""
|
169
|
+
Inicializa uma instância de Captions.
|
170
|
+
|
171
|
+
Args:
|
172
|
+
caption_data (list): Dados das legendas.
|
173
|
+
"""
|
174
|
+
self._caption_data = caption_data
|
175
|
+
|
176
|
+
def languages(self) -> list[dict]:
|
177
|
+
"""Retorna a lista de idiomas disponíveis na aula."""
|
178
|
+
langs = []
|
179
|
+
for caption in self._caption_data:
|
180
|
+
locale_id = caption.get('locale_id', '')
|
181
|
+
video_label = caption.get('video_label','')
|
182
|
+
if locale_id:
|
183
|
+
langs.append({'locale_id': locale_id,'locale':video_label})
|
184
|
+
return langs
|
185
|
+
|
186
|
+
def get_lang(self, locale_id: str) -> Caption:
|
187
|
+
"""
|
188
|
+
Obtém a legenda para o idioma especificado.
|
189
|
+
|
190
|
+
|
191
|
+
Args:
|
192
|
+
locale_id (str): ID do idioma,pode ser obtido no método -> 'languages'
|
193
|
+
|
194
|
+
Returns:
|
195
|
+
Caption: Objeto Caption.
|
196
|
+
|
197
|
+
Raises:
|
198
|
+
FileNotFoundError: Se o idioma não estiver disponível na aula.
|
199
|
+
"""
|
200
|
+
is_t = False
|
201
|
+
cpt = {}
|
202
|
+
for caption in self._caption_data:
|
203
|
+
if locale_id == caption.get('locale_id'):
|
204
|
+
is_t = True
|
205
|
+
cpt = caption
|
206
|
+
if not is_t:
|
207
|
+
raise FileNotFoundError(
|
208
|
+
'Esse idioma não está disponível nessa aula!'
|
209
|
+
)
|
210
|
+
c = Caption(caption=cpt)
|
211
|
+
return c
|
107
212
|
|
108
213
|
class Quiz:
|
109
214
|
"""Representa um quiz.
|
@@ -244,14 +349,20 @@ class Lecture:
|
|
244
349
|
return self.__asset.get('media_sources',[])
|
245
350
|
|
246
351
|
@property
|
247
|
-
def get_captions(self) ->
|
352
|
+
def get_captions(self) -> Captions:
|
248
353
|
"""
|
249
354
|
Obtém as legendas.
|
250
355
|
|
251
356
|
Returns:
|
252
|
-
|
357
|
+
Captions: Objeto para gerenciar as legendas.
|
253
358
|
"""
|
254
|
-
|
359
|
+
if self.__asset.get('captions', []):
|
360
|
+
c = Captions(caption_data=self.__asset.get('captions', []))
|
361
|
+
return c
|
362
|
+
else:
|
363
|
+
raise FileNotFoundError(
|
364
|
+
'Não foi encontrada legendas nessa aula!'
|
365
|
+
)
|
255
366
|
|
256
367
|
@property
|
257
368
|
def get_external_url(self) -> list:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: udemy_userAPI
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.10
|
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
|
@@ -11,19 +11,19 @@ m3u8_analyzer/__init__.py,sha256=v7CiVqsCq2YH347C-QR1kHPJtXFFdru8qole3E9adCY,217
|
|
11
11
|
m3u8_analyzer/__version__.py,sha256=YP3yT87ZKrU3eARUUdQ_pg4xAXLGfBXjH4ZgEoZSq1I,25
|
12
12
|
m3u8_analyzer/exeptions.py,sha256=fK6bU3YxNSbfsPmCp4yudUvmwy_g6dj2KwIkH0dW4LI,3672
|
13
13
|
udemy_userAPI/__init__.py,sha256=BPle89xE_CMTKKe_Lw6jioYLgpH-q_Lpho2S-n1PIUA,206
|
14
|
-
udemy_userAPI/__version__.py,sha256=
|
14
|
+
udemy_userAPI/__version__.py,sha256=YIVcMHGv-aZ63xgTK6N59DO5618rZfFbaiZXNp1_Bzs,406
|
15
15
|
udemy_userAPI/api.py,sha256=GVvbbs3vFN-rF-qLBwiuHz77sjehwk8HjAI-Dey_A6c,29167
|
16
16
|
udemy_userAPI/authenticate.py,sha256=IJRrCjmhe_x40CrQ2KrOMNP8VvotZf0QMWsrbcLl_rw,14225
|
17
|
-
udemy_userAPI/bultins.py,sha256=
|
17
|
+
udemy_userAPI/bultins.py,sha256=LZlyOjSGte6B6gNn7cjl6L2Q2T_CyXIqqfkOUzt4CV4,21996
|
18
18
|
udemy_userAPI/exeptions.py,sha256=kfnPdZpqYY8nd0gnl6_Vh-MIz-XupmmbRPIuFnyXupk,692
|
19
19
|
udemy_userAPI/sections.py,sha256=Q1PlVt2Bu5MSEP8g11-F_gilJDdhZq50TV1Bo400jcA,6389
|
20
20
|
udemy_userAPI/udemy.py,sha256=SpK0LI4hjO45nZDz5waw-Py-d0uulBb28TVjltyWBxM,2920
|
21
|
-
udemy_userAPI/.cache/.udemy_userAPI,sha256=
|
21
|
+
udemy_userAPI/.cache/.udemy_userAPI,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
udemy_userAPI/mpd_analyzer/__init__.py,sha256=i3JVWyvcFLaj5kPmx8c1PgjsLht7OUIQQClD4yqYbo8,102
|
23
23
|
udemy_userAPI/mpd_analyzer/bin.wvd,sha256=1rAJdCc120hQlX9qe5KUS628eY2ZHYxQSmyhGNefSzo,2956
|
24
24
|
udemy_userAPI/mpd_analyzer/mpd_parser.py,sha256=PgUkHc5x8FTuXFCuYkWPZr9TaO_nsKalb02EFYl_zeA,8926
|
25
|
-
udemy_userAPI-0.3.
|
26
|
-
udemy_userAPI-0.3.
|
27
|
-
udemy_userAPI-0.3.
|
28
|
-
udemy_userAPI-0.3.
|
29
|
-
udemy_userAPI-0.3.
|
25
|
+
udemy_userAPI-0.3.10.dist-info/LICENSE,sha256=l4jdKYt8gSdDFOGr09vCKnMn_Im55XIcQKqTDEtFfNs,1095
|
26
|
+
udemy_userAPI-0.3.10.dist-info/METADATA,sha256=LKIjIhPm1Iw8GGR7MzPlBgSbjaNk1vDneQtQhlwebcc,1656
|
27
|
+
udemy_userAPI-0.3.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
28
|
+
udemy_userAPI-0.3.10.dist-info/top_level.txt,sha256=ijTINaSDRKhdahY_X7dmSRFTxBIwQErWv9ATCG55mog,14
|
29
|
+
udemy_userAPI-0.3.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|