Exemplo n.º 1
0
def parse(url, options):
    if url.startswith('http://www.tudou.com/listplay/') or url.startswith(
            'http://www.tudou.com/programs/view/'):  #single video
        parser.feed(url, options)

    else:  #wrong url
        lplayer.warn('Please input a valid tudou url.')
Exemplo n.º 2
0
    def parse_cb(self, page, options):
        #page = content.decode('GBK').encode('UTF-8')
        page = convert_to_utf8(page)
        name_match = name_re.search(page)
        if not name_match:
            lplayer.warn('Cannot get video name.')
            return
        self.name = name_match.group(1)

        if options & lplayer.OPT_QL_SUPER:
            i = 5
        elif options & lplayer.OPT_QL_HIGH:
            i = 3
        else:
            i = 2
        vlist = [None] * 6
        iid_match = iid_re.search(page)
        while iid_match:
            (pt, k) = iid_match.group(1, 2)
            pt = int(pt)
            if pt < 6:
                if vlist[pt] == None:
                    vlist[pt] = []
                vlist[pt].append(k)
            iid_match = iid_re.search(page, iid_match.end(0))
        while i >= 0:
            if vlist[i]:
                self.keys = vlist[i]
                self.result = []
                url = 'http://v2.tudou.com/f?id=' + self.keys[0]
                lplayer.get_url(url, self.parse_keys, options)
                return
            i -= 1
        lplayer.warn('Fail!')
Exemplo n.º 3
0
 def parse_cb(self, page, options):
     #page = content.decode('GBK').encode('UTF-8')
     page = convert_to_utf8(page)
     name_match = name_re.search(page)
     if not name_match:
         lplayer.warn('Cannot get video name.')
         return
     self.name = name_match.group(1)
     
     if options & lplayer.OPT_QL_SUPER:
         i = 5
     elif options & lplayer.OPT_QL_HIGH:
         i = 3
     else:
         i = 2
     vlist = [None] * 6
     iid_match = iid_re.search(page)
     while iid_match:
         (pt, k) = iid_match.group(1, 2)
         pt = int(pt)
         if pt < 6:
             if vlist[pt] == None:
                 vlist[pt] = []
             vlist[pt].append(k)
         iid_match = iid_re.search(page, iid_match.end(0))
     while i >= 0:
         if vlist[i]:
             self.keys = vlist[i]
             self.result = []
             url = 'http://v2.tudou.com/f?id=' + self.keys[0]
             lplayer.get_url(url, self.parse_keys, options)
             return
         i -= 1
     lplayer.warn('Fail!')
Exemplo n.º 4
0
    def parse_cb(self, page, options):
        match = name_re.search(page)
        if not match:
            lplayer.warn("Cannot get the video name!")
            return
        self.name = match.group(1)
        if self.name.isdigit():
            match = cover_re.search(page)
            if match:
                self.name = match.group(1) + "-" + self.name

        match = vid_re.search(page)
        if match:
            self.vid = match.group(1)
            url = "http://vv.video.qq.com/getinfo?otype=json&vids=" + self.vid
            lplayer.get_url(url, self.parse_cb2, options)
        else:
            lplayer.warn("Cannot find the vid of this video.")
Exemplo n.º 5
0
    def parse_cb(self, page, options):
        match = name_re.search(page)
        if not match:
            lplayer.warn('Cannot get the video name!')
            return
        self.name = match.group(1)
        if self.name.isdigit():
            match = cover_re.search(page)
            if match:
                self.name = match.group(1) + '-' + self.name

        match = vid_re.search(page)
        if match:
            self.vid = match.group(1)
            url = 'http://vv.video.qq.com/getinfo?otype=json&vids=' + self.vid
            lplayer.get_url(url, self.parse_cb2, options)
        else:
            lplayer.warn('Cannot find the vid of this video.')
Exemplo n.º 6
0
def parse_cb(page, data):
    options = data[0]
    url = data[1]
    match = cantonese_re.search(page)
    if match and not '_lang=1' in lplayer.final_url:
        if lplayer.question('是否解析为粤语版?'):
            url = match.group(1)
            if not url.startswith('http://'):
                url = 'http://www.flvcd.com/' + url
            url += '&go=1'
            lplayer.get_url(url, parse_cb, data)
            return
        lplayer.warn('解析为粤语版失败!')
    result = parse_flvcd_page(page, None)
    if len(result) == 0:
        lplayer.warn('Cannot parse this video:\n' + url)
    elif options & lplayer.OPT_DOWNLOAD:
        lplayer.download(result, result[0])
    else:
        lplayer.play(result)
Exemplo n.º 7
0
def parse(url, options):
    if url.startswith('http://www.tudou.com/listplay/') or url.startswith('http://www.tudou.com/programs/view/'):  #single video
        parser.feed(url, options)
        
    else:  #wrong url
        lplayer.warn('Please input a valid tudou url.')