[novamov] fix for all included provider (WholeCloud, NowVideo, BitVid, CloudTime, AuroraVid)

This commit is contained in:
FDMX2 2017-04-10 15:07:24 +02:00
parent 3f2ce6896a
commit 79725ab95e
2 changed files with 92 additions and 86 deletions

View File

@ -165,10 +165,7 @@ from .ccc import CCCIE
from .ccma import CCMAIE from .ccma import CCMAIE
from .cctv import CCTVIE from .cctv import CCTVIE
from .cda import CDAIE from .cda import CDAIE
from .ceskatelevize import ( from .ceskatelevize import CeskaTelevizeIE
CeskaTelevizeIE,
CeskaTelevizePoradyIE,
)
from .channel9 import Channel9IE from .channel9 import Channel9IE
from .charlierose import CharlieRoseIE from .charlierose import CharlieRoseIE
from .chaturbate import ChaturbateIE from .chaturbate import ChaturbateIE
@ -541,7 +538,6 @@ from .mangomolo import (
) )
from .matchtv import MatchTVIE from .matchtv import MatchTVIE
from .mdr import MDRIE from .mdr import MDRIE
from .medici import MediciIE
from .meipai import MeipaiIE from .meipai import MeipaiIE
from .melonvod import MelonVODIE from .melonvod import MelonVODIE
from .meta import METAIE from .meta import METAIE
@ -669,7 +665,7 @@ from .novamov import (
AuroraVidIE, AuroraVidIE,
CloudTimeIE, CloudTimeIE,
NowVideoIE, NowVideoIE,
VideoWeedIE, BitVidIE,
WholeCloudIE, WholeCloudIE,
) )
from .nowness import ( from .nowness import (
@ -984,7 +980,6 @@ from .theplatform import (
from .thescene import TheSceneIE from .thescene import TheSceneIE
from .thesixtyone import TheSixtyOneIE from .thesixtyone import TheSixtyOneIE
from .thestar import TheStarIE from .thestar import TheStarIE
from .thesun import TheSunIE
from .theweatherchannel import TheWeatherChannelIE from .theweatherchannel import TheWeatherChannelIE
from .thisamericanlife import ThisAmericanLifeIE from .thisamericanlife import ThisAmericanLifeIE
from .thisav import ThisAVIE from .thisav import ThisAVIE

View File

@ -1,9 +1,10 @@
# coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
NO_DEFAULT, NO_DEFAULT,
@ -29,9 +30,9 @@ class NovaMovIE(InfoExtractor):
_HOST = 'www.novamov.com' _HOST = 'www.novamov.com'
_FILE_DELETED_REGEX = r'This file no longer exists on our servers!</h2>' _FILE_DELETED_REGEX = r'This file no longer exists on our servers!</h2>'
_FILEKEY_REGEX = r'flashvars\.filekey=(?P<filekey>"?[^"]+"?);' _STEPKEY_REGEX = r'<input type="hidden" name="stepkey" value="(?P<stepkey>"?[^"]+"?)">'
_TITLE_REGEX = r'(?s)<div class="v_tab blockborder rounded5" id="v_tab1">\s*<h3>([^<]+)</h3>' _URL_REGEX = r'<source src="(?P<url>"?[^"]+"?)" type=\'video/mp4\'>'
_DESCRIPTION_REGEX = r'(?s)<div class="v_tab blockborder rounded5" id="v_tab1">\s*<h3>[^<]+</h3><p>([^<]+)</p>' _TITLE_REGEX = r'<meta name="title" content="Watch (?P<title>"?[^"]+"?) online | [a-zA-Z_] " />'
_URL_TEMPLATE = 'http://%s/video/%s' _URL_TEMPLATE = 'http://%s/video/%s'
_TEST = None _TEST = None
@ -45,52 +46,45 @@ class NovaMovIE(InfoExtractor):
url = self._URL_TEMPLATE % (self._HOST, video_id) url = self._URL_TEMPLATE % (self._HOST, video_id)
# 1. get the website
webpage = self._download_webpage( webpage = self._download_webpage(
url, video_id, 'Downloading video page') url, video_id, 'Downloading video page')
self._check_existence(webpage, video_id) self._check_existence(webpage, video_id)
def extract_filekey(default=NO_DEFAULT): # 2. extract the 'stepkey' value from form
filekey = self._search_regex( def extract_stepkey(default=NO_DEFAULT):
self._FILEKEY_REGEX, webpage, 'filekey', default=default) stepkey = self._search_regex(
if filekey is not default and (filekey[0] != '"' or filekey[-1] != '"'): self._STEPKEY_REGEX, webpage, 'stepkey', default=default)
return self._search_regex( return stepkey
r'var\s+%s\s*=\s*"([^"]+)"' % re.escape(filekey), webpage, 'filekey', default=default)
else:
return filekey
filekey = extract_filekey(default=None) stepkey = extract_stepkey(default=None)
if not filekey: if not stepkey:
fields = self._hidden_inputs(webpage) raise ExtractorError('stepkey could not be read of %s, please report this error' % video_id, expected=True)
post_url = self._search_regex(
r'<form[^>]+action=(["\'])(?P<url>.+?)\1', webpage, # 3. send the post request
'post url', default=url, group='url') data = urlencode_postdata({
if not post_url.startswith('http'): 'stepkey': stepkey,
post_url = compat_urlparse.urljoin(url, post_url) 'submit': 'submit',
request = sanitized_Request( })
post_url, urlencode_postdata(fields)) request = sanitized_Request(url, data)
request.add_header('Content-Type', 'application/x-www-form-urlencoded') request.add_header('Content-Type', 'application/x-www-form-urlencoded')
request.add_header('Referer', post_url)
webpage = self._download_webpage(
request, video_id, 'Downloading continue to the video page')
self._check_existence(webpage, video_id)
filekey = extract_filekey() webpage = self._download_webpage(request, url)
title = self._html_search_regex(self._TITLE_REGEX, webpage, 'title') # 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) description = self._html_search_regex(self._DESCRIPTION_REGEX, webpage, 'description', default='', fatal=False)
else:
api_response = self._download_webpage( description = None
'http://%s/api/player.api.php?key=%s&file=%s' % (self._HOST, filekey, video_id), video_id,
'Downloading video api response')
response = compat_urlparse.parse_qs(api_response)
if 'error_msg' in response:
raise ExtractorError('%s returned error: %s' % (self.IE_NAME, response['error_msg'][0]), expected=True)
video_url = response['url'][0]
return { return {
'id': video_id, 'id': video_id,
@ -109,19 +103,22 @@ class WholeCloudIE(NovaMovIE):
_HOST = 'www.wholecloud.net' _HOST = 'www.wholecloud.net'
_FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<' _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
_TITLE_REGEX = r'<strong>Title:</strong> ([^<]+)</p>' _TITLE_REGEX = r'<meta name="title" content="Watch (?P<title>"?[^"]+"?) online | [a-zA-Z_] " />'
_DESCRIPTION_REGEX = r'<strong>Description:</strong> ([^<]+)</p>' _DESCRIPTION_REGEX = r'<strong>Description:</strong> ([^<]+)</p>'
_TEST = { _TESTS = [{
'url': 'http://www.wholecloud.net/video/559e28be54d96', 'url': u'http://www.wholecloud.net/video/e1de95371c94a',
'md5': 'abd31a2132947262c50429e1d16c1bfd',
'info_dict': { 'info_dict': {
'id': '559e28be54d96', 'id': u'e1de95371c94a',
'ext': 'flv', 'ext': 'mp4',
'title': 'dissapeared image', 'title': u'Big Buck Bunny UHD 4K 60fps',
'description': 'optical illusion dissapeared image magic illusion', 'description': u'No description',
} },
} 'md5': '909304eb0b75ef231ceb72d84fade33d',
}, {
'url': 'http://www.wholecloud.net/video/e1de95371c94a',
'only_matching': True,
}]
class NowVideoIE(NovaMovIE): class NowVideoIE(NovaMovIE):
@ -136,40 +133,46 @@ class NowVideoIE(NovaMovIE):
_TITLE_REGEX = r'<h4>([^<]+)</h4>' _TITLE_REGEX = r'<h4>([^<]+)</h4>'
_DESCRIPTION_REGEX = r'</h4>\s*<p>([^<]+)</p>' _DESCRIPTION_REGEX = r'</h4>\s*<p>([^<]+)</p>'
_TEST = { _TESTS = [{
'url': 'http://www.nowvideo.sx/video/f1d6fce9a968b', 'url': u'http://www.nowvideo.sx/video/461ebb17e1a83',
'md5': '12c82cad4f2084881d8bc60ee29df092',
'info_dict': { 'info_dict': {
'id': 'f1d6fce9a968b', 'id': u'461ebb17e1a83',
'ext': 'flv', 'ext': 'mp4',
'title': 'youtubedl test video BaWjenozKc', 'title': u'Big Buck Bunny UHD 4K 60fps',
'description': 'Description', 'description': u'No description',
}, },
} 'md5': '909304eb0b75ef231ceb72d84fade33d',
}, {
'url': 'http://www.nowvideo.sx/video/461ebb17e1a83',
'only_matching': True,
}]
class VideoWeedIE(NovaMovIE): # VideoWeed is now BitVid
IE_NAME = 'videoweed' class BitVidIE(NovaMovIE):
IE_DESC = 'VideoWeed' IE_NAME = 'bitvid'
IE_DESC = 'Bitvid'
_VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': r'videoweed\.(?:es|com)'} _VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': r'bitvid\.(?:sx)'}
_HOST = 'www.videoweed.es' _HOST = 'www.bitvid.sx'
_FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<' _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
_TITLE_REGEX = r'<h1 class="text_shadow">([^<]+)</h1>' _TITLE_REGEX = r'<h1 class="text_shadow">([^<]+)</h1>'
_URL_TEMPLATE = 'http://%s/file/%s' _URL_TEMPLATE = 'http://%s/file/%s'
_TEST = { _TESTS = [{
'url': 'http://www.videoweed.es/file/b42178afbea14', 'url': u'http://www.bitvid.sx/file/bceedaa7b969c',
'md5': 'abd31a2132947262c50429e1d16c1bfd',
'info_dict': { 'info_dict': {
'id': 'b42178afbea14', 'id': u'bceedaa7b969c',
'ext': 'flv', 'ext': 'mp4',
'title': 'optical illusion dissapeared image magic illusion', 'title': u'Big Buck Bunny UHD 4K 60fps'
'description': ''
}, },
} 'md5': '909304eb0b75ef231ceb72d84fade33d',
}, {
'url': 'http://www.bitvid.sx/file/bceedaa7b969c',
'only_matching': True,
}]
class CloudTimeIE(NovaMovIE): class CloudTimeIE(NovaMovIE):
@ -181,9 +184,19 @@ class CloudTimeIE(NovaMovIE):
_HOST = 'www.cloudtime.to' _HOST = 'www.cloudtime.to'
_FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<' _FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
_TITLE_REGEX = r'<div[^>]+class=["\']video_det["\'][^>]*>\s*<strong>([^<]+)</strong>'
_TEST = None _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): class AuroraVidIE(NovaMovIE):
@ -197,16 +210,14 @@ class AuroraVidIE(NovaMovIE):
_FILE_DELETED_REGEX = r'This file no longer exists on our servers!<' _FILE_DELETED_REGEX = r'This file no longer exists on our servers!<'
_TESTS = [{ _TESTS = [{
'url': 'http://www.auroravid.to/video/4rurhn9x446jj', 'url': u'http://www.auroravid.to/video/27851f1e57c95',
'md5': '7205f346a52bbeba427603ba10d4b935',
'info_dict': { 'info_dict': {
'id': '4rurhn9x446jj', 'id': u'27851f1e57c95',
'ext': 'flv', 'ext': 'mp4',
'title': 'search engine optimization', 'title': u'Big Buck Bunny UHD 4K 60fps',
'description': 'search engine optimization is used to rank the web page in the google search engine'
}, },
'skip': '"Invalid token" errors abound (in web interface as well as youtube-dl, there is nothing we can do about it.)' 'md5': '909304eb0b75ef231ceb72d84fade33d',
}, { }, {
'url': 'http://www.auroravid.to/embed/?v=4rurhn9x446jj', 'url': 'http://www.auroravid.to/video/27851f1e57c95',
'only_matching': True, 'only_matching': True,
}] }]