Exemple #1
0
 def get_categories(self, datas, skip_empty_id = True):
     # Get all categories
     data = channel.get_url(self.main_url + self.channel_id + '/page/toutes-les-videos/237.aspx')
     regex = r"""(?i)""" + self.channel_id + r"""(/categorie/[^/]+/(\d+)\.aspx)[^>]+><img[^"]+"([^"]+)[^>]*></a>\s*<h3>([^<]+)"""
     all_categories = {}
     for url, id, img, name in re.findall(regex, data):
         all_categories[int(id)] = (url, id, img, name)
         #if skip_empty_id and id in id2skip:
         #    continue
         #if id not in only_good_cat or name.find(only_good_cat[id]) != -1:
         #    channels_data[url] = (name, img, id)
     
     # Get structure
     data = channel.get_url(self.main_url + self.channel_id + '/')
     data = data.split('class=SubmenuPopup ')[2]
     data = data.split('</DIV></li></ul>')[0]
     datas = data.replace('</H3>','<H3>').split('<H3>')[1:]
     categories = {}
     regex = r"""(?i)""" + self.channel_id + r"""/categorie/[^/]+/(\d+)\.aspx[^>]+>"""
     for i in range(len(datas)/2):
         title = datas[i*2]
         content = datas[i*2+1]
         subcats = []
         for id in re.findall(regex, content):
             subcats.append(all_categories[int(id)])
         categories[title] = subcats
     return categories
Exemple #2
0
 def get_lives(self, datas):
     def parse_lives(data):
         regex = r"""href="http://www.rtbf.be/livecenter/([^"]+)"><img class="[^"]+" src="([^"]+)" alt="([^"]+).""" #*\3.*\3.*class="date">([^<]+).*is-live.*\1
         for url, icon, name in re.findall(regex, data, flags=re.DOTALL):
             print "found"
             vurl = channel.array2url(channel_id=self.channel_id, url=url, action='play_live')
             channel.addLink(name.replace('&#039;', "'").replace('&#034;', '"') , vurl, icon) # + ' - ' + date
     live_url = self.main_url + '/livecenter/'
     data = channel.get_url(live_url)
     parse_lives(data)
     data = channel.get_url(live_url + '?category=&page=2&client=')
     parse_lives(data)
Exemple #3
0
 def get_live_rtmp(self, page_url):
     data = channel.get_url(page_url)
     regex = r"""streamName&quot;:&quot;([^&]+)"""
     stream_name = re.search(regex, data)
     if stream_name is None:
         return None
     stream_name = stream_name.group(1)
     """token_json_data = channel.get_url(self.main_url + '/api/media/streaming?streamname=' + stream_name, referer=page_url)
     token = token_json_data.split('":"')[1].split('"')[0]
     swf_url = 'http://static.infomaniak.ch/livetv/playerMain-v4.2.73.swf?sVersion=4%2E2%2E41&sDescription=&bLd=0&sTitle=&autostart=1'
     rtmp = 'rtmp://rtmp.rtbf.be/livecast'
     page_url = 'http://www.rtbf.be'
     play = '%s?%s' % (stream_name, token)
     rtmp += '/%s swfUrl=%s pageUrl=%s tcUrl=%s' % (play, swf_url, page_url, rtmp)
     #xbmc.log('stream: ' + rtmp)
     return rtmp"""
     properties = [
                   ('app', 'livecast'),
                   #('flashVer', 'LNX 11,2,202,451'),
                   ('swfUrl', 'http://static.infomaniak.ch/livetv/playerMain-v4.2.73.swf?sTitle=&bLd=0&sDescription=&sVersion=4%2E2%2E73'),
                   ('tcUrl', 'rtmp://rtmp.rtbf.be/livecast'),
                   #('fpad', False),
                   #('capabilities', '239'),
                   #('audioCodecs', '3575'),
                   #('videoCodecs', '252'),
                   #('videoFunction', '1'),
                   ('pageUrl', page_url),
                   #('objectEncoding', '0')
                   ]
     rtmp = 'rtmp://rtmp.rtbf.be/livecast'
     rtmp += '/%s %s' % (stream_name, ' '.join(['%s=%s' % (p,v) for p,v in properties]))
     return rtmp
     """Correct this
Exemple #4
0
 def play_video(self, datas):
     id = datas.get('url')
     regex = """provider: 'video', file: '([^']+)"""
     data = channel.get_url(self.main_url + '/mediatheek/ajax/video/' + id)
     for url in re.findall(regex, data):
         if url.split('.')[-1] == '3gp':
             return channel.playUrl(url)
Exemple #5
0
 def get_video_news(self):
     url = 'http://nieuws.vtm.be/herbekijk'
     data = channel.get_url(url)
     regex = r"""href="([^"]+)"><img src="([^"]+)[^<]+</a>\s+</div>\s+<div[^<]+</div>\s+<h3[^>]+>\s+<span>\s+<a href[^>]+>([^<]+)"""
     for url, img, title in re.findall(regex, data):
         vurl = channel.array2url(channel_id=self.channel_id, url=url, action='play_video', news='1')
         channel.addLink(title, vurl, img)
Exemple #6
0
 def get_videos(self, datas):
     url = datas.get('url')
     page = datas.get('page', False)
     if page:
         page_txt = '&page=' + str(page)
     else:
         page_txt = ''
     data = channel.get_url(self.main_url + '/mediatheek/tag/' + url +
                            page_txt)
     regex = r""" id="video-(\d+)"><img src="([^"]+)" /></a>\s*<h5><a[^>]+>([^<]+)"""
     for id, img, title in re.findall(regex, data):
         vurl = channel.array2url(channel_id=self.channel_id,
                                  url=id,
                                  action='play_video')
         channel.addLink(title, vurl, img)
     next_page = re.search(
         r"""\?page=(\d+)" class="pager-next active" title="Ga naar volg""",
         data)
     if next_page is not None:
         page = next_page.group(1)
         channel.addDir('Page nr ' + page,
                        self.icon,
                        channel_id=self.channel_id,
                        url=url,
                        action='show_videos',
                        page=page)
Exemple #7
0
    def get_videos(self, datas):
        #from datetime import datetime
        url = datas.get('url')
        vid_id = datas.get('vid_id')
        md5 = datas.get('md5')
        if not vid_id:
            vid_id, md5 = self.get_video_id(url)
        if not vid_id:
            return
        page = datas.get('page', 1)
        #http://www.rtbf.be/video/detail/ajax/av?page=1&timeFilter=all&orderBy=publish_view&videoId=1856226&returnMode=program&categoryId=&md5=00f9cfd447930fa1742d5d9f3e29e45cf083609f
        data = channel.get_url(self.main_url + "/video/detail/ajax/av?page=" + str(page) + "&timeFilter=all&orderBy=publish_view&videoId=" + str(vid_id) + "&returnMode=program&categoryId=&md5=" + str(md5))
        #data = channel.get_url(self.main_url + "/video/detail/ajax/av?page=" + str(page) + "&timeFilter=all&orderBy=more_recent&videoId=" + str(vid_id) + "&returnMode=program&categoryId=&md5=" + str(md5))
        #regex = r"""video/detail_[^?]+\?id=(\d+)".+ src="([^"]+).+\n.+rel="">([^<]+).+\n.+\n.+\n.+<strong>([^<]+)"""
        regex = r"""video/detail_[^?]+\?id=(\d+)".+ src="([^"]+).+\n.+>([^<]+)(.+\n){3,4}.+<strong>(\d\d/\d\d/\d{4})"""
        #regex = r"""(?s)\?id=(\d+)&c[^>]+><img class="thumb" src="([^"]+).+?<h3><[^>]+>([^<]+)</a></h3>\s+<span[^>]+><a[^>]+>([^<]+)"""
        for id, img, title, tt, date in re.findall(regex, data):
            title = title + ' - ' + date
            vurl = channel.array2url(channel_id=self.channel_id, url=id, action='play_video')
            channel.addLink(title.replace('&#039;', "'").replace('&#034;', '"'), vurl, img)

        next_page = re.search(r"""rel="(\d+)">Suivante""", data)
        if next_page is not None:
            page = next_page.group(1)
            channel.addDir('Page nr ' + page, self.icon, channel_id=self.channel_id, vid_id=vid_id, action='show_videos', page=page, md5=md5)
Exemple #8
0
 def play_video(self, datas):
     id = datas.get('url')
     regex = """provider: 'video', file: '([^']+)"""
     data = channel.get_url(self.main_url + '/mediatheek/ajax/video/' + id)
     for url in re.findall(regex, data):
         if url.split('.')[-1] == '3gp':
             return channel.playUrl(url)
Exemple #9
0
 def play_video(self, datas):
     url = datas.get('url')
     video_page_url = self.main_url + url
     data = channel.get_url(video_page_url)
     regex = r"""(http://www.tvcom.be/videos/.+?\.mp4)"""
     video_url = re.findall(regex, data)[0]
     video_url = video_url.replace(' ', '%20')
     channel.playUrl(video_url)
Exemple #10
0
 def get_videos(self, datas):
     url = datas.get('url')
     data = channel.get_url(self.main_url + url)
     regex = r"""class="contentheading"[^>]+>([^<]+)</td>\s+</tr>\s+</table>\s+<table[^>]+>\s+<tr>\s+<td[^>]+>\s+<p><a href="([^"]+)[^>]+><img.+? src="([^"]+)"""
     for title, vurl, img in re.findall(regex, data):
         title = title.strip()
         vurl = channel.array2url(channel_id=self.channel_id, url=vurl, action='play_video')
         channel.addLink(title, vurl, self.main_url + img)
Exemple #11
0
 def play_video(self, datas):
     url = datas.get('url')
     video_page_url = self.main_url + url
     data = channel.get_url(video_page_url)
     regex = r"""(http://www.tvcom.be/videos/.+?\.mp4)"""
     video_url = re.findall(regex, data)[0]
     video_url = video_url.replace(' ', '%20')
     channel.playUrl(video_url)
Exemple #12
0
    def get_lives(self, datas):
        def parse_lives(data):
            regex = r"""href="http://www.rtbf.be/livecenter/([^"]+)"><img class="[^"]+" src="([^"]+)" alt="([^"]+)."""  #*\3.*\3.*class="date">([^<]+).*is-live.*\1
            for url, icon, name in re.findall(regex, data, flags=re.DOTALL):
                print "found"
                vurl = channel.array2url(channel_id=self.channel_id,
                                         url=url,
                                         action='play_live')
                channel.addLink(
                    name.replace('&#039;', "'").replace('&#034;', '"'), vurl,
                    icon)  # + ' - ' + date

        live_url = self.main_url + '/livecenter/'
        data = channel.get_url(live_url)
        parse_lives(data)
        data = channel.get_url(live_url + '?category=&page=2&client=')
        parse_lives(data)
Exemple #13
0
 def get_direct_videos(self):
     url = 'http://www.rtl.be/rtltvi/page/les-directs-rtl-tvi/258.aspx'
     data = channel.get_url(url)
     regex = r"""OtherLiveItem(Big|)Img ><A href="http://www.rtl.be/[^/]+/[^/]+/[^/]+/(\d+)\.aspx"><img src="([^"]+)"[^>]+></A></DIV>\s+<[^>]+>([^<]+)</DIV>\s+<[^>]+>([^<]+)"""
     for big, id, img, title, time in re.findall(regex, data):
         title = channel.htmlentitydecode(title + ' - ' + time)
         vurl = channel.array2url(channel_id=self.channel_id, url=id, action='play_video', direct='1')
         channel.addLink(title, vurl, img)
Exemple #14
0
 def get_categories_iter(self, skip_empty_id):
     data = channel.get_url(self.main_url + '/video/emissions')
     regex = r"""http://www.rtbf.be/video/emissions/detail_([^"]+)"><img src="([^"]+)"[^/]+/><span>([^<]+)"""
     for url, icon, name in re.findall(regex, data):
         id = url.split('pid=')[1]
         if skip_empty_id and id in id2skip:
             continue
         yield url, icon, name, id
Exemple #15
0
 def get_direct_videos(self):
     url = 'http://www.rtl.be/rtltvi/page/les-directs-rtl-tvi/258.aspx'
     data = channel.get_url(url)
     regex = r"""OtherLiveItem(Big|)Img ><A href="http://www.rtl.be/[^/]+/[^/]+/[^/]+/(\d+)\.aspx"><img src="([^"]+)"[^>]+></A></DIV>\s+<[^>]+>([^<]+)</DIV>\s+<[^>]+>([^<]+)"""
     for big, id, img, title, time in re.findall(regex, data):
         title = channel.htmlentitydecode(title + ' - ' + time)
         vurl = channel.array2url(channel_id=self.channel_id, url=id, action='play_video', direct='1')
         channel.addLink(title, vurl, img)
Exemple #16
0
 def get_live_rtmp(self, page_url):
     data = channel.get_url(page_url)
     regex = r"""streamName&quot;:&quot;([^&]+)"""
     stream_name = re.search(regex, data)
     if stream_name is None:
         return None
     stream_name = stream_name.group(1)
     token_json_data = channel.get_url(self.main_url + '/api/media/streaming?streamname=' + stream_name, referer=page_url)
     token = token_json_data.split('":"')[1].split('"')[0]
     swf_url = 'http://static.infomaniak.ch/livetv/playerMain-v4.2.41.swf?sVersion=4%2E2%2E41&sDescription=&bLd=0&sTitle=&autostart=1'
     rtmp = 'rtmp://rtmp.rtbf.be/livecast'
     page_url = 'http://www.rtbf.be'
     play = '%s?%s' % (stream_name, token)
     rtmp += '/%s swfUrl=%s pageUrl=%s tcUrl=%s' % (play, swf_url, page_url, rtmp)
     #xbmc.log('stream: ' + rtmp)
     return rtmp
     """Correct this
Exemple #17
0
 def get_categories_iter(self, skip_empty_id):
     data = channel.get_url(self.main_url + '/video/emissions')
     regex = r"""http://www.rtbf.be/video/emissions/detail_([^"]+)"><img src="([^"]+)"[^/]+/><span>([^<]+)"""
     for url, icon, name in re.findall(regex, data):
         id = url.split('pid=')[1]
         if skip_empty_id and id in id2skip:
             continue
         yield url, icon, name, id
Exemple #18
0
 def get_categories(self, datas):
     data = channel.get_url(self.main_url + '/mediatheek')
     regex = r"""value="(\d+)">([^<]+)"""
     for url, name in re.findall(regex, data):
         channel.addDir(name,
                        self.icon,
                        channel_id=self.channel_id,
                        url=url,
                        action='show_videos')
Exemple #19
0
 def get_categories(self, datas, skip_empty_id=True):
     data = channel.get_url(self.main_url + '/video/programma')
     regex = r"""<li><a href="([^"]+)">([^<]+)</a></li>"""
     for url, name in re.findall(regex, data):
         channel.addDir(name,
                        '',
                        channel_id=self.channel_id,
                        url=url,
                        action='show_videos')
Exemple #20
0
 def get_videos(self, datas):
     url = datas.get('url')
     data = channel.get_url(self.main_url + url)
     regex = r"""class="contentheading"[^>]+>([^<]+)</td>\s+</tr>\s+</table>\s+<table[^>]+>\s+<tr>\s+<td[^>]+>\s+<p><a href="([^"]+)[^>]+><img.+? src="([^"]+)"""
     for title, vurl, img in re.findall(regex, data):
         title = title.strip()
         vurl = channel.array2url(channel_id=self.channel_id,
                                  url=vurl,
                                  action='play_video')
         channel.addLink(title, vurl, self.main_url + img)
Exemple #21
0
 def play_video(self, datas):
     url = datas.get('url')
     if datas.get('news'):
         return self.play_video_news(url)
     data = channel.get_url(url)
     regex = r"""<source src="([^"]+)"""
     video = re.search(regex, data)
     if video is not None:
         vurl = video.group(1)
         channel.playUrl(vurl)
Exemple #22
0
 def get_categories(self, skip_empty_id = True):
     channel.addDir('Directs', 'DefaultVideo.png', channel_id=self.channel_id, action='get_lives')
     data = channel.get_url(self.main_url + '/video/emissions')
     #regex = r"""href="http://www.rtbf.be/video/recherche([^"]+)">([^<]+)"""
     regex = r"""http://www.rtbf.be/video/emissions/detail_([^"]+)"><img src="([^"]+)"[^/]+/><span>([^<]+)"""
     for url, icon, name in re.findall(regex, data):
         id = url.split('pid=')[1]
         if skip_empty_id and id in id2skip:
             continue
         channel.addDir(name, icon, channel_id=self.channel_id, url=url, action='show_videos', id=id)
Exemple #23
0
 def get_categories(self, datas):
     data = channel.get_url(self.main_url)
     regex = r"""missions(.+?)</ul"""
     res = re.findall(regex, data)
     if not res:
         return
     cat_data = res[0]
     regex = r"""<a href="([^"]+)"><span>([^<]+)"""
     for url, name in re.findall(regex, cat_data):
         channel.addDir(name, self.icon, channel_id=self.channel_id, url=url, action='show_videos')
Exemple #24
0
 def play_video(self, datas):
     url = datas.get('url')
     if datas.get('news'):
         return self.play_video_news(url)
     data = channel.get_url(url)
     regex = r"""<source src="([^"]+)"""
     video = re.search(regex, data)
     if video is not None:
         vurl = video.group(1)
         channel.playUrl(vurl)
Exemple #25
0
 def get_video_news(self):
     url = 'http://nieuws.vtm.be/herbekijk'
     data = channel.get_url(url)
     regex = r"""href="([^"]+)"><img src="([^"]+)[^<]+</a>\s+</div>\s+<div[^<]+</div>\s+<h3[^>]+>\s+<span>\s+<a href[^>]+>([^<]+)"""
     for url, img, title in re.findall(regex, data):
         vurl = channel.array2url(channel_id=self.channel_id,
                                  url=url,
                                  action='play_video',
                                  news='1')
         channel.addLink(title, vurl, img)
Exemple #26
0
 def play_video(self, datas):
     import simplejson as json
     id = datas.get('url')
     d = json.loads(channel.get_url(self.main_url + '/api/media/video?method=getVideoDetail&args%5B%5D=' + id))['data']
     try:
         vurl = d['urls']
     except:
         return
     #title = d['title'] + ' - ' + datetime.fromtimestamp(d['created']).strftime('%d/%m/%Y') + ' - ' + channel.time2str(d.get('duration', ''))
     #img = 'http://ds.static.rtbf.be' + d['thumbnail']['full']
     #rating = d['rating']
     channel.playUrl(vurl)
Exemple #27
0
 def get_video_id(self, url):
     rawstr = r"""id="hidVideoId" value="(\d+)"""
     data = channel.get_url(self.main_url + '/video/emissions/detail_' + url)
     id = re.search(rawstr, data)
     if id is not None:
         video_id = id.group(1)
         rawstr = r"""hidMD5"\s*value="([a-f0-9]+)"""
         res = re.search(rawstr, data)
         if res:
             md5 = res.group(1)
             return video_id, md5
     return False, False
Exemple #28
0
 def play_video(self, datas):
     id = datas.get('url')
     if datas.get('direct'):
         id = self.get_direct_video_id(id)
     if channel.in_xbmc:
         from elementtree import ElementTree
     else:
         from xml.etree import ElementTree
     data = channel.get_url(self.main_url + self.channel_id + '/GetFlashParams.aspx?id=%s&bEmbed=0&sDummyPath=' % id)
     tree = ElementTree.fromstring(data)
     vpo = tree.find('VPO')
     title, img, url = vpo.find('Title').text, vpo.find('Thumbnail').text, vpo.find('URL').text
     channel.playUrl(url)
Exemple #29
0
 def get_video_id(self, url):
     rawstr = r"""id="hidVideoId" value="(\d+)"""
     data = channel.get_url(self.main_url + '/video/emissions/detail_' +
                            url)
     id = re.search(rawstr, data)
     if id is not None:
         video_id = id.group(1)
         rawstr = r"""hidMD5"\s*value="([a-f0-9]+)"""
         res = re.search(rawstr, data)
         if res:
             md5 = res.group(1)
             return video_id, md5
     return False, False
Exemple #30
0
 def play_video(self, datas):
     id = datas.get('url')
     if datas.get('direct'):
         id = self.get_direct_video_id(id)
     if channel.in_xbmc:
         from elementtree import ElementTree
     else:
         from xml.etree import ElementTree
     data = channel.get_url(self.main_url + self.channel_id + '/GetFlashParams.aspx?id=%s&bEmbed=0&sDummyPath=' % id)
     tree = ElementTree.fromstring(data)
     vpo = tree.find('VPO')
     title, img, url = vpo.find('Title').text, vpo.find('Thumbnail').text, vpo.find('URL').text
     channel.playUrl(url)
Exemple #31
0
 def get_categories(self, datas):
     data = channel.get_url(self.main_url)
     regex = r"""missions(.+?)</ul"""
     res = re.findall(regex, data)
     if not res:
         return
     cat_data = res[0]
     regex = r"""<a href="([^"]+)"><span>([^<]+)"""
     for url, name in re.findall(regex, cat_data):
         channel.addDir(name,
                        self.icon,
                        channel_id=self.channel_id,
                        url=url,
                        action='show_videos')
Exemple #32
0
 def get_videos(self, datas):
     url = datas.get('url')
     page = datas.get('page', False)
     if page:
         page_txt = '&page=' + str(page)
     else:
         page_txt = ''
     data = channel.get_url(self.main_url + '/mediatheek/tag/' + url + page_txt)
     regex = r""" id="video-(\d+)"><img src="([^"]+)" /></a>\s*<h5><a[^>]+>([^<]+)"""
     for id, img, title in re.findall(regex, data):
         vurl = channel.array2url(channel_id=self.channel_id, url=id, action='play_video')
         channel.addLink(title, vurl, img)
     next_page = re.search(r"""\?page=(\d+)" class="pager-next active" title="Ga naar volg""", data)
     if next_page is not None:
         page = next_page.group(1)
         channel.addDir('Page nr ' + page, self.icon, channel_id=self.channel_id, url=url, action='show_videos', page=page)
Exemple #33
0
 def play_video(self, datas):
     import simplejson as json
     id = datas.get('url')
     d = json.loads(
         channel.get_url(
             self.main_url +
             '/api/media/video?method=getVideoDetail&args%5B%5D=' +
             id))['data']
     try:
         vurl = d['urls']
     except:
         return
     #title = d['title'] + ' - ' + datetime.fromtimestamp(d['created']).strftime('%d/%m/%Y') + ' - ' + channel.time2str(d.get('duration', ''))
     #img = 'http://ds.static.rtbf.be' + d['thumbnail']['full']
     #rating = d['rating']
     channel.playUrl(vurl)
Exemple #34
0
 def get_categories(self, skip_empty_id = True):
     data = channel.get_url(self.main_url + self.channel_id + '/page/toutes-les-videos/237.aspx')
     regex = r"""(?i)""" + self.channel_id + r"""(/categorie/[^/]+/(\d+)\.aspx)[^>]+><img[^"]+"([^"]+)[^>]*></a>\s*<h3>([^<]+)"""
     print regex
     channels = []
     channels_data = {}
     for url, id, img, name in re.findall(regex, data):
         if skip_empty_id and id in id2skip:
             continue
         if id not in only_good_cat or name.find(only_good_cat[id]) != -1:
             channels_data[url] = (name, img, id)
     channels = channels_data.keys()
     channels.sort(lambda x, y: cmp(str.lower(channels_data[x][0]), str.lower(channels_data[y][0])))
     for url in channels:
         name, img, id = channels_data[url]
         name = channel.htmlentitydecode(name)
         channel.addDir(name, img, channel_id=self.channel_id, url=url, action='show_videos', id=id)
Exemple #35
0
 def get_categories_old(self, datas, skip_empty_id = True):
     data = channel.get_url(self.main_url + self.channel_id + '/page/toutes-les-videos/237.aspx')
     regex = r"""(?i)""" + self.channel_id + r"""(/categorie/[^/]+/(\d+)\.aspx)[^>]+><img[^"]+"([^"]+)[^>]*></a>\s*<h3>([^<]+)"""
     print regex
     channels = []
     channels_data = {}
     for url, id, img, name in re.findall(regex, data):
         if skip_empty_id and id in id2skip:
             continue
         if id not in only_good_cat or name.find(only_good_cat[id]) != -1:
             channels_data[url] = (name, img, id)
     channels = channels_data.keys()
     channels.sort(lambda x, y: cmp(str.lower(channels_data[x][0]), str.lower(channels_data[y][0])))
     for url in channels:
         name, img, id = channels_data[url]
         name = channel.htmlentitydecode(name)
         channel.addDir(name, img, channel_id=self.channel_id, url=url, action='show_videos', id=id)
Exemple #36
0
    def get_videos(self, datas):
        url = datas.get('url')
        print url
        if url == 'http://vtm.be/het-nieuws/video':
            print 'Nieuw'
            return self.get_video_news()
        data = channel.get_url(url)
        regex = r"""<a href="([^"]+)">([^<]+)</a></h3>\s+<time[^>]+>([^<]+).+?<a href="\1"><img src="([^"]+)"""
        for url, title, date, img in re.findall(regex, data, re.DOTALL):
            title = title + ' - ' + date
            vurl = channel.array2url(channel_id=self.channel_id, url=url, action='play_video')
            channel.addLink(title, vurl, img)

        next_page = re.search(r"""href="([^?]+\?page=(\d+))">volgende""", data)
        if next_page is not None:
            url = next_page.group(1)
            page = str(int(next_page.group(2)) + 1)
            channel.addDir('Page nr ' + page, self.icon, channel_id=self.channel_id, action='show_videos', url=url)
Exemple #37
0
 def get_videos(self, datas):
     url = datas.get('url')
     if datas.get('direct', False):
         self.get_direct_videos()
         return
     data = channel.get_url(self.main_url + self.channel_id + url)
     regex = r"""<img src="([^"]+)"[^>]*><A class=[^']+'(\d+)[^>]+>[a-z0-9A-Z\s]+<BR>([^<]+)"""
     ids = []
     for img, id, title in re.findall(regex, data):
         if id in ids:
             continue
         ids.append(id)
         vurl = channel.array2url(channel_id=self.channel_id, url=id, action='play_video')
         channel.addLink(channel.htmlentitydecode(title), vurl, img)
     regex = r"""<A href="/""" + self.channel_id + """/video/(\d+)\.aspx[^"]*"[^>]*><img src="([^"]+?)"[^>]*></A>\s*?<H3>([^<]+)</H3>"""
     for id, img, title in re.findall(regex, data):
         if id in ids:
             continue
         ids.append(id)
         vurl = channel.array2url(channel_id=self.channel_id, url=id, action='play_video')
         channel.addLink(channel.htmlentitydecode(title), vurl, img)
Exemple #38
0
 def get_videos(self, datas):
     url = datas.get('url')
     if datas.get('direct', False):
         self.get_direct_videos()
         return
     data = channel.get_url(self.main_url + self.channel_id + url)
     regex = r"""<img src="([^"]+)"[^>]*><A class=[^']+'(\d+)[^>]+>[a-z0-9A-Z\s]+<BR>([^<]+)"""
     ids = []
     for img, id, title in re.findall(regex, data):
         if id in ids:
             continue
         ids.append(id)
         vurl = channel.array2url(channel_id=self.channel_id, url=id, action='play_video')
         channel.addLink(channel.htmlentitydecode(title), vurl, img)
     regex = r"""<A href="/""" + self.channel_id + """/video/(\d+)\.aspx[^"]*"[^>]*><img src="([^"]+?)"[^>]*></A>\s*?<H3>([^<]+)</H3>"""
     for id, img, title in re.findall(regex, data):
         if id in ids:
             continue
         ids.append(id)
         vurl = channel.array2url(channel_id=self.channel_id, url=id, action='play_video')
         channel.addLink(channel.htmlentitydecode(title), vurl, img)
Exemple #39
0
    def get_videos(self, datas):
        #from datetime import datetime
        url = datas.get('url')
        vid_id = datas.get('vid_id')
        md5 = datas.get('md5')
        if not vid_id:
            vid_id, md5 = self.get_video_id(url)
        if not vid_id:
            return
        page = datas.get('page', 1)
        #http://www.rtbf.be/video/detail/ajax/av?page=1&timeFilter=all&orderBy=publish_view&videoId=1856226&returnMode=program&categoryId=&md5=00f9cfd447930fa1742d5d9f3e29e45cf083609f
        data = channel.get_url(
            self.main_url + "/video/detail/ajax/av?page=" + str(page) +
            "&timeFilter=all&orderBy=publish_view&videoId=" + str(vid_id) +
            "&returnMode=program&categoryId=&md5=" + str(md5))
        #data = channel.get_url(self.main_url + "/video/detail/ajax/av?page=" + str(page) + "&timeFilter=all&orderBy=more_recent&videoId=" + str(vid_id) + "&returnMode=program&categoryId=&md5=" + str(md5))
        #regex = r"""video/detail_[^?]+\?id=(\d+)".+ src="([^"]+).+\n.+rel="">([^<]+).+\n.+\n.+\n.+<strong>([^<]+)"""
        regex = r"""video/detail_[^?]+\?id=(\d+)".+ src="([^"]+).+\n.+>([^<]+)(.+\n){3,4}.+<strong>(\d\d/\d\d/\d{4})"""
        #regex = r"""(?s)\?id=(\d+)&c[^>]+><img class="thumb" src="([^"]+).+?<h3><[^>]+>([^<]+)</a></h3>\s+<span[^>]+><a[^>]+>([^<]+)"""
        for id, img, title, tt, date in re.findall(regex, data):
            title = title + ' - ' + date
            vurl = channel.array2url(channel_id=self.channel_id,
                                     url=id,
                                     action='play_video')
            channel.addLink(
                title.replace('&#039;', "'").replace('&#034;', '"'), vurl, img)

        next_page = re.search(r"""rel="(\d+)">Suivante""", data)
        if next_page is not None:
            page = next_page.group(1)
            channel.addDir('Page nr ' + page,
                           self.icon,
                           channel_id=self.channel_id,
                           vid_id=vid_id,
                           action='show_videos',
                           page=page,
                           md5=md5)
Exemple #40
0
    def get_videos(self, datas):
        url = datas.get('url')
        print url
        if url == 'http://vtm.be/het-nieuws/video':
            print 'Nieuw'
            return self.get_video_news()
        data = channel.get_url(url)
        regex = r"""<a href="([^"]+)">([^<]+)</a></h3>\s+<time[^>]+>([^<]+).+?<a href="\1"><img src="([^"]+)"""
        for url, title, date, img in re.findall(regex, data, re.DOTALL):
            title = title + ' - ' + date
            vurl = channel.array2url(channel_id=self.channel_id,
                                     url=url,
                                     action='play_video')
            channel.addLink(title, vurl, img)

        next_page = re.search(r"""href="([^?]+\?page=(\d+))">volgende""", data)
        if next_page is not None:
            url = next_page.group(1)
            page = str(int(next_page.group(2)) + 1)
            channel.addDir('Page nr ' + page,
                           self.icon,
                           channel_id=self.channel_id,
                           action='show_videos',
                           url=url)
Exemple #41
0
 def get_live_rtmp(self, page_url):
     data = channel.get_url(page_url)
     regex = r"""streamName&quot;:&quot;([^&]+)"""
     stream_name = re.search(regex, data)
     if stream_name is None:
         return None
     stream_name = stream_name.group(1)
     """token_json_data = channel.get_url(self.main_url + '/api/media/streaming?streamname=' + stream_name, referer=page_url)
     token = token_json_data.split('":"')[1].split('"')[0]
     swf_url = 'http://static.infomaniak.ch/livetv/playerMain-v4.2.73.swf?sVersion=4%2E2%2E41&sDescription=&bLd=0&sTitle=&autostart=1'
     rtmp = 'rtmp://rtmp.rtbf.be/livecast'
     page_url = 'http://www.rtbf.be'
     play = '%s?%s' % (stream_name, token)
     rtmp += '/%s swfUrl=%s pageUrl=%s tcUrl=%s' % (play, swf_url, page_url, rtmp)
     #xbmc.log('stream: ' + rtmp)
     return rtmp"""
     properties = [
         ('app', 'livecast'),
         #('flashVer', 'LNX 11,2,202,451'),
         ('swfUrl',
          'http://static.infomaniak.ch/livetv/playerMain-v4.2.73.swf?sTitle=&bLd=0&sDescription=&sVersion=4%2E2%2E73'
          ),
         ('tcUrl', 'rtmp://rtmp.rtbf.be/livecast'),
         #('fpad', False),
         #('capabilities', '239'),
         #('audioCodecs', '3575'),
         #('videoCodecs', '252'),
         #('videoFunction', '1'),
         ('pageUrl', page_url),
         #('objectEncoding', '0')
     ]
     rtmp = 'rtmp://rtmp.rtbf.be/livecast'
     rtmp += '/%s %s' % (stream_name, ' '.join(
         ['%s=%s' % (p, v) for p, v in properties]))
     return rtmp
     """Correct this
Exemple #42
0
 def get_categories(self, datas):
     data = channel.get_url(self.main_url + '/mediatheek')
     regex = r"""value="(\d+)">([^<]+)"""
     for url, name in re.findall(regex, data):
         channel.addDir(name, self.icon, channel_id=self.channel_id, url=url, action='show_videos')
Exemple #43
0
 def play_video_news(self, url):
     url = 'http://nieuws.vtm.be' + url
     data = channel.get_url(url)
     regex = r"""<source src="([^"]+)"""
     vurl = re.findall(regex, data)[0]
     channel.playUrl(vurl)
Exemple #44
0
 def get_direct_video_id(self, id):
     url = 'http://www.rtl.be/rtltvi/live//' + id + '.aspx'
     data = channel.get_url(url)
     regex = r"""VideoID=(\d+)"""
     id = re.findall(regex, data)[0]
     return id
Exemple #45
0
 def play_video_news(self, url):
     url = 'http://nieuws.vtm.be' + url
     data = channel.get_url(url)
     regex = r"""<source src="([^"]+)"""
     vurl = re.findall(regex, data)[0]
     channel.playUrl(vurl)
Exemple #46
0
 def get_categories(self, datas, skip_empty_id = True):
     data = channel.get_url(self.main_url + '/video/programma')
     regex = r"""<li><a href="([^"]+)">([^<]+)</a></li>"""
     for url, name in re.findall(regex, data):
         channel.addDir(name, '', channel_id=self.channel_id, url=url, action='show_videos')
Exemple #47
0
 def get_direct_video_id(self, id):
     url = 'http://www.rtl.be/rtltvi/live//' + id + '.aspx'
     data = channel.get_url(url)
     regex = r"""VideoID=(\d+)"""
     id = re.findall(regex, data)[0]
     return id