Esempio n. 1
0
def resolve(url):
    data = util.extract_jwplayer_setup(util.request(url))
    if data and 'sources' in data:
        result = []
        for source in data['sources']:
            items = []
            if source['file'].endswith('.smil'):
                tree = ElementTree.fromstring(util.request(source['file']))
                base_path = tree.find('./head/meta').get('base')
                for video in tree.findall('./body/switch/video'):
                    items.append({
                        'url': '%s playpath=%s pageUrl=%s swfUrl=%s swfVfy=true' %
                               (base_path, video.get('src'), url,
                                'http://static.flashx.tv/player6/jwplayer.flash.swf'),
                        'quality': video.get('height') + 'p'
                    })
            else:
                items.append({'url': source['file']})
            if len(data['tracks']) > 0:
                for item in items:
                    for track in data['tracks']:
                        new_item = deepcopy(item)
                        new_item['subs'] = track['file']
                        new_item['lang'] = ' %s subtitles' % track['label']
                        result.append(new_item)
            else:
                result += items
        return result
    return None
def resolve(url):
    data = util.extract_jwplayer_setup(util.request(url))
    if data and 'file' in data:
        return [{'url': data['file']}]
    return None