mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-29 19:47:54 +01:00
Added login and password to playlist class.
Added login and password to playlist class. Also added a new playlist for the the test of the playlist class. I do not know how to test the credentials in youtube-dl yet so needed a class that did not need username and password and that had all its videos available for access.
This commit is contained in:
parent
db23d51896
commit
331ebfc375
@ -99,16 +99,47 @@ class PornTrexPlayListIE(InfoExtractor):
|
|||||||
_VALID_URL = \
|
_VALID_URL = \
|
||||||
r'https?://(?:www\.)?porntrex\.com/playlists/(?P<id>[0-9]+)/'
|
r'https?://(?:www\.)?porntrex\.com/playlists/(?P<id>[0-9]+)/'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'https://www.porntrex.com/playlists/60671/les45/',
|
'url': 'https://www.porntrex.com/playlists/31075/2016-collection/',
|
||||||
|
'id': '31075',
|
||||||
|
'title': 'FTVGirls 2016 Collection',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '477697',
|
'id': '345462',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'uploader': 'tarpi',
|
'uploader': 'publicgirls',
|
||||||
'title': '4. Kelly Divine, Tiffany Minx (1080p)',
|
'title': 'FTVGirls.16.05 - Adria Part 2',
|
||||||
'description': '4. Kelly Divine, Tiffany Minx (1080p)'
|
'description': 'https://www.indexxx.com/models/121033/adria-rae/',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _login(self):
|
||||||
|
username, password = self._get_login_info()
|
||||||
|
if username is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
login_page = self._download_webpage(
|
||||||
|
'https://www.porntrex.com/login/', None, 'Downloading login page')
|
||||||
|
|
||||||
|
login_form = self._hidden_inputs(login_page)
|
||||||
|
|
||||||
|
login_form.update({
|
||||||
|
'username': username.encode('utf-8'),
|
||||||
|
'pass': password.encode('utf-8'),
|
||||||
|
'remember_me': str(1).encode('utf-8'),
|
||||||
|
})
|
||||||
|
|
||||||
|
login_page = self._download_webpage(
|
||||||
|
'https://www.porntrex.com/ajax-login/', None,
|
||||||
|
note='Logging in',
|
||||||
|
data=urlencode_postdata(login_form))
|
||||||
|
|
||||||
|
if re.search(r'generic-error hidden', login_page):
|
||||||
|
raise ExtractorError(
|
||||||
|
'Unable to login, incorrect username and/or password',
|
||||||
|
expected=True)
|
||||||
|
|
||||||
|
def _real_initialize(self):
|
||||||
|
self._login()
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
playlist_id = self._match_id(url)
|
playlist_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, playlist_id)
|
webpage = self._download_webpage(url, playlist_id)
|
||||||
@ -125,7 +156,7 @@ class PornTrexPlayListIE(InfoExtractor):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'_type': 'playlist',
|
'_type': 'playlist',
|
||||||
'id': playlist_id,
|
'id': url.split('/')[4],
|
||||||
'title': self._html_search_regex(
|
'title': self._html_search_regex(
|
||||||
r'<title>(.+?)</title>',
|
r'<title>(.+?)</title>',
|
||||||
webpage,
|
webpage,
|
||||||
|
Loading…
Reference in New Issue
Block a user