

def get(self):
    data = self.get_urldata()
    if self.exclude(self.options):
        (yield ServiceError('Excluding video'))
        return
    if re.findall('di.se', self.url):
        match = re.search('src="(http://qstream.*)"></iframe', data)
        if (not match):
            (yield ServiceError(("Can't find video info for: %s" % self.url)))
            return
        data = self.http.request('get', match.group(1)).content
        match = re.search('data-qbrick-ccid=\\"([0-9A-Z]+)\\"', data)
        if (not match):
            (yield ServiceError(("Can't find video file for: %s" % self.url)))
            return
        host = ('http://vms.api.qbrick.com/rest/v3/getplayer/%s' % match.group(1))
    else:
        (yield ServiceError(("Can't find any info for %s" % self.url)))
        return
    data = self.http.request('get', host).content
    xml = ET.XML(data)
    try:
        url = xml.find('media').find('item').find('playlist').find('stream').find('format').find('substream').text
    except AttributeError:
        (yield ServiceError("Can't find video file"))
        return
    live = xml.find('media').find('item').find('playlist').find('stream').attrib['isLive']
    if (live == 'true'):
        self.options.live = True
    data = self.http.request('get', url).content
    xml = ET.XML(data)
    server = xml.find('head').find('meta').attrib['base']
    streams = xml.find('body').find('switch')
    if is_py2_old:
        sa = list(streams.getiterator('video'))
    else:
        sa = list(streams.iter('video'))
    for i in sa:
        self.options.other = ("-y '%s'" % i.attrib['src'])
        (yield RTMP(copy.copy(self.options), server, i.attrib['system-bitrate']))

dataset/ETHPy150Open spaam/svtplay-dl/lib/svtplay_dl/service/qbrick.py Qbrick.get/original