Verified with pep8 and pyflakes

This commit is contained in:
Ariset Llerena 2014-06-12 23:08:06 -04:00
parent cb437dc2ad
commit e66ab17a36
1 changed files with 30 additions and 19 deletions

View File

@ -1,16 +1,19 @@
# 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
{
'url': 'http://player.vimple.ru/iframe/b132bdfd71b546d3972f9ab9a25f201c',
'info_dict': {
'id': 'b132bdfd71b546d3972f9ab9a25f201c',
@ -19,7 +22,18 @@ class VimpleIE(InfoExtractor):
'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
@ -39,7 +53,6 @@ class VimpleIE(InfoExtractor):
# 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'),
}