cinetux: fix
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
from channels import autoplay
|
||||
from channels import filtertools
|
||||
from core import httptools
|
||||
@@ -231,6 +232,7 @@ def findvideos(item):
|
||||
data = httptools.downloadpage(item.url).data
|
||||
if filtro_enlaces != 0:
|
||||
list_enlaces = bloque_enlaces(data, filtro_idioma, dict_idiomas, "online", item)
|
||||
return
|
||||
if list_enlaces:
|
||||
itemlist.append(item.clone(action="", title="Enlaces Online", text_color=color1,
|
||||
text_bold=True))
|
||||
@@ -260,103 +262,159 @@ def findvideos(item):
|
||||
return itemlist
|
||||
|
||||
|
||||
def bloque_enlaces(data, filtro_idioma, dict_idiomas, type, item):
|
||||
logger.info()
|
||||
lista_enlaces = []
|
||||
matches = []
|
||||
if type == "online": t_tipo = "Ver Online"
|
||||
if type == "descarga": t_tipo = "Descargar"
|
||||
data = data.replace("\n", "")
|
||||
if type == "online":
|
||||
patron = '(?is)class="playex.*?sheader'
|
||||
bloque1 = scrapertools.find_single_match(data, patron)
|
||||
patron = '(?is)#(option-[^"]+).*?png">([^<]+)'
|
||||
match = scrapertools.find_multiple_matches(data, patron)
|
||||
for scrapedoption, language in match:
|
||||
scrapedserver = ""
|
||||
lazy = ""
|
||||
if "lazy" in bloque1:
|
||||
lazy = "lazy-"
|
||||
patron = '(?s)id="%s".*?metaframe.*?%ssrc="([^"]+)' % (scrapedoption, lazy)
|
||||
url = scrapertools.find_single_match(bloque1, patron)
|
||||
if "goo.gl" in url:
|
||||
url = httptools.downloadpage(url, follow_redirects=False, only_headers=True).headers.get("location", "")
|
||||
if "drive.php" in url:
|
||||
scrapedserver = "gvideo"
|
||||
if "player" in url:
|
||||
scrapedserver = scrapertools.find_single_match(url, 'player/(\w+)')
|
||||
if "ok" in scrapedserver: scrapedserver = "okru"
|
||||
matches.append([url, scrapedserver, "", language.strip(), t_tipo])
|
||||
bloque2 = scrapertools.find_single_match(data, '(?s)box_links.*?dt_social_single')
|
||||
bloque2 = bloque2.replace("\t", "").replace("\r", "")
|
||||
patron = '(?s)optn" href="([^"]+)'
|
||||
patron += '.*?alt="([^\.]+)'
|
||||
patron += '.*?src.*?src="[^>]+"?/>([^<]+)'
|
||||
patron += '.*?src="[^>]+"?/>([^<]+)'
|
||||
patron += '.*?/span>([^<]+)'
|
||||
matches.extend(scrapertools.find_multiple_matches(bloque2, patron))
|
||||
filtrados = []
|
||||
for match in matches:
|
||||
scrapedurl = match[0]
|
||||
scrapedserver = match[1]
|
||||
scrapedcalidad = match[2]
|
||||
language = match[3]
|
||||
scrapedtipo = match[4]
|
||||
if t_tipo.upper() not in scrapedtipo.upper():
|
||||
continue
|
||||
title = " Mirror en %s (" + language + ")"
|
||||
if len(scrapedcalidad.strip()) > 0:
|
||||
title += " (Calidad " + scrapedcalidad.strip() + ")"
|
||||
# def bloque_enlaces(data, filtro_idioma, dict_idiomas, type, item):
|
||||
# logger.info()
|
||||
# lista_enlaces = []
|
||||
# matches = []
|
||||
# if type == "online": t_tipo = "Ver Online"
|
||||
# if type == "descarga": t_tipo = "Descargar"
|
||||
# data = data.replace("\n", "")
|
||||
# if type == "online":
|
||||
# patron = '(?is)class="playex.*?sheader'
|
||||
# bloque1 = scrapertools.find_single_match(data, patron)
|
||||
# patron = '(?is)#(option-[^"]+).*?png">([^<]+)'
|
||||
# match = scrapertools.find_multiple_matches(data, patron)
|
||||
# for scrapedoption, language in match:
|
||||
# scrapedserver = ""
|
||||
# lazy = ""
|
||||
# if "lazy" in bloque1:
|
||||
# lazy = "lazy-"
|
||||
# patron = '(?s)id="%s".*?metaframe.*?%ssrc="([^"]+)' % (scrapedoption, lazy)
|
||||
# url = scrapertools.find_single_match(bloque1, patron)
|
||||
# if "goo.gl" in url:
|
||||
# url = httptools.downloadpage(url, follow_redirects=False, only_headers=True).headers.get("location", "")
|
||||
# if "drive.php" in url:
|
||||
# scrapedserver = "gvideo"
|
||||
# if "player" in url:
|
||||
# scrapedserver = scrapertools.find_single_match(url, 'player/(\w+)')
|
||||
# if "ok" in scrapedserver: scrapedserver = "okru"
|
||||
# matches.append([url, scrapedserver, "", language.strip(), t_tipo])
|
||||
# bloque2 = scrapertools.find_single_match(data, '(?s)box_links.*?dt_social_single')
|
||||
# bloque2 = bloque2.replace("\t", "").replace("\r", "")
|
||||
# patron = '(?s)optn" href="([^"]+)'
|
||||
# patron += '.*?alt="([^\.]+)'
|
||||
# patron += '.*?src.*?src="[^>]+"?/>([^<]+)'
|
||||
# patron += '.*?src="[^>]+"?/>([^<]+)'
|
||||
# patron += '.*?/span>([^<]+)'
|
||||
# matches.extend(scrapertools.find_multiple_matches(bloque2, patron))
|
||||
# filtrados = []
|
||||
# for match in matches:
|
||||
# scrapedurl = match[0]
|
||||
# scrapedserver = match[1]
|
||||
# scrapedcalidad = match[2]
|
||||
# language = match[3]
|
||||
# scrapedtipo = match[4]
|
||||
# if t_tipo.upper() not in scrapedtipo.upper():
|
||||
# continue
|
||||
# title = " Mirror en %s (" + language + ")"
|
||||
# if len(scrapedcalidad.strip()) > 0:
|
||||
# title += " (Calidad " + scrapedcalidad.strip() + ")"
|
||||
#
|
||||
# if filtro_idioma == 3 or item.filtro:
|
||||
# lista_enlaces.append(item.clone(title=title, action="play", text_color=color2,
|
||||
# url=scrapedurl, server=scrapedserver,
|
||||
# extra=item.url, contentThumbnail = item.thumbnail,
|
||||
# language=language))
|
||||
# else:
|
||||
# idioma = dict_idiomas[language]
|
||||
# if idioma == filtro_idioma:
|
||||
# lista_enlaces.append(item.clone(title=title, action="play", text_color=color2,
|
||||
# url=scrapedurl, server=scrapedserver,
|
||||
# extra=item.url, contentThumbnail = item.thumbnail,
|
||||
# language=language))
|
||||
# else:
|
||||
# if language not in filtrados:
|
||||
# filtrados.append(language)
|
||||
# lista_enlaces = servertools.get_servers_itemlist(lista_enlaces, lambda i: i.title % i.server.capitalize())
|
||||
# if filtro_idioma != 3:
|
||||
# if len(filtrados) > 0:
|
||||
# title = "Mostrar también enlaces filtrados en %s" % ", ".join(filtrados)
|
||||
# lista_enlaces.append(item.clone(title=title, action="findvideos", url=item.url, text_color=color3,
|
||||
# filtro=True))
|
||||
# return lista_enlaces
|
||||
#
|
||||
#
|
||||
# def play(item):
|
||||
# logger.info()
|
||||
# itemlist = []
|
||||
# if "api.cinetux" in item.url or item.server == "okru" or "drive.php" in item.url or "youtube" in item.url:
|
||||
# data = httptools.downloadpage(item.url, headers={'Referer': item.extra}).data.replace("\\", "")
|
||||
# id = scrapertools.find_single_match(data, 'img src="[^#]+#(.*?)"')
|
||||
# item.url = "http://docs.google.com/get_video_info?docid=" + id
|
||||
# if item.server == "okru":
|
||||
# item.url = "https://ok.ru/videoembed/" + id
|
||||
# if item.server == "youtube":
|
||||
# item.url = "https://www.youtube.com/embed/" + id
|
||||
# elif "links" in item.url or "www.cinetux.me" in item.url:
|
||||
# data = httptools.downloadpage(item.url).data
|
||||
# scrapedurl = scrapertools.find_single_match(data, '<a href="(http[^"]+)')
|
||||
# if scrapedurl == "":
|
||||
# scrapedurl = scrapertools.find_single_match(data, '(?i)frame.*?src="(http[^"]+)')
|
||||
# if scrapedurl == "":
|
||||
# scrapedurl = scrapertools.find_single_match(data, 'replace."([^"]+)"')
|
||||
# elif "goo.gl" in scrapedurl:
|
||||
# scrapedurl = httptools.downloadpage(scrapedurl, follow_redirects=False, only_headers=True).headers.get(
|
||||
# "location", "")
|
||||
# item.url = scrapedurl
|
||||
# item.server = ""
|
||||
# itemlist.append(item.clone())
|
||||
# itemlist = servertools.get_servers_itemlist(itemlist)
|
||||
# for i in itemlist:
|
||||
# i.thumbnail = i.contentThumbnail
|
||||
# return itemlist
|
||||
|
||||
if filtro_idioma == 3 or item.filtro:
|
||||
lista_enlaces.append(item.clone(title=title, action="play", text_color=color2,
|
||||
url=scrapedurl, server=scrapedserver,
|
||||
extra=item.url, contentThumbnail = item.thumbnail,
|
||||
language=language))
|
||||
else:
|
||||
idioma = dict_idiomas[language]
|
||||
if idioma == filtro_idioma:
|
||||
lista_enlaces.append(item.clone(title=title, action="play", text_color=color2,
|
||||
url=scrapedurl, server=scrapedserver,
|
||||
extra=item.url, contentThumbnail = item.thumbnail,
|
||||
language=language))
|
||||
|
||||
def get_source(url, referer=None):
|
||||
logger.info()
|
||||
if referer == None:
|
||||
data = httptools.downloadpage(url).data
|
||||
else:
|
||||
data = httptools.downloadpage(url, headers={'Referer':referer}).data
|
||||
data = re.sub(r'\n|\r|\t| |<br>|\s{2,}', "", data)
|
||||
return data
|
||||
|
||||
def findvideos(item):
|
||||
import urllib
|
||||
logger.info()
|
||||
|
||||
itemlist=[]
|
||||
|
||||
data = get_source(item.url)
|
||||
|
||||
patron = 'class="title">([^>]+)</span>.*?data-type="([^"]+)" data-post="(\d+)" data-nume="(\d+)'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for language, tp, pt, nm in matches:
|
||||
|
||||
post = {'action':'doo_player_ajax', 'post':pt, 'nume':nm, 'type':tp}
|
||||
post = urllib.urlencode(post)
|
||||
new_data = httptools.downloadpage(CHANNEL_HOST+'wp-admin/admin-ajax.php', post=post, headers={'Referer':item.url}).data
|
||||
if not config.get_setting('unify'):
|
||||
if item.quality == '':
|
||||
quality = 'SD'
|
||||
else:
|
||||
if language not in filtrados:
|
||||
filtrados.append(language)
|
||||
lista_enlaces = servertools.get_servers_itemlist(lista_enlaces, lambda i: i.title % i.server.capitalize())
|
||||
if filtro_idioma != 3:
|
||||
if len(filtrados) > 0:
|
||||
title = "Mostrar también enlaces filtrados en %s" % ", ".join(filtrados)
|
||||
lista_enlaces.append(item.clone(title=title, action="findvideos", url=item.url, text_color=color3,
|
||||
filtro=True))
|
||||
return lista_enlaces
|
||||
quality = item.quality
|
||||
title = ' [%s][%s]' % (quality, IDIOMAS[language])
|
||||
else:
|
||||
title = ''
|
||||
url = scrapertools.find_single_match(new_data, "src='([^']+)'")
|
||||
itemlist.append(Item(channel=item.channel, title ='%s'+title, url=url, action='play', quality=item.quality,
|
||||
language=IDIOMAS[language], infoLabels=item.infoLabels))
|
||||
|
||||
patron = "<a class='optn' href='([^']+)'.*?<img src='.*?>([^<]+)<.*?<img src='.*?>([^<]+)<"
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
def play(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
if "api.cinetux" in item.url or item.server == "okru" or "drive.php" in item.url or "youtube" in item.url:
|
||||
data = httptools.downloadpage(item.url, headers={'Referer': item.extra}).data.replace("\\", "")
|
||||
id = scrapertools.find_single_match(data, 'img src="[^#]+#(.*?)"')
|
||||
item.url = "http://docs.google.com/get_video_info?docid=" + id
|
||||
if item.server == "okru":
|
||||
item.url = "https://ok.ru/videoembed/" + id
|
||||
if item.server == "youtube":
|
||||
item.url = "https://www.youtube.com/embed/" + id
|
||||
elif "links" in item.url or "www.cinetux.me" in item.url:
|
||||
data = httptools.downloadpage(item.url).data
|
||||
scrapedurl = scrapertools.find_single_match(data, '<a href="(http[^"]+)')
|
||||
if scrapedurl == "":
|
||||
scrapedurl = scrapertools.find_single_match(data, '(?i)frame.*?src="(http[^"]+)')
|
||||
if scrapedurl == "":
|
||||
scrapedurl = scrapertools.find_single_match(data, 'replace."([^"]+)"')
|
||||
elif "goo.gl" in scrapedurl:
|
||||
scrapedurl = httptools.downloadpage(scrapedurl, follow_redirects=False, only_headers=True).headers.get(
|
||||
"location", "")
|
||||
item.url = scrapedurl
|
||||
item.server = ""
|
||||
itemlist.append(item.clone())
|
||||
itemlist = servertools.get_servers_itemlist(itemlist)
|
||||
for i in itemlist:
|
||||
i.thumbnail = i.contentThumbnail
|
||||
return itemlist
|
||||
for hidden_url, quality, language in matches:
|
||||
|
||||
if not config.get_setting('unify'):
|
||||
title = ' [%s][%s]' % (quality, IDIOMAS[language])
|
||||
else:
|
||||
title = ''
|
||||
new_data = get_source(hidden_url)
|
||||
url = scrapertools.find_single_match(new_data, '"url":"([^"]+)"')
|
||||
url = url.replace('\\/', '/')
|
||||
itemlist.append(Item(channel=item.channel, title='%s'+title, url=url, action='play', quality=quality,
|
||||
language=IDIOMAS[language], infoLabels=item.infoLabels))
|
||||
|
||||
itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize())
|
||||
return itemlist
|
||||
Reference in New Issue
Block a user