mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-05 09:57:59 +09:00
[slutload] Simplify (#2898)
This commit is contained in:
parent
948bcc60df
commit
5301304bf2
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@ -5,42 +7,41 @@ from ..utils import (
|
|||||||
ExtractorError,
|
ExtractorError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SlutloadIE(InfoExtractor):
|
class SlutloadIE(InfoExtractor):
|
||||||
_VALID_URL = r'^https?://(?:\w+\.)?slutload\.com/video/[^/]+/(?P<videoid>[^/]+)/?$'
|
_VALID_URL = r'^https?://(?:\w+\.)?slutload\.com/video/[^/]+/(?P<id>[^/]+)/?$'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.slutload.com/video/virginie-baisee-en-cam/TD73btpBqSxc/',
|
'url': 'http://www.slutload.com/video/virginie-baisee-en-cam/TD73btpBqSxc/',
|
||||||
u'file': u'TD73btpBqSxc.mp4',
|
'md5': '0cf531ae8006b530bd9df947a6a0df77',
|
||||||
u'md5': u'0cf531ae8006b530bd9df947a6a0df77',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': 'TD73btpBqSxc',
|
||||||
u"title": u"virginie baisee en cam",
|
'ext': 'mp4',
|
||||||
u"age_limit": 18,
|
"title": "virginie baisee en cam",
|
||||||
|
"age_limit": 18,
|
||||||
|
'thumbnail': 're:https?://.*?\.jpg'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
video_id = mobj.group('videoid')
|
|
||||||
|
|
||||||
# Get webpage content
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
# Get the video title
|
|
||||||
video_title = self._html_search_regex(r'<h1><strong>([^<]+)</strong>',
|
video_title = self._html_search_regex(r'<h1><strong>([^<]+)</strong>',
|
||||||
webpage, u'title').strip()
|
webpage, 'title').strip()
|
||||||
|
|
||||||
# Get the video url
|
video_url = self._html_search_regex(
|
||||||
result = re.compile(r'<div id="vidPlayer"\s+data-url="([^"]+)"\s+previewer-file="([^"]+)"', re.S).search(webpage)
|
r'(?s)<div id="vidPlayer"\s+data-url="([^"]+)"',
|
||||||
if result is None:
|
webpage, 'video URL')
|
||||||
raise ExtractorError(u'ERROR: unable to extract video_url')
|
thumbnail = self._html_search_regex(
|
||||||
|
r'(?s)<div id="vidPlayer"\s+.*?previewer-file="([^"]+)"',
|
||||||
|
webpage, 'thumbnail', fatal=False)
|
||||||
|
|
||||||
video_url, video_thumb = result.group(1,2)
|
return {
|
||||||
|
'id': video_id,
|
||||||
info = {'id': video_id,
|
'url': video_url,
|
||||||
'url': video_url,
|
'title': video_title,
|
||||||
'title': video_title,
|
'thumbnail': thumbnail,
|
||||||
'thumbnail': video_thumb,
|
'age_limit': 18
|
||||||
'ext': 'mp4',
|
}
|
||||||
'age_limit': 18}
|
|
||||||
|
|
||||||
return [info]
|
|
||||||
|
Loading…
Reference in New Issue
Block a user