mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-30 06:11:27 +02:00
Compare commits
3 Commits
b8677c94ce
...
9944e98d1c
Author | SHA1 | Date | |
---|---|---|---|
|
9944e98d1c | ||
|
6113c3d086 | ||
|
0db6db349f |
|
@ -9,6 +9,7 @@ from ..utils.traversal import traverse_obj
|
||||||
|
|
||||||
class GetCourseRuPlayerIE(InfoExtractor):
|
class GetCourseRuPlayerIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://player02\.getcourse\.ru/sign-player/?\?(?:[^#]+&)?json=[^#&]+'
|
_VALID_URL = r'https?://player02\.getcourse\.ru/sign-player/?\?(?:[^#]+&)?json=[^#&]+'
|
||||||
|
_EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"](?P<url>{_VALID_URL}[^\'"]*)']
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://player02.getcourse.ru/sign-player/?json=eyJ2aWRlb19oYXNoIjoiMTkwYmRmOTNmMWIyOTczNTMwOTg1M2E3YTE5ZTI0YjMiLCJ1c2VyX2lkIjozNTk1MjUxODMsInN1Yl9sb2dpbl91c2VyX2lkIjpudWxsLCJsZXNzb25faWQiOm51bGwsImlwIjoiNDYuMTQyLjE4Mi4yNDciLCJnY19ob3N0IjoiYWNhZGVteW1lbC5vbmxpbmUiLCJ0aW1lIjoxNzA1NDQ5NjQyLCJwYXlsb2FkIjoidV8zNTk1MjUxODMiLCJ1aV9sYW5ndWFnZSI6InJ1IiwiaXNfaGF2ZV9jdXN0b21fc3R5bGUiOnRydWV9&s=354ad2c993d95d5ac629e3133d6cefea&vh-static-feature=zigzag',
|
'url': 'http://player02.getcourse.ru/sign-player/?json=eyJ2aWRlb19oYXNoIjoiMTkwYmRmOTNmMWIyOTczNTMwOTg1M2E3YTE5ZTI0YjMiLCJ1c2VyX2lkIjozNTk1MjUxODMsInN1Yl9sb2dpbl91c2VyX2lkIjpudWxsLCJsZXNzb25faWQiOm51bGwsImlwIjoiNDYuMTQyLjE4Mi4yNDciLCJnY19ob3N0IjoiYWNhZGVteW1lbC5vbmxpbmUiLCJ0aW1lIjoxNzA1NDQ5NjQyLCJwYXlsb2FkIjoidV8zNTk1MjUxODMiLCJ1aV9sYW5ndWFnZSI6InJ1IiwiaXNfaGF2ZV9jdXN0b21fc3R5bGUiOnRydWV9&s=354ad2c993d95d5ac629e3133d6cefea&vh-static-feature=zigzag',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
@ -20,7 +21,6 @@ class GetCourseRuPlayerIE(InfoExtractor):
|
||||||
},
|
},
|
||||||
'skip': 'JWT expired',
|
'skip': 'JWT expired',
|
||||||
}]
|
}]
|
||||||
_EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"](?P<url>{_VALID_URL}[^\'"]*)']
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
webpage = self._download_webpage(url, None, 'Downloading player page')
|
webpage = self._download_webpage(url, None, 'Downloading player page')
|
||||||
|
@ -44,7 +44,16 @@ class GetCourseRuPlayerIE(InfoExtractor):
|
||||||
|
|
||||||
class GetCourseRuIE(InfoExtractor):
|
class GetCourseRuIE(InfoExtractor):
|
||||||
_NETRC_MACHINE = 'getcourseru'
|
_NETRC_MACHINE = 'getcourseru'
|
||||||
_LOGIN_URL_PATH = '/cms/system/login'
|
_DOMAINS = [
|
||||||
|
'academymel.online',
|
||||||
|
'marafon.mani-beauty.com',
|
||||||
|
'on.psbook.ru'
|
||||||
|
]
|
||||||
|
_BASE_URL_RE = rf'https?://(?:(?!player02\.)[^.]+\.getcourse\.(?:ru|io)|{"|".join(map(re.escape, _DOMAINS))})'
|
||||||
|
_VALID_URL = [
|
||||||
|
rf'{_BASE_URL_RE}/(?!pl/|teach/)(?P<id>[^?#]+)',
|
||||||
|
rf'{_BASE_URL_RE}/(:?pl/)?teach/control/lesson/view\?(?:[^#]+&)?id=(?P<id>\d+)',
|
||||||
|
]
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://academymel.online/3video_1',
|
'url': 'http://academymel.online/3video_1',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
@ -117,16 +126,8 @@ class GetCourseRuIE(InfoExtractor):
|
||||||
'url': 'https://gaismasmandalas.getcourse.io/ATLAUTSEVBUT',
|
'url': 'https://gaismasmandalas.getcourse.io/ATLAUTSEVBUT',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
_DOMAINS = [
|
|
||||||
'academymel.online',
|
_LOGIN_URL_PATH = '/cms/system/login'
|
||||||
'marafon.mani-beauty.com',
|
|
||||||
'on.psbook.ru'
|
|
||||||
]
|
|
||||||
_BASE_URL_RE = rf'https?://(?:(?!player02\.)[^.]+\.getcourse\.(?:ru|io)|{"|".join(map(re.escape, _DOMAINS))})'
|
|
||||||
_VALID_URL = [
|
|
||||||
rf'{_BASE_URL_RE}/(?!pl/|teach/)(?P<id>[^?#]+)',
|
|
||||||
rf'{_BASE_URL_RE}/(:?pl/)?teach/control/lesson/view\?(?:[^#]+&)?id=(?P<id>\d+)',
|
|
||||||
]
|
|
||||||
|
|
||||||
def _login(self, hostname, username, password):
|
def _login(self, hostname, username, password):
|
||||||
if self._get_cookies(f'https://{hostname}').get('PHPSESSID5'):
|
if self._get_cookies(f'https://{hostname}').get('PHPSESSID5'):
|
||||||
|
@ -168,8 +169,7 @@ class GetCourseRuIE(InfoExtractor):
|
||||||
|
|
||||||
playlist_id = self._search_regex(
|
playlist_id = self._search_regex(
|
||||||
r'window\.(?:lessonId|gcsObjectId)\s*=\s*(\d+)', webpage, 'playlist id', default=display_id)
|
r'window\.(?:lessonId|gcsObjectId)\s*=\s*(\d+)', webpage, 'playlist id', default=display_id)
|
||||||
|
title = self._og_search_title(webpage) or self._html_extract_title(webpage)
|
||||||
title = self._html_extract_title(webpage) or self._og_search_title(webpage)
|
|
||||||
|
|
||||||
return self.playlist_from_matches(
|
return self.playlist_from_matches(
|
||||||
re.findall(GetCourseRuPlayerIE._EMBED_REGEX[0], webpage),
|
re.findall(GetCourseRuPlayerIE._EMBED_REGEX[0], webpage),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user