def showsEpisodeList(contentId, page): ''' Returns the list of episodes of the chosen show''' videoPage = cache.getFileCache(contentId + '-' + str(page) + '.txt', 56700) if videoPage == None: videoPage = http.getPage( 'http://www.rai.tv/dl/RaiTV/programmi/json/liste/' + contentId + '-json-V-' + str(page) + '.html') cache.saveFileCache(contentId + '-' + str(page) + '.txt', videoPage) videoJSON = json.loads(videoPage) return videoJSON
def showsEpisodeList(contentId,page): ''' Returns the list of episodes of the chosen show''' videoPage = cache.getFileCache(contentId + '-' + str(page) + '.txt', 56700) if videoPage == None: videoPage = http.getPage('http://www.rai.tv/dl/RaiTV/programmi/json/liste/' + contentId + '-json-V-' + str(page) + '.html') cache.saveFileCache(contentId + '-' + str(page) + '.txt',videoPage) videoJSON = json.loads(videoPage) return videoJSON
def showVideoCategories(showUrl): ''' Returns the list of video categories as tuple, with their contentSet, available for the show chosen''' global base_url showPage = http.getPage(base_url + showUrl) match = re.compile('<li class="Video ">\n(.+?)\n</li>').findall(showPage) result = [] for line in match: category = re.compile('<a.+?id="(.+?)".+?>(.+?)</a>').findall(line) if category: result += category return result
def showVideoCategories(showUrl): ''' Returns the list of video categories as tuple, with their contentSet, available for the show chosen''' global base_url showPage = http.getPage(base_url + showUrl) match=re.compile('<li class="Video ">\n(.+?)\n</li>').findall(showPage) result = [] for line in match: category = re.compile('<a.+?id="(.+?)".+?>(.+?)</a>').findall(line) if category: result += category return result
def showsWithLetterReq(letter): ''' Returns the list of shows starting with the letter passed in JSON format''' index = cache.getFileCache('showsIndex.txt',56700) # 56700 means that the cache file must be younger than 12 hours if index == None: index = http.getPage('http://www.rai.tv/dl/RaiTV/programmi/ricerca/ContentSet-6445de64-d321-476c-a890-ae4ed32c729e-darivedere.html') cache.saveFileCache('showsIndex.txt',index) indexList = json.loads(index) filteredList = [] for elem in indexList: if elem['title'].startswith(letter) or (letter[0].isdigit() and elem['title'][0].isdigit()): filteredList.append(elem) return filteredList
def showsWithLetterReq(letter): ''' Returns the list of shows starting with the letter passed in JSON format''' index = cache.getFileCache( 'showsIndex.txt', 56700) # 56700 means that the cache file must be younger than 12 hours if index == None: index = http.getPage( 'http://www.rai.tv/dl/RaiTV/programmi/ricerca/ContentSet-6445de64-d321-476c-a890-ae4ed32c729e-darivedere.html' ) cache.saveFileCache('showsIndex.txt', index) indexList = json.loads(index) filteredList = [] for elem in indexList: if elem['title'].startswith(letter) or (letter[0].isdigit() and elem['title'][0].isdigit()): filteredList.append(elem) return filteredList