[hors-serie] Add new extractor
This commit is contained in:
parent
c05a44d186
commit
62ee9977ab
@ -69,7 +69,10 @@ from .arte import (
|
||||
TheOperaPlatformIE,
|
||||
ArteTVPlaylistIE,
|
||||
)
|
||||
from .loubiana import ArretSurImagesIE
|
||||
from .loubiana import (
|
||||
ArretSurImagesIE,
|
||||
HorsSerieIE,
|
||||
)
|
||||
from .atresplayer import AtresPlayerIE
|
||||
from .atttechchannel import ATTTechChannelIE
|
||||
from .audimedia import AudiMediaIE
|
||||
|
@ -13,6 +13,9 @@ from ..utils import (
|
||||
class ArretSurImagesIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://(?:www\.)?arretsurimages\.net/emissions/.*?-id(?P<id>[0-9]+)'
|
||||
_LOGIN_URL = 'https://www.arretsurimages.net/forum/login.php'
|
||||
_DOWNLOAD_URL = 'https?://v42.arretsurimages.net'
|
||||
_FILE_URL = 'https?://v42.arretsurimages.net/fichiers'
|
||||
|
||||
_TEST = {
|
||||
'url': 'https://www.arretsurimages.net/emissions/2017-02-17/Theo-La-matraque-telescopique-beaucoup-de-collegues-l-ont-demandee-id9557',
|
||||
'md5': '650d2102dad67b2b6a94ac9c063f6d5b',
|
||||
@ -32,36 +35,42 @@ class ArretSurImagesIE(InfoExtractor):
|
||||
if username is None:
|
||||
return
|
||||
|
||||
login_data = urlencode_postdata({
|
||||
'ok': 'Valider',
|
||||
'username': username,
|
||||
'password': password,
|
||||
});
|
||||
login_data = urlencode_postdata(self._get_login_data(username, password))
|
||||
|
||||
login_results = self._download_webpage(
|
||||
sanitized_Request(self._LOGIN_URL, login_data),
|
||||
None, note='Logging in', errnote='Unable to log in')
|
||||
|
||||
if re.search(r'(?i)Ce nom d\'utilisateur / mot de passe est introuvable ou inactif. Recommencez', login_results) is not None:
|
||||
if not self._is_logged(login_results):
|
||||
self._downloader.report_warning('unable to log in: bad username or password')
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def _is_logged(self, login_results):
|
||||
return re.search(r'(?i)Ce nom d\'utilisateur / mot de passe est introuvable ou inactif. Recommencez', login_results) is None
|
||||
|
||||
def _get_login_data(self, username, password):
|
||||
return {
|
||||
'ok': 'Valider',
|
||||
'username': username,
|
||||
'password': password,
|
||||
}
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
video_title = self._html_search_regex(
|
||||
r'<h1 itemprop="headline">(.*?)</h1>',
|
||||
r'<h1 itemprop=".*?">(.*?)</h1>',
|
||||
webpage, 'title')
|
||||
download_url = self._html_search_regex(
|
||||
r'<a href="(http://v42.arretsurimages.net/telecharger/.*?.mp4)" target="_blank" class="bouton-telecharger"></a>',
|
||||
r'<a href="(' + self._DOWNLOAD_URL + '/telecharger/.*?.mp4)"',
|
||||
webpage, 'download information')
|
||||
|
||||
download_page = self._download_webpage(download_url, video_id, 'Downloading download information page')
|
||||
video_url = self._html_search_regex(
|
||||
r'<a id="file" href="(http://v42.arretsurimages.net/fichiers/.*?.mp4)" download>suivre ce lien</a>',
|
||||
r'<a id="file" href="(' + self._FILE_URL + '/.*?.mp4)" download>suivre ce lien</a>',
|
||||
download_page, 'video url')
|
||||
|
||||
return {
|
||||
@ -69,3 +78,31 @@ class ArretSurImagesIE(InfoExtractor):
|
||||
'title': video_title,
|
||||
'url': video_url,
|
||||
}
|
||||
|
||||
|
||||
class HorsSerieIE(ArretSurImagesIE):
|
||||
_VALID_URL = r'https?://(?:www\.)?hors-serie\.net/.*?-id(?P<id>[0-9]+)'
|
||||
_LOGIN_URL = 'https://www.hors-serie.net/connexion.php'
|
||||
_DOWNLOAD_URL = 'https?://v42.hors-serie.net'
|
||||
_FILE_URL = 'https?://v42.hors-serie.net/fichiers_hs'
|
||||
|
||||
_TEST = {
|
||||
'url': 'http://www.hors-serie.net/Dans-le-Texte/2017-01-21/L-effondrement-qui-vient-id211',
|
||||
'md5': 'a6aabfe23871146fb55c924e196680c2',
|
||||
'info_dict': {
|
||||
'id': '211',
|
||||
'ext': 'mp4',
|
||||
'title': 'L\'effondrement qui vient',
|
||||
},
|
||||
'skip': 'Requires account credentials',
|
||||
}
|
||||
|
||||
def _get_login_data(self, username, password):
|
||||
return {
|
||||
'submit': 'valider',
|
||||
'mail': username,
|
||||
'pass': password,
|
||||
}
|
||||
|
||||
def _is_logged(self, login_results):
|
||||
return re.search(r'(?i)Adresse électronique ou mot de passe invalide...', login_results) is None
|
||||
|
Loading…
x
Reference in New Issue
Block a user