[vier] Support authentication
Complete episodes now require authentication.
This commit is contained in:
parent
8abc7dca39
commit
5283140a89
@ -5,12 +5,16 @@ import re
|
|||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
urlencode_postdata,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class VierIE(InfoExtractor):
|
class VierIE(InfoExtractor):
|
||||||
IE_NAME = 'vier'
|
IE_NAME = 'vier'
|
||||||
IE_DESC = 'vier.be and vijf.be'
|
IE_DESC = 'vier.be and vijf.be'
|
||||||
_VALID_URL = r'https?://(?:www\.)?(?P<site>vier|vijf)\.be/(?:[^/]+/videos/(?P<display_id>[^/]+)(?:/(?P<id>\d+))?|video/v3/embed/(?P<embed_id>\d+))'
|
_VALID_URL = r'https?://(?:www\.)?(?P<site>vier|vijf)\.be/(?:[^/]+/videos/(?P<display_id>[^/]+)(?:/(?P<id>\d+))?|video/v3/embed/(?P<embed_id>\d+))'
|
||||||
|
_NETRC_MACHINE = 'vier'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.vier.be/planb/videos/het-wordt-warm-de-moestuin/16129',
|
'url': 'http://www.vier.be/planb/videos/het-wordt-warm-de-moestuin/16129',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@ -45,6 +49,24 @@ class VierIE(InfoExtractor):
|
|||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
def _real_initialize(self):
|
||||||
|
self._login()
|
||||||
|
|
||||||
|
def _login(self):
|
||||||
|
username, password = self._get_login_info()
|
||||||
|
if username is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._request_webpage(
|
||||||
|
'http://www.vier.be/user/login',
|
||||||
|
None, note='Logging in', errnote='Could not log in',
|
||||||
|
data=urlencode_postdata({
|
||||||
|
'form_id': 'user_login',
|
||||||
|
'name': username,
|
||||||
|
'pass': password,
|
||||||
|
}),
|
||||||
|
headers={'Content-Type': 'application/x-www-form-urlencoded'})
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
embed_id = mobj.group('embed_id')
|
embed_id = mobj.group('embed_id')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user