mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-14 13:13:06 +00:00
merge upstream
This commit is contained in:
parent
d9ab668223
commit
b68122d9aa
@ -1,10 +1,7 @@
|
||||
import re
|
||||
import urllib.parse
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..compat import (
|
||||
compat_str,
|
||||
compat_urlparse,
|
||||
)
|
||||
from ..utils import (
|
||||
ExtractorError,
|
||||
parse_duration,
|
||||
@ -42,7 +39,7 @@ class FrontendMastersBaseIE(InfoExtractor):
|
||||
|
||||
login_form.update({
|
||||
'username': username,
|
||||
'password': password
|
||||
'password': password,
|
||||
})
|
||||
|
||||
post_url = self._search_regex(
|
||||
@ -50,7 +47,7 @@ class FrontendMastersBaseIE(InfoExtractor):
|
||||
'post_url', default=self._LOGIN_URL, group='url')
|
||||
|
||||
if not post_url.startswith('http'):
|
||||
post_url = compat_urlparse.urljoin(self._LOGIN_URL, post_url)
|
||||
post_url = urllib.parse.urljoin(self._LOGIN_URL, post_url)
|
||||
|
||||
response = self._download_webpage(
|
||||
post_url, None, 'Logging in', data=urlencode_postdata(login_form),
|
||||
@ -65,14 +62,14 @@ class FrontendMastersBaseIE(InfoExtractor):
|
||||
r'class=(["\'])(?:(?!\1).)*\bMessageAlert\b(?:(?!\1).)*\1[^>]*>(?P<error>[^<]+)<',
|
||||
response, 'error message', default=None, group='error')
|
||||
if error:
|
||||
raise ExtractorError('Unable to login: %s' % error, expected=True)
|
||||
raise ExtractorError(f'Unable to login: {error}', expected=True)
|
||||
raise ExtractorError('Unable to log in')
|
||||
|
||||
|
||||
class FrontendMastersPageBaseIE(FrontendMastersBaseIE):
|
||||
def _download_course(self, course_name, url):
|
||||
return self._download_json(
|
||||
'%s/courses/%s' % (self._API_BASE, course_name), course_name,
|
||||
f'{self._API_BASE}/courses/{course_name}', course_name,
|
||||
'Downloading course JSON', headers={'Referer': url})
|
||||
|
||||
@staticmethod
|
||||
@ -101,7 +98,7 @@ class FrontendMastersPageBaseIE(FrontendMastersBaseIE):
|
||||
|
||||
duration = None
|
||||
timestamp = lesson.get('timestamp')
|
||||
if isinstance(timestamp, compat_str):
|
||||
if isinstance(timestamp, str):
|
||||
mobj = re.search(
|
||||
r'(?P<start>\d{1,2}:\d{1,2}:\d{1,2})\s*-(?P<end>\s*\d{1,2}:\d{1,2}:\d{1,2})',
|
||||
timestamp)
|
||||
@ -111,7 +108,7 @@ class FrontendMastersPageBaseIE(FrontendMastersBaseIE):
|
||||
|
||||
return {
|
||||
'_type': 'url_transparent',
|
||||
'url': 'frontendmasters:%s' % lesson_id,
|
||||
'url': f'frontendmasters:{lesson_id}',
|
||||
'ie_key': FrontendMastersIE.ie_key(),
|
||||
'id': lesson_id,
|
||||
'display_id': display_id,
|
||||
|
Loading…
Reference in New Issue
Block a user