def list_shows(channel,folder): shows=[] jsonParser = json.loads(cats) if folder=='none': for c in jsonParser['categories']: shows.append( [channel,c['id'], utils.formatName(c['id'].replace('+',' ')) ,'' ,'folder'] ) else: for c in jsonParser['categories']: if c['id']==folder: for s in c['sub']: shows.append( [channel,c['id'] + '|' + s['id'] +'|0', utils.formatName(s['id'].replace('+',' ')) ,'' ,'shows'] ) return shows
def list_videos(channel,page): videos=[] filePath=utils.downloadCatalog('http://rmcdecouverte.bfmtv.com/mediaplayer-replay/' ,'rmcd.html',False,{}) html=open(filePath).read().replace('\n', ' ').replace('\r', '') match = re.compile(r'<figure class="figure modulx1-5-inside-bloc">(.*?)<a href="(.*?)" title="(.*?)">(.*?)data-original="(.*?)" alt=',re.DOTALL).findall(html) for a,url,title,b,img in match: title=utils.formatName(title) infoLabels = {"Title": title.encode('utf-8')} videos.append( [channel, url.replace('\t','').encode('utf-8') , title.encode('utf-8') , img.encode('utf-8'),infoLabels,'play'] ) return videos
def list_shows(channel, folder): shows = [] jsonParser = json.loads(cats) if folder == 'none': for c in jsonParser['categories']: shows.append([ channel, c['id'], utils.formatName(c['id'].replace('+', ' ')), '', 'folder' ]) else: for c in jsonParser['categories']: if c['id'] == folder: for s in c['sub']: shows.append([ channel, c['id'] + '|' + s['id'] + '|0', utils.formatName(s['id'].replace('+', ' ')), '', 'shows' ]) return shows
def list_videos(channel, cat_url): videos = [] cat = cat_url[2:] filePath = utils.downloadCatalog(url_root + cat_url, 'rtbf' + cat + '.html', False, {}) html = open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a').replace( '\n', ' ').replace('\r', '') match = re.compile( r'<h3 class="rtbf-media-item__title "><a href="(.*?)" title="(.*?)">', re.DOTALL).findall(html) for url, title in match: title = utils.formatName(title) infoLabels = {"Title": title} videos.append([channel, url, title, '', infoLabels, 'play']) return videos
def list_videos(channel,page): videos=[] if page!='0': videos.append( [channel,str(int(page)-1), '<<Page Precedente' ,'',{} ,'shows'] ) filePath = utils.downloadCatalog(url_Videos % page, 'natgeo%s.JSON' % page, False, {}) filPrgm = open(filePath).read() jsonParser = json.loads(filPrgm) for vid in jsonParser: id=vid['field_mpx_guid'].encode('utf-8') title=utils.formatName(vid['title']) img=url_base + vid['field_promo_image'] infoLabels = {"Title": title} videos.append( [channel, id , title , img,infoLabels,'play'] ) videos.append( [channel,str(int(page)+1), 'Page Suivante>>' ,'',{} ,'shows'] ) return videos
def list_videos(channel, folder): videos = [] cat, page = folder.split('|') filePath = utils.downloadCatalog( 'http://www.les-docus.com%s/page/%s/' % (cat, page), 'lesdocuslist.html', True, {}) html = open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a').replace( '\n', ' ').replace('\r', '') match = re.compile(r'<a class="(.*?) page-numbers"', re.DOTALL).findall(html) prev = False next = False for item in match: prev = ('prev' in item or prev) next = ('next' in item or next) if prev: videos.append([ channel, cat + '|' + str(int(page) - 1), '<<Page Precedente', '', {}, 'shows' ]) match = re.compile( r'<div class="post-header"> <a href="(.*?)" title="(.*?)">', re.DOTALL).findall(html) for url, title in match: title = utils.formatName(title) infoLabels = {"Title": title} videos.append([channel, url, title, '', infoLabels, 'play']) if next: videos.append([ channel, cat + '|' + str(int(page) + 1), 'Page Suivante>>', '', {}, 'shows' ]) return videos
def list_videos(channel,cat): videos=[] filePath=utils.downloadCatalog(url_base + cat ,'futura%s.html' % cat.replace('/video/','').replace('/',''),False,{}) html=open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a').replace('\n', ' ').replace('\r', '') prev=re.findall('<link rel="prev" href="(.*?)" />', html) if len(prev)==1: title='<<Page Precedente' videos.append( [channel,prev[0].replace(url_base,''), title , '',{"Title": title},'shows'] ) match = re.compile(r'</header><a href="(.*?)" class="link-wrapper"><article><h3 class="gamma image-mosaic-title text-shadow">(.*?)</h3></article>',re.DOTALL).findall(html) for url,title in match: title=utils.formatName(title) videos.append( [channel,url, title , '',{"Title": title},'play'] ) next=re.findall('<link rel="next" href="(.*?)" />', html) if len(next)==1: title='Page Suivante>>' videos.append( [channel,next[0].replace(url_base,''), title , '',{"Title": title},'shows'] ) return videos
def list_videos(channel, cat): videos = [] filePath = utils.downloadCatalog( url_base + cat, 'futura%s.html' % cat.replace('/video/', '').replace('/', ''), False, {}) html = open(filePath).read().replace('\xe9', 'e').replace('\xe0', 'a').replace( '\n', ' ').replace('\r', '') prev = re.findall('<link rel="prev" href="(.*?)" />', html) if len(prev) == 1: title = '<<Page Precedente' videos.append([ channel, prev[0].replace(url_base, ''), title, '', { "Title": title }, 'shows' ]) match = re.compile( r'</header><a href="(.*?)" class="link-wrapper"><article><h3 class="gamma image-mosaic-title text-shadow">(.*?)</h3></article>', re.DOTALL).findall(html) for url, title in match: title = utils.formatName(title) videos.append([channel, url, title, '', {"Title": title}, 'play']) next = re.findall('<link rel="next" href="(.*?)" />', html) if len(next) == 1: title = 'Page Suivante>>' videos.append([ channel, next[0].replace(url_base, ''), title, '', { "Title": title }, 'shows' ]) return videos
def list_videos(channel, page): videos = [] if page != '0': videos.append([ channel, str(int(page) - 1), '<<Page Precedente', '', {}, 'shows' ]) filePath = utils.downloadCatalog(url_Videos % page, 'natgeo%s.JSON' % page, False, {}) filPrgm = open(filePath).read() jsonParser = json.loads(filPrgm) for vid in jsonParser: id = vid['field_mpx_guid'].encode('utf-8') title = utils.formatName(vid['title']) img = url_base + vid['field_promo_image'] infoLabels = {"Title": title} videos.append([channel, id, title, img, infoLabels, 'play']) videos.append( [channel, str(int(page) + 1), 'Page Suivante>>', '', {}, 'shows']) return videos