def GetEpisodes(text): #raw_unicode_escape = False #match = []#re.compile(u'<main id="main"(.*?)</main>', re.S).findall(text) #if len(match) < 1: match = re.compile(u'pageGlobals.*?"id":(.*?),').findall(text) link = 'https://sport1.maariv.co.il/wp-json/sport1/v1/league/{0}/video/content?is_mobile=false&rows=800'.format(match[0]) text = common.OpenURL(link) match[0] = text.replace('\\"', '"').replace('\/', '/') #raw_unicode_escape = True match = re.compile(u'<div class="video-card(.*?)</a>', re.S).findall(match[0]) for item in match: m = re.compile("<a href=['\"](.*?)['\"].*?<img(.*?)>.*?<h3.*?>(.*?)</h3>", re.S).findall(item) if len(m) < 1: continue url, icon, name = m[0] m = re.compile(u'data-lazy="(.*?)"', re.S).findall(icon) if len(m) < 1: m = re.compile(u'src=["\'](.*?)["\']', re.S).findall(icon) icon = m[0] #if raw_unicode_escape: name = common.decode(name, 'raw_unicode_escape', force=True) url = common.decode(url, 'raw_unicode_escape', force=True) icon = common.decode(icon, 'raw_unicode_escape', force=True) name = common.GetLabelColor(common.UnEscapeXML(name.strip()), keyColor="chColor", bold=True) try: common.addDir(name, url.replace(baseUrl, ''), 4, icon, infos={"Title": name}, contextMenu=[(common.GetLocaleString(30005), 'RunPlugin({0}?url={1}&name={2}&mode=4&iconimage={3}&moredata=choose&module={4})'.format(sys.argv[0], common.quote_plus(url), name, common.quote_plus(icon), module)), (common.GetLocaleString(30023), 'RunPlugin({0}?url={1}&name={2}&mode=4&iconimage={3}&moredata=set_{4}_res&module={4})'.format(sys.argv[0], common.quote_plus(url), name, common.quote_plus(icon), module))], module=module, moreData=bitrate, isFolder=False, isPlayable=True) except Exception as ex: xbmc.log(str(ex), 3)
def GetSeriesList(iconimage): text = common.OpenURL( 'https://www.20il.co.il/tochniot_haarutz/%d7%97%d7%93%d7%a9%d7%95%d7%aa-%d7%a2%d7%a8%d7%95%d7%a5-20/' ) match = re.compile('<div class="tochniot-in-use-images(.*?)</div>', re.S).findall(text) match = re.compile('<a href="(.*?)".*?<img src="\s*(.*?)"', re.S).findall(match[0]) grids_arr = [] for link, iconimage in match: iconimage = GetQuoteUrl(iconimage) name = common.unquote( common.encode(link[link.rfind('/') + 1:], 'utf-8')) name = common.GetLabelColor(common.UnEscapeXML(name.replace('-', ' ')), keyColor="prColor", bold=True) if iconimage.startswith('http') == False: iconimage = '{0}{1}'.format(baseUrl, iconimage) grids_arr.append((name, '{0}{1}'.format(baseUrl, link), iconimage, { "Title": name })) grids_sorted = grids_arr if sortBy == 0 else sorted( grids_arr, key=lambda grids_arr: grids_arr[0]) for name, link, image, infos in grids_sorted: common.addDir(name, link, 1, common.encode(image, 'utf-8'), infos=infos, module=module)
def GetNewsCategoriesList(iconimage): url = 'https://13news.co.il/programs/' result = GetUrlJson(url) if len(result) < 1: return grids_arr = [] mainMenus = result.get('Header', {}).get('mainMenu', []) for mainMenu in mainMenus: if mainMenu['url'] == url: grids = mainMenu['children'] for grid in grids: name = common.GetLabelColor(common.UnEscapeXML(common.encode(grid['title'], 'utf-8')), keyColor="prColor", bold=True) link = grid['url'] grids_arr.append((name, link, iconimage, {"Title": name})) grids_sorted = grids_arr if sortBy == 0 else sorted(grids_arr,key=lambda grids_arr: grids_arr[0]) for name, link, icon, infos in grids_sorted: common.addDir(name, link, 1, icon, infos=infos, module=module)
def GetSeriesList(iconimage): text = common.OpenURL('https://www.oles.tv/891fm/shows/') series = re.compile( 'class="media-left"><a href="(.*?)" class="pic link"><img class="media-object" src="(.*?)" alt="Programme: (.*?)"(.*?)<div class="tools">' ).findall(text) for link, iconimage, name, desc in series: name = common.GetLabelColor(common.UnEscapeXML(name), keyColor="prColor", bold=True) match = re.compile('p class="text">(.*?)<a').findall(desc) desc = common.GetLabelColor( match[0], keyColor="chColor") if len(match) > 0 else '' common.addDir(name, link, 1, iconimage, infos={ "Plot": desc, "Title": name }, module=module)
def Search(url, iconimage): search_entered = common.GetKeyboardText('מילים לחיפוש', '') if search_entered != '': url = url.format(search_entered.replace(' ', '%20')) params = GetJson(url) suggestions = params["suggestions"] data = params["data"] for i in range(len(suggestions)): if "mako-vod-channel2-news" in data[i]: continue url = "{0}{1}".format(baseUrl, data[i]) name = common.UnEscapeXML(common.encode(suggestions[i], "utf-8")) infos = {"Title": name, "Plot": name} if "VOD-" in data[i]: name = common.GetLabelColor(name, keyColor="chColor") common.addDir( name, url, 5, iconimage, infos, contextMenu=[(common.GetLocaleString( 30005 ), 'RunPlugin({0}?url={1}&name={2}&mode=5&iconimage={3}&moredata=choose&module=keshet)' .format(sys.argv[0], common.quote_plus(url), common.quote_plus(name), common.quote_plus(iconimage)))], moreData=bitrate, module='keshet', isFolder=False, isPlayable=True) else: name = common.GetLabelColor(name, keyColor="prColor", bold=True) common.addDir(name, url, 2, iconimage, infos, module=module) else: return
def GetEpisodesList(url, image): bitrate = Addon.getSetting('twenty_res') if bitrate == '': bitrate = 'best' text = common.OpenURL(url) episodes = re.compile( '<div class="katan-unit(.*?)</div>\s*</div>\s*</div>', re.S).findall(text) for episode in episodes: match = re.compile( 'data-videoid="(.*?)".*?src="(.*?)".*?<div class="the-title">(.*?)</div>', re.S).findall(episode) for videoid, iconimage, name in match: name = common.GetLabelColor(common.UnEscapeXML(name.strip()), keyColor="chColor") iconimage = GetQuoteUrl(iconimage) link = 'https://cdn.ch20-cdnwiz.com/ch20/player.php?clipid={0}&autoplay=true&automute=false'.format( videoid.strip()) common.addDir( name, link, 2, iconimage, infos={"Title": name}, contextMenu= [(common.GetLocaleString(30005), 'RunPlugin({0}?url={1}&name={2}&mode=2&iconimage={3}&moredata=choose&module={4})' .format(sys.argv[0], common.quote_plus(link), name, common.quote_plus(iconimage), module)), (common.GetLocaleString(30023), 'RunPlugin({0}?url={1}&name={2}&mode=2&iconimage={3}&moredata=set_twenty_res&module={4})' .format(sys.argv[0], common.quote_plus(link), name, common.quote_plus(iconimage), module))], module=module, moreData=bitrate, isFolder=False, isPlayable=True)
def GetEpisodesList(url, programName, image): programName = common.GetLabelColor(programName, keyColor="prColor") text = common.OpenURL(url) match = re.compile('class="day">(.*?)class="tools"').findall(text) episodes = re.compile('<a href="(.*?)".*?</i>\s*(.*?)</a>').findall( match[0]) name = common.GetLabelColor(programName, keyColor="prColor") common.addDir(name, '', 99, image, infos={ "Title": name, "Plot": name }, module=module, isFolder=False) grids_arr = [] for link, name in episodes: grids_arr.append((name, link)) grids_sorted = sorted(grids_arr, key=lambda grids_arr: grids_arr[0], reverse=True) for name, link in grids_sorted: name = common.GetLabelColor(common.UnEscapeXML(name), keyColor="chColor") common.addDir(name, link, 2, image, infos={ "Title": name, "Plot": programName }, module=module, isFolder=False, isPlayable=True)
def GetPodcatsList(iconimage, page='1'): page = int(page) url = '{0}/podcasts?category=&person=&show=&order=updated--dn&page={{0}}'.format( baseUrl) xbmc.log(url.format(page), 5) text = common.OpenURL(url.format(page), headers=headers) podcasts, pagination = re.compile( 'container container--big(.*?)class="pagination">(.*?)</section>', re.S).findall(text)[0] podcasts = re.compile( '<a href="(.*?)".*?data-src="(.*?)".*?podcastCard__title">(.*?)</div>.*?podcastCard__description">(.*?)</div>', re.S).findall(podcasts) for link, icon, name, desc in podcasts: name = common.GetLabelColor(common.UnEscapeXML(name), keyColor="prColor", bold=True) desc = common.GetLabelColor(desc, keyColor="chColor") common.addDir(name, '{0}{1}'.format(baseUrl, link), 2, icon, infos={ "Plot": desc, "Title": name }, module=module, isFolder=False, isPlayable=True) pagination = re.compile('href=.*?page=(.*?)"', re.S).findall(pagination) pages = page for p in pagination: if int(p) > pages: pages = int(p) if page > 1: name = common.GetLabelColor(common.GetLocaleString(30011), color="green") common.addDir(name, str(page - 1), 0, iconimage, infos={ "Title": name, "Plot": name }, module=module) if pages > page: name = common.GetLabelColor(common.GetLocaleString(30012), color="green") common.addDir(name, str(page + 1), 0, iconimage, infos={ "Title": name, "Plot": name }, module=module) if pages > 1: name = common.GetLabelColor(common.GetLocaleString(30013), color="green") common.addDir(name, 'p={0}&pages={1}'.format(page, pages), 1, iconimage, infos={ "Title": name, "Plot": name }, module=module)
def GetEpisodesList(url, progName=''): text = common.OpenURL(url) pagination = re.compile('pagination\(\d*?, (\d*?)\);', re.S).findall(text) pages = 1 if len(pagination) < 1 else int(pagination[0]) i = url.find('program/') if i < 1: i = url.find('programs/') j = url.find('/', i + 9) else: j = url.find('/', i + 8) if j > 0: page = int(url[j + 1:]) _url = url[:j + 1] else: page = 1 _url = '{0}/'.format(url) firtepisode = re.compile( 'poster: \'(.*?)\',.*?<div>(.*?)</div>.*?<div class="share_group".*?href="(.*?)"', re.S).findall(text) for image, name, link in firtepisode: name = common.GetLabelColor(common.UnEscapeXML(name), keyColor="chColor") common.addDir(name, 'http://{0}'.format(link), 2, '{0}{1}'.format(baseUrl, image), infos={ "Title": name, "Plot": progName }, module=module, isFolder=False, isPlayable=True) episodes = re.compile('<li class=".*?program">(.*?)</li>', re.S).findall(text) for episode in episodes: matches = re.compile( 'href="(.*?)".*?src="(.*?)".*?program_item_date">(.*?)</', re.S).findall(episode) for link, image, name in matches: name = common.GetLabelColor(common.UnEscapeXML(name), keyColor="chColor") common.addDir(name, '{0}{1}'.format(baseUrl, link), 2, '{0}{1}'.format(baseUrl, image), infos={ "Title": name, "Plot": progName }, module=module, isFolder=False, isPlayable=True) if page > 1: name = common.GetLabelColor(common.GetLocaleString(30011), color="green") common.addDir(name, '{0}{1}'.format(_url, page - 1), 1, image, infos={ "Title": name, "Plot": name }, module=module) if pages > page: name = common.GetLabelColor(common.GetLocaleString(30012), color="green") common.addDir(name, '{0}{1}'.format(_url, page + 1), 1, image, infos={ "Title": name, "Plot": name }, module=module) if pages > 1: name = common.GetLabelColor(common.GetLocaleString(30013), color="green") common.addDir(name, '{0}?p={1}&pages={2}'.format(_url, page, pages), 3, image, infos={ "Title": name, "Plot": name }, module=module)