diff --git a/channels/cineblog01.py b/channels/cineblog01.py index 1a51f8d2..a0fba827 100644 --- a/channels/cineblog01.py +++ b/channels/cineblog01.py @@ -9,6 +9,7 @@ from core import scrapertools, httptools, servertools, tmdb, support from core.item import Item from lib import unshortenit from platformcode import logger, config +from lib.concurrent import futures def findhost(): @@ -175,14 +176,19 @@ def findvideos(item): if item.contentType == "episode": return findvid_serie(item) - def load_links(urls, re_txt, color, desc_txt, quality=""): + def load_links(urls, re_txt, desc_txt, quality=""): if re_txt: streaming = scrapertools.find_single_match(data, re_txt).replace('"', '') support.log('STREAMING',streaming) - matches = support.match(streaming, patron = r']+>([^<])+<').matches - for url, server in matches: - logger.debug("##### findvideos %s ## %s ## %s ##" % (desc_txt, url, server)) - urls.append(final_links(url)) + matches = support.match(streaming, patron = r']+>[^<]+<').matches + with futures.ThreadPoolExecutor() as executor: + u = [executor.submit(final_links, match) for match in matches] + for res in futures.as_completed(u): + if res.result(): + urls.append(res.result()) + # for url in matches: + # # logger.debug("##### findvideos %s ## %s ## %s ##" % (desc_txt, url, server)) + # urls.append(final_links(url)) support.log() @@ -200,13 +206,13 @@ def findvideos(item): QualityStr = scrapertools.decodeHtmlentities(match.group(1)) # Estrae i contenuti - Streaming - load_links(urls, 'Streamin?g:(.*?)cbtable', "orange", "Streaming", "SD") + load_links(urls, 'Streamin?g:(.*?)cbtable', "Streaming", "SD") # Estrae i contenuti - Streaming HD - load_links(urls, 'Streamin?g HD[^<]+(.*?)cbtable', "yellow", "Streaming HD", "HD") + load_links(urls, 'Streamin?g HD[^<]+(.*?)cbtable', "Streaming HD", "HD") # Estrae i contenuti - Streaming 3D - load_links(urls, 'Streamin?g 3D[^<]+(.*?)cbtable', "pink", "Streaming 3D") + load_links(urls, 'Streamin?g 3D[^<]+(.*?)cbtable', "Streaming 3D") itemlist=support.server(item, urls) if itemlist and QualityStr: @@ -231,9 +237,14 @@ def findvid_serie(item): # patron = r']+>(?!