[nowvideo] Rewrite based on novamov extractor
parent
ce78943ae1
commit
f1c9dfcc01
@ -1,46 +1,28 @@
|
|||||||
import re
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .novamov import NovaMovIE
|
||||||
from ..utils import compat_urlparse
|
|
||||||
|
|
||||||
|
|
||||||
class NowVideoIE(InfoExtractor):
|
class NowVideoIE(NovaMovIE):
|
||||||
_VALID_URL = r'(?:https?://)?(?:www\.)?nowvideo\.(?:ch|sx)/video/(?P<id>\w+)'
|
IE_NAME = 'nowvideo'
|
||||||
_TEST = {
|
IE_DESC = 'NowVideo'
|
||||||
u'url': u'http://www.nowvideo.ch/video/0mw0yow7b6dxa',
|
|
||||||
u'file': u'0mw0yow7b6dxa.flv',
|
|
||||||
u'md5': u'f8fbbc8add72bd95b7850c6a02fc8817',
|
|
||||||
u'info_dict': {
|
|
||||||
u"title": u"youtubedl test video _BaW_jenozKc.mp4"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
|
||||||
mobj = re.match(self._VALID_URL, url)
|
|
||||||
|
|
||||||
video_id = mobj.group('id')
|
|
||||||
webpage_url = 'http://www.nowvideo.ch/video/' + video_id
|
|
||||||
embed_url = 'http://embed.nowvideo.ch/embed.php?v=' + video_id
|
|
||||||
webpage = self._download_webpage(webpage_url, video_id)
|
|
||||||
embed_page = self._download_webpage(embed_url, video_id,
|
|
||||||
u'Downloading embed page')
|
|
||||||
|
|
||||||
self.report_extraction(video_id)
|
_VALID_URL = r'http://(?:(?:www\.)?%(host)s/video/|(?:(?:embed|www)\.)%(host)s/embed\.php\?(?:.*?&)?v=)(?P<videoid>[a-z\d]{13})' % {'host': 'nowvideo\.(?:ch|sx|eu)'}
|
||||||
|
|
||||||
video_title = self._html_search_regex(r'<h4>(.*)</h4>',
|
_HOST = 'www.nowvideo.ch'
|
||||||
webpage, u'video title')
|
|
||||||
|
|
||||||
video_key = self._search_regex(r'var fkzd="(.*)";',
|
_FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
|
||||||
embed_page, u'video key')
|
_FILEKEY_REGEX = r'var fkzd="([^"]+)";'
|
||||||
|
_TITLE_REGEX = r'<h4>([^<]+)</h4>'
|
||||||
|
_DESCRIPTION_REGEX = r'</h4>\s*<p>([^<]+)</p>'
|
||||||
|
|
||||||
api_call = "http://www.nowvideo.ch/api/player.api.php?file={0}&numOfErrors=0&cid=1&key={1}".format(video_id, video_key)
|
_TEST = {
|
||||||
api_response = self._download_webpage(api_call, video_id,
|
'url': 'http://www.nowvideo.ch/video/0mw0yow7b6dxa',
|
||||||
u'Downloading API page')
|
'md5': 'f8fbbc8add72bd95b7850c6a02fc8817',
|
||||||
video_url = compat_urlparse.parse_qs(api_response)[u'url'][0]
|
'info_dict': {
|
||||||
|
'id': '0mw0yow7b6dxa',
|
||||||
return [{
|
|
||||||
'id': video_id,
|
|
||||||
'url': video_url,
|
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
'title': video_title,
|
'title': 'youtubedl test video _BaW_jenozKc.mp4',
|
||||||
}]
|
'description': 'Description',
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue