4 from .common
import InfoExtractor
13 class OwnCloudIE(InfoExtractor
):
14 _INSTANCES_RE
= '|'.join((
15 r
'(?:[^\.]+\.)?sciebo\.de',
16 r
'cloud\.uni-koblenz-landau\.de',
18 _VALID_URL
= rf
'https?://(?:{_INSTANCES_RE})/s/(?P<id>[\w.-]+)'
22 'url': 'https://ruhr-uni-bochum.sciebo.de/s/wWhqZzh9jTumVFN',
24 'id': 'wWhqZzh9jTumVFN',
26 'title': 'CmvpJST.mp4',
30 'url': 'https://ruhr-uni-bochum.sciebo.de/s/WNDuFu0XuFtmm3f',
32 'id': 'WNDuFu0XuFtmm3f',
34 'title': 'CmvpJST.mp4',
37 'videopassword': '12345',
42 def _real_extract(self
, url
):
43 video_id
= self
._match
_id
(url
)
44 webpage
, urlh
= self
._download
_webpage
_handle
(url
, video_id
)
46 if re
.search(r
'<label[^>]+for="password"', webpage
):
47 webpage
= self
._verify
_video
_password
(webpage
, urlh
.url
, video_id
)
49 hidden_inputs
= self
._hidden
_inputs
(webpage
)
50 title
= hidden_inputs
.get('filename')
51 parsed_url
= urllib
.parse
.urlparse(url
)
56 'url': url_or_none(hidden_inputs
.get('downloadURL')) or parsed_url
._replace
(
57 path
=urllib
.parse
.urljoin(parsed_url
.path
, 'download')).geturl(),
58 'ext': determine_ext(title
),
61 def _verify_video_password(self
, webpage
, url
, video_id
):
62 password
= self
.get_param('videopassword')
65 'This video is protected by a password, use the --video-password option',
68 validation_response
= self
._download
_webpage
(
69 url
, video_id
, 'Validating Password', 'Wrong password?',
70 data
=urlencode_postdata({
71 'requesttoken': self
._hidden
_inputs
(webpage
)['requesttoken'],
75 if re
.search(r
'<label[^>]+for="password"', validation_response
):
76 warning
= self
._search
_regex
(
77 r
'<div[^>]+class="warning">([^<]*)</div>', validation_response
,
78 'warning', default
='The password is wrong')
79 raise ExtractorError(f
'Opening the video failed, {self.IE_NAME} said: {warning!r}', expected
=True)
80 return validation_response