# -*- coding: utf-8 -*- # ----------------------------------------------------------- # support functions that are needed by many channels, to no repeat the same code import base64 import inspect import os import re from concurrent import futures try: import urllib.request as urllib import urllib.parse as urlparse from urllib.parse import urlencode except ImportError: import urllib, urlparse from urllib import urlencode from channelselector import thumb from core import httptools, scrapertools, servertools, tmdb, channeltools from core.item import Item from lib import unshortenit from platformcode import logger, config from specials import autoplay def hdpass_get_servers(item): def get_hosts(url, quality): ret = [] page = httptools.downloadpage(url).data log(page) mir = scrapertools.find_single_match(page, patron_mir) for mir_url, srv in scrapertools.find_multiple_matches(mir, patron_option): ret.append(Item(channel=item.channel, action="play", fulltitle=item.fulltitle, quality=quality, show=item.show, thumbnail=item.thumbnail, contentType=item.contentType, title=srv, server=srv, url=mir_url)) return ret # Carica la pagina itemlist = [] if 'hdpass' in item.url or 'hdplayer' in item.url: url = item.url else: data = httptools.downloadpage(item.url).data.replace('\n', '') patron = r']+><\/iframe>' url = scrapertools.find_single_match(data, patron).replace("?alta", "") url = url.replace("&download=1", "") if 'hdpass' not in url and 'hdplayer' not in url: return itemlist if 'https' not in url: url = 'https:' + url data = httptools.downloadpage(url).data patron_res = '
(.*?)
(.*?)
([^<]+?)' res = scrapertools.find_single_match(data, patron_res) with futures.ThreadPoolExecutor() as executor: thL = [] for res_url, res_video in scrapertools.find_multiple_matches(res, patron_option): thL.append(executor.submit(get_hosts, res_url, res_video)) for res in futures.as_completed(thL): if res.result(): itemlist.extend(res.result()) return server(item, itemlist=itemlist) def hdpass_get_url(item): patron_media = r'