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(''', "'").replace('"', '"'), 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)
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)
def show_channels(): for channel_id, ch in channels.iteritems(): if channel.in_xbmc: icon = xbmc.translatePath(os.path.join(channel.home, 'resources/' + ch['icon'])) channel.addDir(ch['name'], icon, channel_id=channel_id, action='show_categories') else: print ch['name'], channel_id, 'show_categories'
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')
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')
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)
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')
def show_channels(): for channel_id, ch in channels.iteritems(): if channel.in_xbmc: icon = xbmc.translatePath( os.path.join(channel.home, 'resources/' + ch['icon'])) channel.addDir(ch['name'], icon, channel_id=channel_id, action='show_categories') else: print ch['name'], channel_id, 'show_categories'
def get_categories(self, datas, skip_empty_id=True): channel.addDir('Directs', 'DefaultVideo.png', channel_id=self.channel_id, action='get_lives') for url, icon, name, id in self.get_categories_iter(skip_empty_id): channel.addDir(name, icon, channel_id=self.channel_id, url=url, action='show_videos', id=id) """cats = self.db.get_cats()
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)
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)
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)
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)
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(''', "'").replace('"', '"'), 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)
def get_categories(self, datas, skip_empty_id = True): channel.addDir('Directs', 'DefaultVideo.png', channel_id=self.channel_id, action='get_lives') for url, icon, name, id in self.get_categories_iter(skip_empty_id): channel.addDir(name, icon, channel_id=self.channel_id, url=url, action='show_videos', id=id) """cats = self.db.get_cats()
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')