[linkedin:learning] use urljoin for form action url(closes #20431)

This commit is contained in:
Remita Amine 2019-04-11 08:44:58 +01:00
parent 118f7add3b
commit c912029480
1 changed files with 5 additions and 4 deletions

View File

@ -9,11 +9,13 @@ from ..utils import (
float_or_none, float_or_none,
int_or_none, int_or_none,
urlencode_postdata, urlencode_postdata,
urljoin,
) )
class LinkedInLearningBaseIE(InfoExtractor): class LinkedInLearningBaseIE(InfoExtractor):
_NETRC_MACHINE = 'linkedin' _NETRC_MACHINE = 'linkedin'
_LOGIN_URL = 'https://www.linkedin.com/uas/login?trk=learning'
def _call_api(self, course_slug, fields, video_slug=None, resolution=None): def _call_api(self, course_slug, fields, video_slug=None, resolution=None):
query = { query = {
@ -50,11 +52,10 @@ class LinkedInLearningBaseIE(InfoExtractor):
return return
login_page = self._download_webpage( login_page = self._download_webpage(
'https://www.linkedin.com/uas/login?trk=learning', self._LOGIN_URL, None, 'Downloading login page')
None, 'Downloading login page') action_url = urljoin(self._LOGIN_URL, self._search_regex(
action_url = self._search_regex(
r'<form[^>]+action=(["\'])(?P<url>.+?)\1', login_page, 'post url', r'<form[^>]+action=(["\'])(?P<url>.+?)\1', login_page, 'post url',
default='https://www.linkedin.com/uas/login-submit', group='url') default='https://www.linkedin.com/uas/login-submit', group='url'))
data = self._hidden_inputs(login_page) data = self._hidden_inputs(login_page)
data.update({ data.update({
'session_key': email, 'session_key': email,