udemy-userAPI 0.3.6__tar.gz → 0.3.7__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {udemy_userapi-0.3.6/udemy_userAPI.egg-info → udemy_userapi-0.3.7}/PKG-INFO +2 -2
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/README.md +1 -1
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/README_PYPI.md +1 -1
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI/__version__.py +1 -1
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI/bultins.py +119 -9
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI/sections.py +2 -1
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI/udemy.py +13 -4
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7/udemy_userAPI.egg-info}/PKG-INFO +2 -2
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/LICENSE +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/MANIFEST.in +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/setup.cfg +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/setup.py +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI/.cache/.udemy_userAPI +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI/__init__.py +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI/api.py +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI/authenticate.py +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI/exeptions.py +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI/mpd_analyzer/__init__.py +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI/mpd_analyzer/bin.wvd +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI/mpd_analyzer/mpd_parser.py +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI.egg-info/SOURCES.txt +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI.egg-info/dependency_links.txt +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI.egg-info/not-zip-safe +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI.egg-info/requires.txt +0 -0
- {udemy_userapi-0.3.6 → udemy_userapi-0.3.7}/udemy_userAPI.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: udemy_userAPI
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.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
|
@@ -29,7 +29,7 @@ Dynamic: summary
|
|
29
29
|
# udemy-userAPI
|
30
30
|
|
31
31
|
|
32
|
-

|
33
33
|

|
34
34
|
[](https://paulocesar-dev404.github.io/me-apoiando-online/)
|
35
35
|
[](https://github.com/PauloCesar-dev404/udemy-userAPI/blob/main/docs/iniciando.md)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
|
6
|
-

|
7
7
|

|
8
8
|
[](https://paulocesar-dev404.github.io/me-apoiando-online/)
|
9
9
|
[](https://github.com/PauloCesar-dev404/udemy-userAPI/blob/main/docs/iniciando.md)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# udemy-userAPI
|
2
2
|
|
3
3
|
|
4
|
-

|
5
5
|

|
6
6
|
[](https://paulocesar-dev404.github.io/me-apoiando-online/)
|
7
7
|
[](https://github.com/PauloCesar-dev404/udemy-userAPI/blob/main/docs/iniciando.md)
|
@@ -162,6 +162,115 @@ class Quiz:
|
|
162
162
|
htmls = get_quizzes(lecture_id=self.id)
|
163
163
|
return htmls
|
164
164
|
|
165
|
+
|
166
|
+
class Caption:
|
167
|
+
"""Representa uma legenda."""
|
168
|
+
|
169
|
+
def __init__(self, caption: dict):
|
170
|
+
"""
|
171
|
+
Inicializa uma instância de Caption.
|
172
|
+
|
173
|
+
Args:
|
174
|
+
caption (dict): Dados da legenda.
|
175
|
+
"""
|
176
|
+
self._caption = caption
|
177
|
+
|
178
|
+
@property
|
179
|
+
def locale(self) -> str:
|
180
|
+
"""Retorna o idioma."""
|
181
|
+
return self._caption.get('video_label', '')
|
182
|
+
|
183
|
+
@property
|
184
|
+
def status(self) -> str:
|
185
|
+
"""Retorna o status da legenda 1 ou 0"""
|
186
|
+
return self._caption.get('status')
|
187
|
+
|
188
|
+
@property
|
189
|
+
def title(self) -> str:
|
190
|
+
"""Retorna o título da legenda."""
|
191
|
+
return self._caption.get('title', '')
|
192
|
+
|
193
|
+
@property
|
194
|
+
def created(self) -> str:
|
195
|
+
"""Retorna a data de criação da legenda."""
|
196
|
+
return self._caption.get('created', '')
|
197
|
+
|
198
|
+
@property
|
199
|
+
def id(self) -> int:
|
200
|
+
"""Retorna o ID da legenda."""
|
201
|
+
return self._caption.get('id', 0)
|
202
|
+
|
203
|
+
@property
|
204
|
+
def url(self) -> str:
|
205
|
+
"""Retorna a URL da legenda."""
|
206
|
+
return self._caption.get('url', '')
|
207
|
+
|
208
|
+
@property
|
209
|
+
def content(self) -> str:
|
210
|
+
"""Obtém o conteúdo da legenda."""
|
211
|
+
if self.url:
|
212
|
+
r = requests.get(headers=HEADERS_USER, url=self.url)
|
213
|
+
if r.status_code == 200:
|
214
|
+
return r.text
|
215
|
+
else:
|
216
|
+
raise ConnectionError(
|
217
|
+
f'status_code: {r.status_code}, Não foi possível obter o conteúdo da legenda!'
|
218
|
+
)
|
219
|
+
else:
|
220
|
+
raise FileNotFoundError(
|
221
|
+
'Não foi possível obter a URL da legenda!'
|
222
|
+
)
|
223
|
+
|
224
|
+
class Captions:
|
225
|
+
"""Gerencia as legendas de um vídeo."""
|
226
|
+
|
227
|
+
def __init__(self, caption_data: list):
|
228
|
+
"""
|
229
|
+
Inicializa uma instância de Captions.
|
230
|
+
|
231
|
+
Args:
|
232
|
+
caption_data (list): Dados das legendas.
|
233
|
+
"""
|
234
|
+
self._caption_data = caption_data
|
235
|
+
|
236
|
+
def languages(self) -> list[dict]:
|
237
|
+
"""Retorna a lista de idiomas disponíveis na aula."""
|
238
|
+
langs = []
|
239
|
+
for caption in self._caption_data:
|
240
|
+
locale_id = caption.get('locale_id', '')
|
241
|
+
video_label = caption.get('video_label','')
|
242
|
+
if locale_id:
|
243
|
+
langs.append({'locale_id': locale_id,'locale':video_label})
|
244
|
+
return langs
|
245
|
+
|
246
|
+
def get_lang(self, locale_id: str) -> Caption:
|
247
|
+
"""
|
248
|
+
Obtém a legenda para o idioma especificado.
|
249
|
+
|
250
|
+
|
251
|
+
Args:
|
252
|
+
locale_id (str): ID do idioma,pode ser obtido no método -> 'languages'
|
253
|
+
|
254
|
+
Returns:
|
255
|
+
Caption: Objeto Caption.
|
256
|
+
|
257
|
+
Raises:
|
258
|
+
FileNotFoundError: Se o idioma não estiver disponível na aula.
|
259
|
+
"""
|
260
|
+
is_t = False
|
261
|
+
cpt = {}
|
262
|
+
for caption in self._caption_data:
|
263
|
+
if locale_id == caption.get('locale_id'):
|
264
|
+
is_t = True
|
265
|
+
cpt = caption
|
266
|
+
if not is_t:
|
267
|
+
raise FileNotFoundError(
|
268
|
+
'Esse idioma não está disponível nessa aula!'
|
269
|
+
)
|
270
|
+
c = Caption(caption=cpt)
|
271
|
+
return c
|
272
|
+
|
273
|
+
|
165
274
|
class Lecture:
|
166
275
|
"""Cria objetos aula (lecture) do curso e extrai os dados."""
|
167
276
|
|
@@ -244,15 +353,20 @@ class Lecture:
|
|
244
353
|
return self.__asset.get('media_sources',[])
|
245
354
|
|
246
355
|
@property
|
247
|
-
def get_captions(self) ->
|
356
|
+
def get_captions(self) -> Captions:
|
248
357
|
"""
|
249
358
|
Obtém as legendas.
|
250
359
|
|
251
360
|
Returns:
|
252
|
-
|
361
|
+
Captions: Objeto para gerenciar as legendas.
|
253
362
|
"""
|
254
|
-
|
255
|
-
|
363
|
+
if self.__asset.get('captions',[]):
|
364
|
+
c = Captions(caption_data=self.__asset.get('captions',[]))
|
365
|
+
return c
|
366
|
+
else:
|
367
|
+
raise FileNotFoundError(
|
368
|
+
'Não foi encontrada legendas nessa aula!'
|
369
|
+
)
|
256
370
|
@property
|
257
371
|
def get_external_url(self) -> list:
|
258
372
|
"""
|
@@ -475,11 +589,7 @@ class Course:
|
|
475
589
|
@property
|
476
590
|
def get_lectures(self) -> list:
|
477
591
|
"""
|
478
|
-
Obtém uma lista com todas as aulas.
|
479
|
-
|
480
|
-
Args:
|
481
|
-
data (list): Lista de capítulos contendo as aulas.
|
482
|
-
|
592
|
+
Obtém uma lista de dicionários com todas as aulas.
|
483
593
|
Returns:
|
484
594
|
list: Uma lista contendo todas as aulas.
|
485
595
|
"""
|
@@ -84,7 +84,8 @@ def get_details_courses(course_id):
|
|
84
84
|
resposta = json.loads(response.text)
|
85
85
|
return resposta
|
86
86
|
else:
|
87
|
-
raise UdemyUserApiExceptions(
|
87
|
+
raise UdemyUserApiExceptions(
|
88
|
+
response.text)
|
88
89
|
|
89
90
|
|
90
91
|
def get_course_infor(course_id):
|
@@ -19,9 +19,6 @@ class Udemy:
|
|
19
19
|
LoginException: Se a sessão estiver expirada.
|
20
20
|
"""
|
21
21
|
self.__headers = HEADERS_USER
|
22
|
-
if not verif_login:
|
23
|
-
raise LoginException("Sessão expirada!")
|
24
|
-
|
25
22
|
@staticmethod
|
26
23
|
def my_subscribed_courses_by_plan() -> list[dict]:
|
27
24
|
"""
|
@@ -33,6 +30,10 @@ class Udemy:
|
|
33
30
|
Raises:
|
34
31
|
UdemyUserApiExceptions: Se houver erro ao obter os cursos.
|
35
32
|
"""
|
33
|
+
if not verif_login:
|
34
|
+
raise LoginException(
|
35
|
+
"Nenhuma sessão ativa,primeiro efetue login!")
|
36
|
+
|
36
37
|
try:
|
37
38
|
courses = get_courses_plan(tipe='plan')
|
38
39
|
return courses
|
@@ -50,6 +51,10 @@ class Udemy:
|
|
50
51
|
Raises:
|
51
52
|
UdemyUserApiExceptions: Se houver erro ao obter os cursos.
|
52
53
|
"""
|
54
|
+
if not verif_login:
|
55
|
+
raise LoginException(
|
56
|
+
"Nenhuma sessão ativa,primeiro efetue login!")
|
57
|
+
|
53
58
|
try:
|
54
59
|
# Obtém os cursos
|
55
60
|
courses1 = get_courses_plan(tipe='default') # lista de cursos padrão
|
@@ -72,7 +77,7 @@ class Udemy:
|
|
72
77
|
raise UnhandledExceptions(e)
|
73
78
|
|
74
79
|
@staticmethod
|
75
|
-
def get_details_course(course_id):
|
80
|
+
def get_details_course(course_id) ->Course:
|
76
81
|
"""
|
77
82
|
Obtém detalhes de um curso através do ID.
|
78
83
|
|
@@ -85,6 +90,10 @@ class Udemy:
|
|
85
90
|
Raises:
|
86
91
|
UnhandledExceptions: Se houver erro ao obter os detalhes do curso.
|
87
92
|
"""
|
93
|
+
if not verif_login:
|
94
|
+
raise LoginException(
|
95
|
+
"Nenhuma sessão ativa,primeiro efetue login!")
|
96
|
+
|
88
97
|
try:
|
89
98
|
d = get_details_courses(course_id)
|
90
99
|
b = Course(course_id=course_id, results=d)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: udemy_userAPI
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.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
|
@@ -29,7 +29,7 @@ Dynamic: summary
|
|
29
29
|
# udemy-userAPI
|
30
30
|
|
31
31
|
|
32
|
-

|
33
33
|

|
34
34
|
[](https://paulocesar-dev404.github.io/me-apoiando-online/)
|
35
35
|
[](https://github.com/PauloCesar-dev404/udemy-userAPI/blob/main/docs/iniciando.md)
|
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
|