From b1f77fbff469e761b4f13d7f23c9994ffbb876bd Mon Sep 17 00:00:00 2001 From: mac12m99 Date: Thu, 11 Apr 2019 21:06:10 +0200 Subject: [PATCH] more efficient way to get host --- plugin.video.alfa/channels/cineblog01.py | 14 +++++++++----- plugin.video.alfa/channels/vedohd.py | 22 +++++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/plugin.video.alfa/channels/cineblog01.py b/plugin.video.alfa/channels/cineblog01.py index 5e9e9c32..1e7681ef 100644 --- a/plugin.video.alfa/channels/cineblog01.py +++ b/plugin.video.alfa/channels/cineblog01.py @@ -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’ 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) diff --git a/plugin.video.alfa/channels/vedohd.py b/plugin.video.alfa/channels/vedohd.py index 257526f3..e3d14261 100644 --- a/plugin.video.alfa/channels/vedohd.py +++ b/plugin.video.alfa/channels/vedohd.py @@ -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'