示例#1
0
    def streamhub_list(self, url, result=None):
        try:
            if result == None: result = cache.get(client.request, 0, url)

            if result.strip().startswith('#EXTM3U') and '#EXTINF' in result:
                result = re.compile('#EXTINF:.+?\,(.+?)\n(.+?)\n', re.MULTILINE|re.DOTALL).findall(result)
                result = ['<item><title>%s</title><link>%s</link></item>' % (i[0], i[1]) for i in result]
                result = ''.join(result)

            try: r = base64.b64decode(result)
            except: r = ''
            if '</link>' in r: result = r

            result = str(result)

            result = self.account_filter(result)

            info = result.split('<item>')[0].split('<dir>')[0]

            try: vip = re.findall('<poster>(.+?)</poster>', info)[0]
            except: vip = '0'

            try: image = re.findall('<thumbnail>(.+?)</thumbnail>', info)[0]
            except: image = '0'

            try: fanart = re.findall('<fanart>(.+?)</fanart>', info)[0]
            except: fanart = '0'

            items = re.compile('((?:<item>.+?</item>|<dir>.+?</dir>|<plugin>.+?</plugin>|<info>.+?</info>|<name>[^<]+</name><link>[^<]+</link><thumbnail>[^<]+</thumbnail><mode>[^<]+</mode>|<name>[^<]+</name><link>[^<]+</link><thumbnail>[^<]+</thumbnail><date>[^<]+</date>))', re.MULTILINE|re.DOTALL).findall(result)
        except:
            return

        for item in items:
            try:
                regdata = re.compile('(<regex>.+?</regex>)', re.MULTILINE|re.DOTALL).findall(item)
                regdata = ''.join(regdata)
                reglist = re.compile('(<listrepeat>.+?</listrepeat>)', re.MULTILINE|re.DOTALL).findall(regdata)
                regdata = urllib.quote_plus(regdata)

                reghash = hashlib.md5()
                for i in regdata: reghash.update(str(i))
                reghash = str(reghash.hexdigest())

                item = item.replace('\r','').replace('\n','').replace('\t','').replace('&nbsp;','')
                item = re.sub('<regex>.+?</regex>','', item)
                item = re.sub('<sublink></sublink>|<sublink\s+name=(?:\'|\").*?(?:\'|\")></sublink>','', item)
                item = re.sub('<link></link>','', item)

                name = re.sub('<meta>.+?</meta>','', item)
                try: name = re.findall('<title>(.+?)</title>', name)[0]
                except: name = re.findall('<name>(.+?)</name>', name)[0]

                try: date = re.findall('<date>(.+?)</date>', item)[0]
                except: date = ''
                if re.search(r'\d+', date): name += ' [COLOR red] Updated %s[/COLOR]' % date

                try: image2 = re.findall('<thumbnail>(.+?)</thumbnail>', item)[0]
                except: image2 = image

                try: fanart2 = re.findall('<fanart>(.+?)</fanart>', item)[0]
                except: fanart2 = fanart

                try: meta = re.findall('<meta>(.+?)</meta>', item)[0]
                except: meta = '0'

                try: url = re.findall('<link>(.+?)</link>', item)[0]
                except: url = '0'
                url = url.replace('>search<', '><preset>search</preset>%s<' % meta)
                url = '<preset>search</preset>%s' % meta if url == 'search' else url
                url = url.replace('>searchsd<', '><preset>searchsd</preset>%s<' % meta)
                url = '<preset>searchsd</preset>%s' % meta if url == 'searchsd' else url
                url = re.sub('<sublink></sublink>|<sublink\s+name=(?:\'|\").*?(?:\'|\")></sublink>','', url)

                if item.startswith('<item>'): action = 'play'
                elif item.startswith('<plugin>'): action = 'plugin'
                elif item.startswith('<info>') or url == '0': action = '0'
                else: action = 'directory'
                if action == 'play' and reglist: action = 'xdirectory'

                if not regdata == '':
                    self.hash.append({'regex': reghash, 'response': regdata})
                    url += '|regex=%s' % reghash

                if action in ['directory', 'xdirectory', 'plugin']:
                    folder = True
                else:
                    folder = False

                try: content = re.findall('<content>(.+?)</content>', meta)[0]
                except: content = '0'
                if content == '0': 
                    try: content = re.findall('<content>(.+?)</content>', item)[0]
                    except: content = '0'
                if not content == '0': content += 's'

                if 'tvshow' in content and not url.strip().endswith('.xml'):
                    url = '<preset>tvindexer</preset><url>%s</url><thumbnail>%s</thumbnail><fanart>%s</fanart>%s' % (url, image2, fanart2, meta)
                    action = 'tvtuner'

                if 'tvtuner' in content and not url.strip().endswith('.xml'):
                    url = '<preset>tvtuner</preset><url>%s</url><thumbnail>%s</thumbnail><fanart>%s</fanart>%s' % (url, image2, fanart2, meta)
                    action = 'tvtuner'

                try: imdb = re.findall('<imdb>(.+?)</imdb>', meta)[0]
                except: imdb = '0'

                try: tvdb = re.findall('<tvdb>(.+?)</tvdb>', meta)[0]
                except: tvdb = '0'

                try: tvshowtitle = re.findall('<tvshowtitle>(.+?)</tvshowtitle>', meta)[0]
                except: tvshowtitle = '0'

                try: title = re.findall('<title>(.+?)</title>', meta)[0]
                except: title = '0'

                if title == '0' and not tvshowtitle == '0': title = tvshowtitle

                try: year = re.findall('<year>(.+?)</year>', meta)[0]
                except: year = '0'

                try: premiered = re.findall('<premiered>(.+?)</premiered>', meta)[0]
                except: premiered = '0'

                try: season = re.findall('<season>(.+?)</season>', meta)[0]
                except: season = '0'

                try: episode = re.findall('<episode>(.+?)</episode>', meta)[0]
                except: episode = '0'

                self.list.append({'name': name, 'vip': vip, 'url': url, 'action': action, 'folder': folder, 'poster': image2, 'banner': '0', 'fanart': fanart2, 'content': content, 'imdb': imdb, 'tvdb': tvdb, 'tmdb': '0', 'title': title, 'originaltitle': title, 'tvshowtitle': tvshowtitle, 'year': year, 'premiered': premiered, 'season': season, 'episode': episode})
            except:
                pass

        regex.insert(self.hash)

        return self.list
示例#2
0
    def jizzplanet_list(self, url, result=None):
        try:
            if result == None: result = cache.get(client.request, 0, url)

            if result.strip().startswith('#EXTM3U') and '#EXTINF' in result:
                result = re.compile('#EXTINF:.+?\,(.+?)\n(.+?)\n',
                                    re.MULTILINE | re.DOTALL).findall(result)
                result = [
                    '<item><title>%s</title><link>%s</link></item>' %
                    (i[0], i[1]) for i in result
                ]
                result = ''.join(result)

            try:
                r = base64.b64decode(result)
            except:
                r = ''
            if '</link>' in r: result = r

            result = str(result)

            #result = self.account_filter(result)

            info = result.split('<item>')[0].split('<dir>')[0]

            try:
                vip = re.findall('<poster>(.+?)</poster>', info)[0]
            except:
                vip = '0'

            try:
                image = re.findall('<thumbnail>(.+?)</thumbnail>', info)[0]
            except:
                image = '0'

            try:
                fanart = re.findall('<fanart>(.+?)</fanart>', info)[0]
            except:
                fanart = '0'

            items = re.compile(
                '((?:<item>.+?</item>|<dir>.+?</dir>|<plugin>.+?</plugin>|<info>.+?</info>|<name>[^<]+</name><link>[^<]+</link><thumbnail>[^<]+</thumbnail><mode>[^<]+</mode>|<name>[^<]+</name><link>[^<]+</link><thumbnail>[^<]+</thumbnail><date>[^<]+</date>))',
                re.MULTILINE | re.DOTALL).findall(result)
        except:
            return

        for item in items:
            try:
                regdata = re.compile('(<regex>.+?</regex>)',
                                     re.MULTILINE | re.DOTALL).findall(item)
                regdata = ''.join(regdata)
                reglist = re.compile('(<listrepeat>.+?</listrepeat>)',
                                     re.MULTILINE | re.DOTALL).findall(regdata)
                regdata = urllib.quote_plus(regdata)

                reghash = hashlib.md5()
                for i in regdata:
                    reghash.update(str(i))
                reghash = str(reghash.hexdigest())

                item = item.replace('\r', '').replace('\n', '').replace(
                    '\t', '').replace('&nbsp;', '')
                item = re.sub('<regex>.+?</regex>', '', item)
                item = re.sub(
                    '<sublink></sublink>|<sublink\s+name=(?:\'|\").*?(?:\'|\")></sublink>',
                    '', item)
                item = re.sub('<link></link>', '', item)

                name = re.sub('<meta>.+?</meta>', '', item)
                try:
                    name = re.findall('<title>(.+?)</title>', name)[0]
                except:
                    name = re.findall('<name>(.+?)</name>', name)[0]

                try:
                    date = re.findall('<date>(.+?)</date>', item)[0]
                except:
                    date = ''
                if re.search(r'\d+', date):
                    name += ' [COLOR red] Updated %s[/COLOR]' % date

                try:
                    image2 = re.findall('<thumbnail>(.+?)</thumbnail>',
                                        item)[0]
                except:
                    image2 = image

                try:
                    fanart2 = re.findall('<fanart>(.+?)</fanart>', item)[0]
                except:
                    fanart2 = fanart

                try:
                    meta = re.findall('<meta>(.+?)</meta>', item)[0]
                except:
                    meta = '0'

                try:
                    url = re.findall('<link>(.+?)</link>', item)[0]
                except:
                    url = '0'
                url = url.replace('>search<',
                                  '><preset>search</preset>%s<' % meta)
                url = '<preset>search</preset>%s' % meta if url == 'search' else url
                url = url.replace('>searchsd<',
                                  '><preset>searchsd</preset>%s<' % meta)
                url = '<preset>searchsd</preset>%s' % meta if url == 'searchsd' else url
                url = re.sub(
                    '<sublink></sublink>|<sublink\s+name=(?:\'|\").*?(?:\'|\")></sublink>',
                    '', url)

                if item.startswith('<item>'): action = 'play'
                elif item.startswith('<plugin>'): action = 'plugin'
                elif item.startswith('<info>') or url == '0': action = '0'
                else: action = 'directory'
                if action == 'play' and reglist: action = 'xdirectory'

                if not regdata == '':
                    self.hash.append({'regex': reghash, 'response': regdata})
                    url += '|regex=%s' % reghash

                if action in ['directory', 'xdirectory', 'plugin']:
                    folder = True
                else:
                    folder = False

                try:
                    content = re.findall('<content>(.+?)</content>', meta)[0]
                except:
                    content = '0'
                if content == '0':
                    try:
                        content = re.findall('<content>(.+?)</content>',
                                             item)[0]
                    except:
                        content = '0'
                if not content == '0': content += 's'

                if 'tvshow' in content and not url.strip().endswith('.xml'):
                    url = '<preset>tvindexer</preset><url>%s</url><thumbnail>%s</thumbnail><fanart>%s</fanart>%s' % (
                        url, image2, fanart2, meta)
                    action = 'tvtuner'

                if 'tvtuner' in content and not url.strip().endswith('.xml'):
                    url = '<preset>tvtuner</preset><url>%s</url><thumbnail>%s</thumbnail><fanart>%s</fanart>%s' % (
                        url, image2, fanart2, meta)
                    action = 'tvtuner'

                try:
                    imdb = re.findall('<imdb>(.+?)</imdb>', meta)[0]
                except:
                    imdb = '0'

                try:
                    tvdb = re.findall('<tvdb>(.+?)</tvdb>', meta)[0]
                except:
                    tvdb = '0'

                try:
                    tvshowtitle = re.findall(
                        '<tvshowtitle>(.+?)</tvshowtitle>', meta)[0]
                except:
                    tvshowtitle = '0'

                try:
                    title = re.findall('<title>(.+?)</title>', meta)[0]
                except:
                    title = '0'

                if title == '0' and not tvshowtitle == '0': title = tvshowtitle

                try:
                    year = re.findall('<year>(.+?)</year>', meta)[0]
                except:
                    year = '0'

                try:
                    premiered = re.findall('<premiered>(.+?)</premiered>',
                                           meta)[0]
                except:
                    premiered = '0'

                try:
                    season = re.findall('<season>(.+?)</season>', meta)[0]
                except:
                    season = '0'

                try:
                    episode = re.findall('<episode>(.+?)</episode>', meta)[0]
                except:
                    episode = '0'

                self.list.append({
                    'name': name,
                    'vip': vip,
                    'url': url,
                    'action': action,
                    'folder': folder,
                    'poster': image2,
                    'banner': '0',
                    'fanart': fanart2,
                    'content': content,
                    'imdb': imdb,
                    'tvdb': tvdb,
                    'tmdb': '0',
                    'title': title,
                    'originaltitle': title,
                    'tvshowtitle': tvshowtitle,
                    'year': year,
                    'premiered': premiered,
                    'season': season,
                    'episode': episode
                })
            except:
                pass

        regex.insert(self.hash)

        return self.list
示例#3
0
	def it_list(self, url, result=None):

		try:
			if result is None: result = cache.get(client.request, 0, url)

			if result.strip().startswith('#EXTM3U') and '#EXTINF' in result:
				result = re.compile('#EXTINF:.+?\,(.+?)\n(.+?)\n', re.MULTILINE|re.DOTALL).findall(result)
				result = ['<item><title>%s</title><link>%s</link></item>' % (i[0], i[1]) for i in result]
				result = ''.join(result)

			try: r = base64.b64decode(result)
			except: r = ''
			if '</link>' in r: result = r

			result = str(result)

			info = result.split('<item>')[0].split('<dir>')[0]

			try: vip = re.findall('<poster>(.+?)</poster>', info)[0]
			except: vip = '0'

			try: image = re.findall('<thumbnail>(.+?)</thumbnail>', info)[0]
			except: image = '0'

			try: fanart = re.findall('<fanart>(.+?)</fanart>', info)[0]
			except: fanart = '0'

			api_data = client.request(base64.b64decode('aHR0cDovL3RleHR1cGxvYWRlci5jb20vZHI3NmcvcmF3'), timeout='5')
			tmdb_api = re.compile('<api>(.+?)</api>').findall(api_data)[0]

			items = re.compile('((?:<item>.+?</item>|<dir>.+?</dir>|<plugin>.+?</plugin>|<info>.+?</info>|<name>[^<]+</name><link>[^<]+</link><thumbnail>[^<]+</thumbnail><mode>[^<]+</mode>|<name>[^<]+</name><link>[^<]+</link><thumbnail>[^<]+</thumbnail><date>[^<]+</date>))', re.MULTILINE|re.DOTALL).findall(result)
		except:
			return

		for item in items:

			try:
				regdata = re.compile('(<regex>.+?</regex>)', re.MULTILINE|re.DOTALL).findall(item)
				regdata = ''.join(regdata)
				reglist = re.compile('(<listrepeat>.+?</listrepeat>)', re.MULTILINE|re.DOTALL).findall(regdata)
				regdata = urllib.quote_plus(regdata)

				reghash = hashlib.md5()
				for i in regdata: reghash.update(str(i))
				reghash = str(reghash.hexdigest())

				item = item.replace('\r','').replace('\n','').replace('\t','').replace('&nbsp;','').replace('<tmdb_data>true</tmdb_data>','<tmdb_data>all</tmdb_data>')

				try: meta = re.findall('<meta>(.+?)</meta>', item)[0]
				except: meta = '0'

				try: imdb = re.findall('<imdb>(.+?)</imdb>', meta)[0]
				except: imdb = '0'

				try: tmdb_get = re.findall('<tmdb_data>(.+?)</tmdb_data>', meta)[0]
				except: tmdb_get = '0'

				try: tvshowtitle = re.findall('<tvshowtitle>(.+?)</tvshowtitle>', item)[0]
				except: tvshowtitle = '0'

				item = re.sub('<regex>.+?</regex>','', item)
				item = re.sub('<sublink></sublink>|<sublink\s+name=(?:\'|\").*?(?:\'|\")></sublink>','', item)
				item = re.sub('<link></link>','', item)

				try: meta = re.findall('<meta>(.+?)</meta>', item)[0]
				except: meta = '0'

				if any(f for f in ['all','data','images'] if f == tmdb_get.lower()):         
					try:
						url_api = 'http://api.themoviedb.org/3/movie/' + imdb + '?api_key=' + tmdb_api
						item_json = client.request(url_api, timeout='5')

						item_json = json.loads(item_json)
					except: pass

					if any(f for f in ['all','data'] if f == tmdb_get.lower()):         
						try:
							if item_json['original_title'] is not None: 
							title = item_json['original_title']
							name = title
							else:
								name = re.sub('<meta>.+?</meta>','', item)
								try: name = re.findall('<title>(.+?)</title>', name)[0]
								except: name = re.findall('<name>(.+?)</name>', name)[0]
								try: title = name
								except: title = '0'
								if title == '0' and not tvshowtitle == '0': title = tvshowtitle

						except:
							name = re.sub('<meta>.+?</meta>','', item)
							try: name = re.findall('<title>(.+?)</title>', name)[0]
							except: name = re.findall('<name>(.+?)</name>', name)[0]
							try: title = name
							except: title = '0'

							if title == '0' and not tvshowtitle == '0': title = tvshowtitle

						if '<title></title>' in item:
							item = item.replace('<title></title>','<title>'+title+'</title>')

						try:
							if item_json['release_date'] is not None: year = item_json['release_date']; year = year.split('-')[0]; name = title + ' (' + year + ')'
							else: 
								try: year = re.findall('<year>(.+?)</year>', meta)[0]
								except: year = '0'
						except:
							try: year = re.findall('<year>(.+?)</year>', meta)[0]
							except: year = '0'

						if '<year></year>' in item:
							item = item.replace('<year></year>','<year>'+title+'</year>')
					else:
						name = re.sub('<meta>.+?</meta>','', item)
						try: name = re.findall('<title>(.+?)</title>', name)[0]
						except: name = re.findall('<name>(.+?)</name>', name)[0]
						try: title = name
						except: title = '0'
						if '<title></title>' in item:
							item = item.replace('<title></title>','<title>'+title+'</title>')
						try: year = re.findall('<year>(.+?)</year>', meta)[0]
						except: year = '0'
						if '<year></year>' in item:
							item = item.replace('<year></year>','<year>'+title+'</year>')

					if any(f for f in ['all','images'] if f == tmdb_get.lower()):         

						try:
							if item_json['backdrop_path'] is not None: fanart2 = 'http://image.tmdb.org/t/p/original/' + item_json['backdrop_path']
							else: 
								try: fanart2 = re.findall('<fanart>(.+?)</fanart>', item)[0]
								except: fanart2 = fanart
						except:
							try: fanart2 = re.findall('<fanart>(.+?)</fanart>', item)[0]
							except: fanart2 = fanart

						try:
							if item_json['poster_path'] is not None: image2 = 'http://image.tmdb.org/t/p/original/' + item_json['poster_path']
							else: 
								try: image2 = re.findall('<thumbnail>(.+?)</thumbnail>', item)[0]
								except: image2 = image
						except:
							try: image2 = re.findall('<thumbnail>(.+?)</thumbnail>', item)[0]
							except: image2 = image
					else:
						try: fanart2 = re.findall('<fanart>(.+?)</fanart>', item)[0]
						except: fanart2 = fanart
						try: image2 = re.findall('<thumbnail>(.+?)</thumbnail>', item)[0]
						except: image2 = image
				else:

					name = re.sub('<meta>.+?</meta>','', item)
					try: name = re.findall('<title>(.+?)</title>', name)[0]
					except: name = re.findall('<name>(.+?)</name>', name)[0]

					try: title = re.findall('<title>(.+?)</title>', meta)[0]
					except: title = '0'

					if title == '0' and not tvshowtitle == '0': title = tvshowtitle

					try: year = re.findall('<year>(.+?)</year>', meta)[0]
					except: year = '0'

					try: image2 = re.findall('<thumbnail>(.+?)</thumbnail>', item)[0]
					except: image2 = image

					try: fanart2 = re.findall('<fanart>(.+?)</fanart>', item)[0]
					except: fanart2 = fanart

				try: date = re.findall('<date>(.+?)</date>', item)[0]
				except: date = ''
				if re.search(r'\d+', date):
					name += ' [COLOR red] Updated %s[/COLOR]' % date

				try: meta = re.findall('<meta>(.+?)</meta>', item)[0]
				except: meta = '0'
				try: url = re.findall('<link>(.+?)</link>', item)[0]
				except: url = '0'
				url = url.replace('>search<', '><preset>search</preset>%s<' % meta)
				url = '<preset>search</preset>%s' % meta if url == 'search' else url
				url = url.replace('>searchsd<', '><preset>searchsd</preset>%s<' % meta)
				url = '<preset>searchsd</preset>%s' % meta if url == 'searchsd' else url
				url = re.sub('<sublink></sublink>|<sublink\s+name=(?:\'|\").*?(?:\'|\")></sublink>','', url)

				if item.startswith('<item>'): action = 'play'
				elif item.startswith('<plugin>'): action = 'plugin'
				elif item.startswith('<info>') or url == '0': action = '0'
				else: action = 'directory'
				if action == 'play' and reglist: action = 'xdirectory'

				if not regdata == '':
					self.hash.append({'regex': reghash, 'response': regdata})
					url += '|regex=%s' % reghash

				if action in ['directory', 'xdirectory', 'plugin']:
					folder = True
				else:
					folder = False

				try: content = re.findall('<content>(.+?)</content>', meta)[0]
				except: content = '0'
				if content == '0': 
					try: content = re.findall('<content>(.+?)</content>', item)[0]
					except: content = '0'
				if not content == '0': content += 's'

				if 'tvshow' in content and not url.strip().endswith('.xml'):
					url = '<preset>tvindexer</preset><url>%s</url><thumbnail>%s</thumbnail><fanart>%s</fanart>%s' % (url, image2, fanart2, meta)
					action = 'tvtuner'

				if 'tvtuner' in content and not url.strip().endswith('.xml'):
					url = '<preset>tvtuner</preset><url>%s</url><thumbnail>%s</thumbnail><fanart>%s</fanart>%s' % (url, image2, fanart2, meta)
					action = 'tvtuner'

				try: tvdb = re.findall('<tvdb>(.+?)</tvdb>', meta)[0]
				except: tvdb = '0'

				try: premiered = re.findall('<premiered>(.+?)</premiered>', meta)[0]
				except: premiered = '0'

				try: season = re.findall('<season>(.+?)</season>', meta)[0]
				except: season = '0'

				try: episode = re.findall('<episode>(.+?)</episode>', meta)[0]
				except: episode = '0'

				self.list.append({'name': name, 'vip': vip, 'url': url, 'action': action, 'folder': folder, 'poster': image2, 'banner': '0', 'fanart': fanart2, 'content': content, 'imdb': imdb, 'tvdb': tvdb, 'tmdb': '0', 'title': title, 'originaltitle': title, 'tvshowtitle': tvshowtitle, 'year': year, 'premiered': premiered, 'season': season, 'episode': episode})

			except:
				pass

		regex.insert(self.hash)

		return self.list