mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-22 10:11:52 +00:00
[platzi:course] Add support for authentication
This commit is contained in:
parent
d7da1e37c7
commit
66d04c74e0
1 changed files with 38 additions and 35 deletions
|
@ -18,43 +18,10 @@ from ..utils import (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class PlatziIE(InfoExtractor):
|
class PlatziBaseIE(InfoExtractor):
|
||||||
_VALID_URL = r'''(?x)
|
|
||||||
https?://
|
|
||||||
(?:
|
|
||||||
platzi\.com/clases| # es version
|
|
||||||
courses\.platzi\.com/classes # en version
|
|
||||||
)/[^/]+/(?P<id>\d+)-[^/?\#&]+
|
|
||||||
'''
|
|
||||||
_LOGIN_URL = 'https://platzi.com/login/'
|
_LOGIN_URL = 'https://platzi.com/login/'
|
||||||
_NETRC_MACHINE = 'platzi'
|
_NETRC_MACHINE = 'platzi'
|
||||||
|
|
||||||
_TESTS = [{
|
|
||||||
'url': 'https://platzi.com/clases/1311-next-js/12074-creando-nuestra-primera-pagina/',
|
|
||||||
'md5': '8f56448241005b561c10f11a595b37e3',
|
|
||||||
'info_dict': {
|
|
||||||
'id': '12074',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': 'Creando nuestra primera página',
|
|
||||||
'description': 'md5:4c866e45034fc76412fbf6e60ae008bc',
|
|
||||||
'duration': 420,
|
|
||||||
},
|
|
||||||
'skip': 'Requires platzi account credentials',
|
|
||||||
}, {
|
|
||||||
'url': 'https://courses.platzi.com/classes/1367-communication-codestream/13430-background/',
|
|
||||||
'info_dict': {
|
|
||||||
'id': '13430',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': 'Background',
|
|
||||||
'description': 'md5:49c83c09404b15e6e71defaf87f6b305',
|
|
||||||
'duration': 360,
|
|
||||||
},
|
|
||||||
'skip': 'Requires platzi account credentials',
|
|
||||||
'params': {
|
|
||||||
'skip_download': True,
|
|
||||||
},
|
|
||||||
}]
|
|
||||||
|
|
||||||
def _real_initialize(self):
|
def _real_initialize(self):
|
||||||
self._login()
|
self._login()
|
||||||
|
|
||||||
|
@ -97,6 +64,42 @@ class PlatziIE(InfoExtractor):
|
||||||
'Unable to login: %s' % error, expected=True)
|
'Unable to login: %s' % error, expected=True)
|
||||||
raise ExtractorError('Unable to log in')
|
raise ExtractorError('Unable to log in')
|
||||||
|
|
||||||
|
|
||||||
|
class PlatziIE(PlatziBaseIE):
|
||||||
|
_VALID_URL = r'''(?x)
|
||||||
|
https?://
|
||||||
|
(?:
|
||||||
|
platzi\.com/clases| # es version
|
||||||
|
courses\.platzi\.com/classes # en version
|
||||||
|
)/[^/]+/(?P<id>\d+)-[^/?\#&]+
|
||||||
|
'''
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://platzi.com/clases/1311-next-js/12074-creando-nuestra-primera-pagina/',
|
||||||
|
'md5': '8f56448241005b561c10f11a595b37e3',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '12074',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Creando nuestra primera página',
|
||||||
|
'description': 'md5:4c866e45034fc76412fbf6e60ae008bc',
|
||||||
|
'duration': 420,
|
||||||
|
},
|
||||||
|
'skip': 'Requires platzi account credentials',
|
||||||
|
}, {
|
||||||
|
'url': 'https://courses.platzi.com/classes/1367-communication-codestream/13430-background/',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '13430',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Background',
|
||||||
|
'description': 'md5:49c83c09404b15e6e71defaf87f6b305',
|
||||||
|
'duration': 360,
|
||||||
|
},
|
||||||
|
'skip': 'Requires platzi account credentials',
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
lecture_id = self._match_id(url)
|
lecture_id = self._match_id(url)
|
||||||
|
|
||||||
|
@ -146,7 +149,7 @@ class PlatziIE(InfoExtractor):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class PlatziCourseIE(InfoExtractor):
|
class PlatziCourseIE(PlatziBaseIE):
|
||||||
_VALID_URL = r'''(?x)
|
_VALID_URL = r'''(?x)
|
||||||
https?://
|
https?://
|
||||||
(?:
|
(?:
|
||||||
|
|
Loading…
Reference in a new issue