more efficient way to get host

This commit is contained in:
mac12m99
2019-04-11 21:06:10 +02:00
parent c83cc3b27f
commit b1f77fbff4
2 changed files with 24 additions and 12 deletions

View File

@@ -16,9 +16,11 @@ from platformcode import logger, config
host = ""
headers = ""
permUrl = httptools.downloadpage('https://www.cb01.uno/', follow_redirects=False).headers
host = 'https://www.'+permUrl['location'].replace('https://www.google.it/search?q=site:', '')
headers = [['Referer', host]]
def findhost():
global host, headers
permUrl = httptools.downloadpage('https://www.cb01.uno/', follow_redirects=False).headers
host = 'https://www.'+permUrl['location'].replace('https://www.google.it/search?q=site:', '')
headers = [['Referer', host]]
IDIOMAS = {'Italiano': 'IT'}
list_language = IDIOMAS.values()
@@ -33,7 +35,7 @@ blacklist = ['BENVENUTI', 'Richieste Serie TV', 'CB01.UNO ▶ TROVA L&#8217
def mainlist(item):
support.log()
findhost()
autoplay.init(item.channel, list_servers, list_quality)
@@ -94,7 +96,7 @@ def search(item, text):
def newest(categoria):
support.log()
findhost()
itemlist = []
item = Item()
item.url = host + '/lista-film-ultimi-100-film-aggiunti/'
@@ -128,6 +130,8 @@ def episodios(item):
def findvideos(item):
findhost()
if item.contentType == "episode":
return findvid_serie(item)

View File

@@ -13,15 +13,21 @@ from platformcode import logger
from channelselector import thumb
headers = ""
host = ""
permUrl = httptools.downloadpage('https://www.cb01.uno/', follow_redirects=False).headers
cb01Url = 'https://www.'+permUrl['location'].replace('https://www.google.it/search?q=site:', '')
data = httptools.downloadpage(cb01Url).data
host = scrapertoolsV2.get_match(data, r'<a class="?mega-menu-link"? href=(https://vedohd[^/"]+)')+'/'
if 'https' not in host: # in caso cb01 cambi, si spera di riuscire ad accedere da questo URL
host = "https://vedohd.pw/"
headers = [['Referer', host]]
def findhost():
permUrl = httptools.downloadpage('https://www.cb01.uno/', follow_redirects=False).headers
cb01Url = 'https://www.'+permUrl['location'].replace('https://www.google.it/search?q=site:', '')
data = httptools.downloadpage(cb01Url).data
global host, headers
host = scrapertoolsV2.get_match(data, r'<a class="?mega-menu-link"? href=(https://vedohd[^/"]+)')+'/'
if 'https' not in host: # in caso cb01 cambi, si spera di riuscire ad accedere da questo URL
host = "https://vedohd.pw/"
headers = [['Referer', host]]
IDIOMAS = {'Italiano': 'IT'}
list_language = IDIOMAS.values()
@@ -34,6 +40,7 @@ blacklist = ['CB01.UNO &#x25b6; TROVA L&#8217;INDIRIZZO UFFICIALE ', 'AVVISO IMP
def mainlist(item):
logger.info("[vedohd.py] mainlist")
findhost()
autoplay.init(item.channel, list_servers, list_quality)
@@ -65,6 +72,7 @@ def peliculas(item):
def findvideos(item):
findhost()
itemlist = []
for link in support.dooplay_get_links(item, host):
if link['title'] != 'Trailer':