Verified with pep8 and pyflakes

pull/2/head
Ariset Llerena 11 years ago
parent cb437dc2ad
commit e66ab17a36

@ -1,28 +1,42 @@
# coding: utf-8
from __future__ import unicode_literals
import re, zlib, base64
import re
import zlib
import base64
import xml.etree.ElementTree
from .common import InfoExtractor
class VimpleIE(InfoExtractor):
IE_DESC = 'Vimple.ru'
_VALID_URL = r'https?://player.vimple.ru/iframe/(?P<id>[a-f0-9]+)'
_VALID_URL = r'https?://(player.vimple.ru/iframe|vimple.ru)/(?P<id>[a-f0-9]{10,})'
_TESTS = [
# Quality: Large, from iframe
{
# Quality: Large, from iframe
'url': 'http://player.vimple.ru/iframe/b132bdfd71b546d3972f9ab9a25f201c',
'info_dict': {
'id': 'b132bdfd71b546d3972f9ab9a25f201c',
'title': 'great-escape-minecraft.flv',
'ext':'mp4',
'ext': 'mp4',
'duration': 352,
'webpage_url': 'http://vimple.ru/b132bdfd71b546d3972f9ab9a25f201c',
},
}
},
},
# Quality: Medium, from mainpage
{
'url': 'http://vimple.ru/a15950562888453b8e6f9572dc8600cd',
'info_dict': {
'id': 'a15950562888453b8e6f9572dc8600cd',
'title': 'DB 01',
'ext': 'flv',
'duration': 1484,
'webpage_url': 'http://vimple.ru/a15950562888453b8e6f9572dc8600cd',
}
},
]
#http://jsunpack-n.googlecode.com/svn-history/r63/trunk/swf.py
# http://jsunpack-n.googlecode.com/svn-history/r63/trunk/swf.py
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
@ -35,11 +49,10 @@ class VimpleIE(InfoExtractor):
player = self._request_webpage(player_url, video_id, note='Downloading swf player').read()
#http://stackoverflow.com/a/6804758
#http://stackoverflow.com/a/12073686
# http://stackoverflow.com/a/6804758
# http://stackoverflow.com/a/12073686
player = zlib.decompress(player[8:])
xml_pieces = re.findall(b'([a-zA-Z0-9 =+/]{500})', player)
xml_pieces = [piece[1:-1] for piece in xml_pieces]
@ -69,5 +82,3 @@ class VimpleIE(InfoExtractor):
'duration': int(video.get('duration')),
'webpage_url': video.find('Share').get('videoPageUrl'),
}

Loading…
Cancel
Save