2016-10-02 22:39:18 +11:00
|
|
|
# coding: utf-8
|
2014-07-10 02:21:46 +10:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
2015-11-30 08:58:39 +11:00
|
|
|
from ..utils import (
|
|
|
|
ExtractorError,
|
2016-01-15 02:48:08 +11:00
|
|
|
NO_DEFAULT,
|
2015-11-30 08:58:39 +11:00
|
|
|
sanitized_Request,
|
2016-03-26 07:19:24 +11:00
|
|
|
urlencode_postdata,
|
2015-11-30 08:58:39 +11:00
|
|
|
)
|
2014-07-10 02:21:46 +10:00
|
|
|
|
|
|
|
|
|
|
|
class VodlockerIE(InfoExtractor):
|
2016-01-15 02:48:08 +11:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?vodlocker\.(?:com|city)/(?:embed-)?(?P<id>[0-9a-zA-Z]+)(?:\..*?)?'
|
2014-07-10 02:21:46 +10:00
|
|
|
|
|
|
|
_TESTS = [{
|
|
|
|
'url': 'http://vodlocker.com/e8wvyzz4sl42',
|
|
|
|
'md5': 'ce0c2d18fa0735f1bd91b69b0e54aacf',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'e8wvyzz4sl42',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Germany vs Brazil',
|
2017-01-02 23:08:07 +11:00
|
|
|
'thumbnail': r're:http://.*\.jpg',
|
2014-07-10 02:21:46 +10:00
|
|
|
},
|
|
|
|
}]
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2014-12-13 22:24:42 +11:00
|
|
|
video_id = self._match_id(url)
|
2014-07-10 02:21:46 +10:00
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
|
2015-11-30 08:58:39 +11:00
|
|
|
if any(p in webpage for p in (
|
|
|
|
'>THIS FILE WAS DELETED<',
|
|
|
|
'>File Not Found<',
|
2016-11-04 02:22:40 +11:00
|
|
|
'The file you were looking for could not be found, sorry for any inconvenience.<',
|
|
|
|
'>The file was removed')):
|
2015-11-30 08:58:39 +11:00
|
|
|
raise ExtractorError('Video %s does not exist' % video_id, expected=True)
|
|
|
|
|
2015-07-15 02:36:30 +10:00
|
|
|
fields = self._hidden_inputs(webpage)
|
2014-07-10 02:21:46 +10:00
|
|
|
|
|
|
|
if fields['op'] == 'download1':
|
2014-07-11 18:57:08 +10:00
|
|
|
self._sleep(3, video_id) # they do detect when requests happen too fast!
|
2016-03-26 07:19:24 +11:00
|
|
|
post = urlencode_postdata(fields)
|
2015-11-22 03:18:17 +11:00
|
|
|
req = sanitized_Request(url, post)
|
2014-07-10 02:21:46 +10:00
|
|
|
req.add_header('Content-type', 'application/x-www-form-urlencoded')
|
2014-07-11 18:57:08 +10:00
|
|
|
webpage = self._download_webpage(
|
|
|
|
req, video_id, 'Downloading video page')
|
2014-07-10 02:21:46 +10:00
|
|
|
|
2016-01-15 02:48:08 +11:00
|
|
|
def extract_file_url(html, default=NO_DEFAULT):
|
|
|
|
return self._search_regex(
|
|
|
|
r'file:\s*"(http[^\"]+)",', html, 'file url', default=default)
|
|
|
|
|
|
|
|
video_url = extract_file_url(webpage, default=None)
|
|
|
|
|
|
|
|
if not video_url:
|
|
|
|
embed_url = self._search_regex(
|
|
|
|
r'<iframe[^>]+src=(["\'])(?P<url>(?:https?://)?vodlocker\.(?:com|city)/embed-.+?)\1',
|
|
|
|
webpage, 'embed url', group='url')
|
|
|
|
embed_webpage = self._download_webpage(
|
|
|
|
embed_url, video_id, 'Downloading embed webpage')
|
|
|
|
video_url = extract_file_url(embed_webpage)
|
|
|
|
thumbnail_webpage = embed_webpage
|
|
|
|
else:
|
|
|
|
thumbnail_webpage = webpage
|
|
|
|
|
2014-07-11 18:57:08 +10:00
|
|
|
title = self._search_regex(
|
2014-08-23 22:39:45 +10:00
|
|
|
r'id="file_title".*?>\s*(.*?)\s*<(?:br|span)', webpage, 'title')
|
2014-07-11 18:57:08 +10:00
|
|
|
thumbnail = self._search_regex(
|
2016-01-15 02:48:08 +11:00
|
|
|
r'image:\s*"(http[^\"]+)",', thumbnail_webpage, 'thumbnail', fatal=False)
|
2014-07-10 02:21:46 +10:00
|
|
|
|
|
|
|
formats = [{
|
|
|
|
'format_id': 'sd',
|
2016-01-15 02:48:08 +11:00
|
|
|
'url': video_url,
|
2014-07-10 02:21:46 +10:00
|
|
|
}]
|
|
|
|
|
|
|
|
return {
|
|
|
|
'id': video_id,
|
|
|
|
'title': title,
|
|
|
|
'thumbnail': thumbnail,
|
|
|
|
'formats': formats,
|
|
|
|
}
|