~ubuntu-branches/ubuntu/vivid/youtube-dl/vivid

« back to all changes in this revision

Viewing changes to youtube_dl/extractor/videolecturesnet.py

  • Committer: Package Import Robot
  • Author(s): Rogério Brito
  • Date: 2015-03-01 02:12:13 UTC
  • mfrom: (44.1.24 sid)
  • Revision ID: package-import@ubuntu.com-20150301021213-8w657cue71kp77sz
Tags: 2015.02.28-1
Imported Upstream version 2015.02.28. Closes: #778765.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
        thumbnail = (
50
50
            None if thumbnail_el is None else thumbnail_el.attrib.get('src'))
51
51
 
52
 
        formats = [{
53
 
            'url': v.attrib['src'],
54
 
            'width': int_or_none(v.attrib.get('width')),
55
 
            'height': int_or_none(v.attrib.get('height')),
56
 
            'filesize': int_or_none(v.attrib.get('size')),
57
 
            'tbr': int_or_none(v.attrib.get('systemBitrate')) / 1000.0,
58
 
            'ext': v.attrib.get('ext'),
59
 
        } for v in switch.findall('./video')
60
 
            if v.attrib.get('proto') == 'http']
 
52
        formats = []
 
53
        for v in switch.findall('./video'):
 
54
            proto = v.attrib.get('proto')
 
55
            if proto not in ['http', 'rtmp']:
 
56
                continue
 
57
            f = {
 
58
                'width': int_or_none(v.attrib.get('width')),
 
59
                'height': int_or_none(v.attrib.get('height')),
 
60
                'filesize': int_or_none(v.attrib.get('size')),
 
61
                'tbr': int_or_none(v.attrib.get('systemBitrate')) / 1000.0,
 
62
                'ext': v.attrib.get('ext'),
 
63
            }
 
64
            src = v.attrib['src']
 
65
            if proto == 'http':
 
66
                if self._is_valid_url(src, video_id):
 
67
                    f['url'] = src
 
68
                    formats.append(f)
 
69
            elif proto == 'rtmp':
 
70
                f.update({
 
71
                    'url': v.attrib['streamer'],
 
72
                    'play_path': src,
 
73
                    'rtmp_real_time': True,
 
74
                })
 
75
                formats.append(f)
 
76
        self._sort_formats(formats)
61
77
 
62
78
        return {
63
79
            'id': video_id,