224 lines
6.8 KiB
Python
Raw Normal View History

# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
NO_DEFAULT,
Switch codebase to use sanitized_Request instead of compat_urllib_request.Request [downloader/dash] Use sanitized_Request [downloader/http] Use sanitized_Request [atresplayer] Use sanitized_Request [bambuser] Use sanitized_Request [bliptv] Use sanitized_Request [brightcove] Use sanitized_Request [cbs] Use sanitized_Request [ceskatelevize] Use sanitized_Request [collegerama] Use sanitized_Request [extractor/common] Use sanitized_Request [crunchyroll] Use sanitized_Request [dailymotion] Use sanitized_Request [dcn] Use sanitized_Request [dramafever] Use sanitized_Request [dumpert] Use sanitized_Request [eitb] Use sanitized_Request [escapist] Use sanitized_Request [everyonesmixtape] Use sanitized_Request [extremetube] Use sanitized_Request [facebook] Use sanitized_Request [fc2] Use sanitized_Request [flickr] Use sanitized_Request [4tube] Use sanitized_Request [gdcvault] Use sanitized_Request [extractor/generic] Use sanitized_Request [hearthisat] Use sanitized_Request [hotnewhiphop] Use sanitized_Request [hypem] Use sanitized_Request [iprima] Use sanitized_Request [ivi] Use sanitized_Request [keezmovies] Use sanitized_Request [letv] Use sanitized_Request [lynda] Use sanitized_Request [metacafe] Use sanitized_Request [minhateca] Use sanitized_Request [miomio] Use sanitized_Request [meovideo] Use sanitized_Request [mofosex] Use sanitized_Request [moniker] Use sanitized_Request [mooshare] Use sanitized_Request [movieclips] Use sanitized_Request [mtv] Use sanitized_Request [myvideo] Use sanitized_Request [neteasemusic] Use sanitized_Request [nfb] Use sanitized_Request [niconico] Use sanitized_Request [noco] Use sanitized_Request [nosvideo] Use sanitized_Request [novamov] Use sanitized_Request [nowness] Use sanitized_Request [nuvid] Use sanitized_Request [played] Use sanitized_Request [pluralsight] Use sanitized_Request [pornhub] Use sanitized_Request [pornotube] Use sanitized_Request [primesharetv] Use sanitized_Request [promptfile] Use sanitized_Request [qqmusic] Use sanitized_Request [rtve] Use sanitized_Request [safari] Use sanitized_Request [sandia] Use sanitized_Request [shared] Use sanitized_Request [sharesix] Use sanitized_Request [sina] Use sanitized_Request [smotri] Use sanitized_Request [sohu] Use sanitized_Request [spankwire] Use sanitized_Request [sportdeutschland] Use sanitized_Request [streamcloud] Use sanitized_Request [streamcz] Use sanitized_Request [tapely] Use sanitized_Request [tube8] Use sanitized_Request [tubitv] Use sanitized_Request [twitch] Use sanitized_Request [twitter] Use sanitized_Request [udemy] Use sanitized_Request [vbox7] Use sanitized_Request [veoh] Use sanitized_Request [vessel] Use sanitized_Request [vevo] Use sanitized_Request [viddler] Use sanitized_Request [videomega] Use sanitized_Request [viewvster] Use sanitized_Request [viki] Use sanitized_Request [vk] Use sanitized_Request [vodlocker] Use sanitized_Request [voicerepublic] Use sanitized_Request [wistia] Use sanitized_Request [xfileshare] Use sanitized_Request [xtube] Use sanitized_Request [xvideos] Use sanitized_Request [yandexmusic] Use sanitized_Request [youku] Use sanitized_Request [youporn] Use sanitized_Request [youtube] Use sanitized_Request [patreon] Use sanitized_Request [extractor/common] Remove unused import [nfb] PEP 8
2015-11-21 22:18:17 +06:00
sanitized_Request,
urlencode_postdata,
)
2014-01-08 01:18:47 +01:00
2014-02-24 23:30:09 +07:00
class NovaMovIE(InfoExtractor):
IE_NAME = 'novamov'
IE_DESC = 'NovaMov'
_VALID_URL_TEMPLATE = r'''(?x)
http://
(?:
(?:www\.)?%(host)s/(?:file|video|mobile/\#/videos)/|
(?:(?:embed|www)\.)%(host)s/embed(?:\.php|/)?\?(?:.*?&)?\bv=
)
(?P<id>[a-z\d]{13})
'''
_VALID_URL = _VALID_URL_TEMPLATE % {'host': r'novamov\.com'}
2014-02-24 23:30:09 +07:00
_HOST = 'www.novamov.com'
_FILE_DELETED_REGEX = r'This file no longer exists on our servers!</h2>'
_STEPKEY_REGEX = r'<input type="hidden" name="stepkey" value="(?P<stepkey>"?[^"]+"?)">'
_URL_REGEX = r'<source src="(?P<url>"?[^"]+"?)" type=\'video/mp4\'>'
_TITLE_REGEX = r'<meta name="title" content="Watch (?P<title>"?[^"]+"?) online | [a-zA-Z_] " />'
_URL_TEMPLATE = 'http://%s/video/%s'
_TEST = None
2015-12-13 15:37:52 +08:00
def _check_existence(self, webpage, video_id):
if re.search(self._FILE_DELETED_REGEX, webpage) is not None:
raise ExtractorError('Video %s does not exist' % video_id, expected=True)
def _real_extract(self, url):
2015-11-11 22:34:49 +06:00
video_id = self._match_id(url)
url = self._URL_TEMPLATE % (self._HOST, video_id)
# 1. get the website
webpage = self._download_webpage(
url, video_id, 'Downloading video page')
2015-12-13 15:37:52 +08:00
self._check_existence(webpage, video_id)
# 2. extract the 'stepkey' value from form
def extract_stepkey(default=NO_DEFAULT):
stepkey = self._search_regex(
self._STEPKEY_REGEX, webpage, 'stepkey', default=default)
return stepkey
stepkey = extract_stepkey(default=None)
if not stepkey:
raise ExtractorError('stepkey could not be read of %s, please report this error' % video_id, expected=True)
# 3. send the post request
data = urlencode_postdata({
'stepkey': stepkey,
'submit': 'submit',
})
request = sanitized_Request(url, data)
request.add_header('Content-Type', 'application/x-www-form-urlencoded')
webpage = self._download_webpage(request, url)
# 4. extract the real video url from response
video_url = self._search_regex(self._URL_REGEX, webpage, 'stepkey')
if hasattr(self, '_TITLE_REGEX'):
title = self._search_regex(self._TITLE_REGEX, webpage, 'title')
else:
title = str(id)
if hasattr(self, '_DESCRIPTION_REGEX'):
description = self._html_search_regex(self._DESCRIPTION_REGEX, webpage, 'description', default='', fatal=False)
else:
description = None
return {
'id': video_id,
'url': video_url,
'title': title,
'description': description
2014-11-23 20:41:03 +01:00
}
2015-12-06 09:42:00 +06:00
class WholeCloudIE(NovaMovIE):
IE_NAME = 'wholecloud'
IE_DESC = 'WholeCloud'
_VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': r'(?:wholecloud\.net|movshare\.(?:net|sx|ag))'}
2015-12-06 09:42:00 +06:00
_HOST = 'www.wholecloud.net'
_FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
_TITLE_REGEX = r'<meta name="title" content="Watch (?P<title>"?[^"]+"?) online | [a-zA-Z_] " />'
_DESCRIPTION_REGEX = r'<strong>Description:</strong> ([^<]+)</p>'
_TESTS = [{
'url': u'http://www.wholecloud.net/video/e1de95371c94a',
'info_dict': {
'id': u'e1de95371c94a',
'ext': 'mp4',
'title': u'Big Buck Bunny UHD 4K 60fps',
'description': u'No description',
},
'md5': '909304eb0b75ef231ceb72d84fade33d',
}, {
'url': 'http://www.wholecloud.net/video/e1de95371c94a',
'only_matching': True,
}]
class NowVideoIE(NovaMovIE):
IE_NAME = 'nowvideo'
IE_DESC = 'NowVideo'
_VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': r'nowvideo\.(?:to|ch|ec|sx|eu|at|ag|co|li)'}
_HOST = 'www.nowvideo.to'
_FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
_TITLE_REGEX = r'<h4>([^<]+)</h4>'
_DESCRIPTION_REGEX = r'</h4>\s*<p>([^<]+)</p>'
_TESTS = [{
'url': u'http://www.nowvideo.sx/video/461ebb17e1a83',
'info_dict': {
'id': u'461ebb17e1a83',
'ext': 'mp4',
'title': u'Big Buck Bunny UHD 4K 60fps',
'description': u'No description',
2015-12-13 15:42:34 +08:00
},
'md5': '909304eb0b75ef231ceb72d84fade33d',
}, {
'url': 'http://www.nowvideo.sx/video/461ebb17e1a83',
'only_matching': True,
}]
# VideoWeed is now BitVid
class BitVidIE(NovaMovIE):
IE_NAME = 'bitvid'
IE_DESC = 'Bitvid'
_VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': r'bitvid\.(?:sx)'}
_HOST = 'www.bitvid.sx'
_FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
_TITLE_REGEX = r'<h1 class="text_shadow">([^<]+)</h1>'
_URL_TEMPLATE = 'http://%s/file/%s'
_TESTS = [{
'url': u'http://www.bitvid.sx/file/bceedaa7b969c',
'info_dict': {
'id': u'bceedaa7b969c',
'ext': 'mp4',
'title': u'Big Buck Bunny UHD 4K 60fps'
},
'md5': '909304eb0b75ef231ceb72d84fade33d',
}, {
'url': 'http://www.bitvid.sx/file/bceedaa7b969c',
'only_matching': True,
}]
2015-12-06 09:37:38 +06:00
class CloudTimeIE(NovaMovIE):
IE_NAME = 'cloudtime'
IE_DESC = 'CloudTime'
_VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': r'cloudtime\.to'}
2015-12-06 09:37:38 +06:00
_HOST = 'www.cloudtime.to'
_FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
_TESTS = [{
'url': u'http://www.cloudtime.to/video/ef47760a7793d',
'info_dict': {
'id': u'ef47760a7793d',
'ext': 'mp4',
'title': u'Big Buck Bunny UHD 4K 60fps'
},
'md5': '909304eb0b75ef231ceb72d84fade33d',
}, {
'url': 'http://www.cloudtime.to/video/ef47760a7793d',
'only_matching': True,
}]
class AuroraVidIE(NovaMovIE):
IE_NAME = 'auroravid'
IE_DESC = 'AuroraVid'
_VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': r'auroravid\.to'}
_HOST = 'www.auroravid.to'
_FILE_DELETED_REGEX = r'This file no longer exists on our servers!<'
_TESTS = [{
'url': u'http://www.auroravid.to/video/27851f1e57c95',
'info_dict': {
'id': u'27851f1e57c95',
'ext': 'mp4',
'title': u'Big Buck Bunny UHD 4K 60fps',
},
'md5': '909304eb0b75ef231ceb72d84fade33d',
}, {
'url': 'http://www.auroravid.to/video/27851f1e57c95',
'only_matching': True,
}]