CB01 Final links in Thread

This commit is contained in:
Alhaziel
2020-02-22 12:46:12 +01:00
parent 57f35855b4
commit dedf988eb8
+22 -11
View File
@@ -9,6 +9,7 @@ from core import scrapertools, httptools, servertools, tmdb, support
from core.item import Item from core.item import Item
from lib import unshortenit from lib import unshortenit
from platformcode import logger, config from platformcode import logger, config
from lib.concurrent import futures
def findhost(): def findhost():
@@ -175,14 +176,19 @@ def findvideos(item):
if item.contentType == "episode": if item.contentType == "episode":
return findvid_serie(item) 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: if re_txt:
streaming = scrapertools.find_single_match(data, re_txt).replace('"', '') streaming = scrapertools.find_single_match(data, re_txt).replace('"', '')
support.log('STREAMING',streaming) support.log('STREAMING',streaming)
matches = support.match(streaming, patron = r'<td><a.*?href=([^ ]+) [^>]+>([^<])+<').matches matches = support.match(streaming, patron = r'<td><a.*?href=([^ ]+) [^>]+>[^<]+<').matches
for url, server in matches: with futures.ThreadPoolExecutor() as executor:
logger.debug("##### findvideos %s ## %s ## %s ##" % (desc_txt, url, server)) u = [executor.submit(final_links, match) for match in matches]
urls.append(final_links(url)) 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() support.log()
@@ -200,13 +206,13 @@ def findvideos(item):
QualityStr = scrapertools.decodeHtmlentities(match.group(1)) QualityStr = scrapertools.decodeHtmlentities(match.group(1))
# Estrae i contenuti - Streaming # Estrae i contenuti - Streaming
load_links(urls, '<strong>Streamin?g:</strong>(.*?)cbtable', "orange", "Streaming", "SD") load_links(urls, '<strong>Streamin?g:</strong>(.*?)cbtable', "Streaming", "SD")
# Estrae i contenuti - Streaming HD # Estrae i contenuti - Streaming HD
load_links(urls, '<strong>Streamin?g HD[^<]+</strong>(.*?)cbtable', "yellow", "Streaming HD", "HD") load_links(urls, '<strong>Streamin?g HD[^<]+</strong>(.*?)cbtable', "Streaming HD", "HD")
# Estrae i contenuti - Streaming 3D # Estrae i contenuti - Streaming 3D
load_links(urls, '<strong>Streamin?g 3D[^<]+</strong>(.*?)cbtable', "pink", "Streaming 3D") load_links(urls, '<strong>Streamin?g 3D[^<]+</strong>(.*?)cbtable', "Streaming 3D")
itemlist=support.server(item, urls) itemlist=support.server(item, urls)
if itemlist and QualityStr: if itemlist and QualityStr:
@@ -231,9 +237,14 @@ def findvid_serie(item):
# patron = r'<a href="([^"]+)"[^=]+="_blank"[^>]+>(?!<!--)(.*?)</a>' # patron = r'<a href="([^"]+)"[^=]+="_blank"[^>]+>(?!<!--)(.*?)</a>'
# Estrae i contenuti # Estrae i contenuti
# matches = re.compile(patron, re.DOTALL).finditer(html) # matches = re.compile(patron, re.DOTALL).finditer(html)
matches = support.match(html, patron = r'<a href="([^"]+)"[^=]+="_blank"[^>]+>(?!<!--)(.*?)</a>').matches matches = support.match(html, patron = r'<a href="([^"]+)"[^=]+="_blank"[^>]+>(?!<!--).*?</a>').matches
for url, server in matches: with futures.ThreadPoolExecutor() as executor:
urls.append(final_links(url)) 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, server in matches:
# urls.append(final_links(url))
support.log() support.log()