def keyMenu(self): printDBG(">> PlayerSelectorWidget.keyMenu") options = [] selItem = self.getSelectedItem() if self.groupObj != None and selItem != None and len( self.groupObj.getGroupsWithoutHost(selItem[1])): options.append( (_("Add host %s to group") % selItem[0], "ADD_HOST_TO_GROUP")) if not self.reorderingMode and self.numOfItems - self.numOfLockedItems > 0: options.append( (_("Enable reordering mode"), "CHANGE_REORDERING_MODE")) elif self.reorderingMode: options.append( (_("Disable reordering mode"), "CHANGE_REORDERING_MODE")) options.append((_("IPTV download manager"), "IPTVDM")) if self.groupName in ['selecthost', 'all']: options.append((_("Disable/Enable services"), "config_hosts")) if self.groupName in ['selectgroup']: options.append((_("Disable/Enable groups"), "config_groups")) if self.groupName == 'selecthost': pass elif self.groupName == 'selectgroup': if selItem[1] not in ['update', 'config', 'all']: options.append((_('Hide "%s" group') % selItem[0], "DEL_ITEM")) elif self.groupName not in ['all']: options.append((_('Remove "%s" item') % selItem[0], "DEL_ITEM")) if len(options): self.session.openWithCallback(self.selectMenuCallback, ChoiceBox, title=_("Select option"), list=options)
def keyMenu(self): options = [] if not self.reorderingEnabled: options.append((_("Enable reordering mode"), "REORDERING_ENABLED")) else: options.append( (_("Disable reordering mode"), "REORDERING_DISABLED")) self.session.openWithCallback(self._changeMode, ChoiceBox, title=_("Select option"), list=options)
def getVideoLinks(self, videoUrl): printDBG("SerienStreamTo.getVideoLinks [%s]" % videoUrl) urlTab = [] videoUrl = strwithmeta(videoUrl) key = videoUrl.meta.get('base_url', '') if key != '' and key in self.cacheLinks: for idx in range(len(self.cacheLinks[key])): if self.cacheLinks[key][idx]['url'] == videoUrl: if not self.cacheLinks[key][idx]['name'].startswith('*'): self.cacheLinks[key][idx][ 'name'] = '*' + self.cacheLinks[key][idx]['name'] if self.cm.isValidUrl(videoUrl): if 1 != self.up.checkHostSupport(videoUrl): params = dict(self.defaultParams) try: params['return_data'] = False params['no_redirection'] = True tries = 0 tmpUrl = videoUrl while tries < 3: sts, response = self.getPage(videoUrl, params) printDBG("+++++++++++") printDBG(response.info()) printDBG("+++++++++++") url = '' for key in response.info(): if key.upper() == 'LOCATION': url = response.info()[key] response.close() if not self.cm.isValidUrl(url): break videoUrl = url tries += 1 except Exception: printExc() if 1 != self.up.checkHostSupport(videoUrl): sts, data = self.getPage(videoUrl) if sts and 'google.com/recaptcha/' in data and 'sitekey' in data: message = _('Link protected with google recaptcha v2.') if True != self.loggedIn: message += '\n' + _( 'Please fill your login and password in the host configuration (available under blue button) and try again.' ) else: message += '\n' + self.cleanHtmlStr( self.cm.ph.getDataBeetwenMarkers( data, '<small', '</small>')[1]) message += '\n' + _('Please retry later.') SetIPTVPlayerLastHostError(message) urlTab = self.up.getVideoLinkExt(videoUrl) return urlTab
def getList(self, cItem): printDBG("LivetvhdNetApi.getChannelsList") channelsTab = [] try: initList = cItem.get('init_list', True) if initList: rm(self.COOKIE_FILE) params = dict(cItem) params.update({ 'init_list': False, 'url': 'https://livetvhd.net/api/videos', 'title': _('--All--') }) channelsTab.append(params) sts, data = self.cm.getPage( 'https://livetvhd.net/api/categories') if not sts: return [] data = byteify(json.loads(data)) for item in data: params = dict(cItem) params.update({ 'init_list': False, 'url': 'https://livetvhd.net/api/videos/category/' + item['seo_name'], 'title': self.cleanHtmlStr(item['name']) }) channelsTab.append(params) else: sts, data = self.cm.getPage(cItem['url']) if not sts: return [] data = byteify(json.loads(data)) if 'videos' in data: data = data['videos'] for item in data: url = item['url'] icon = item['thumbnail'] title = self.cleanHtmlStr(item['title']) desc = _('Views: ') + str(item.get('views', '')) params = dict(cItem) params.update({ 'type': 'video', 'title': title, 'url': url, 'desc': desc, 'icon': self.getFullIconUrl(icon) }) channelsTab.append(params) except Exception: printExc() return channelsTab
def _validate(self, text): if 0 == len(text): return False, _("Name cannot be empty.") elif not IsValidFileName(text): return False, _( "Name is not valid.\nPlease remove special characters.") else: group_id = text.lower() idx = self.favourites._getGroupIdx(group_id) if -1 != idx: return False, _("Group \"%s\" already exists.") % group_id return True, ""
def startDownload(self, item): self.setListMode(False) self.cleanDownloader() self.currItem = item self["console"].setText(_("Downloading subtitles.\n ('%r').") % self.currItem.get('url', '')) # create downloader self.downloader = DownloaderCreator(self.currItem.get('url', '')) if self.downloader: self.downloader.isWorkingCorrectly(self._startDownloader) else: self["console"].setText(_("Download can not be started.\n Incorrect address ('%r')."))
def GetConfigList(): optionList = [] optionList.append( getConfigListEntry(_("Use proxy server:"), config.plugins.iptvplayer.planetstreaming_proxy)) if config.plugins.iptvplayer.planetstreaming_proxy.value == 'None': optionList.append( getConfigListEntry( _("Alternative domain:"), config.plugins.iptvplayer.planetstreaming_alt_domain)) return optionList
def GetConfigList(): optionList = [] optionList.append( getConfigListEntry( _("login") + ":", config.plugins.iptvplayer.kinopodaniolempl_login)) optionList.append( getConfigListEntry( _("password") + ":", config.plugins.iptvplayer.kinopodaniolempl_password)) return optionList
def listType(self, cItem): printDBG("PlayRTSIW.listType") self.setMainUrl(cItem['url']) self.DEFAULT_ICON_URL = cItem['icon'] for item in [('tv', _('TV')), ('radio', _('Radio'))]: params = dict(cItem) params.update({'f_type':item[0], 'title':item[1], 'desc':self.getFullUrl('/play/' + item[0])}) if item[0] == 'tv': params.update({'category':'portal'}) else: params.update({'category':'radio_channels'}) self.addDir(params)
def getPage(self, url, params={}, post_data=None): if params == {}: params = dict(self.defaultParams) sts, data = self.cm.getPage(url, params, post_data) if sts and data.meta.get('status_code', 0) in [410, 404] and 'captcha' in data: errorMsg = [_('Link protected with google recaptcha v2.')] errorMsg.append(_("Please visit \"%s\" and confirm that you are human." % self.getMainUrl())) if not self.loggedIn: errorMsg.append(_('Please register and set login and password in the host configuration, to solve this problems permanently.')) errorMsg = '\n'.join(errorMsg) GetIPTVNotify().push(errorMsg, 'info', 10) SetIPTVPlayerLastHostError(errorMsg) return sts, data
def __init__(self, session, downloadmanager): self.session = session Screen.__init__(self, session) self.currentService = self.session.nav.getCurrentlyPlayingServiceReference() self.session.nav.event.append(self.__event) self["key_red"] = StaticText(_("Stop")) self["key_green"] = StaticText(_("Start")) self["key_yellow"] = StaticText(_("Archive")) self["key_blue"] = StaticText(_("Downloads")) self["list"] = IPTVDownloadManagerList() self["list"].connectSelChanged(self.onSelectionChanged) self["actions"] = ActionMap(["WizardActions", "DirectionActions", "ColorActions"], { "ok": self.ok_pressed, "back": self.back_pressed, "red": self.red_pressed, "green": self.green_pressed, "yellow": self.yellow_pressed, "blue": self.blue_pressed, }, -1) self["titel"] = Label() self.DM = downloadmanager self.DM.connectListChanged(self.onListChanged) self.DM.setUpdateProgress(True) self.setManagerStatus() self.started = 0 global gIPTVDM_listChanged gIPTVDM_listChanged = True self.onClose.append(self.__onClose) self.onShow.append(self.onStart) #main Timer to refresh liar self.mainTimer = eTimer() self.mainTimer_conn = eConnectCallback(self.mainTimer.timeout, self.reloadList) # every 500ms Proxy Queue will be checked self.mainTimer.start(500) self.localMode = False self.localFiles = [] self.console = eConsoleAppContainer() self.console_appClosed_conn = eConnectCallback(self.console.appClosed, self.refreshFinished) self.console_stderrAvail_conn = eConnectCallback(self.console.stderrAvail, self.refreshNewData) self.underRefreshing = False self.iptvclosing = False self.currList = []
def __init__(self): CBaseHostClass.__init__( self, { 'history': 'mozicsillag.cc', 'cookie': 'mozicsillag.cc.cookie', 'cookie_type': 'MozillaCookieJar', 'min_py_ver': (2, 7, 9) }) self.USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0' self.HEADER = { 'User-Agent': self.USER_AGENT, 'DNT': '1', 'Accept': 'text/html' } self.AJAX_HEADER = dict(self.HEADER) self.AJAX_HEADER.update({'X-Requested-With': 'XMLHttpRequest'}) self.MAIN_URL = 'https://mozicsillag.me/' self.DEFAULT_ICON_URL = strwithmeta( 'https://mozicsillag.me/img/logo.png', {'Referer': self.getMainUrl()}) self.cacheLinks = {} self.cacheFilters = {} self.cacheFiltersKeys = [] self.cacheSortOrder = [] self.defaultParams = { 'header': self.HEADER, 'with_metadata': True, 'use_cookie': True, 'load_cookie': True, 'save_cookie': True, 'cookiefile': self.COOKIE_FILE } self.MAIN_CAT_TAB = [{ 'category': 'list_filters', 'title': _('Catalog'), 'url': self.getMainUrl(), 'use_query': True }, { 'category': 'list_movies', 'title': _('Movies'), 'url': self.getMainUrl() }, { 'category': 'list_series', 'title': _('Series'), 'url': self.getMainUrl() }, { 'category': 'search', 'title': _('Search'), 'search_item': True, }, { 'category': 'search_history', 'title': _('Search history'), }]
def tryTologin(self): printDBG('tryTologin start') if self.login == config.plugins.iptvplayer.kinomanco_login.value and \ self.password == config.plugins.iptvplayer.kinomanco_password.value: return self.login = config.plugins.iptvplayer.kinomanco_login.value self.password = config.plugins.iptvplayer.kinomanco_password.value self.defaultParams['header'].pop('x-user-token', None) self.logginInfo = '' self.isVip = False if '' == self.login.strip() or '' == self.password.strip(): printDBG('tryTologin wrong login data') self.loggedIn = None return url = self.getFullUrl('/api/user/login', 'api') post_data = '{"password":"******","login":"******"}' % (self.password, self.login) httpParams = dict(self.defaultParams) httpParams.update({'raw_post_data':True, 'ignore_http_code_ranges':[(401,401)]}) httpParams['header'] = dict(httpParams['header']) httpParams['header']['Content-Type'] = 'application/json; charset=UTF-8' sts, data = self.getPage(url, httpParams, post_data) printDBG(data) if sts: try: data = byteify(json.loads(data), '', True) if not isinstance(data, str): self.defaultParams['header']['x-user-token'] = data['token'] self.loggedIn = True logginInfo = [] logginInfo.append(self._('Points') + '\t' + data['points']) logginInfo.append(self._('Vip valid') + '\t' + data['vip_valid']) logginInfo.append(self._('Vip level') + '\t' + data['vip_level']) self.logginInfo = '[/br]'.join(logginInfo) if data['vip_valid'] != '' and data['vip_level'] > 0: self.isVip = True return else: msg = data except Exception: msg = _('Unknown server response.') printExc() else: msg = _('Network connection failed.') self.sessionEx.open(MessageBox, _('Login failed.') + '\n' + (_('Error message "%s".') % msg), type = MessageBox.TYPE_ERROR, timeout = 10) printDBG('tryTologin failed') self.loggedIn = False
def listSeries(self, cItem): printDBG("Gledalica.listSeries [%s]" % cItem) self.addDir({ 'category': 'a_z', 'url': cItem['url'], 'title': _('A-Z') }) self.addDir({ 'category': 'sort', 'url': cItem['url'], 'title': _('Episodes') })
def GetConfigList(): optionList = [] optionList.append( getConfigListEntry(_("Używaj danych z pamięci podręcznej:"), config.plugins.iptvplayer.iplacachexml)) optionList.append( getConfigListEntry(_("Domyślny format video:"), config.plugins.iptvplayer.iplaDefaultformat)) optionList.append( getConfigListEntry(_("Używaj domyślnego format video:"), config.plugins.iptvplayer.iplaUseDF)) return optionList
def GetConfigList(): optionList = [] optionList.append( getConfigListEntry(_("Default video quality:"), config.plugins.iptvplayer.vevo_default_quality)) optionList.append( getConfigListEntry(_("Use default video quality:"), config.plugins.iptvplayer.vevo_use_default_quality)) optionList.append( getConfigListEntry(_("Allow hls format"), config.plugins.iptvplayer.vevo_allow_hls)) return optionList
def __init__(self): CBaseHostClass.__init__(self, {'history':'dokumentalne.net', 'cookie':'dokumentalne.net.cookie', 'cookie_type':'MozillaCookieJar', 'min_py_ver':(2,7,9)}) self.DEFAULT_ICON_URL = 'https://dokumentalne.net/wp-content/uploads/2016/11/dokumentalne_logo_1.png' self.USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0' self.MAIN_URL = 'https://dokumentalne.net/' self.HTTP_HEADER = {'User-Agent': self.USER_AGENT, 'DNT':'1', 'Accept': 'text/html', 'Accept-Encoding':'gzip, deflate', 'Referer':self.getMainUrl(), 'Origin':self.getMainUrl()} self.defaultParams = {'header':self.HTTP_HEADER, 'use_cookie': True, 'load_cookie': True, 'save_cookie': True, 'cookiefile': self.COOKIE_FILE} self.MAIN_CAT_TAB = [{'category':'list_categories', 'title': 'Kategorie', 'url':self.getMainUrl()}, {'category':'search', 'title': _('Search'), 'search_item':True}, {'category':'search_history', 'title': _('Search history')}, ]
def listSeasons(self, cItem, nextCategory): printDBG("GamatoMovies.listSeasons") sts, data = self.cm.getPage(cItem['url']) if not sts: return data = self.cm.ph.getDataBeetwenMarkers(data, 'vars.title =', '};', False)[1].strip() + '}' try: trailerUrl = self.cm.ph.getSearchGroups( data, '''"trailer"\s*:\s*(['"]http[^'^"]+?['"])''')[0] trailerUrl = byteify(json.loads(trailerUrl)) if self.cm.isValidUrl(trailerUrl): params = dict(cItem) params.update({ 'good_for_fav': True, 'title': cItem['title'] + ' - ' + _('trailer'), 'priv_type': 'trailer', 'url': trailerUrl }) self.addVideo(params) except Exception: printExc() try: data = byteify(json.loads(data)) for item in data['season']: title = self.getStr(item, 'title') if '' == title: title = _('Season {0}'.format(item['number'])) url = self.getFullUrl(cItem['url'] + '/seasons/' + str(item['number'])) overview = self.getStr(item, 'overview') if overview == '': desc = cItem['desc'] else: desc = '{0}[/br]{1}'.format( self.getStr(item, 'release_date'), overview) params = { 'good_for_fav': True, 'category': nextCategory, 'priv_type': cItem['priv_type'], 'title': title, 'url': url, 'priv_stitle': cItem['title'], 'priv_snum': self.getStr(item, 'number'), 'priv_id': self.getStr(item, 'id'), 'icon': self.getStr(item, 'poster'), 'desc': desc } self.addDir(params) except Exception: printExc()
def handleService(self, index, refresh=0, searchPattern='', searchType=''): printDBG('handleService start') CBaseHostClass.handleService(self, index, refresh, searchPattern, searchType) name = self.currItem.get("name", '') category = self.currItem.get("category", '') mode = self.currItem.get("mode", '') printDBG( "handleService: |||||||||||||||||||||||||||||||||||| name[%s], category[%s] " % (name, category)) self.currList = [] #MAIN MENU if name == None: login = config.plugins.iptvplayer.streamliveto_login.value passwd = config.plugins.iptvplayer.streamliveto_password.value logged = False if '' != login.strip() and '' != passwd.strip(): logged = self.doLogin(login, passwd) if not logged: self.sessionEx.open(MessageBox, _('Login failed.'), type=MessageBox.TYPE_INFO, timeout=10) self.listsTab(self.MAIN_CAT_TAB, {'name': 'category'}) #if logged: # self.addDir({'name':'category', 'title':_('Get free credits'), 'category':'get_free_credits'}) elif category == 'get_free_credits': self.listGetFreeCredits() elif category == 'list_filters': self.listFilters(self.currItem, 'list_channels') elif category == 'list_channels': self.listChannels(self.currItem) #SEARCH elif category in ["search", "search_next_page"]: cItem = dict(self.currItem) cItem.update({'search_item': False, 'name': 'category'}) self.listSearchResult(cItem, searchPattern, searchType) #HISTORIA SEARCH elif category == "search_history": self.listsHistory({ 'name': 'history', 'category': 'search' }, 'desc', _("Type: ")) else: printExc() CBaseHostClass.endHandleService(self, index, refresh)
def __init__(self): printDBG("TvGryPL.__init__") CBaseHostClass.__init__( self, { 'history': 'TvGryPL.tv', 'cookie': 'grypl.cookie', 'cookie_type': 'MozillaCookieJar', 'min_py_ver': (2, 7, 9) }) self.USER_AGENT = 'User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0' self.HEADER = { 'User-Agent': self.USER_AGENT, 'DNT': '1', 'Accept': 'text/html' } self.AJAX_HEADER = dict(self.HEADER) self.AJAX_HEADER.update({'X-Requested-With': 'XMLHttpRequest'}) self.defaultParams = { 'header': self.HEADER, 'use_cookie': True, 'load_cookie': True, 'save_cookie': True, 'cookiefile': self.COOKIE_FILE } self.DEFAULT_ICON_URL = 'http://www.gry-online.pl/apple-touch-icon-120x120.png' self.MAIN_URL = 'https://tvgry.pl/' self.SEARCH_URL = self.getFullUrl('wyszukiwanie.asp') self.MAIN_CAT_TAB = [{ 'category': 'list_tabs', 'title': 'Materiały', 'url': self.getFullUrl('/wideo-tvgry.asp') }, { 'category': 'list_items', 'title': 'Tematy', 'url': self.getFullUrl('/tematy.asp') }, { 'category': 'list_tabs', 'title': 'Zwiastuny gier', 'url': self.getFullUrl('/trailery-z-gier.asp') }, { 'category': 'list_tabs', 'title': 'Zwiastuny filmów', 'url': self.getFullUrl('/trailery-filmowe.asp') }, { 'category': 'search', 'title': _('Search'), 'search_item': True }, { 'category': 'search_history', 'title': _('Search history') }]
def listLiveGuideMenu(self, cItem, nextCategory): printDBG("BBCSport.listLiveGuideMenu") self.liveGuideItemsCache = {} sts, data = self.getPage(cItem['url']) if not sts: return mediaDataTab = [] mediaData = '' tmp = self.cm.ph.getAllItemsBeetwenMarkers(data, '.setPayload(', '</script>', False) for item in tmp: if '"promoted"' in item: mediaData = item break mediaData = self.cm.ph.getDataBeetwenMarkers(mediaData, '"body":{', '});', False)[1].strip()[:-1] try: mediaData = byteify(json.loads('{%s}' % mediaData), '', True) for item in [{ 'key': 'promoted', 'title': _('Promoted') }, { 'key': 'live', 'title': _('Live') }, { 'key': 'coming_up', 'title': _('Coming up') }, { 'key': 'catch_up', 'title': _('Catch up') }]: try: if isinstance(mediaData[item['key']], list) and len( mediaData[item['key']]): self.liveGuideItemsCache[item['key']] = mediaData[ item['key']] params = dict(cItem) params.update({ 'good_for_fav': False, 'category': nextCategory, 'title': item['title'], 'f_key': item['key'] }) self.addDir(params) except Exception: printExc() except Exception: printExc()
def listsMainMenu(self): printDBG("Playpuls.listsMainMenu") sts, data = self.cm.getPage(self.getMainUrl()) if sts: menuData = self.cm.ph.getDataBeetwenMarkers(data, '<div id="navigation">', '</div>', False)[1] menuData = re.compile('<li class="menu__item menu-[0-9]+? menuparent[^"]*?"><a href="[/]*?([^"]+?)" title="([^"]+?)" class="menu__link">([^<]+?)</a>').findall(menuData) for item in menuData: if item[1] in 'Filmy': continue params = {'name':'category', 'title':item[1], 'category':'menu', 'url':self.getFullUrl(item[0]), 'icon':self.DEFAULT_ICON_URL} self.addDir(params) # self.addDir({'name':'category', 'title':_('Search'), 'category':'search', 'search_item':True}) self.addDir({'name':'category', 'title':_('Search history'), 'category':'search_history'})
def listMainMenu(self, cItem, nextCategory1, nextCategory2): printDBG("PlayRTSIW.listMainMenu") for portal in ['rtr', 'rsi', 'srf', 'rts', 'swi']: params = dict(cItem) params.update(self.PORTALS_MAP[portal]) params.update({'portal':portal, 'desc':params['url']}) if portal == 'swi': params.update({'f_type':'tv', 'category':nextCategory2}) else: params.update({'category':nextCategory1}) self.addDir(params) MAIN_CAT_TAB = [{'category':'search', 'title': _('Search'), 'search_item':True, 'icon':self.SEARCH_ICON_URL}, {'category':'search_history', 'title': _('Search history'), 'icon':self.SEARCH_ICON_URL}] self.listsTab(MAIN_CAT_TAB, cItem)
def __init__(self): CBaseHostClass.__init__( self, { 'history': 'movierulz.sx', 'cookie': 'movierulz.sx.cookie', 'cookie_type': 'MozillaCookieJar' }) self.USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0' self.MAIN_URL = 'https://movierulz.be/' self.DEFAULT_ICON_URL = 'https://superrepo.org/static/images/icons/original/xplugin.video.movierulz.png.pagespeed.ic.em3U-ZIgpV.png' self.HTTP_HEADER = { 'User-Agent': self.USER_AGENT, 'DNT': '1', 'Accept': 'text/html', 'Accept-Encoding': 'gzip, deflate', 'Referer': self.getMainUrl(), 'Origin': self.getMainUrl() } self.AJAX_HEADER = dict(self.HTTP_HEADER) self.AJAX_HEADER.update({ 'X-Requested-With': 'XMLHttpRequest', 'Accept-Encoding': 'gzip, deflate', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Accept': 'application/json, text/javascript, */*; q=0.01' }) self.cacheLinks = {} self.defaultParams = { 'header': self.HTTP_HEADER, 'use_cookie': True, 'load_cookie': True, 'save_cookie': True, 'cookiefile': self.COOKIE_FILE } self.MAIN_CAT_TAB = [ { 'category': 'search', 'title': _('Search'), 'search_item': True }, { 'category': 'search_history', 'title': _('Search history') }, ] self.cacheGenresSections = []
def __init__(self): CBaseHostClass.__init__( self, { 'history': 'cine.to', 'cookie': 'cine.to.cookie', 'cookie_type': 'MozillaCookieJar', 'min_py_ver': (2, 7, 9) }) self.DEFAULT_ICON_URL = 'https://cine.to/opengraph.jpg' self.USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0' self.MAIN_URL = 'https://cine.to/' self.HEADER = { 'User-Agent': self.USER_AGENT, 'DNT': '1', 'Accept': 'text/html', 'Accept-Encoding': 'gzip, deflate', 'Referer': self.getMainUrl(), 'Origin': self.getMainUrl() } self.AJAX_HEADER = dict(self.HEADER) self.AJAX_HEADER.update({ 'X-Requested-With': 'XMLHttpRequest', 'Accept-Encoding': 'gzip, deflate', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Accept': 'application/json, text/javascript, */*; q=0.01' }) self.cacheFilters = {} self.cacheLinks = {} self.defaultParams = { 'with_metadata': True, 'header': self.HEADER, 'raw_post_data': True, 'use_cookie': True, 'load_cookie': True, 'save_cookie': True, 'cookiefile': self.COOKIE_FILE } self.MAIN_CAT_TAB = [{ 'category': 'search', 'title': _('Search'), 'search_item': True, }, { 'category': 'search_history', 'title': _('Search history'), }]
def __init__(self): CBaseHostClass.__init__(self, {'history':'allbox.tv', 'cookie':'allbox.tv.cookie', 'cookie_type':'MozillaCookieJar', 'min_py_ver':(2,7,9)}) self.USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0' self.MAIN_URL = 'https://allbox.tv/' self.DEFAULT_ICON_URL = 'https://allbox.tv/static/img/seriale_brak_foto.jpg?v=1' self.HTTP_HEADER = {'User-Agent': self.USER_AGENT, 'DNT':'1', 'Accept': 'text/html', 'Accept-Encoding':'gzip, deflate', 'Referer':self.getMainUrl(), 'Origin':self.getMainUrl()} self.AJAX_HEADER = dict(self.HTTP_HEADER) self.AJAX_HEADER.update( {'X-Requested-With': 'XMLHttpRequest', 'Accept-Encoding':'gzip, deflate', 'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8', 'Accept':'application/json, text/javascript, */*; q=0.01'} ) self.cacheSearch = {} self.cacheEpisodes = {} self.cacheSeriesLetter = [] self.cacheSetiesByLetter = {} self.cacheCartoonsLetter = [] self.cacheCartoonsByLetter = {} self.cacheLinks = {} self.defaultParams = {'header':self.HTTP_HEADER, 'use_cookie': True, 'load_cookie': True, 'save_cookie': True, 'cookiefile': self.COOKIE_FILE} self.MAIN_CAT_TAB = [{'category':'list_filters', 'title': _('Movies'), 'url':self.getFullUrl('/filmy-online') }, {'category':'list_items', 'title': _('Premieres'), 'url':self.getFullUrl('/premiery') }, {'category':'list_series_az', 'title': _('TV series'), 'url':self.getFullUrl('/seriale-online')}, {'category':'list_cartoons_az', 'title': _('Cartoons'), 'url':self.getFullUrl('/bajki-online')}, {'category':'list_filters', 'title': _('Ranking'), 'url':self.getFullUrl('/filmy-online,wszystkie,top')}, {'category':'list_live_channels', 'title': _('Live TV'), 'url':self.getFullUrl('/get_tv')}, {'category':'search', 'title': _('Search'), 'search_item':True}, {'category':'search_history', 'title': _('Search history')}, ] self.loggedIn = None self.login = '' self.password = '' self.loginMessage = ''
def listMainMenu(self, cItem): printDBG("VevoCom.listMainMenu") sts, data = self.getPage(self.getMainUrl()) if not sts: return self.fillBrowse(data) catsMAp = { 'genres': 'list_genres', 'moods': 'list_containers', 'recently-added': 'list_genres_filters', 'trending-now': 'list_genres_filters', 'artists': 'list_artists' } data = self.cm.ph.getDataBeetwenNodes(data, ('<div', '>', 'sub-menu'), ('</ul', '>'), False)[1] data = self.cm.ph.getAllItemsBeetwenMarkers(data, '<a', '</a>') for item in data: url = self.getFullUrl( self.cm.ph.getSearchGroups(item, '''\shref=['"]([^'^"]+?)['"]''')[0]) title = self.cleanHtmlStr(item) nextCategory = catsMAp.get(url.split('/')[-1], '') if nextCategory == '': continue params = dict(cItem) params.pop('page', 0) params.update({ 'good_for_fav': False, 'category': nextCategory, 'title': title, 'url': url }) self.addDir(params) MAIN_CAT_TAB = [ { 'category': 'search', 'title': _('Search'), 'search_item': True }, { 'category': 'search_history', 'title': _('Search history') }, ] self.listsTab(MAIN_CAT_TAB, cItem)
def addMissedDay(self, cItem, nextCategory): printDBG("TVNowDE.addMissedDay") now = datetime.now() for d in range(8): t = (now - timedelta(days=d)).strftime('%Y-%m-%d') if d == 0: title = _('Today') elif d == 1: title = _('Yesterday') else: title = t url = '/movies?fields=*,format,paymentPaytypes,pictures,trailers,packages&filter=%7B%22BroadcastStartDate%22:%7B%22between%22:%7B%22start%22:%22{0}+00:00:00%22,%22end%22:%22{1}+23:59:59%22%7D%7D%7D&maxPerPage=200&order=BroadcastStartDate+asc'.format(t, t) url = self.getFullUrl(url) params = dict(cItem) params.update({'category':nextCategory, 'url':url, 'title':title, 'icon':cItem.get('icon', '')}) self.addDir(params)
def listChannelMenu(self, cItem, nextCategory): sts, data = self.cm.getPage(cItem['url'], self.defaultParams) if not sts: return azItem = False data = self.cm.ph.getDataBeetwenMarkers(data, '<div id="main"', '</ul>', withMarkers=True)[1] data = re.split('<div class="grid__item one-whole[^>]+?>', data) for item in data: item = item.split('</li>')[0] url = self.cm.ph.getSearchGroups( item, '''href=['"]([^'^"]+?rewindTo[^'^"]+?)['"]''')[0] if url == '': url = self.cm.ph.getSearchGroups( item, '''href=['"]([^'^"]+?)['"]''')[0] if url == '': continue title = self.cleanHtmlStr(item) icon = self.cm.ph.getSearchGroups( item, '''<source[^>]+?srcset=['"]([^'^"^\s]+?)['"\s]''')[0] params = { 'good_for_fav': True, 'title': title, 'url': self.getFullUrl(url), 'icon': self.getFullIconUrl(icon), 'desc': '' } if '/a-z' in url: azItem = True params['category'] = nextCategory self.addDir(params) else: self.addVideo(params) if not azItem: params = dict(cItem) params.update({ 'good_for_fav': True, 'title': cItem['title'] + ' ' + _('A-Z'), 'category': nextCategory, 'url': cItem['url'] + '/a-z' }) self.addDir(params) params = dict(cItem) params.update({'title': _('Highlights'), 'category': 'list_items3'}) self.addDir(params)
def listTypes(self, cItem, nextCategory): printDBG("DancetrippinTV.listTypes") tab = [{ 'title': _('All') }, { 'title': _('Video'), 'f_type': 'video' }, { 'title': _('Audio'), 'f_type': 'audio' }] cItem = dict(cItem) cItem.update({'category': nextCategory}) self.listsTab(tab, cItem)