Merge remote-tracking branch 'upstream/master'

This commit is contained in:
rupertbaxter2 2014-07-20 15:46:33 -07:00
commit d4b3232560
6 changed files with 16 additions and 20 deletions

View File

@ -8,7 +8,6 @@ from ..utils import (
ExtractorError, ExtractorError,
compat_urllib_parse, compat_urllib_parse,
compat_urllib_request, compat_urllib_request,
determine_ext,
) )

View File

@ -28,11 +28,13 @@ class LivestreamIE(InfoExtractor):
} }
def _extract_video_info(self, video_data): def _extract_video_info(self, video_data):
video_url = video_data.get('progressive_url_hd') or video_data.get('progressive_url') video_url = (
video_data.get('progressive_url_hd') or
video_data.get('progressive_url')
)
return { return {
'id': compat_str(video_data['id']), 'id': compat_str(video_data['id']),
'url': video_url, 'url': video_url,
'ext': 'mp4',
'title': video_data['caption'], 'title': video_data['caption'],
'thumbnail': video_data['thumbnail_url'], 'thumbnail': video_data['thumbnail_url'],
'upload_date': video_data['updated_at'].replace('-', '')[:8], 'upload_date': video_data['updated_at'].replace('-', '')[:8],
@ -50,7 +52,8 @@ class LivestreamIE(InfoExtractor):
r'window.config = ({.*?});', webpage, 'window config') r'window.config = ({.*?});', webpage, 'window config')
info = json.loads(config_json)['event'] info = json.loads(config_json)['event']
videos = [self._extract_video_info(video_data['data']) videos = [self._extract_video_info(video_data['data'])
for video_data in info['feed']['data'] if video_data['type'] == 'video'] for video_data in info['feed']['data']
if video_data['type'] == 'video']
return self.playlist_result(videos, info['id'], info['full_name']) return self.playlist_result(videos, info['id'], info['full_name'])
else: else:
og_video = self._og_search_video_url(webpage, 'player url') og_video = self._og_search_video_url(webpage, 'player url')

View File

@ -1,8 +1,6 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import re
from .common import InfoExtractor from .common import InfoExtractor

View File

@ -1,15 +1,12 @@
# coding: utf-8 # coding: utf-8
import collections
import errno import errno
import io import io
import itertools import itertools
import json import json
import os.path import os.path
import re import re
import struct
import traceback import traceback
import zlib
from .common import InfoExtractor, SearchInfoExtractor from .common import InfoExtractor, SearchInfoExtractor
from .subtitles import SubtitlesInfoExtractor from .subtitles import SubtitlesInfoExtractor

View File

@ -2,12 +2,12 @@ from __future__ import unicode_literals
import collections import collections
import io import io
import struct
import zlib import zlib
from .utils import ( from .utils import (
compat_str, compat_str,
ExtractorError, ExtractorError,
struct_unpack,
) )
@ -23,17 +23,17 @@ def _extract_tags(file_contents):
file_contents[:1]) file_contents[:1])
# Determine number of bits in framesize rectangle # Determine number of bits in framesize rectangle
framesize_nbits = struct.unpack('!B', content[:1])[0] >> 3 framesize_nbits = struct_unpack('!B', content[:1])[0] >> 3
framesize_len = (5 + 4 * framesize_nbits + 7) // 8 framesize_len = (5 + 4 * framesize_nbits + 7) // 8
pos = framesize_len + 2 + 2 pos = framesize_len + 2 + 2
while pos < len(content): while pos < len(content):
header16 = struct.unpack('<H', content[pos:pos + 2])[0] header16 = struct_unpack('<H', content[pos:pos + 2])[0]
pos += 2 pos += 2
tag_code = header16 >> 6 tag_code = header16 >> 6
tag_len = header16 & 0x3f tag_len = header16 & 0x3f
if tag_len == 0x3f: if tag_len == 0x3f:
tag_len = struct.unpack('<I', content[pos:pos + 4])[0] tag_len = struct_unpack('<I', content[pos:pos + 4])[0]
pos += 4 pos += 4
assert pos + tag_len <= len(content), \ assert pos + tag_len <= len(content), \
('Tag %d ends at %d+%d - that\'s longer than the file (%d)' ('Tag %d ends at %d+%d - that\'s longer than the file (%d)'
@ -99,7 +99,7 @@ def _read_int(reader):
for _ in range(5): for _ in range(5):
buf = reader.read(1) buf = reader.read(1)
assert len(buf) == 1 assert len(buf) == 1
b = struct.unpack('<B', buf)[0] b = struct_unpack('<B', buf)[0]
res = res | ((b & 0x7f) << shift) res = res | ((b & 0x7f) << shift)
if b & 0x80 == 0: if b & 0x80 == 0:
break break
@ -111,7 +111,7 @@ def _u30(reader):
res = _read_int(reader) res = _read_int(reader)
assert res & 0xf0000000 == 0 assert res & 0xf0000000 == 0
return res return res
u32 = _read_int _u32 = _read_int
def _s32(reader): def _s32(reader):
@ -125,7 +125,7 @@ def _s24(reader):
bs = reader.read(3) bs = reader.read(3)
assert len(bs) == 3 assert len(bs) == 3
last_byte = b'\xff' if (ord(bs[2:3]) >= 0x80) else b'\x00' last_byte = b'\xff' if (ord(bs[2:3]) >= 0x80) else b'\x00'
return struct.unpack('<i', bs + last_byte)[0] return struct_unpack('<i', bs + last_byte)[0]
def _read_string(reader): def _read_string(reader):
@ -144,7 +144,7 @@ def _read_bytes(count, reader):
def _read_byte(reader): def _read_byte(reader):
resb = _read_bytes(1, reader=reader) resb = _read_bytes(1, reader=reader)
res = struct.unpack('<B', resb)[0] res = struct_unpack('<B', resb)[0]
return res return res
@ -470,8 +470,7 @@ class SWFInterpreter(object):
mname = self.multinames[index] mname = self.multinames[index]
assert isinstance(obj, _AVMClass) assert isinstance(obj, _AVMClass)
construct_method = self.extract_function(
obj, mname)
# We do not actually call the constructor for now; # We do not actually call the constructor for now;
# we just pretend it does nothing # we just pretend it does nothing
stack.append(obj.make_object()) stack.append(obj.make_object())

View File

@ -1,2 +1,2 @@
__version__ = '2014.07.20.1' __version__ = '2014.07.20.2'