예제 #1
0
def get_letv_vid(url):
    if re.match(r'http://www.letv.com/ptv/vplay/(\d+).html', url):
        vid = match1(url,r'http://www.letv.com/ptv/vplay/(\d+).html')
    else:
        html = get_content(url)
        vid = match1(html, r'vid="(\d+)"')
    return vid
예제 #2
0
def get_letv_vid(url):
    if re.match(r'http://www.letv.com/ptv/vplay/(\d+).html', url):
        vid = match1(url, r'http://www.letv.com/ptv/vplay/(\d+).html')
    else:
        html = get_content(url)
        vid = match1(html, r'vid="(\d+)"')
    return vid
예제 #3
0
 def video_from_url(self, url, **kwargs):
     # Embedded player
     id = r1(r'.tudou.com/v/([^/]+)/', url)
     if id:
         return self.tudou_download_by_id(id, title='')
 
     html = get_html(url)
     try:
         title = r1(r'\Wkw\s*[:=]\s*[\'\"]([^\n]+?)\'\s*\n', html).replace("\\'", "\'")
         assert title
         title = unescape_html(title)
     except AttributeError:
         title = match1(html, r'id=\"subtitle\"\s*title\s*=\s*\"([^\"]+)\"')
         if title is None:
             title = ''
 
     vcode = r1(r'vcode\s*[:=]\s*\'([^\']+)\'', html)
     if vcode is None:
         vcode = match1(html, r'viden\s*[:=]\s*\"([\w+/=]+)\"')
     if vcode:
         print "vcode", vcode
         from youku import Youku
         return Youku().video_from_vid(vcode, **kwargs)
 
     iid = r1(r'iid\s*[:=]\s*(\d+)', html)
     if not iid:
         return self.tudou_download_playlist(url, **kwargs)
     else:
         return self.tudou_download_by_iid(iid, title, **kwargs)
예제 #4
0
 def vid_from_url(self, url):
     """Extracts video ID from URL.
     """
     return match1(url, r'youku\.com/v_show/id_([a-zA-Z0-9=]+)') or \
       match1(url, r'player\.youku\.com/player\.php/sid/([a-zA-Z0-9=]+)/v\.swf') or \
       match1(url, r'loader\.swf\?VideoIDS=([a-zA-Z0-9=]+)') or \
       match1(url, r'player\.youku\.com/embed/([a-zA-Z0-9=]+)')
예제 #5
0
파일: mgtv.py 프로젝트: peiit/kodi_plugins
 def vid_from_url(self, url, **kwargs):
     """Extracts video ID from URL.
     """
     vid = match1(url, 'https?://www.mgtv.com/b/\d+/(\d+).html')
     if vid is None:
         html = get_html(url)
         vid = match1(html, 'vid.*(\d+)')
     return vid
예제 #6
0
    def video_from_url(self, url, **kwargs):
        if re.match(r'http://yuntv.letv.com/', url):
            self.letvcloud_download(url)
        else:
            html = get_html(url)
            vid = match1(url, r'http://www.letv.com/ptv/vplay/(\d+).html') or \
                    match1(url, r'http://www.le.com/ptv/vplay/(\d+).html') or \
                    match1(html, r'vid="(\d+)"')
        # title = match1(html,r'name="irTitle" content="(.*?)"')

        return self.video_from_vid(vid, **kwargs)
예제 #7
0
파일: qq.py 프로젝트: peiit/kodi_plugins
    def video_from_url(self, url, **kwargs):
        vid = match1(url, 'vid=(\w+)', '/(\w+)\.html')
        if vid and match1(url, '(^https?://film\.qq\.com)'):
            url = 'http://v.qq.com/x/cover/%s.html' % vid

        if not vid or len(vid) != 11:
            html = get_html(url)
            vid = match1(html, '&vid=(\w+)', 'vid:\s*[\"\'](\w+)',
                         'vid\s*=\s*[\"\']\s*(\w+)')
        for v in vid:
            if v is not None:
                break
        return self.video_from_vid(v, **kwargs)
예제 #8
0
파일: acfun.py 프로젝트: peiit/kodi_plugins
    def video_from_url(self, url, **kwargs):
        assert re.match(r'http://[^\.]*\.*acfun\.[^\.]+/\D/\D\D(\d+)', url)
        html = get_html(url)

        title = r1(r'data-title="([^"]+)"', html)
        assert title
        if match1(url, r'_(\d+)$'):  # current P
            title = title + " " + r1(r'active">([^<]*)', html)

        vid = r1('data-vid="(\d+)"', html)
        up = r1('data-name="([^"]+)"', html)
        p_title = r1('active">([^<]+)', html)
        title = '%s (%s)' % (title, up)
        if p_title:
            title = '%s - %s' % (title, p_title)
        return self.video_from_vid(vid, **kwargs)
예제 #9
0
파일: cntv.py 프로젝트: peiit/kodi_plugins
    def vid_from_url(self, url, **kwargs):
        html = get_html(url)
        if re.match(r'http://tv\.cntv\.cn/video/(\w+)/(\w+)', url):
            id = match1(url, r'http://tv\.cntv\.cn/video/\w+/(\w+)')
        elif re.match(r'http://tv\.cctv\.com/\d+/\d+/\d+/\w+.shtml', url):
            id = r1(r'var guid = "(\w+)"', html)
        elif re.match(r'http://\w+\.cntv\.cn/(\w+/\w+/(classpage/video/)?)?\d+/\d+\.shtml', url) or \
            re.match(r'http://\w+.cntv.cn/(\w+/)*VIDE\d+.shtml', url) or \
            re.match(r'http://(\w+).cntv.cn/(\w+)/classpage/video/(\d+)/(\d+).shtml', url) or \
            re.match(r'http://\w+.cctv.com/\d+/\d+/\d+/\w+.shtml', url) or \
            re.match(r'http://\w+.cntv.cn/\d+/\d+/\d+/\w+.shtml', url):
            id = r1(r'videoCenterId","(\w+)"', html)
        elif re.match(r'http://xiyou.cntv.cn/v-[\w-]+\.html', url):
            id = r1(r'http://xiyou.cntv.cn/v-([\w-]+)\.html', url)
        else:
            return None

        return id
예제 #10
0
    def video_from_url(self, url, **kwargs):
        level = kwargs.get('level', 0)  # set default to best
        level += 1
        self.url = url
        self.vid = None
        fake_headers = {'Referer': 'http://www.bilibili.com'}

        if "#page=" in self.url:
            page_index = match1(self.url, '#page=(\d+)')
            av_id = match1(self.url, '\/(av\d+)')
            self.url = 'http://www.bilibili.com/{}/index_{}.html'.format(
                av_id, page_index)
        if not self.vid:
            html = get_html(self.url, headers=fake_headers)
            self.vid = match1(html, 'cid=\"*(\d+)')
            title = match1(html,
                           '<title>([^<]+)').strip(u"_完结动画_番剧_bilibili_哔哩哔哩")
            if not self.vid:
                eid = match1(self.url, 'anime/v/(\d+)') or \
                        match1(self.url, 'play#(\d+)') or \
                        match1(html, 'anime/v/(\d+)')
                if eid:
                    html = get_html(
                        'http://bangumi.bilibili.com/web_api/episode/{}.json'.
                        format(eid))
                    Episode_info = loads(html)['result']['currentEpisode']
                    self.vid = Episode_info['danmaku']
                    self.title += ' ' + Episode_info[
                        'indexTitle'] + '.  ' + Episode_info['longTitle']

        assert self.vid, "can't play this video: {}".format(url)

        pdata = 'cid={}&from=miniplay&player=1&quality={}{}'.format(
            self.vid, level, SECRETKEY_MINILOADER)
        sign_this = hashlib.md5(pdata.encode('utf-8')).hexdigest()
        api_url = 'http://interface.bilibili.com/playurl?cid={}&player=1&quality={}&from=miniplay&sign={}'.format(
            self.vid, level, sign_this)
        html = get_html(api_url, headers=fake_headers)
        urls = self.parse_cid_playurl(html)

        return urls
예제 #11
0
 def letvcloud_download(self, url):
     qs = urlparse(url).query
     vu = match1(qs, r'vu=([\w]+)')
     uu = match1(qs, r'uu=([\w]+)')
     title = "LETV-" + vu
     self.letvcloud_download_by_vu(vu, uu)
예제 #12
0
def getVideoId(url):
    vid =  match1(url, r'youku\.com/v_show/id_([\w=]+)') or \
          match1(url, r'player\.youku\.com/player\.php/sid/([\w=]+)/v\.swf') or \
          match1(url, r'loader\.swf\?VideoIDS=([\w=]+)')
    return vid
예제 #13
0
 def get_playlist_id_from_url(url):
     """Extracts playlist ID from URL.
     """
     return match1(url, r'youku\.com/albumlist/show\?id=([a-zA-Z0-9=]+)')
예제 #14
0
def episodelist(url):
    plugin.set_content('video')
    html = get_html(url)
    tree = BeautifulSoup(html, 'html.parser')
    items = []

    # 主题视频
    #soup = tree.find_all('div', {'class': 'lists'})
    programs = tree.find_all('div', {'class': 'program'})
    if len(programs) < 1:
        info = tree.find('meta', {'name': 'description'})['content']
        title = tree.find('meta', {'name': 'title'})['content']
        items.append({
            'label': title,
            'path': url_for('playvideo', url=url),
            'is_playable': True,
            'info': {'title': title, 'plot': info}
        })
    else:
        for item in programs:
            dr = item.find('span', {'class': 'c-time'}).text
            duration = 0
            for t in dr.split(':'):
                duration = duration * 60 + int(t)
            items.append({
                'label': item['title'],
                'path': url_for('playvideo', url=httphead(item.a['href'])),
                'thumbnail': item.img['src'],
                'is_playable': True,
                'info': {'title': item['title'], 'duration': duration}
            })

    programs = tree.find_all('div', {'class': 'item '})

    for item in programs:
        intro = item.find('div', {'class': 'show_aspect'})
        items.append({
            'label': item['title'],
            'path': url_for('playvideo', url=httphead(item.a['href'])),
            'is_playable': True,
            'info': {'title': item['title'],
                     'plot': intro.text if intro else ''}
        })

    # 相关视频
    items.append({
        'label': BANNER_FMT % '相关视频',
        'path': url_for('stay')
    })
    soup = tree.find_all('div', {'class': 'textlists'})
    try:
        lists = soup[0].find_all('li')
        for item in lists:
            items.append({
                'label': item['title'],
                'path': url_for('playvideo', url=httphead(item.a['href'])),
                'is_playable': True,
                'info': {'title': item['title']}
            })
    except:
        pass

    cid = match1(html, 'catId:"(\d+)"')
    vid = match1(html, 'videoId:"(\d+)"')
    sid = match1(html, 'showid:"(\d+)"')
    pg = match1(html, 'playmode:"(\d+)"')

    api_rel = 'http://ykrec.youku.com/show/packed/list.json'

    api_rel += '?vid=%s&sid=%s&cate=%s' % (vid, sid, cid)
    api_rel += '&picSize=&apptype=1&pg=%s&module=9&pl=30' % (pg)
    html = get_html(api_rel)
    jsdata = loads(html.encode('utf-8'))
    jsdata = jsdata['data']
    for item in jsdata:
        items.append({
            'label': item['title'],
            'path': url_for('playvideo', url=httphead(item['playLink'])),
            'thumbnail': item['picUrl'],
            'is_playable': True,
            'info': {'title': item['title']}
        })
    return items
예제 #15
0
파일: qq2.py 프로젝트: peiit/kodi_plugins
 def prepare_list(self):
     html = get_html(self.url)
     vids = [
         a.strip('"') for a in match1(html, '\"vid\":\[([^\]]+)').split(',')
     ]
     return vids
예제 #16
0
파일: qq2.py 프로젝트: peiit/kodi_plugins
    def video_from_url(self, url, **kwargs):
        html = get_html(url)
        vid = match1(html, 'vid:\s*\"([^\"]+)')

        return self.video_from_vid(vid, **kwargs)
예제 #17
0
def fetch_cna():
    url = 'https://gm.mmstat.com/yt/ykcomment.play.commentInit?cna='
    req = request.urlopen(url)
    cookies = req.info()['Set-Cookie']
    cna = match1(cookies, "cna=([^;]+)")
    return cna if cna else "oqikEO1b7CECAbfBdNNf1PM1"