CB01 Final links in Thread

This commit is contained in:
Alhaziel
2020-02-22 12:46:12 +01:00
parent 57f35855b4
commit dedf988eb8

View File

@@ -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'<td><a.*?href=([^ ]+) [^>]+>([^<])+<').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'<td><a.*?href=([^ ]+) [^>]+>[^<]+<').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, '<strong>Streamin?g:</strong>(.*?)cbtable', "orange", "Streaming", "SD")
load_links(urls, '<strong>Streamin?g:</strong>(.*?)cbtable', "Streaming", "SD")
# 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
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)
if itemlist and QualityStr:
@@ -231,9 +237,14 @@ def findvid_serie(item):
# patron = r'<a href="([^"]+)"[^=]+="_blank"[^>]+>(?!<!--)(.*?)</a>'
# Estrae i contenuti
# matches = re.compile(patron, re.DOTALL).finditer(html)
matches = support.match(html, patron = r'<a href="([^"]+)"[^=]+="_blank"[^>]+>(?!<!--)(.*?)</a>').matches
for url, server in matches:
urls.append(final_links(url))
matches = support.match(html, patron = r'<a href="([^"]+)"[^=]+="_blank"[^>]+>(?!<!--).*?</a>').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, server in matches:
# urls.append(final_links(url))
support.log()