Merge pull request #7 from alfa-addon/master

v2.8.2
This commit is contained in:
Intel1
2019-04-03 16:04:53 -05:00
committed by GitHub
47 changed files with 5725 additions and 618 deletions
-69
View File
@@ -1,69 +0,0 @@
{
"id": "cuevana3",
"name": "Cuevana 3",
"active": true,
"adult": false,
"language": ["lat", "cast"],
"thumbnail": "https://www.cuevana3.co/wp-content/themes/cuevana3/public/img/cnt/cuevana3.png",
"banner": "",
"version": 1,
"categories": [
"movie"
],
"settings": [
{
"id": "include_in_global_search",
"type": "bool",
"label": "Incluir en busqueda global",
"default": false,
"enabled": false,
"visible": false
},
{
"id": "filter_languages",
"type": "list",
"label": "Mostrar enlaces en idioma...",
"default": 0,
"enabled": true,
"visible": true,
"lvalues": [
"No filtrar",
"LAT",
"CAST",
"VOSE"
]
},
{
"id": "include_in_newest_peliculas",
"type": "bool",
"label": "Incluir en Novedades - Peliculas",
"default": true,
"enabled": true,
"visible": true
},
{
"id": "include_in_newest_infantiles",
"type": "bool",
"label": "Incluir en Novedades - Infantiles",
"default": true,
"enabled": true,
"visible": true
},
{
"id": "include_in_newest_terror",
"type": "bool",
"label": "Incluir en Novedades - Terror",
"default": true,
"enabled": true,
"visible": true
},
{
"id": "include_in_newest_documentales",
"type": "bool",
"label": "Incluir en Novedades - Documentales",
"default": true,
"enabled": true,
"visible": true
}
]
}
Executable → Regular
+43 -44
View File
@@ -1,44 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.alfa" name="Alfa" version="2.8.1" provider-name="Alfa Addon"> <addon id="plugin.video.alfa" name="Alfa" version="2.8.2" provider-name="Alfa Addon">
<requires> <requires>
<import addon="xbmc.python" version="2.1.0"/> <import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.libtorrent" optional="true"/> <import addon="script.module.libtorrent" optional="true"/>
</requires> </requires>
<extension point="xbmc.python.pluginsource" library="default.py"> <extension point="xbmc.python.pluginsource" library="default.py">
<provides>video</provides> <provides>video</provides>
</extension> </extension>
<extension point="xbmc.addon.metadata"> <extension point="xbmc.addon.metadata">
<summary lang="es">Navega con Kodi por páginas web.</summary> <summary lang="es">Navega con Kodi por páginas web.</summary>
<assets> <assets>
<icon>logo-cumple.png</icon> <icon>logo-cumple.png</icon>
<fanart>fanart1.jpg</fanart> <fanart>fanart1.jpg</fanart>
<screenshot>resources/media/themes/ss/1.jpg</screenshot> <screenshot>resources/media/themes/ss/1.jpg</screenshot>
<screenshot>resources/media/themes/ss/2.jpg</screenshot> <screenshot>resources/media/themes/ss/2.jpg</screenshot>
<screenshot>resources/media/themes/ss/3.jpg</screenshot> <screenshot>resources/media/themes/ss/3.jpg</screenshot>
<screenshot>resources/media/themes/ss/4.jpg</screenshot> <screenshot>resources/media/themes/ss/4.jpg</screenshot>
</assets> </assets>
<news>[B]Estos son los cambios para esta versión:[/B] <news>[B]Estos son los cambios para esta versión:[/B]
[COLOR green][B]Arreglos[/B][/COLOR] [COLOR green][B]Arreglos[/B][/COLOR]
¤ allpelicuas ¤ asialiveaction ¤ danimados ¤ allcalidad ¤ animeflv ¤ streamcloud
¤ MixToon ¤ pack +18 ¤ AbToon ¤ pack +18 ¤ divxtotal ¤ elitetorrent
¤ hdfull ¤ estrenosgo ¤ mejortorrent ¤ mejortorrent1
¤ newpct1 ¤ pelismagnet
[COLOR green][B]Novedades[/B][/COLOR]
¤ uploadmp4 ¤ HomeCine ¤ CinemaUpload Agradecimientos a @shlibidon y @nyicris por colaborar con esta versión
</news>
</news> <description lang="es">Navega con Kodi por páginas web para ver sus videos de manera fácil.</description>
<description lang="es">Navega con Kodi por páginas web para ver sus videos de manera fácil.</description> <summary lang="en">Browse web pages using Kodi</summary>
<summary lang="en">Browse web pages using Kodi</summary> <description lang="en">Browse web pages using Kodi, you can easily watch their video content.</description>
<description lang="en">Browse web pages using Kodi, you can easily watch their video content.</description> <disclaimer>[COLOR red]The owners and submitters to this addon do not host or distribute any of the content displayed by these addons nor do they have any affiliation with the content providers.[/COLOR]</disclaimer>
<disclaimer>[COLOR red]The owners and submitters to this addon do not host or distribute any of the content displayed by these addons nor do they have any affiliation with the content providers.[/COLOR]</disclaimer> <platform>all</platform>
<platform>all</platform> <license>GNU GPL v3</license>
<license>GNU GPL v3</license> <forum>foro</forum>
<forum>foro</forum> <website>web</website>
<website>web</website> <email>my@email.com</email>
<email>my@email.com</email> <source>https://github.com/alfa-addon/addon</source>
<source>https://github.com/alfa-addon/addon</source> </extension>
</extension> <extension point="xbmc.service" library="videolibrary_service.py" start="login|startup">
<extension point="xbmc.service" library="videolibrary_service.py" start="login|startup"> </extension>
</extension> </addon>
</addon>
+3 -19
View File
@@ -14,6 +14,7 @@ host = 'http://www.alsoporn.com'
def mainlist(item): def mainlist(item):
logger.info() logger.info()
itemlist = [] itemlist = []
# itemlist.append( Item(channel=item.channel, title="Nuevos" , action="lista", url=host + "/en/g/All/new/1"))
itemlist.append( Item(channel=item.channel, title="Top" , action="lista", url=host + "/g/All/top/1")) itemlist.append( Item(channel=item.channel, title="Top" , action="lista", url=host + "/g/All/top/1"))
itemlist.append( Item(channel=item.channel, title="Categorias" , action="categorias", url=host)) itemlist.append( Item(channel=item.channel, title="Categorias" , action="categorias", url=host))
itemlist.append( Item(channel=item.channel, title="Buscar", action="search")) itemlist.append( Item(channel=item.channel, title="Buscar", action="search"))
@@ -33,23 +34,6 @@ def search(item, texto):
return [] return []
def catalogo(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'<h3>CLIPS</h3>(.*?)<h3>FILM</h3>')
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
patron = '<li><a href="([^"]+)" title="">.*?'
patron += '<span class="videos-count">([^"]+)</span><span class="title">([^"]+)</span>'
matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,cantidad,scrapedtitle in matches:
scrapedplot = ""
scrapedthumbnail = ""
itemlist.append( Item(channel=item.channel, action="lista", title=scrapedtitle, url=scrapedurl,
thumbnail=scrapedthumbnail, plot=scrapedplot) )
return itemlist
def categorias(item): def categorias(item):
logger.info() logger.info()
itemlist = [] itemlist = []
@@ -96,10 +80,10 @@ def play(item):
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
scrapedurl = scrapertools.find_single_match(data,'<iframe frameborder=0 scrolling="no" src=\'([^\']+)\'') scrapedurl = scrapertools.find_single_match(data,'<iframe frameborder=0 scrolling="no" src=\'([^\']+)\'')
data = scrapertools.cachePage(scrapedurl) data = httptools.downloadpage(item.url).data
scrapedurl1 = scrapertools.find_single_match(data,'<iframe src="(.*?)"') scrapedurl1 = scrapertools.find_single_match(data,'<iframe src="(.*?)"')
scrapedurl1 = scrapedurl1.replace("//www.playercdn.com/ec/i2.php?", "https://www.trinitytube.xyz/ec/i2.php?") scrapedurl1 = scrapedurl1.replace("//www.playercdn.com/ec/i2.php?", "https://www.trinitytube.xyz/ec/i2.php?")
data = scrapertools.cachePage(scrapedurl1) data = httptools.downloadpage(item.url).data
scrapedurl2 = scrapertools.find_single_match(data,'<source src="(.*?)"') scrapedurl2 = scrapertools.find_single_match(data,'<source src="(.*?)"')
itemlist.append(item.clone(action="play", title=item.title, fulltitle = item.title, url=scrapedurl2)) itemlist.append(item.clone(action="play", title=item.title, fulltitle = item.title, url=scrapedurl2))
return itemlist return itemlist
+1 -1
View File
@@ -41,7 +41,7 @@ def catalogo(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'<strong class="popup-title">Canales</strong>(.*?)<strong>Models</strong>') data = scrapertools.find_single_match(data,'<strong class="popup-title">Canales</strong>(.*?)<strong>Models</strong>')
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
patron = '<li><a class="item" href="([^"]+)" title="([^"]+)">' patron = '<li><a class="item" href="([^"]+)" title="([^"]+)">'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
-146
View File
@@ -1,146 +0,0 @@
# -*- coding: utf-8 -*-
import re
import urllib
from core import jsontools as json, httptools
from core import scrapertools
from core.item import Item
from platformcode import logger
url_api = ""
beeg_salt = ""
Host = "https://beeg.com"
def get_api_url():
global url_api
global beeg_salt
data = scrapertools.downloadpage(Host)
version = re.compile('<script src="/static/cpl/([\d]+).js"').findall(data)[0]
js_url = Host + "/static/cpl/" + version + ".js"
url_api = Host + "/api/v6/" + version
data = scrapertools.downloadpage(js_url)
beeg_salt = re.compile('beeg_salt="([^"]+)"').findall(data)[0]
def decode(key):
a = beeg_salt
e = unicode(urllib.unquote(key), "utf8")
t = len(a)
o = ""
for n in range(len(e)):
r = ord(e[n:n + 1])
i = n % t
s = ord(a[i:i + 1]) % 21
o += chr(r - s)
n = []
for x in range(len(o), 0, -3):
if x >= 3:
n.append(o[(x - 3):x])
else:
n.append(o[0:x])
return "".join(n)
get_api_url()
def mainlist(item):
logger.info()
get_api_url()
itemlist = []
itemlist.append(Item(channel=item.channel, action="videos", title="Útimos videos", url=url_api + "/index/main/0/pc",
viewmode="movie"))
# itemlist.append(Item(channel=item.channel, action="listcategorias", title="Listado categorias Populares",
# url=url_api + "/index/main/0/pc", extra="popular"))
itemlist.append(Item(channel=item.channel, action="listcategorias", title="Listado categorias completo",
url=url_api + "/index/main/0/pc", extra="nonpopular"))
itemlist.append(
Item(channel=item.channel, action="search", title="Buscar", url=url_api + "/index/search/0/pc?query=%s"))
return itemlist
def videos(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
JSONData = json.load(data)
for Video in JSONData["videos"]:
thumbnail = "http://img.beeg.com/236x177/" + Video["id"] + ".jpg"
url = url_api + "/video/" + Video["id"]
title = Video["title"]
itemlist.append(
Item(channel=item.channel, action="play", title=title, url=url, thumbnail=thumbnail, plot="", show="",
folder=True, contentType="movie"))
# Paginador
Actual = int(scrapertools.get_match(item.url, url_api + '/index/[^/]+/([0-9]+)/pc'))
if JSONData["pages"] - 1 > Actual:
scrapedurl = item.url.replace("/" + str(Actual) + "/", "/" + str(Actual + 1) + "/")
itemlist.append(
Item(channel=item.channel, action="videos", title="Página Siguiente", url=scrapedurl, thumbnail="",
folder=True, viewmode="movie"))
return itemlist
def listcategorias(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
JSONData = json.load(data)
# for Tag in JSONData["tags"][item.extra]:
for Tag in JSONData["tags"]:
url = url_api + "/index/tag/0/pc?tag=" + Tag["tag"]
title = '%s - %s' % (str(Tag["tag"]), str(Tag["videos"]))
# title = title[:1].upper() + title[1:]
itemlist.append(
Item(channel=item.channel, action="videos", title=title, url=url, folder=True, viewmode="movie"))
return itemlist
def search(item, texto):
logger.info()
texto = texto.replace(" ", "+")
item.url = item.url % (texto)
try:
return videos(item)
# Se captura la excepción, para no interrumpir al buscador global si un canal falla
except:
import sys
for line in sys.exc_info():
logger.error("%s" % line)
return []
def play(item):
logger.info()
itemlist = []
data = scrapertools.downloadpage(item.url)
JSONData = json.load(data)
for key in JSONData:
videourl = re.compile("([0-9]+p)", re.DOTALL).findall(key)
if videourl:
videourl = videourl[0]
if not JSONData[videourl] == None:
url = JSONData[videourl]
url = url.replace("{DATA_MARKERS}", "data=pc.ES")
viedokey = re.compile("key=(.*?)%2Cend=", re.DOTALL).findall(url)[0]
url = url.replace(viedokey, decode(viedokey))
if not url.startswith("https:"):
url = "https:" + url
title = videourl
itemlist.append(["%s %s [directo]" % (title, url[-4:]), url])
itemlist.sort(key=lambda item: item[0])
return itemlist
+10 -6
View File
@@ -14,6 +14,7 @@ host = 'https://www.cine-online.eu'
IDIOMAS = {'Español': 'ESP', 'Cast': 'ESP', 'Latino': 'LAT', 'Lat': 'LAT', 'Subtitulado': 'VOSE', 'Sub': 'VOSE'} IDIOMAS = {'Español': 'ESP', 'Cast': 'ESP', 'Latino': 'LAT', 'Lat': 'LAT', 'Subtitulado': 'VOSE', 'Sub': 'VOSE'}
list_language = IDIOMAS.values() list_language = IDIOMAS.values()
list_servers = ['Streamango', 'Vidoza', 'Openload', 'Streamcherry', 'Netutv'] list_servers = ['Streamango', 'Vidoza', 'Openload', 'Streamcherry', 'Netutv']
# list_quality = ['Brscreener', 'HD', 'TS']
list_quality = [] list_quality = []
__channel__='cineonline' __channel__='cineonline'
__comprueba_enlaces__ = config.get_setting('comprueba_enlaces', __channel__) __comprueba_enlaces__ = config.get_setting('comprueba_enlaces', __channel__)
@@ -75,7 +76,7 @@ def categorias(item):
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
if "Año" in item.title: if "Año" in item.title:
data = scrapertools.get_match(data,'<h3>Año de estreno(.*?)</ul>') data = scrapertools.find_single_match(data,'<h3>Año de estreno(.*?)</ul>')
patron = '<li><a href="([^"]+)">(\d+)</(\w)>' patron = '<li><a href="([^"]+)">(\d+)</(\w)>'
else: else:
patron = '<li class="cat-item cat-item-\d+"><a href="([^"]+)">([^"]+)</a> <span>(\d+)</span>' patron = '<li class="cat-item cat-item-\d+"><a href="([^"]+)">([^"]+)</a> <span>(\d+)</span>'
@@ -89,6 +90,9 @@ def categorias(item):
return itemlist return itemlist
def lista(item): def lista(item):
logger.info() logger.info()
itemlist = [] itemlist = []
@@ -200,11 +204,11 @@ def findvideos(item):
itemlist = filtertools.get_links(itemlist, item, list_language) itemlist = filtertools.get_links(itemlist, item, list_language)
# Requerido para AutoPlay # Requerido para AutoPlay
autoplay.start(itemlist, item) autoplay.start(itemlist, item)
if not "/episodios/" in item.url:
if config.get_videolibrary_support() and len(itemlist) > 0 and item.extra !='findvideos': if config.get_videolibrary_support() and len(itemlist) > 0 and item.extra !='findvideos' and not "/episodios/" in item.url :
itemlist.append(Item(channel=item.channel, action="add_pelicula_to_library", itemlist.append(Item(channel=item.channel, action="add_pelicula_to_library",
title='[COLOR yellow]Añadir esta pelicula a la videoteca[/COLOR]', url=item.url, title='[COLOR yellow]Añadir esta pelicula a la videoteca[/COLOR]', url=item.url,
extra="findvideos", contentTitle=item.contentTitle)) extra="findvideos", contentTitle=item.contentTitle))
return itemlist return itemlist
+1 -1
View File
@@ -37,7 +37,7 @@ def categorias(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'<div class="category">(.*?)</ul>') data = scrapertools.find_single_match(data,'<div class="category">(.*?)</ul>')
patron = '<li><a href="(.*?)".*?>(.*?)</a></li>' patron = '<li><a href="(.*?)".*?>(.*?)</a></li>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
scrapertools.printMatches(matches) scrapertools.printMatches(matches)
+2 -2
View File
@@ -85,7 +85,7 @@ def submenu(item):
if item.extra == "series": if item.extra == "series":
item.url_plus = "serie/" item.url_plus = "series-12/"
itemlist.append(item.clone(title="Series completas", action="listado", url=item.url + item.url_plus, url_plus=item.url_plus, thumbnail=thumb_series, extra="series")) itemlist.append(item.clone(title="Series completas", action="listado", url=item.url + item.url_plus, url_plus=item.url_plus, thumbnail=thumb_series, extra="series"))
itemlist.append(item.clone(title="Alfabético A-Z", action="alfabeto", url=item.url + item.url_plus + "?s=letra-%s", url_plus=item.url_plus, thumbnail=thumb_series, extra="series")) itemlist.append(item.clone(title="Alfabético A-Z", action="alfabeto", url=item.url + item.url_plus + "?s=letra-%s", url_plus=item.url_plus, thumbnail=thumb_series, extra="series"))
@@ -141,7 +141,7 @@ def categorias(item):
if not extra3: if not extra3:
itemlist.append(item.clone(title="Todas las " + item.extra.upper(), action="listado")) itemlist.append(item.clone(title="Todas las " + item.extra.upper(), action="listado"))
itemlist.append(item.clone(title="Alfabético A-Z", action="alfabeto", url=item.url + "?s=letra-%s")) itemlist.append(item.clone(title="Alfabético A-Z", action="alfabeto", url=item.url + "?s=letra-%s"))
itemlist.append(item.clone(title="Géneros", url=item.url)) #itemlist.append(item.clone(title="Géneros", url=item.url))
for scrapedurl, scrapedtitle in matches: for scrapedurl, scrapedtitle in matches:
if item.url_plus not in scrapedurl: if item.url_plus not in scrapedurl:
+11 -11
View File
@@ -24,7 +24,7 @@ list_language = IDIOMAS.values()
list_quality = [] list_quality = []
list_servers = ['torrent'] list_servers = ['torrent']
host = 'http://www.elitetorrent.biz' host = 'http://www.elitetorrent.io'
channel = "elitetorrent" channel = "elitetorrent"
categoria = channel.capitalize() categoria = channel.capitalize()
@@ -85,9 +85,9 @@ def submenu(item):
return itemlist #Algo no funciona, pintamos lo que tenemos return itemlist #Algo no funciona, pintamos lo que tenemos
patron = '<div class="cab_menu">.*?<\/div>' #Menú principal patron = '<div class="cab_menu">.*?<\/div>' #Menú principal
data1 = scrapertools.get_match(data, patron) data1 = scrapertools.find_single_match(data, patron)
patron = '<div id="menu_langen">.*?<\/div>' #Menú de idiomas patron = '<div id="menu_langen">.*?<\/div>' #Menú de idiomas
data1 += scrapertools.get_match(data, patron) data1 += scrapertools.find_single_match(data, patron)
patron = '<a href="(.*?)".*?title="(.*?)"' #Encontrar todos los apartados patron = '<a href="(.*?)".*?title="(.*?)"' #Encontrar todos los apartados
matches = re.compile(patron, re.DOTALL).findall(data1) matches = re.compile(patron, re.DOTALL).findall(data1)
@@ -155,16 +155,16 @@ def listado(item):
patron = '<div id="principal">.*?<\/nav><\/div><\/div>' patron = '<div id="principal">.*?<\/nav><\/div><\/div>'
data = scrapertools.find_single_match(data, patron) data = scrapertools.find_single_match(data, patron)
patron = '<li>.*?<a href="(.*?)".*?' #url patron = '<li>\s*<div\s*class="[^"]+">\s*<a href="([^"]+)"\s*' #url
patron += 'title="(.*?)".*?' #título patron += 'title="([^"]+)"\s*(?:alt="[^"]+")?\s*>\s*' #título
patron += 'src="(.*?)".*?' #thumb patron += '<img (?:class="[^"]+")?\s*src="([^"]+)"\s*border="[^"]+"\s*' #thumb
patron += "title='(.*?)'.*?" #categoría, idioma patron += 'title="([^"]+)".*?' #categoría, idioma
patron += '"><i>(.*?)<\/i><\/span.*?' #calidad patron += '<span class="[^"]+" style="[^"]+"\s*><i>(.*?)<\/i><\/span.*?' #calidad
patron += '="dig1">(.*?)<.*?' #tamaño patron += '="dig1">(.*?)<.*?' #tamaño
patron += '="dig2">(.*?)<\/span><\/div>' #tipo tamaño patron += '="dig2">(.*?)<\/span><\/div>' #tipo tamaño
matches = re.compile(patron, re.DOTALL).findall(data) matches = re.compile(patron, re.DOTALL).findall(data)
if not matches and not '<title>503 Backend fetch failed</title>' in data: #error if not matches and not '<title>503 Backend fetch failed</title>' in data and not 'No se han encontrado resultados' in data: #error
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
if item.intervencion: #Sí ha sido clausurada judicialmente if item.intervencion: #Sí ha sido clausurada judicialmente
item, itemlist = generictools.post_tmdb_listado(item, itemlist) #Llamamos al método para el pintado del error item, itemlist = generictools.post_tmdb_listado(item, itemlist) #Llamamos al método para el pintado del error
+1 -1
View File
@@ -37,7 +37,7 @@ def categorias(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'<h2>TAGS</h2>(.*?)<div class="sideitem"') data = scrapertools.find_single_match(data,'<h2>TAGS</h2>(.*?)<div class="sideitem"')
patron = '<a href="(.*?)".*?>(.*?)</a>' patron = '<a href="(.*?)".*?>(.*?)</a>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedtitle in matches: for scrapedurl,scrapedtitle in matches:
+23 -13
View File
@@ -25,6 +25,7 @@ list_quality = []
list_servers = ['torrent'] list_servers = ['torrent']
host = 'http://estrenosby.net/' # 'http://estrenosli.org/' host = 'http://estrenosby.net/' # 'http://estrenosli.org/'
host_alt = 'http://estrenoske.net/'
channel = "estrenosgo" channel = "estrenosgo"
color1, color2, color3 = ['0xFF58D3F7', '0xFF2E64FE', '0xFF0404B4'] color1, color2, color3 = ['0xFF58D3F7', '0xFF2E64FE', '0xFF0404B4']
@@ -320,7 +321,8 @@ def listado(item):
patron_serie = '<div id="where_i_am">.*?<a href="[^"]+">.*?<\/a>.*?<a href="([^"]+)">' patron_serie = '<div id="where_i_am">.*?<a href="[^"]+">.*?<\/a>.*?<a href="([^"]+)">'
url = scrapertools.find_single_match(data_serie, patron_serie) #buscamos la url de la serie completa url = scrapertools.find_single_match(data_serie, patron_serie) #buscamos la url de la serie completa
if url: if url:
url = host + url if host not in url and host_alt not in url:
url = host + url
extra = 'series' #es una serie completa extra = 'series' #es una serie completa
title_lista += [cat_sec] #la añadimos a la lista de series completas procesadas title_lista += [cat_sec] #la añadimos a la lista de series completas procesadas
title = cat_sec #salvamos el título de la serie completa title = cat_sec #salvamos el título de la serie completa
@@ -361,7 +363,10 @@ def listado(item):
quality_alt = cat_sec.lower().strip() quality_alt = cat_sec.lower().strip()
item_local.extra = extra #guardamos el extra procesado item_local.extra = extra #guardamos el extra procesado
item_local.url = url #guardamos la url final item_local.url = url #guardamos la url final
item_local.thumbnail = host[:-1] + scrapedthumbnail #guardamos el thumb if host not in scrapedthumbnail and host_alt not in scrapedthumbnail:
item_local.thumbnail = host[:-1] + scrapedthumbnail #guardamos el thumb
else:
item_local.thumbnail = scrapedthumbnail #guardamos el thumb sin Host
item_local.context = "['buscar_trailer']" item_local.context = "['buscar_trailer']"
item_local.contentType = "movie" #por defecto, son películas item_local.contentType = "movie" #por defecto, son películas
@@ -743,7 +748,7 @@ def findvideos(item):
#Ahora tratamos los enlaces .torrent #Ahora tratamos los enlaces .torrent
itemlist_alt = [] #Usamos una lista intermedia para poder ordenar los episodios itemlist_alt = [] #Usamos una lista intermedia para poder ordenar los episodios
if matches_torrent: if matches_torrent:
for scrapedurl, scrapedquality, scrapedlang in matches_torrent: #leemos los torrents con la diferentes calidades for scrapedurl, scrapedquality, scrapedlang in matches_torrent: #leemos los torrents con la diferentes calidades
#Generamos una copia de Item para trabajar sobre ella #Generamos una copia de Item para trabajar sobre ella
item_local = item.clone() item_local = item.clone()
@@ -772,7 +777,7 @@ def findvideos(item):
patron = '<div class="linksDescarga"><span class="titulo">Descargar Torrent: <\/span><br><a href="([^"]+)" class="TTlink">&raquo;\s?(.*?)\s?&laquo;<\/a>' patron = '<div class="linksDescarga"><span class="titulo">Descargar Torrent: <\/span><br><a href="([^"]+)" class="TTlink">&raquo;\s?(.*?)\s?&laquo;<\/a>'
matches = re.compile(patron, re.DOTALL).findall(data) matches = re.compile(patron, re.DOTALL).findall(data)
else: else:
matches = item.emergency_urls[2][0] #Guardamos los matches de Directos, si los hay matches = item.emergency_urls[2][0] #Guardamos los matches de Directos, si los hay
del item.emergency_urls[2][0] #Una vez tratado lo limpiamos del item.emergency_urls[2][0] #Una vez tratado lo limpiamos
data = 'xyz123' #iniciamos data para que no dé problemas data = 'xyz123' #iniciamos data para que no dé problemas
@@ -781,15 +786,20 @@ def findvideos(item):
if not data or not matches: if not data or not matches:
logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / URL: " + item_local.url + " / DATA: " + data) logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / URL: " + item_local.url + " / DATA: " + data)
continue #si no hay más datos, algo no funciona, pasamos a Ver Online continue #si no hay más datos, algo no funciona, pasamos a Ver Online
#logger.debug(patron) #logger.debug(patron)
#logger.debug(matches) #logger.debug(matches)
#logger.debug(data) #logger.debug(data)
for scrapedtorrent, scrapedtitle in matches: for scrapedtorrent_alt, scrapedtitle in matches:
if host not in scrapedtorrent_alt and host_alt not in scrapedtorrent_alt:
scrapedtorrent = host + scrapedtorrent_alt
else:
scrapedtorrent = scrapedtorrent_alt
if item.videolibray_emergency_urls: if item.videolibray_emergency_urls:
item.emergency_urls[0].append(host + scrapedtorrent) item.emergency_urls[0].append(scrapedtorrent)
else: else:
item_local = item_local.clone() item_local = item_local.clone()
quality = item_local.quality quality = item_local.quality
@@ -829,19 +839,19 @@ def findvideos(item):
quality = '[%s] %s' % (qualityscraped, item_local.quality) quality = '[%s] %s' % (qualityscraped, item_local.quality)
#Ahora pintamos el link del Torrent #Ahora pintamos el link del Torrent
item_local.url = host + scrapedtorrent item_local.url = scrapedtorrent
if item.emergency_urls and not item.videolibray_emergency_urls: if item.emergency_urls and not item.videolibray_emergency_urls:
item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA
if item.armagedon: if item.armagedon:
item_local.url = item.emergency_urls[0][0] #... ponemos la emergencia como primaria item_local.url = item.emergency_urls[0][0] #... ponemos la emergencia como primaria
del item.emergency_urls[0][0] #Una vez tratado lo limpiamos del item.emergency_urls[0][0] #Una vez tratado lo limpiamos
size = '' size = ''
if not item.armagedon: if not item.armagedon:
size = generictools.get_torrent_size(item_local.url) #Buscamos el tamaño en el .torrent size = generictools.get_torrent_size(item_local.url) #Buscamos el tamaño en el .torrent
if size: if size:
quality += ' [%s]' % size quality += ' [%s]' % size
if item.armagedon: #Si es catastrófico, lo marcamos if item.armagedon: #Si es catastrófico, lo marcamos
quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % quality quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % quality
item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (quality, str(item_local.language)) item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (quality, str(item_local.language))
+1 -1
View File
@@ -15,7 +15,7 @@ def mainlist(item):
if item.url=="": if item.url=="":
item.url = "http://www.filmovix.net/videoscategory/porno/" item.url = "http://www.filmovix.net/videoscategory/porno/"
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'<h1 class="cat_head">XXX</h1>(.*?)<h3> Novo dodato </h3>') data = scrapertools.find_single_match(data,'<h1 class="cat_head">XXX</h1>(.*?)<h3> Novo dodato </h3>')
patron = '<li class="clearfix">.*?' patron = '<li class="clearfix">.*?'
patron += 'src="([^"]+)".*?' patron += 'src="([^"]+)".*?'
patron += '<p class="title"><a href="([^"]+)" rel="bookmark" title="([^"]+)">' patron += '<p class="title"><a href="([^"]+)" rel="bookmark" title="([^"]+)">'
+2 -1
View File
@@ -80,7 +80,8 @@ def lista(item):
def play(item): def play(item):
logger.info() logger.info()
itemlist = [] itemlist = []
url = scrapertools.find_single_match(scrapertools.cachePage(item.url),'<iframe src="([^"]+)"') data = httptools.downloadpage(item.url).data
url = scrapertools.find_single_match(data,'<iframe src="([^"]+)"')
data = httptools.downloadpage(url).data data = httptools.downloadpage(url).data
patron = 'html5player.setVideoHLS\\(\'([^\']+)\'' patron = 'html5player.setVideoHLS\\(\'([^\']+)\''
matches = scrapertools.find_multiple_matches(data, patron) matches = scrapertools.find_multiple_matches(data, patron)
@@ -39,7 +39,7 @@ def catalogo(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'>Top Sites</a>(.*?)</aside>') data = scrapertools.find_single_match(data,'>Top Sites</a>(.*?)</aside>')
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
patron = '<li id="menu-item-\d+".*?<a href="([^"]+)">([^"]+)</a></li>' patron = '<li id="menu-item-\d+".*?<a href="([^"]+)">([^"]+)</a></li>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
@@ -54,7 +54,7 @@ def categorias(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'Top Tags(.*?)</ul>') data = scrapertools.find_single_match(data,'Top Tags(.*?)</ul>')
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
patron = '<a href="([^"]+)">(.*?)</a>' patron = '<a href="([^"]+)">(.*?)</a>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
@@ -498,6 +498,7 @@ def findvideos(item):
return item #Devolvemos el Item de la llamada return item #Devolvemos el Item de la llamada
else: else:
return itemlist #salimos return itemlist #salimos
data = unicode(data, "utf-8", errors="replace").encode("utf-8") data = unicode(data, "utf-8", errors="replace").encode("utf-8")
data = scrapertools.find_single_match(data, 'div id="Tokyo" [^>]+>(.*?)</div>') #Seleccionamos la zona de links data = scrapertools.find_single_match(data, 'div id="Tokyo" [^>]+>(.*?)</div>') #Seleccionamos la zona de links
+47 -42
View File
@@ -5,9 +5,10 @@ import sys
import urllib import urllib
import urlparse import urlparse
import time import time
import traceback
from channelselector import get_thumb from channelselector import get_thumb
from core import httptools from core import httptools, proxytools
from core import scrapertools from core import scrapertools
from core import servertools from core import servertools
from core.item import Item from core.item import Item
@@ -26,7 +27,7 @@ list_servers = ['torrent']
channel = "mejortorrent" channel = "mejortorrent"
host = 'http://www.mejortorrent.tv/' host = 'http://www.mejortorrent.tv'
host_sufix = '.tv' host_sufix = '.tv'
#host = config.get_setting('domain_name', channel) #host = config.get_setting('domain_name', channel)
@@ -61,7 +62,7 @@ def mainlist(item):
thumbnail=thumb_pelis_hd)) thumbnail=thumb_pelis_hd))
itemlist.append(Item(channel=item.channel, title="Películas Listado Alfabetico", action="alfabeto", itemlist.append(Item(channel=item.channel, title="Películas Listado Alfabetico", action="alfabeto",
url= host + "/peliculas-buscador.html" + url= host + "/peliculas-buscador.html" +
"?campo=letra&valor&valor2=Acci%%F3n&valor3=%s&valor4=3&submit=Buscar", extra="peliculas", "?campo=letra&valor=&valor2=Acci%%F3n&valor3=%s&valor4=3&submit=Buscar", extra="peliculas",
thumbnail=thumb_pelis)) thumbnail=thumb_pelis))
itemlist.append(Item(channel=item.channel, title="Series", action="listado", extra="series", tipo=False, itemlist.append(Item(channel=item.channel, title="Series", action="listado", extra="series", tipo=False,
url= host + "/torrents-de-series.html", thumbnail=thumb_series)) url= host + "/torrents-de-series.html", thumbnail=thumb_series))
@@ -102,7 +103,7 @@ def alfabeto(item):
url= host + "/secciones.php?sec=descargas&ap=series_hd&func=mostrar&letra=.")) url= host + "/secciones.php?sec=descargas&ap=series_hd&func=mostrar&letra=."))
for letra in ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']: for letra in ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']:
itemlist.append(Item(channel=item.channel, action="listado", title=letra, extra="series", tipo=True, itemlist.append(Item(channel=item.channel, action="listado", title=letra, extra="series", tipo=True,
url= host + "/secciones.php?sec=descargas&ap=series_hd&func=mostrar&letra=" + letra.lower())) url= host + "/secciones.php?sec=descargas&ap=series_hd&func=mostrar&letra=" + letra))
elif item.extra == "series" or item.extra == "documentales": elif item.extra == "series" or item.extra == "documentales":
itemlist.append(Item(channel=item.channel, action="listado", title="Todas", extra=item.extra, tipo=True, url= host + "/" + item.extra + "-letra-..html")) itemlist.append(Item(channel=item.channel, action="listado", title="Todas", extra=item.extra, tipo=True, url= host + "/" + item.extra + "-letra-..html"))
@@ -112,7 +113,7 @@ def alfabeto(item):
elif item.extra == "peliculas": elif item.extra == "peliculas":
itemlist.append(Item(channel=item.channel, action="listado", title="Todas", extra=item.extra, tipo=True, url=item.url % ".")) itemlist.append(Item(channel=item.channel, action="listado", title="Todas", extra=item.extra, tipo=True, url=item.url % "."))
for letra in ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']: for letra in ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']:
itemlist.append(Item(channel=item.channel, action="listado", title=letra, extra=item.extra, tipo=True, url=item.url % letra.lower())) itemlist.append(Item(channel=item.channel, action="listado", title=letra, extra=item.extra, tipo=True, url=item.url % letra))
return itemlist return itemlist
@@ -128,13 +129,15 @@ def listado(item):
del item.totalItems del item.totalItems
try: try:
# La url de Películas por orden Alfabético tiene un formato distinto data = ''
# La url de Películas por orden Alfabético tiene un formato distinto
if item.extra == "peliculas" and item.tipo: if item.extra == "peliculas" and item.tipo:
url = item.url.split("?") url = item.url.split("?")
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(url[0], post=url[1]).data) data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(url[0], post=url[1]).data)
else: else:
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data) data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data)
except: except:
logger.error(traceback.format_exc())
logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log'))
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
@@ -145,35 +148,35 @@ def listado(item):
# En este canal las url's y los títulos tienen diferente formato dependiendo del contenido # En este canal las url's y los títulos tienen diferente formato dependiendo del contenido
if item.extra == "peliculas" and item.tipo: #Desde Lista Alfabética if item.extra == "peliculas" and item.tipo: #Desde Lista Alfabética
patron = "<a href='(/peli-descargar-torrent[^']+)'()" patron = "<a href='((?:[^']+)?/peli-descargar-torrent[^']+)'()"
patron_enlace = "/peli-descargar-torrent-\d+-(.*?)\.html" patron_enlace = "/peli-descargar-torrent-\d+-(.*?)\.html"
patron_title = "<a href='/peli-descargar-torrent[^']+'[^>]+>([^>]+)</a>(\s*<b>([^>]+)</b>)?" patron_title = "<a href='(?:[^']+)?/peli-descargar-torrent[^']+'[^>]+>([^>]+)</a>(\s*<b>([^>]+)</b>)?"
item.action = "findvideos" item.action = "findvideos"
item.contentType = "movie" item.contentType = "movie"
pag = False #No hay paginación pag = False #No hay paginación
elif item.extra == "peliculas" and not item.tipo: #Desde Menú principal elif item.extra == "peliculas" and not item.tipo: #Desde Menú principal
patron = '<a href="(/peli-descargar-torrent[^"]+)">?' patron = '<a href="((?:[^"]+)?/peli-descargar-torrent[^"]+)">?'
patron += '<img src="([^"]+)"[^<]+</a>' patron += '<img src="([^"]+)"[^<]+</a>'
patron_enlace = "/peli-descargar-torrent-\d+-(.*?)\.html" patron_enlace = "/peli-descargar-torrent-\d+-(.*?)\.html"
patron_title = '<a href="/peli-descargar-torrent[^"]+">([^<]+)</a>(\s*<b>([^>]+)</b>)?' patron_title = '<a href="(?:[^"]+)?/peli-descargar-torrent[^"]+">([^<]+)</a>(\s*<b>([^>]+)</b>)?'
item.action = "findvideos" item.action = "findvideos"
item.contentType = "movie" item.contentType = "movie"
pag = True #Sí hay paginación pag = True #Sí hay paginación
cnt_tot = 25 # Poner el num. máximo de items por página. Parece que hay 50 cnt_tot = 25 # Poner el num. máximo de items por página. Parece que hay 50
elif item.extra == "series" and item.tipo: elif item.extra == "series" and item.tipo:
patron = "<a href='(/serie-descargar-torrent[^']+)'>()" patron = "<a href='((?:[^']+)?/serie-descargar-torrent[^']+)'>()"
patron_enlace = "\/serie-descargar-torrent*.-\d+-?\d+-(.*?)\.html" patron_enlace = "\/serie-descargar-torrent*.-\d+-?\d+-(.*?)\.html"
patron_title = "<a href='\/serie-descargar-torrent[^']+'>([^<]+)<\/a>(\s*<b>([^>]+)<\/b>)?" patron_title = "<a href='(?:[^']+)?\/serie-descargar-torrent[^']+'>([^<]+)<\/a>(\s*<b>([^>]+)<\/b>)?"
patron_title_ep = "\/serie-descargar-torrent*.-\d+-?\d+-(.*?)-\d+x\d+.*?\.html" patron_title_ep = "\/serie-descargar-torrent*.-\d+-?\d+-(.*?)-\d+x\d+.*?\.html"
patron_title_se = "\/serie-descargar-torrent*.-\d+-?\d+-(.*?)-\d+-Temp.*?\.html" patron_title_se = "\/serie-descargar-torrent*.-\d+-?\d+-(.*?)-\d+-Temp.*?\.html"
item.action = "episodios" item.action = "episodios"
item.contentType = "season" item.contentType = "season"
pag = False pag = False
elif item.extra == "series" and not item.tipo: elif item.extra == "series" and not item.tipo:
patron = '<a href="(\/serie-[^a_z]{0,10}descargar-torrent[^"]+)">?' patron = '<a href="((?:[^"]+)?\/serie-[^a_z]{0,10}descargar-torrent[^"]+)">?'
patron += '<img src="([^"]+)"[^<]+</a>' patron += '<img src="([^"]+)"[^<]+</a>'
patron_enlace = "\/serie-[^a_z]{0,10}descargar-torrent*.-\d+-?\d+-(.*?)\.html" patron_enlace = "\/serie-[^a_z]{0,10}descargar-torrent*.-\d+-?\d+-(.*?)\.html"
patron_title = '<a href="/serie-[^a_z]{0,10}descargar-torrent[^"]+">([^<]+)</a>(\s*<b>([^>]+)</b>)?' patron_title = '<a href="(?:[^"]+)?/serie-[^a_z]{0,10}descargar-torrent[^"]+">([^<]+)</a>(\s*<b>([^>]+)</b>)?'
patron_title_ep = "\/serie-[^a_z]{0,10}descargar-torrent*.-\d+-?\d+-(.*?)-\d+x\d+.*?\.html" patron_title_ep = "\/serie-[^a_z]{0,10}descargar-torrent*.-\d+-?\d+-(.*?)-\d+x\d+.*?\.html"
patron_title_se = "\/serie-[^a_z]{0,10}descargar-torrent*.-\d+-?\d+-(.*?)-\d+-Temp.*?\.html" patron_title_se = "\/serie-[^a_z]{0,10}descargar-torrent*.-\d+-?\d+-(.*?)-\d+-Temp.*?\.html"
item.action = "episodios" item.action = "episodios"
@@ -181,19 +184,19 @@ def listado(item):
pag = True pag = True
cnt_tot = 10 # Se reduce el numero de items por página porque es un proceso pesado cnt_tot = 10 # Se reduce el numero de items por página porque es un proceso pesado
elif item.extra == "documentales" and item.tipo: elif item.extra == "documentales" and item.tipo:
patron = "<a href='(/doc-descargar-torrent[^']+)'>()" patron = "<a href='((?:[^']+)?/doc-descargar-torrent[^']+)'>()"
patron_enlace = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)\.html" patron_enlace = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)\.html"
patron_title = "<a href='\/doc-descargar-torrent[^']+'>([^<]+)<\/a>(\s*<b>([^>]+)<\/b>)?" patron_title = "<a href='(?:[^']+)?\/doc-descargar-torrent[^']+'>([^<]+)<\/a>(\s*<b>([^>]+)<\/b>)?"
patron_title_ep = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)-\d+x\d+.*?\.html" patron_title_ep = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)-\d+x\d+.*?\.html"
patron_title_se = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)-\d+-Temp.*?\.html" patron_title_se = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)-\d+-Temp.*?\.html"
item.action = "episodios" item.action = "episodios"
item.contentType = "tvshow" item.contentType = "tvshow"
pag = False pag = False
else: else:
patron = '<a href="(/doc-descargar-torrent[^"]+)">?' patron = '<a href="((?:[^"]+)?/doc-descargar-torrent[^"]+)">?'
patron += '<img src="([^"]+)"[^<]+</a>' patron += '<img src="([^"]+)"[^<]+</a>'
patron_enlace = "/doc-descargar-torrent-\d+-\d+-(.*?)\.html" patron_enlace = "/doc-descargar-torrent-\d+-\d+-(.*?)\.html"
patron_title = '<a href="/doc-descargar-torrent[^"]+">([^<]+)</a>(\s*<b>([^>]+)</b>)?' patron_title = '<a href="(?:[^"]+)?/doc-descargar-torrent[^"]+">([^<]+)</a>(\s*<b>([^>]+)</b>)?'
patron_title_ep = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)-\d+x\d+.*?\.html" patron_title_ep = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)-\d+x\d+.*?\.html"
patron_title_se = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)-\d+-Temp.*?\.html" patron_title_se = "\/doc-descargar-torrent*.-\d+-?\d+-(.*?)-\d+-Temp.*?\.html"
item.action = "episodios" item.action = "episodios"
@@ -237,10 +240,13 @@ def listado(item):
url_last_page = re.sub(r"\d+$", "9999", url_next_page) url_last_page = re.sub(r"\d+$", "9999", url_next_page)
data_last = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(url_last_page).data) data_last = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(url_last_page).data)
patron_last_page = "<span class='nopaginar'>(\d+)<\/span>" patron_last_page = "<span class='nopaginar'>(\d+)<\/span>"
if item.extra == "documentales": try:
item.last_page = int(scrapertools.find_single_match(data_last, patron_last_page)) if item.extra == "documentales":
else: item.last_page = int(scrapertools.find_single_match(data_last, patron_last_page))
item.last_page = int(scrapertools.find_single_match(data_last, patron_last_page)) * (len(matches) / cnt_tot) else:
item.last_page = int(scrapertools.find_single_match(data_last, patron_last_page)) * (len(matches) / cnt_tot)
except:
item.last_page = 1
if matches_cnt > cnt_tot and item.extra == "documentales" and pag: if matches_cnt > cnt_tot and item.extra == "documentales" and pag:
item.next_page = '' item.next_page = ''
@@ -295,10 +301,10 @@ def listado(item):
item_local.title = '' item_local.title = ''
item_local.context = "['buscar_trailer']" item_local.context = "['buscar_trailer']"
item_local.title = scrapertools.get_match(scrapedurl, patron_enlace) item_local.title = scrapertools.find_single_match(scrapedurl, patron_enlace)
item_local.title = item_local.title.replace("-", " ") item_local.title = item_local.title.replace("-", " ")
item_local.url = verificar_url(urlparse.urljoin(item_local.url, scrapedurl)) item_local.url = verificar_url(urlparse.urljoin(item_local.url, scrapedurl)).replace(' ', '%20')
item_local.thumbnail = verificar_url(host + urllib.quote(scrapedthumbnail)) item_local.thumbnail = verificar_url(urlparse.urljoin(host, scrapedthumbnail)).replace(' ', '%20')
item_local.contentThumbnail = item_local.thumbnail item_local.contentThumbnail = item_local.thumbnail
item_local.infoLabels['year'] = '-' # Al no saber el año, le ponemos "-" y TmDB lo calcula automáticamente item_local.infoLabels['year'] = '-' # Al no saber el año, le ponemos "-" y TmDB lo calcula automáticamente
@@ -429,7 +435,7 @@ def listado(item):
if info != "" and not item_local.quality: if info != "" and not item_local.quality:
item_local.quality = info item_local.quality = info
if "(hdrip" in title.lower() or "(br" in title.lower() or "(vhsrip" in title.lower() or "(dvdrip" in title.lower() or "(fullb" in title.lower() or "(blu" in title.lower() or "(4k" in title.lower() or "(hevc" in title.lower() or "(imax" in title.lower() or "extendida" in title.lower() or "[720p]" in title.lower() or "[1080p]" in title.lower(): if "(hdrip" in title.lower() or "(br" in title.lower() or "(vhsrip" in title.lower() or "(dvdrip" in title.lower() or "(fullb" in title.lower() or "(blu" in title.lower() or "(4k" in title.lower() or "4k" in title.lower() or "(hevc" in title.lower() or "(imax" in title.lower() or "extendida" in title.lower() or "[720p]" in title.lower() or "[1080p]" in title.lower():
if not item_local.quality: if not item_local.quality:
item_local.quality = scrapertools.find_single_match(title, r'\(.*?\)?\(.*?\)') item_local.quality = scrapertools.find_single_match(title, r'\(.*?\)?\(.*?\)')
if not item_local.quality: if not item_local.quality:
@@ -515,22 +521,22 @@ def listado_busqueda(item):
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
# busca series y Novedades # busca series y Novedades
patron = "<a href='(\/serie-descargar-torrent[^']+)'[^>]+>(.*?)<\/a>" patron = "<a href='((?:[^']+)?\/serie-descargar-torrent[^']+)'[^>]+>(.*?)<\/a>"
patron += ".*?<span style='color:\w+;'>([^']+)<\/span>" patron += ".*?<span style='color:\w+;'>([^']+)<\/span>"
patron_enlace = "\/serie-descargar-torrents-\d+-\d+-(.*?)\.html" patron_enlace = "\/serie-descargar-torrents-\d+-\d+-(.*?)\.html"
matches = scrapertools.find_multiple_matches(data, patron) matches = scrapertools.find_multiple_matches(data, patron)
# busca pelis y Novedades # busca pelis y Novedades
patron = "<a href='(\/peli-descargar-torrent[^']+)'[^>]+>(.*?)<\/a>" patron = "<a href='((?:[^']+)?\/peli-descargar-torrent[^']+)'[^>]+>(.*?)<\/a>"
patron += ".*?<span style='color:\w+;'>([^']+)<\/a>" patron += ".*?<span style='color:\w+;'>([^']+)<\/a>"
matches += re.compile(patron, re.DOTALL).findall(data) #Busquedas matches += re.compile(patron, re.DOTALL).findall(data) #Busquedas
patron = "<a href='(\/peli-descargar-torrent[^']+)'[^>]+>(.*?)<\/a>" patron = "<a href='((?:[^']+)?\/peli-descargar-torrent[^']+)'[^>]+>(.*?)<\/a>"
patron += ".*?<span style='color:\w+;'>([^']+)<\/span>" patron += ".*?<span style='color:\w+;'>([^']+)<\/span>"
patron_enlace = "\/peli-descargar-torrent-\d+(.*?)\.html" patron_enlace = "\/peli-descargar-torrent-\d+(.*?)\.html"
matches += re.compile(patron, re.DOTALL).findall(data) #Novedades matches += re.compile(patron, re.DOTALL).findall(data) #Novedades
# busca docu # busca docu
patron = "<a href='(\/doc-descargar-torrent[^']+)' .*?" patron = "<a href='((?:[^']+)?\/doc-descargar-torrent[^']+)' .*?"
patron += "<font Color='\w+'>(.*?)<\/a>.*?" patron += "<font Color='\w+'>(.*?)<\/a>.*?"
patron += "<td align='right' width='20%'>(.*?)<\/td>" patron += "<td align='right' width='20%'>(.*?)<\/td>"
patron_enlace = "\/doc-descargar-torrent-\d+-\d+-(.*?)\.html" patron_enlace = "\/doc-descargar-torrent-\d+-\d+-(.*?)\.html"
@@ -661,7 +667,7 @@ def listado_busqueda(item):
item_local.quality = scrapertools.remove_htmltags(scrapedinfo).decode('iso-8859-1').encode('utf8') item_local.quality = scrapertools.remove_htmltags(scrapedinfo).decode('iso-8859-1').encode('utf8')
item_local.quality = item_local.quality.replace("(", "").replace(")", "").replace("[", "").replace("]", "").replace("Documental", "").replace("documental", "") item_local.quality = item_local.quality.replace("(", "").replace(")", "").replace("[", "").replace("]", "").replace("Documental", "").replace("documental", "")
item_local.url = verificar_url(urlparse.urljoin(item.url, scrapedurl)) item_local.url = verificar_url(urlparse.urljoin(item.url, scrapedurl)).replace(' ', '%20')
#Preparamos la información básica para TMDB #Preparamos la información básica para TMDB
if "/serie-" in scrapedurl or "/doc-" in scrapedurl: if "/serie-" in scrapedurl or "/doc-" in scrapedurl:
@@ -686,7 +692,7 @@ def listado_busqueda(item):
if not item_local.contentSeason: if not item_local.contentSeason:
item_local.contentSeason = 1 item_local.contentSeason = 1
if "(hdrip" in title.lower() or "(br" in title.lower() or "(vhsrip" in title.lower() or "(dvdrip" in title.lower() or "(fullb" in title.lower() or "(blu" in title.lower() or "(4k" in title.lower() or "(hevc" in title.lower() or "(imax" in title.lower() or "extendida" in title.lower() or "[720p]" in title.lower() or "[1080p]" in title.lower(): if "(hdrip" in title.lower() or "(br" in title.lower() or "(vhsrip" in title.lower() or "(dvdrip" in title.lower() or "(fullb" in title.lower() or "(blu" in title.lower() or "(4k" in title.lower() or "4k" in title.lower() or "(hevc" in title.lower() or "(imax" in title.lower() or "extendida" in title.lower() or "[720p]" in title.lower() or "[1080p]" in title.lower():
if not item_local.quality: if not item_local.quality:
item_local.quality = scrapertools.find_single_match(title, r'\(.*?\)?\(.*?\)') item_local.quality = scrapertools.find_single_match(title, r'\(.*?\)?\(.*?\)')
if not item_local.quality: if not item_local.quality:
@@ -777,10 +783,10 @@ def findvideos(item):
if item.post: #Puede traer datos para una llamada "post". De momento usado para documentales, pero podrían ser series if item.post: #Puede traer datos para una llamada "post". De momento usado para documentales, pero podrían ser series
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url, post=item.post).data) data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url, post=item.post).data)
data = data.replace('"', "'") data = data.replace('"', "'")
patron = ">Pincha.*?<a href='(.*?\/uploads\/torrents\/\w+\/.*?\.torrent)'" patron = ">Pincha.*?<a href='((?:[^']+)?\/uploads\/torrents\/\w+\/.*?\.torrent)'"
else: else:
data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data) data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data)
patron = "<a href='(secciones.php\?sec\=descargas&ap=contar&tabla=[^']+)'" patron = "<a href='((?:[^']+)?secciones.php\?sec\=descargas&ap=contar&tabla=[^']+)'"
except: except:
pass pass
@@ -795,7 +801,7 @@ def findvideos(item):
if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca... if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca...
return item #Devolvemos el Item de la llamada return item #Devolvemos el Item de la llamada
else: else:
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
if not item.armagedon: #Si es un proceso normal, seguimos if not item.armagedon: #Si es un proceso normal, seguimos
matches = re.compile(patron, re.DOTALL).findall(data) matches = re.compile(patron, re.DOTALL).findall(data)
@@ -852,13 +858,12 @@ def findvideos(item):
else: else:
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
#logger.debug(torrent_data)
if not item.armagedon: if not item.armagedon:
item_local.url = scrapertools.get_match(torrent_data, ">Pincha.*?<a href='(.*?\/uploads\/torrents\/\w+\/.*?\.torrent)'") item_local.url = scrapertools.find_single_match(torrent_data, ">Pincha.*?<a href='((?:[^']+)?\/uploads\/torrents\/\w+\/.*?\.torrent)'")
item_local.url = verificar_url(urlparse.urljoin(url, item_local.url)) item_local.url = verificar_url(urlparse.urljoin(url, item_local.url))
elif not item.armagedon: elif not item.armagedon:
item_local.url = url # Ya teníamos el link desde el primer nivel (documentales) item_local.url = url # Ya teníamos el link desde el primer nivel (documentales)
item_local.url = item_local.url.replace(" ", "%20") item_local.url = item_local.url.replace(" ", "%20")
if item.armagedon and item.emergency_urls and not item.videolibray_emergency_urls: if item.armagedon and item.emergency_urls and not item.videolibray_emergency_urls:
@@ -956,7 +961,7 @@ def episodios(item):
# Selecciona en tramo que nos interesa # Selecciona en tramo que nos interesa
data = scrapertools.find_single_match(data_alt, data = scrapertools.find_single_match(data_alt,
"(<form name='episodios' action='secciones.php\?sec=descargas\&ap=contar_varios' method='post'>.*?)</form>") "(<form name='episodios' action='(?:[^']+)?secciones.php\?sec=descargas\&ap=contar_varios' method='post'>.*?)</form>")
# Prepara el patrón de búsqueda de: URL, título, fechas y dos valores mas sin uso # Prepara el patrón de búsqueda de: URL, título, fechas y dos valores mas sin uso
if '/serie' in item.url: if '/serie' in item.url:
@@ -974,7 +979,7 @@ def episodios(item):
item, itemlist = generictools.post_tmdb_episodios(item, itemlist) #Llamamos al método para el pintado del error item, itemlist = generictools.post_tmdb_episodios(item, itemlist) #Llamamos al método para el pintado del error
return itemlist #Salimos return itemlist #Salimos
logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data_alt)
itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log'))
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
@@ -1054,8 +1059,8 @@ def episodios(item):
def verificar_url(url): def verificar_url(url):
if '.com' in url or '.net' in url or '.org' in url: if '.com' in url or '.net' in url or '.org' in url or '.tv' in url:
url = url.replace('.com', '.tv').replace('.net', '.tv').replace('.org', '.tv') url = url.replace('.com', host_sufix).replace('.net', host_sufix).replace('.org', host_sufix).replace('.tv', host_sufix)
url = url.replace('torrents/tmp/torrent.php?table=peliculas/&name=', 'torrents/peliculas/') url = url.replace('torrents/tmp/torrent.php?table=peliculas/&name=', 'torrents/peliculas/')
url = url.replace('torrents/tmp/torrent.php?table=series/&name=', 'torrents/series/') url = url.replace('torrents/tmp/torrent.php?table=series/&name=', 'torrents/series/')
url = url.replace('torrents/tmp/torrent.php?table=documentales/&name=', 'torrents/documentales/') url = url.replace('torrents/tmp/torrent.php?table=documentales/&name=', 'torrents/documentales/')
+4 -4
View File
@@ -25,7 +25,8 @@ list_quality = []
list_servers = ['torrent'] list_servers = ['torrent']
channel = "mejortorrent1" channel = "mejortorrent1"
host = config.get_setting('domain_name', channel) #host = config.get_setting('domain_name', channel)
host = "https://mejortorrent1.net/"
categoria = channel.capitalize() categoria = channel.capitalize()
__modo_grafico__ = config.get_setting('modo_grafico', channel) __modo_grafico__ = config.get_setting('modo_grafico', channel)
@@ -889,7 +890,6 @@ def findvideos(item):
torrent_data = httptools.downloadpage(url, post=post, headers=headers, follow_redirects=False) torrent_data = httptools.downloadpage(url, post=post, headers=headers, follow_redirects=False)
except: #error except: #error
pass pass
else: else:
#Viene de SERIES y DOCUMENTALES. Generamos una copia de Item para trabajar sobre ella #Viene de SERIES y DOCUMENTALES. Generamos una copia de Item para trabajar sobre ella
@@ -901,7 +901,7 @@ def findvideos(item):
except: except:
pass pass
if not torrent_data and not ('location' in torrent_data.headers or 'zip' in torrent_data.headers['content-type']): if not torrent_data and not ('location' in torrent_data.headers or 'zip' in torrent_data.headers):
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
if item.intervencion: #Sí ha sido clausurada judicialmente if item.intervencion: #Sí ha sido clausurada judicialmente
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error
@@ -1003,7 +1003,7 @@ def findvideos(item):
if config.get_setting('filter_languages', channel) > 0 and len(itemlist_t) > 0: #Si no hay entradas filtradas ... if config.get_setting('filter_languages', channel) > 0 and len(itemlist_t) > 0: #Si no hay entradas filtradas ...
thumb_separador = get_thumb("next.png") #... pintamos todo con aviso thumb_separador = get_thumb("next.png") #... pintamos todo con aviso
itemlist.append(Item(channel=item.channel, url=host, title="[COLOR red][B]NO hay elementos con el idioma seleccionado[/B][/COLOR]", thumbnail=thumb_separador)) itemlist.append(Item(channel=item.channel, url=host, title="[COLOR red][B]NO hay elementos con el idioma seleccionado[/B][/COLOR]", thumbnail=thumb_separador))
itemlist.extend(itemlist_t) #Pintar pantalla con todo si no hay filtrado itemlist.extend(itemlist_t) #Pintar pantalla con todo si no hay filtrado
# Requerido para AutoPlay # Requerido para AutoPlay
autoplay.start(itemlist, item) #Lanzamos Autoplay autoplay.start(itemlist, item) #Lanzamos Autoplay
+41 -28
View File
@@ -82,6 +82,13 @@ __modo_grafico__ = config.get_setting('modo_grafico', channel_py)
modo_ultima_temp = config.get_setting('seleccionar_ult_temporadda_activa', channel_py) #Actualización sólo últ. Temporada? modo_ultima_temp = config.get_setting('seleccionar_ult_temporadda_activa', channel_py) #Actualización sólo últ. Temporada?
timeout = config.get_setting('clonenewpct1_timeout_downloadpage', channel_py) #Timeout downloadpage timeout = config.get_setting('clonenewpct1_timeout_downloadpage', channel_py) #Timeout downloadpage
if timeout == 0: timeout = None if timeout == 0: timeout = None
try:
from core import proxytools
if proxytools.channel_proxy_list(host): #Si usa un proxy, ...
timeout = timeout * 2 #Duplicamos en timeout
except:
pass
fecha_rango = config.get_setting('clonenewpct1_rango_fechas_novedades', channel_py) #Rango fechas para Novedades fecha_rango = config.get_setting('clonenewpct1_rango_fechas_novedades', channel_py) #Rango fechas para Novedades
if fecha_rango == 0: fecha_rango = 'Hoy' if fecha_rango == 0: fecha_rango = 'Hoy'
elif fecha_rango == 1: fecha_rango = 'Ayer' elif fecha_rango == 1: fecha_rango = 'Ayer'
@@ -173,7 +180,7 @@ def submenu(item):
except: except:
pass pass
patron = '<li><a\s*class="[^"]+"\s*href="http.*:[^"]+"><i\s*class=.*><\/i>.*Inicio<\/a><\/li>(.+)<\/ul>\s*<\/nav>' patron = '<li><a\s*class="[^"]+"\s*href="[^"]+"><i\s*class="[^"]+".*?><\/i>.*?Inicio.*?<\/a><\/li>(.+)<\/ul>\s*<\/nav>'
#Verificamos si se ha cargado una página, y si además tiene la estructura correcta #Verificamos si se ha cargado una página, y si además tiene la estructura correcta
if not data or not scrapertools.find_single_match(data, patron): if not data or not scrapertools.find_single_match(data, patron):
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
@@ -183,9 +190,12 @@ def submenu(item):
itemlist.append(item.clone(action='', title="[COLOR yellow]" + clone_inter.capitalize() + ': [/COLOR]' + intervenido_judicial + '. Reportar el problema en el foro', thumbnail=thumb_intervenido)) itemlist.append(item.clone(action='', title="[COLOR yellow]" + clone_inter.capitalize() + ': [/COLOR]' + intervenido_judicial + '. Reportar el problema en el foro', thumbnail=thumb_intervenido))
return itemlist #Salimos return itemlist #Salimos
logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url + data) try:
logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data)
except:
logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: (probablemente bloqueada por antivirus)")
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú
item, data = generictools.fail_over_newpct1(item, patron) item, data = generictools.fail_over_newpct1(item, patron, timeout=timeout)
if not data: #Si no ha logrado encontrar nada, salimos if not data: #Si no ha logrado encontrar nada, salimos
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR]: Ningún canal NewPct1 activo')) itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR]: Ningún canal NewPct1 activo'))
@@ -203,9 +213,12 @@ def submenu(item):
if "pelisyseries.com" in item.channel_host and item.extra == "varios": #compatibilidad con mispelisy.series.com if "pelisyseries.com" in item.channel_host and item.extra == "varios": #compatibilidad con mispelisy.series.com
data = '<li><a href="' + item.channel_host + 'varios/" title="Documentales">Documentales</a></li>' data = '<li><a href="' + item.channel_host + 'varios/" title="Documentales">Documentales</a></li>'
else: else:
data_menu = scrapertools.get_match(data, patron) #Seleccionamos el trozo que nos interesa data_menu = scrapertools.find_single_match(data, patron) #Seleccionamos el trozo que nos interesa
if not data_menu: if not data_menu:
logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) try:
logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
except:
logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: (probablemente bloqueada por antivirus)")
itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: SUBMENU: Ha cambiado la estructura de la Web. Reportar el error con el log')) itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: SUBMENU: Ha cambiado la estructura de la Web. Reportar el error con el log'))
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
@@ -302,7 +315,7 @@ def submenu_novedades(item):
logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url + data) logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url + data)
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú
item, data = generictools.fail_over_newpct1(item, patron) item, data = generictools.fail_over_newpct1(item, patron, timeout=timeout)
if not data: #Si no ha logrado encontrar nada, salimos if not data: #Si no ha logrado encontrar nada, salimos
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR]: Ningún canal NewPct1 activo')) itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR]: Ningún canal NewPct1 activo'))
@@ -315,7 +328,7 @@ def submenu_novedades(item):
if item.url_alt: del item.url_alt if item.url_alt: del item.url_alt
del item.channel_alt del item.channel_alt
data = scrapertools.get_match(data, patron) #Seleccionamos el trozo que nos interesa data = scrapertools.find_single_match(data, patron) #Seleccionamos el trozo que nos interesa
data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8")
data = data.replace("'", '"').replace('/series"', '/series/"') #Compatibilidad con mispelisy.series.com data = data.replace("'", '"').replace('/series"', '/series/"') #Compatibilidad con mispelisy.series.com
@@ -392,7 +405,7 @@ def alfabeto(item):
logger.error("ERROR 01: ALFABETO: La Web no responde o ha cambiado de URL: " + item.url + data) logger.error("ERROR 01: ALFABETO: La Web no responde o ha cambiado de URL: " + item.url + data)
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú
item, data = generictools.fail_over_newpct1(item, patron) item, data = generictools.fail_over_newpct1(item, patron, timeout=timeout)
if not data: #Si no ha logrado encontrar nada, salimos if not data: #Si no ha logrado encontrar nada, salimos
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR]: Ningún canal NewPct1 activo')) itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.category + '[/COLOR]: Ningún canal NewPct1 activo'))
@@ -405,7 +418,7 @@ def alfabeto(item):
if item.url_alt: del item.url_alt if item.url_alt: del item.url_alt
del item.channel_alt del item.channel_alt
data = scrapertools.get_match(data, patron) data = scrapertools.find_single_match(data, patron)
patron = '<a href="([^"]+)"[^>]+>([^>]+)</a>' patron = '<a href="([^"]+)"[^>]+>([^>]+)</a>'
@@ -454,7 +467,7 @@ def listado(item):
logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data)
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú
item, data = generictools.fail_over_newpct1(item, patron) item, data = generictools.fail_over_newpct1(item, patron, timeout=timeout)
if not data: #Si no ha logrado encontrar nada, salimos if not data: #Si no ha logrado encontrar nada, salimos
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo')) itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo'))
@@ -479,7 +492,7 @@ def listado(item):
#Selecciona el tramo de la página con el listado de contenidos #Selecciona el tramo de la página con el listado de contenidos
patron = '<ul class="' + clase + '">(.*?)</ul>' patron = '<ul class="' + clase + '">(.*?)</ul>'
if data: if data:
fichas = scrapertools.get_match(data, patron) fichas = scrapertools.find_single_match(data, patron)
if not fichas and not '<h3><strong>( 0 ) Resultados encontrados </strong>' in data: #error if not fichas and not '<h3><strong>( 0 ) Resultados encontrados </strong>' in data: #error
logger.error("ERROR 02: LISTADO: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) logger.error("ERROR 02: LISTADO: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: LISTADO: Ha cambiado la estructura de la Web. Reportar el error con el log')) itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: LISTADO: Ha cambiado la estructura de la Web. Reportar el error con el log'))
@@ -659,7 +672,7 @@ def listado(item):
title = title.replace("Ver online Serie", "").replace("Ver online ", "").replace("Descarga Serie HD ", "").replace("Descargar Serie HD ", "").replace("Descarga Serie ", "").replace("Descargar Serie ", "").replace("Ver en linea ", "").replace("Ver en linea", "").replace("en Full HD", "").replace("en hd ", "").replace("en HD ", "").replace("MicroHD", "").replace("HD ", "").replace("(Proper)", "").replace("HDTV", "").replace("RatDVD", "").replace("DVDRiP", "").replace("DVDRIP", "").replace("DVDRip", "").replace("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVBRIP", "").replace("DVB", "").replace("LINE", "").replace("calidad", " ").replace("- ES ", "").replace("ES ", "").replace("COMPLETA", "").replace("Serie Animada", " ").replace("(", "-").replace(")", "-").replace(".", " ").strip() title = title.replace("Ver online Serie", "").replace("Ver online ", "").replace("Descarga Serie HD ", "").replace("Descargar Serie HD ", "").replace("Descarga Serie ", "").replace("Descargar Serie ", "").replace("Ver en linea ", "").replace("Ver en linea", "").replace("en Full HD", "").replace("en hd ", "").replace("en HD ", "").replace("MicroHD", "").replace("HD ", "").replace("(Proper)", "").replace("HDTV", "").replace("RatDVD", "").replace("DVDRiP", "").replace("DVDRIP", "").replace("DVDRip", "").replace("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVBRIP", "").replace("DVB", "").replace("LINE", "").replace("calidad", " ").replace("- ES ", "").replace("ES ", "").replace("COMPLETA", "").replace("Serie Animada", " ").replace("(", "-").replace(")", "-").replace(".", " ").strip()
title = title.replace("Descargar torrent ", "").replace("Descarga Gratis", "").replace("Descarga gratis", "").replace("Descargar Gratis", "").replace("Descargar gratis", "").replace("en gratis", "").replace("gratis gratis", "").replace("Gratisgratis", "").replace("Descargar Estreno ", "").replace("Descargar Estrenos ", "").replace("Pelicula en latino ", "").replace("Descargar Pelicula ", "").replace("Descargar pelicula ", "").replace("Descargar Peliculas ", "").replace("Descargar peliculas ", "").replace("Descargar Todas ", "").replace("Descargar Otras ", "").replace("Descargar ", "").replace("Descarga ", "").replace("Descargar ", "").replace("Decargar ", "").replace("Bajar ", "").replace("HDRIP ", "").replace("HDRiP ", "").replace("HDRip ", "").replace("RIP ", "").replace("Rip", "").replace("RiP", "").replace("XviD", "").replace("AC3 5.1", "").replace("AC3", "").replace("1080p ", "").replace("720p ", "").replace("DVD-Screener ", "").replace("TS-Screener ", "").replace("Screener ", "").replace("BdRemux ", "").replace("BR ", "").replace("4K UHDrip", "").replace("BDremux", "").replace("FULL UHD4K", "").replace("4KULTRA", "").replace("FULLBluRay", "").replace("FullBluRay", "").replace("en BluRay", "").replace("BluRay en", "").replace("Bluray en", "").replace("BluRay", "").replace("Bonus Disc", "").replace("de Cine ", "").replace("TeleCine ", "").replace("latino", "").replace("Latino", "").replace("argentina", "").replace("Argentina", "").replace("++Sub", "").replace("+-+Sub", "").strip() title = title.replace("Descargar torrent ", "").replace("Descarga Gratis", "").replace("Descarga gratis", "").replace("Descargar Gratis", "").replace("Descargar gratis", "").replace("en gratis", "").replace("gratis gratis", "").replace("Gratisgratis", "").replace("Descargar Estreno ", "").replace("Descargar Estrenos ", "").replace("Pelicula en latino ", "").replace("Descargar Pelicula ", "").replace("Descargar pelicula ", "").replace("Descargar Peliculas ", "").replace("Descargar peliculas ", "").replace("Descargar Todas ", "").replace("Descargar Otras ", "").replace("Descargar ", "").replace("Descarga ", "").replace("Descargar ", "").replace("Decargar ", "").replace("Bajar ", "").replace("HDRIP ", "").replace("HDRiP ", "").replace("HDRip ", "").replace("RIP ", "").replace("Rip", "").replace("RiP", "").replace("XviD", "").replace("AC3 5.1", "").replace("AC3", "").replace("1080p ", "").replace("720p ", "").replace("DVD-Screener ", "").replace("TS-Screener ", "").replace("Screener ", "").replace("BdRemux ", "").replace("BR ", "").replace("4K UHDrip", "").replace("BDremux", "").replace("FULL UHD4K", "").replace("4KULTRA", "").replace("FULLBluRay", "").replace("FullBluRay", "").replace("en BluRay", "").replace("BluRay en", "").replace("Bluray en", "").replace("BluRay", "").replace("Bonus Disc", "").replace("de Cine ", "").replace("TeleCine ", "").replace("latino", "").replace("Latino", "").replace("argentina", "").replace("Argentina", "").replace("++Sub", "").replace("+-+Sub", "").replace("Directors Cut", "").strip()
title = re.sub(r'\(\d{4}\)$', '', title) title = re.sub(r'\(\d{4}\)$', '', title)
if re.sub(r'\d{4}$', '', title).strip(): if re.sub(r'\d{4}$', '', title).strip():
@@ -815,7 +828,7 @@ def listado_busqueda(item):
logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + item.post + " / DATA: " + data) logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item.url + item.post + " / DATA: " + data)
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el submenú
item, data = generictools.fail_over_newpct1(item, pattern) item, data = generictools.fail_over_newpct1(item, pattern, timeout=timeout_search)
if not data: #Si no ha logrado encontrar nada, salimos if not data: #Si no ha logrado encontrar nada, salimos
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo')) itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo'))
@@ -855,7 +868,7 @@ def listado_busqueda(item):
else: else:
pattern = '<ul class="%s">(.*?)</ul>' % item.pattern pattern = '<ul class="%s">(.*?)</ul>' % item.pattern
data_alt = data data_alt = data
data = scrapertools.get_match(data, pattern) data = scrapertools.find_single_match(data, pattern)
if item.extra == "novedades": if item.extra == "novedades":
pattern = '<a href="(?P<scrapedurl>[^"]+)"\s?' #url pattern = '<a href="(?P<scrapedurl>[^"]+)"\s?' #url
pattern += 'title="(?P<scrapedtitle>[^"]+)"[^>]*>' #título pattern += 'title="(?P<scrapedtitle>[^"]+)"[^>]*>' #título
@@ -997,7 +1010,7 @@ def listado_busqueda(item):
if item_local.category == 'Mispelisyseries': #Esta web no gestiona bien el cambio de episodio a Serie if item_local.category == 'Mispelisyseries': #Esta web no gestiona bien el cambio de episodio a Serie
pattern = 'class="btn-torrent">.*?window.location.href = "([^"]+)";' #Patron para .torrent pattern = 'class="btn-torrent">.*?window.location.href = "([^"]+)";' #Patron para .torrent
#Como no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el cambio de episodio por serie #Como no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el cambio de episodio por serie
item_local, data_serie = generictools.fail_over_newpct1(item_local, pattern) item_local, data_serie = generictools.fail_over_newpct1(item_local, pattern, timeout=timeout_search)
else: else:
try: try:
data_serie = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item_local.url, timeout=timeout).data) data_serie = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item_local.url, timeout=timeout).data)
@@ -1008,7 +1021,7 @@ def listado_busqueda(item):
if not data_serie or (not scrapertools.find_single_match(data_serie, pattern) and not '<h3><strong>( 0 ) Resultados encontrados </strong>' in data and not '<ul class="noticias-series"></ul></form></div><!-- end .page-box -->' in data): if not data_serie or (not scrapertools.find_single_match(data_serie, pattern) and not '<h3><strong>( 0 ) Resultados encontrados </strong>' in data and not '<ul class="noticias-series"></ul></form></div><!-- end .page-box -->' in data):
logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item_local.url + " / DATA: " + data_serie) logger.error("ERROR 01: LISTADO_BUSQUEDA: La Web no responde o ha cambiado de URL: " + item_local.url + " / DATA: " + data_serie)
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el cambio de episodio por serie #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el cambio de episodio por serie
item_local, data_serie = generictools.fail_over_newpct1(item_local, pattern) item_local, data_serie = generictools.fail_over_newpct1(item_local, pattern, timeout=timeout)
if not data_serie: #Si no ha logrado encontrar nada, salimos if not data_serie: #Si no ha logrado encontrar nada, salimos
title_subs += ["ERR"] title_subs += ["ERR"]
@@ -1147,7 +1160,7 @@ def listado_busqueda(item):
title = title.replace("Ver online Serie", "").replace("Ver online ", "").replace("Descarga Serie HD ", "").replace("Descargar Serie HD ", "").replace("Descarga Serie ", "").replace("Descargar Serie ", "").replace("Ver en linea ", "").replace("Ver en linea", "").replace("en Full HD", "").replace("en hd ", "").replace("en HD ", "").replace("MicroHD", "").replace("HD ", "").replace("(Proper)", "").replace("HDTV", "").replace("RatDVD", "").replace("DVDRiP", "").replace("DVDRIP", "").replace("DVDRip", "").replace("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVBRIP", "").replace("DVB", "").replace("LINE", "").replace("calidad", " ").replace("- ES ", "").replace("ES ", "").replace("COMPLETA", "").replace("Serie Animada", " ").replace("(", "-").replace(")", "-").replace(".", " ").strip() title = title.replace("Ver online Serie", "").replace("Ver online ", "").replace("Descarga Serie HD ", "").replace("Descargar Serie HD ", "").replace("Descarga Serie ", "").replace("Descargar Serie ", "").replace("Ver en linea ", "").replace("Ver en linea", "").replace("en Full HD", "").replace("en hd ", "").replace("en HD ", "").replace("MicroHD", "").replace("HD ", "").replace("(Proper)", "").replace("HDTV", "").replace("RatDVD", "").replace("DVDRiP", "").replace("DVDRIP", "").replace("DVDRip", "").replace("DVDR", "").replace("DVD9", "").replace("DVD", "").replace("DVBRIP", "").replace("DVB", "").replace("LINE", "").replace("calidad", " ").replace("- ES ", "").replace("ES ", "").replace("COMPLETA", "").replace("Serie Animada", " ").replace("(", "-").replace(")", "-").replace(".", " ").strip()
title = title.replace("Descargar torrent ", "").replace("Descarga Gratis", "").replace("Descarga gratis", "").replace("Descargar Gratis", "").replace("Descargar gratis", "").replace("en gratis", "").replace("gratis gratis", "").replace("Gratisgratis", "").replace("Descargar Estreno ", "").replace("Descargar Estrenos ", "").replace("Pelicula en latino ", "").replace("Descargar Pelicula ", "").replace("Descargar pelicula ", "").replace("Descargar Peliculas ", "").replace("Descargar peliculas ", "").replace("Descargar Todas ", "").replace("Descargar Otras ", "").replace("Descargar ", "").replace("Descarga ", "").replace("Descargar ", "").replace("Decargar ", "").replace("Bajar ", "").replace("HDRIP ", "").replace("HDRiP ", "").replace("HDRip ", "").replace("RIP ", "").replace("Rip", "").replace("RiP", "").replace("XviD", "").replace("AC3 5.1", "").replace("AC3", "").replace("1080p ", "").replace("720p ", "").replace("DVD-Screener ", "").replace("TS-Screener ", "").replace("Screener ", "").replace("BdRemux ", "").replace("BR ", "").replace("4K UHDrip", "").replace("BDremux", "").replace("FULL UHD4K", "").replace("4KULTRA", "").replace("FULLBluRay", "").replace("FullBluRay", "").replace("en BluRay", "").replace("BluRay en", "").replace("Bluray en", "").replace("BluRay", "").replace("Bonus Disc", "").replace("de Cine ", "").replace("TeleCine ", "").replace("latino", "").replace("Latino", "").replace("argentina", "").replace("Argentina", "").replace("++Sub", "").replace("+-+Sub", "").strip() title = title.replace("Descargar torrent ", "").replace("Descarga Gratis", "").replace("Descarga gratis", "").replace("Descargar Gratis", "").replace("Descargar gratis", "").replace("en gratis", "").replace("gratis gratis", "").replace("Gratisgratis", "").replace("Descargar Estreno ", "").replace("Descargar Estrenos ", "").replace("Pelicula en latino ", "").replace("Descargar Pelicula ", "").replace("Descargar pelicula ", "").replace("Descargar Peliculas ", "").replace("Descargar peliculas ", "").replace("Descargar Todas ", "").replace("Descargar Otras ", "").replace("Descargar ", "").replace("Descarga ", "").replace("Descargar ", "").replace("Decargar ", "").replace("Bajar ", "").replace("HDRIP ", "").replace("HDRiP ", "").replace("HDRip ", "").replace("RIP ", "").replace("Rip", "").replace("RiP", "").replace("XviD", "").replace("AC3 5.1", "").replace("AC3", "").replace("1080p ", "").replace("720p ", "").replace("DVD-Screener ", "").replace("TS-Screener ", "").replace("Screener ", "").replace("BdRemux ", "").replace("BR ", "").replace("4K UHDrip", "").replace("BDremux", "").replace("FULL UHD4K", "").replace("4KULTRA", "").replace("FULLBluRay", "").replace("FullBluRay", "").replace("en BluRay", "").replace("BluRay en", "").replace("Bluray en", "").replace("BluRay", "").replace("Bonus Disc", "").replace("de Cine ", "").replace("TeleCine ", "").replace("latino", "").replace("Latino", "").replace("argentina", "").replace("Argentina", "").replace("++Sub", "").replace("+-+Sub", "").replace("Directors Cut", "").strip()
title = re.sub(r'\(\d{4}\)$', '', title) title = re.sub(r'\(\d{4}\)$', '', title)
if re.sub(r'\d{4}$', '', title).strip(): if re.sub(r'\d{4}$', '', title).strip():
@@ -1329,7 +1342,7 @@ def findvideos(item):
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize() item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
verify_fo = True #Verificamos si el clone a usar está activo verify_fo = True #Verificamos si el clone a usar está activo
item, data = generictools.fail_over_newpct1(item, verify_fo) item, data = generictools.fail_over_newpct1(item, verify_fo, timeout=timeout)
# Cualquiera de las tres opciones son válidas # Cualquiera de las tres opciones son válidas
# item.url = item.url.replace(".com/",".com/ver-online/") # item.url = item.url.replace(".com/",".com/ver-online/")
@@ -1450,7 +1463,7 @@ def findvideos(item):
except: #La web no responde. Probemos las urls de emergencia except: #La web no responde. Probemos las urls de emergencia
pass pass
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent patron = 'class="btn-torrent">.*?window.location.href = (?:parseURL\()?"(.*?)"\)?;' #Patron para .torrent
patron_mult = 'torrent:check:status|' + patron + '|<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"' patron_mult = 'torrent:check:status|' + patron + '|<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"'
if not scrapertools.find_single_match(data, patron): if not scrapertools.find_single_match(data, patron):
patron_alt = '<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"' #Patron para .torrent (planetatorrent) patron_alt = '<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"' #Patron para .torrent (planetatorrent)
@@ -1461,7 +1474,7 @@ def findvideos(item):
url_torr = scrapertools.find_single_match(item.channel_host, '(\w+:)//') + url_torr url_torr = scrapertools.find_single_match(item.channel_host, '(\w+:)//') + url_torr
#Verificamos si se ha cargado una página, y si además tiene la estructura correcta #Verificamos si se ha cargado una página, y si además tiene la estructura correcta
if not data or not scrapertools.find_single_match(data, patron) or not videolibrarytools.verify_url_torrent(url_torr): # Si no hay datos o url, error if not data or not scrapertools.find_single_match(data, patron) or not videolibrarytools.verify_url_torrent(url_torr, timeout=timeout): # Si no hay datos o url, error
item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
if item.intervencion: #Sí ha sido clausurada judicialmente if item.intervencion: #Sí ha sido clausurada judicialmente
item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error
@@ -1479,7 +1492,7 @@ def findvideos(item):
data = 'xyz123' #Para que no haga más preguntas data = 'xyz123' #Para que no haga más preguntas
else: else:
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el vídeo #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el vídeo
item, data = generictools.fail_over_newpct1(item, patron_mult) item, data = generictools.fail_over_newpct1(item, patron_mult, timeout=timeout)
if not data: #Si no ha logrado encontrar nada, verificamos si hay servidores if not data: #Si no ha logrado encontrar nada, verificamos si hay servidores
cnt_servidores = 0 cnt_servidores = 0
@@ -1500,7 +1513,7 @@ def findvideos(item):
cnt_servidores += 1 cnt_servidores += 1
if cnt_servidores == 0: if cnt_servidores == 0:
item, data_servidores = generictools.fail_over_newpct1(item, patron) #intentamos recuperar servidores item, data_servidores = generictools.fail_over_newpct1(item, patron, timeout=timeout) #intentamos recuperar servidores
#Miramos si ha servidores #Miramos si ha servidores
if not data_servidores: #Si no ha logrado encontrar nada nos vamos if not data_servidores: #Si no ha logrado encontrar nada nos vamos
@@ -1518,7 +1531,7 @@ def findvideos(item):
data = data.replace("$!", "#!").replace("'", "\"").replace("ñ", "ñ").replace("//pictures", "/pictures") data = data.replace("$!", "#!").replace("'", "\"").replace("ñ", "ñ").replace("//pictures", "/pictures")
# patrón para la url torrent # patrón para la url torrent
patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";' #Patron para .torrent patron = 'class="btn-torrent">.*?window.location.href = (?:parseURL\()?"(.*?)"\)?;' #Patron para .torrent
if not scrapertools.find_single_match(data, patron): if not scrapertools.find_single_match(data, patron):
patron = '<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"' #Patron para .torrent (planetatorrent) patron = '<a href="([^"]+)"\s?title="[^"]+"\s?class="btn-torrent"' #Patron para .torrent (planetatorrent)
url_torr = scrapertools.find_single_match(data, patron) url_torr = scrapertools.find_single_match(data, patron)
@@ -1533,7 +1546,7 @@ def findvideos(item):
if not size: if not size:
size = scrapertools.find_single_match(item.quality, '\s?\[(\d+.?\d*?\s?\w\s?[b|B])\]') size = scrapertools.find_single_match(item.quality, '\s?\[(\d+.?\d*?\s?\w\s?[b|B])\]')
if not size and not item.armagedon and not item.videolibray_emergency_urls: if not size and not item.armagedon and not item.videolibray_emergency_urls:
size = generictools.get_torrent_size(url_torr) #Buscamos el tamaño en el .torrent size = generictools.get_torrent_size(url_torr, timeout=timeout) #Buscamos el tamaño en el .torrent
if size: if size:
item.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía item.title = re.sub(r'\s\[\d+,?\d*?\s\w[b|B]\]', '', item.title) #Quitamos size de título, si lo traía
item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título item.title = '%s [%s]' % (item.title, size) #Agregamos size al final del título
@@ -1877,7 +1890,7 @@ def episodios(item):
item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize() item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize()
verify_fo = True #Verificamos si el clone a usar está activo verify_fo = True #Verificamos si el clone a usar está activo
item, data = generictools.fail_over_newpct1(item, verify_fo) item, data = generictools.fail_over_newpct1(item, verify_fo, timeout=timeout)
#Limpiamos num. Temporada y Episodio que ha podido quedar por Novedades #Limpiamos num. Temporada y Episodio que ha podido quedar por Novedades
season_display = 0 season_display = 0
@@ -1931,7 +1944,7 @@ def episodios(item):
patron = '<ul class="%s">(.*?)</ul>' % "buscar-list" # item.pattern patron = '<ul class="%s">(.*?)</ul>' % "buscar-list" # item.pattern
data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, timeout=timeout).data) data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url, timeout=timeout).data)
if data: data_alt = scrapertools.get_match(data, patron) if data: data_alt = scrapertools.find_single_match(data, patron)
except: #Algún error de proceso except: #Algún error de proceso
pass pass
@@ -1951,7 +1964,7 @@ def episodios(item):
logger.error(pattern + data) logger.error(pattern + data)
#Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el vídeo #Si no hay datos consistentes, llamamos al método de fail_over para que encuentre un canal que esté activo y pueda gestionar el vídeo
item, data = generictools.fail_over_newpct1(item, patron, pattern) item, data = generictools.fail_over_newpct1(item, patron, pattern, timeout=timeout)
if not data: #No se ha encontrado ningún canal activo para este vídeo if not data: #No se ha encontrado ningún canal activo para este vídeo
itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo')) itemlist.append(item.clone(action='', title="[COLOR yellow]" + item.channel.capitalize() + '[/COLOR]: Ningún canal NewPct1 activo'))
@@ -1997,7 +2010,7 @@ def episodios(item):
data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8")
data = data.replace("chapters", "buscar-list") #Compatibilidad con mispelisy.series.com data = data.replace("chapters", "buscar-list") #Compatibilidad con mispelisy.series.com
pattern = '<ul class="%s">(.*?)</ul>' % "buscar-list" # item.pattern pattern = '<ul class="%s">(.*?)</ul>' % "buscar-list" # item.pattern
data_sector = scrapertools.get_match(data, pattern) data_sector = scrapertools.find_single_match(data, pattern)
if not data_sector: if not data_sector:
raise raise
data = data_sector data = data_sector
+2 -2
View File
@@ -42,9 +42,9 @@ def categorias(item):
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
if item.title == "Categorias": if item.title == "Categorias":
data = scrapertools.get_match(data, '<a href="#">Genres</a>(.*?)</ul>') data = scrapertools.find_single_match(data, '<a href="#">Genres</a>(.*?)</ul>')
else: else:
data = scrapertools.get_match(data, '<a href="#">Studios</a>(.*?)</ul>') data = scrapertools.find_single_match(data, '<a href="#">Studios</a>(.*?)</ul>')
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
patron = '<a href="([^"]+)">([^<]+)</a>' patron = '<a href="([^"]+)">([^<]+)</a>'
matches = re.compile(patron, re.DOTALL).findall(data) matches = re.compile(patron, re.DOTALL).findall(data)
+1 -1
View File
@@ -135,7 +135,7 @@ def categorias(item):
return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
data = scrapertools.find_single_match(data, patron) data = scrapertools.find_single_match(data, patron)
patron = '<li><a href="genero/([^"]+)">(.*?)<' patron = '<li><a href="\/?genero\/([^"]+)">(.*?)<\/a><\/li>'
matches = re.compile(patron, re.DOTALL).findall(data) matches = re.compile(patron, re.DOTALL).findall(data)
if not matches: if not matches:
+2 -2
View File
@@ -42,9 +42,9 @@ def categorias(item):
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
if "/category/movies/" in item.url: if "/category/movies/" in item.url:
data = scrapertools.get_match(data,'>Movies</a>(.*?)</ul>') data = scrapertools.find_single_match(data,'>Movies</a>(.*?)</ul>')
else: else:
data = scrapertools.get_match(data,'>Clips</a>(.*?)</ul>') data = scrapertools.find_single_match(data,'>Clips</a>(.*?)</ul>')
patron = '<a href=([^"]+)>([^"]+)</a>' patron = '<a href=([^"]+)>([^"]+)</a>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
scrapertools.printMatches(matches) scrapertools.printMatches(matches)
+2 -2
View File
@@ -41,9 +41,9 @@ def categorias(item):
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
if item.title == "Categorias" : if item.title == "Categorias" :
data = scrapertools.get_match(data,'Categories(.*?)Channels') data = scrapertools.find_single_match(data,'Categories(.*?)Channels')
else: else:
data = scrapertools.get_match(data,'Channels(.*?)</ul>') data = scrapertools.find_single_match(data,'Channels(.*?)</ul>')
patron = '<li><a href="([^"]+)" title="[^"]+">(.*?)</a>' patron = '<li><a href="([^"]+)" title="[^"]+">(.*?)</a>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
scrapertools.printMatches(matches) scrapertools.printMatches(matches)
+2 -2
View File
@@ -54,7 +54,7 @@ def lista(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'<div class="videos-list">(.*?)<div class="videos-list">') data = scrapertools.find_single_match(data,'<div class="videos-list">(.*?)<div class="videos-list">')
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
patron = '<article id="post-\d+".*?' patron = '<article id="post-\d+".*?'
patron += '<a href="([^"]+)" title="([^"]+)">.*?' patron += '<a href="([^"]+)" title="([^"]+)">.*?'
@@ -82,7 +82,7 @@ def play(item):
url = scrapertools.find_single_match(data,'<meta itemprop="embedURL" content="([^"]+)"') url = scrapertools.find_single_match(data,'<meta itemprop="embedURL" content="([^"]+)"')
url = url.replace("pornhub.com/embed/", "pornhub.com/view_video.php?viewkey=") url = url.replace("pornhub.com/embed/", "pornhub.com/view_video.php?viewkey=")
data = httptools.downloadpage(url).data data = httptools.downloadpage(url).data
# data = scrapertools.cachePage(url) https://www.spankwire.com/EmbedPlayer.aspx?ArticleId=14049072 # https://www.spankwire.com/EmbedPlayer.aspx?ArticleId=14049072
if "xvideos" in url : if "xvideos" in url :
scrapedurl = scrapertools.find_single_match(data,'setVideoHLS\(\'([^\']+)\'') scrapedurl = scrapertools.find_single_match(data,'setVideoHLS\(\'([^\']+)\'')
if "pornhub" in url : if "pornhub" in url :
+2 -2
View File
@@ -39,7 +39,7 @@ def canales(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(host).data data = httptools.downloadpage(host).data
data = scrapertools.get_match(data, 'Top Networks</a>(.*?)</ul>') data = scrapertools.find_single_match(data, 'Top Networks</a>(.*?)</ul>')
patron = '<li id=.*?<a href="(.*?)">(.*?)</a></li>' patron = '<li id=.*?<a href="(.*?)">(.*?)</a></li>'
matches = re.compile(patron, re.DOTALL).findall(data) matches = re.compile(patron, re.DOTALL).findall(data)
for scrapedurl, scrapedtitle in matches: for scrapedurl, scrapedtitle in matches:
@@ -56,7 +56,7 @@ def categorias(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data, 'More Categories</a>(.*?)</ul>') data = scrapertools.find_single_match(data, 'More Categories</a>(.*?)</ul>')
patron = '<li id=.*?<a href="(.*?)">(.*?)</a></li>' patron = '<li id=.*?<a href="(.*?)">(.*?)</a></li>'
matches = re.compile(patron, re.DOTALL).findall(data) matches = re.compile(patron, re.DOTALL).findall(data)
for scrapedurl, scrapedtitle in matches: for scrapedurl, scrapedtitle in matches:
+2 -2
View File
@@ -42,9 +42,9 @@ def categorias(item):
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
if item.title == "Canal" : if item.title == "Canal" :
data = scrapertools.get_match(data,'>Adult Porn Parodies</a></li>(.*?)</ul>') data = scrapertools.find_single_match(data,'>Adult Porn Parodies</a></li>(.*?)</ul>')
else: else:
data = scrapertools.get_match(data,'<div class="nav-wrap">(.*?)<ul class="sub-menu">') data = scrapertools.find_single_match(data,'<div class="nav-wrap">(.*?)<ul class="sub-menu">')
itemlist.append( Item(channel=item.channel, action="lista", title="Big tit", url="https://sexofilm.com/?s=big+tits")) itemlist.append( Item(channel=item.channel, action="lista", title="Big tit", url="https://sexofilm.com/?s=big+tits"))
patron = '<a href="([^<]+)">([^<]+)</a>' patron = '<a href="([^<]+)">([^<]+)</a>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
+1 -1
View File
@@ -42,7 +42,7 @@ def categorias(item):
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|&nbsp;|<br>|<br/>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>|<br/>", "", data)
data = scrapertools.get_match(data,'<div id="content">(.*?)<div class="maincat">') data = scrapertools.find_single_match(data,'<div id="content">(.*?)<div class="maincat">')
patron = '<a href="(.*?)".*?' patron = '<a href="(.*?)".*?'
patron += '<img src="(.*?)".*?alt="(.*?)"' patron += '<img src="(.*?)".*?alt="(.*?)"'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
+2 -2
View File
@@ -51,7 +51,7 @@ def categorias(item):
scrapedtitle = scrapedtitle + " (" + cantidad +")" scrapedtitle = scrapedtitle + " (" + cantidad +")"
scrapedurl = urlparse.urljoin(item.url,scrapedurl) + "/Submitted/59" scrapedurl = urlparse.urljoin(item.url,scrapedurl) + "/Submitted/59"
itemlist.append( Item(channel=item.channel, action="lista", title=scrapedtitle, url=scrapedurl, itemlist.append( Item(channel=item.channel, action="lista", title=scrapedtitle, url=scrapedurl,
thumbnail=scrapedthumbnail, fanart=scrapedthumbnail, plot=scrapedplot) ) fanart=scrapedthumbnail, thumbnail=scrapedthumbnail, plot=scrapedplot) )
return itemlist return itemlist
@@ -88,7 +88,7 @@ def play(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'Copy Embed Code(.*?)For Desktop') data = scrapertools.find_single_match(data,'Copy Embed Code(.*?)For Desktop')
patron = '<div class="shareDownload_container__item__dropdown">.*?<a href="([^"]+)"' patron = '<div class="shareDownload_container__item__dropdown">.*?<a href="([^"]+)"'
matches = scrapertools.find_multiple_matches(data, patron) matches = scrapertools.find_multiple_matches(data, patron)
for scrapedurl in matches: for scrapedurl in matches:
+2 -2
View File
@@ -38,7 +38,7 @@ def catalogo(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'PaySites(.*?)<li id="menu-item-28040"') data = scrapertools.find_single_match(data,'PaySites(.*?)<li id="menu-item-28040"')
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
patron = '<li id="menu-item-\d+".*?<a href="([^"]+)">([^"]+)</a>' patron = '<li id="menu-item-\d+".*?<a href="([^"]+)">([^"]+)</a>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
@@ -55,7 +55,7 @@ def categorias(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'<a href="#">Categories</a>(.*?)</ul>') data = scrapertools.find_single_match(data,'<a href="#">Categories</a>(.*?)</ul>')
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
patron = '<li id="menu-item-\d+".*?<a href="([^"]+)">([^"]+)</a>' patron = '<li id="menu-item-\d+".*?<a href="([^"]+)">([^"]+)</a>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
+7 -6
View File
@@ -40,16 +40,17 @@ def categorias(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'<div class="category-item">(.*?)<div id="goupBlock"')
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
patron = '<a href="([^"]+)">\s*(.*?)\s*<' patron = '<div class="thumb-container with-title moviec">.*?'
patron += '<a href="([^"]+)".*?'
patron += 'src="([^"]+)".*?'
patron += '<a title="([^"]+)".*?'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedtitle in matches: for scrapedurl,scrapedthumbnail,scrapedtitle in matches:
scrapedplot = "" scrapedplot = ""
scrapedthumbnail = ""
scrapedurl = scrapedurl + "/most-recent/" scrapedurl = scrapedurl + "/most-recent/"
itemlist.append( Item(channel=item.channel, action="lista", title=scrapedtitle, url=scrapedurl, itemlist.append( Item(channel=item.channel, action="lista", title=scrapedtitle, url=scrapedurl,
thumbnail=scrapedthumbnail, plot=scrapedplot) ) fanart=scrapedthumbnail, thumbnail=scrapedthumbnail, plot=scrapedplot) )
return itemlist return itemlist
@@ -80,7 +81,7 @@ def lista(item):
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
data = scrapertools.get_match(data,'class="thumbs-container">(.*?)<div class="clearfix">') data = scrapertools.find_single_match(data,'class="thumbs-container">(.*?)<div class="clearfix">')
patron = '<p class="btime">([^"]+)</p>.*?' patron = '<p class="btime">([^"]+)</p>.*?'
patron += '>(.*?)<img width=.*?' patron += '>(.*?)<img width=.*?'
patron += '="([^"]+)" class="thumb.*?' patron += '="([^"]+)" class="thumb.*?'
+1 -1
View File
@@ -23,7 +23,7 @@ def categorias(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'<h3>Categories</h3>(.*?)</ul>') data = scrapertools.find_single_match(data,'<h3>Categories</h3>(.*?)</ul>')
patron = '<li class="cat-item cat-item-\d+"><a href="(.*?)" >(.*?)</a>' patron = '<li class="cat-item cat-item-\d+"><a href="(.*?)" >(.*?)</a>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedtitle in matches: for scrapedurl,scrapedtitle in matches:
+1 -1
View File
@@ -62,7 +62,7 @@ def categorias(item):
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
if item.title=="PornStars" : if item.title=="PornStars" :
data = scrapertools.get_match(data,'</i> Hall Of Fame Pornstars</h1>(.*?)</section>') data = scrapertools.find_single_match(data,'</i> Hall Of Fame Pornstars</h1>(.*?)</section>')
patron = '<a class="thumb" href="([^"]+)">.*?<img src="([^"]+)".*?<div class="vidcountSp">(.*?)</div>.*?<a class="categoryTitle".*?>([^"]+)</a>' patron = '<a class="thumb" href="([^"]+)">.*?<img src="([^"]+)".*?<div class="vidcountSp">(.*?)</div>.*?<a class="categoryTitle".*?>([^"]+)</a>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedthumbnail,cantidad,scrapedtitle in matches: for scrapedurl,scrapedthumbnail,cantidad,scrapedtitle in matches:
+1 -1
View File
@@ -81,7 +81,7 @@ def play(item):
# http://tubehentai.com/media/thumbs/5/2/3/9/c/5239cf74632cbTHLaBlueGirlep3%20%20Segment2000855.000001355.000.mp4 # http://tubehentai.com/media/thumbs/5/2/3/9/c/5239cf74632cbTHLaBlueGirlep3%20%20Segment2000855.000001355.000.mp4
# http://tubehentai.com/media/videos/5/2/3/9/c/5239cf74632cbTHLaBlueGirlep3%20%20Segment2000855.000001355.000.mp4?start=0 # http://tubehentai.com/media/videos/5/2/3/9/c/5239cf74632cbTHLaBlueGirlep3%20%20Segment2000855.000001355.000.mp4?start=0
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
url = scrapertools.get_match(data, 's1.addParam\("flashvars","bufferlength=1&autostart=true&overlay=(.*?\.mp4)') url = scrapertools.find_single_match(data, 's1.addParam\("flashvars","bufferlength=1&autostart=true&overlay=(.*?\.mp4)')
url = url.replace("/thumbs", "/videos") url = url.replace("/thumbs", "/videos")
# url = url+"?start=0" # url = url+"?start=0"
logger.info("url=" + url) logger.info("url=" + url)
+1 -1
View File
@@ -69,7 +69,7 @@ def categorias(item):
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
data = scrapertools.get_match(data,'<div class="cats-all categories-list">(.*?)</div>') data = scrapertools.find_single_match(data,'<div class="cats-all categories-list">(.*?)</div>')
patron = '<a href="([^"]+)".*?>([^"]+)</a>' patron = '<a href="([^"]+)".*?>([^"]+)</a>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedtitle in matches: for scrapedurl,scrapedtitle in matches:
+3 -3
View File
@@ -43,11 +43,11 @@ def categorias(item):
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
if item.title == "Canal": if item.title == "Canal":
data = scrapertools.get_match(data,'>Studios</a>(.*?)</ul>') data = scrapertools.find_single_match(data,'>Studios</a>(.*?)</ul>')
if item.title == "Año": if item.title == "Año":
data = scrapertools.get_match(data,'>Years</a>(.*?)</ul>') data = scrapertools.find_single_match(data,'>Years</a>(.*?)</ul>')
if item.title == "Categorias": if item.title == "Categorias":
data = scrapertools.get_match(data,'>XXX Genres</div>(.*?)</ul>') data = scrapertools.find_single_match(data,'>XXX Genres</div>(.*?)</ul>')
patron = '<a href="([^"]+)".*?>([^"]+)</a>(.*?)</li>' patron = '<a href="([^"]+)".*?>([^"]+)</a>(.*?)</li>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedtitle,cantidad in matches: for scrapedurl,scrapedtitle,cantidad in matches:
+2 -2
View File
@@ -53,7 +53,7 @@ def videos(item):
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
itemlist = [] itemlist = []
data = scrapertools.get_match(data, '<article.+?>(.*?)</article>') data = scrapertools.find_single_match(data, '<article.+?>(.*?)</article>')
# Patron # Patron
patron = '(?s)<div class="thumb-list__item.*?href="([^"]+)".*?src="([^"]+)".*?alt="([^"]+)">.*?' patron = '(?s)<div class="thumb-list__item.*?href="([^"]+)".*?src="([^"]+)".*?alt="([^"]+)">.*?'
@@ -87,7 +87,7 @@ def categorias(item):
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data, '(?s)<div class="all-categories">(.*?)</aside>') data = scrapertools.find_single_match(data, '(?s)<div class="all-categories">(.*?)</aside>')
patron = '(?s)<li>.*?<a href="([^"]+)".*?>([^<]+).*?</a></li>' patron = '(?s)<li>.*?<a href="([^"]+)".*?>([^<]+).*?</a></li>'
matches = re.compile(patron, re.DOTALL).findall(data) matches = re.compile(patron, re.DOTALL).findall(data)
+4 -4
View File
@@ -44,11 +44,11 @@ def categorias(item):
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
if item.title=="Canal": if item.title=="Canal":
data = scrapertools.get_match(data,'<div class="footer-banner">(.*?)<div id="footer-copyright">') data = scrapertools.find_single_match(data,'<div class="footer-banner">(.*?)<div id="footer-copyright">')
if item.title=="Productora" : if item.title=="Productora" :
data = scrapertools.get_match(data,'<li id="menu-item-16"(.*?)</ul>') data = scrapertools.find_single_match(data,'<li id="menu-item-16"(.*?)</ul>')
if item.title=="Categorias" : if item.title=="Categorias" :
data = scrapertools.get_match(data,'<a>Categories</a>(.*?)</ul>') data = scrapertools.find_single_match(data,'<a>Categories</a>(.*?)</ul>')
patron = '<a href="([^"]+)">([^"]+)</a>' patron = '<a href="([^"]+)">([^"]+)</a>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedtitle in matches: for scrapedurl,scrapedtitle in matches:
@@ -95,7 +95,7 @@ def play(item):
variable = scrapertools.find_single_match(data,'<script type=\'text/javascript\'> str=\'([^\']+)\'') variable = scrapertools.find_single_match(data,'<script type=\'text/javascript\'> str=\'([^\']+)\'')
resuelta = re.sub("@[A-F0-9][A-F0-9]", lambda m: m.group()[1:].decode('hex'), variable) resuelta = re.sub("@[A-F0-9][A-F0-9]", lambda m: m.group()[1:].decode('hex'), variable)
url = scrapertools.find_single_match(resuelta,'<iframe src="([^"]+)"') url = scrapertools.find_single_match(resuelta,'<iframe src="([^"]+)"')
data = scrapertools.cachePage(url) data = httptools.downloadpage(item.url).data
itemlist = servertools.find_video_items(data=data) itemlist = servertools.find_video_items(data=data)
for videoitem in itemlist: for videoitem in itemlist:
videoitem.title = item.title videoitem.title = item.title
+1 -1
View File
@@ -82,7 +82,7 @@ def findvideos(item):
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
data = scrapertools.get_match(data,'<div class="video-embed">(.*?)</div>') data = scrapertools.find_single_match(data,'<div class="video-embed">(.*?)</div>')
patron = '<noscript>.*?<iframe src="([^"]+)"' patron = '<noscript>.*?<iframe src="([^"]+)"'
matches = scrapertools.find_multiple_matches(data, patron) matches = scrapertools.find_multiple_matches(data, patron)
for url in matches: for url in matches:
+2 -2
View File
@@ -42,9 +42,9 @@ def categorias(item):
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
if item.title == "Canal" : if item.title == "Canal" :
data = scrapertools.get_match(data,'>Studios</a>(.*?)</ul>') data = scrapertools.find_single_match(data,'>Studios</a>(.*?)</ul>')
else: else:
data = scrapertools.get_match(data,'>Categories</a>(.*?)</ul>') data = scrapertools.find_single_match(data,'>Categories</a>(.*?)</ul>')
patron = '<a href="([^"]+)">([^<]+)</a>' patron = '<a href="([^"]+)">([^<]+)</a>'
matches = re.compile(patron,re.DOTALL).findall(data) matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedtitle in matches: for scrapedurl,scrapedtitle in matches:
+6 -32
View File
@@ -38,19 +38,20 @@ def categorias(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data1 = scrapertools.get_match(data,'<h5>Popular Categories<br />(.*?)</aside>') data1 = scrapertools.find_single_match(data,'<h5>Popular Categories<br />(.*?)</aside>')
if item.title == "Canal" : if item.title == "Canal" :
data1 = scrapertools.get_match(data,'>Top sites</a>(.*?)</ul>') data1 = scrapertools.find_single_match(data,'>Top sites</a>(.*?)</ul>')
data1 += scrapertools.get_match(data,'Downloads</h2>(.*?)</ul>') data1 += scrapertools.find_single_match(data,'Downloads</h2>(.*?)</ul>')
patron = '<a href="([^<]+)">([^<]+)</a>' patron = '<a href="([^<]+)">([^<]+)</a>'
matches = re.compile(patron,re.DOTALL).findall(data1) matches = re.compile(patron,re.DOTALL).findall(data1)
for scrapedurl,scrapedtitle in matches: for scrapedurl,scrapedtitle in matches:
scrapedplot = "" scrapedplot = ""
scrapedthumbnail = "" scrapedthumbnail = ""
itemlist.append( Item(channel=item.channel, action="lista", title=scrapedtitle, url=scrapedurl, itemlist.append( Item(channel=item.channel, action="lista", title=scrapedtitle, url=scrapedurl,
thumbnail=scrapedthumbnail , plot=scrapedplot , folder=True) ) thumbnail=scrapedthumbnail , plot=scrapedplot) )
return itemlist return itemlist
def lista(item): def lista(item):
logger.info() logger.info()
itemlist = [] itemlist = []
@@ -67,7 +68,7 @@ def lista(item):
elif '1080' in scrapedtitle : title= "[COLOR red]" + "1080p" + "[/COLOR] " + scrapedtitle elif '1080' in scrapedtitle : title= "[COLOR red]" + "1080p" + "[/COLOR] " + scrapedtitle
else: title = scrapedtitle else: title = scrapedtitle
itemlist.append( Item(channel=item.channel, action="findvideos", title=title, url=scrapedurl, itemlist.append( Item(channel=item.channel, action="findvideos", title=title, url=scrapedurl,
thumbnail=scrapedthumbnail, fanart=scrapedthumbnail, plot=scrapedplot) ) fanart=scrapedthumbnail, thumbnail=scrapedthumbnail,plot=scrapedplot) )
next_page = scrapertools.find_single_match(data,'<a class="next page-numbers" href="([^"]+)">Next &rarr;</a>') next_page = scrapertools.find_single_match(data,'<a class="next page-numbers" href="([^"]+)">Next &rarr;</a>')
if next_page!="": if next_page!="":
next_page = urlparse.urljoin(item.url,next_page) next_page = urlparse.urljoin(item.url,next_page)
@@ -75,30 +76,3 @@ def lista(item):
return itemlist return itemlist
def findvideos(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data,'--more-->(.*?)/a>')
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
patron = '<a href="([^"]+)".*?class="external">(.*?)<'
matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedtitle in matches:
scrapedplot = ""
scrapedthumbnail = ""
itemlist.append( Item(channel=item.channel, action="play", title=scrapedtitle, fulltitle=item.title,
url=scrapedurl, thumbnail=scrapedthumbnail, plot=scrapedplot) )
return itemlist
def play(item):
logger.info()
data = httptools.downloadpage(item.url).data
itemlist = servertools.find_video_items(data=data)
for videoitem in itemlist:
videoitem.title = item.title
videoitem.fulltitle = item.fulltitle
videoitem.thumbnail = item.thumbnail
videoitem.channel = item.channel
return itemlist
+2 -2
View File
@@ -44,7 +44,7 @@ def categorias(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data, '<h4>Trending(.*?)</ul>') data = scrapertools.find_single_match(data, '<h4>Trending(.*?)</ul>')
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
patron = '<li><a href="([^"]+)">([^"]+)</a>' patron = '<li><a href="([^"]+)">([^"]+)</a>'
matches = re.compile(patron, re.DOTALL).findall(data) matches = re.compile(patron, re.DOTALL).findall(data)
@@ -97,7 +97,7 @@ def play(item):
logger.info() logger.info()
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = scrapertools.get_match(data, 'var encodings(.*?)var') data = scrapertools.find_single_match(data, 'var encodings(.*?)var')
if '360' in data: if '360' in data:
patron = '"360".*?"filename"\:"(.*?)"' patron = '"360".*?"filename"\:"(.*?)"'
if '720' in data: if '720' in data:
+3 -3
View File
@@ -41,7 +41,7 @@ def catalogo(item):
itemlist = [] itemlist = []
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
data1 = scrapertools.get_match(data,'>Most Popular Pornstars<(.*?)<i class=\'icon-menu-right\'></i></a>') data1 = scrapertools.find_single_match(data,'>Most Popular Pornstars<(.*?)<i class=\'icon-menu-right\'></i></a>')
patron = '<a href="([^"]+)".*?' patron = '<a href="([^"]+)".*?'
patron += 'data-original="([^"]+)".*?' patron += 'data-original="([^"]+)".*?'
patron += '<span class="porn-star-name">([^"]+)</span>.*?' patron += '<span class="porn-star-name">([^"]+)</span>.*?'
@@ -66,9 +66,9 @@ def categorias(item):
data = httptools.downloadpage(item.url).data data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data) data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
if item.title == "Canal": if item.title == "Canal":
data = scrapertools.get_match(data,'>All</div>(.*?)<i class=\'icon-menu-right\'></i></a>') data = scrapertools.find_single_match(data,'>All</div>(.*?)<i class=\'icon-menu-right\'></i></a>')
if item.title == "Categorias": if item.title == "Categorias":
data = scrapertools.get_match(data,'<div class=\'row alphabetical\'.*?>(.*?)>Popular by Country</h2>') data = scrapertools.find_single_match(data,'<div class=\'row alphabetical\'.*?>(.*?)>Popular by Country</h2>')
patron = '<a href="([^"]+)".*?' patron = '<a href="([^"]+)".*?'
patron += '<img src=(.*?)>.*?' patron += '<img src=(.*?)>.*?'
patron += '>([^<]+) (?:Videos|videos)<' patron += '>([^<]+) (?:Videos|videos)<'
+234 -140
View File
@@ -99,7 +99,7 @@ load_cookies()
def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=True, cookies=True, replace_headers=False, def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=True, cookies=True, replace_headers=False,
add_referer=False, only_headers=False, bypass_cloudflare=True, count_retries=0, random_headers=False, ignore_response_code=False, alfa_s=False): add_referer=False, only_headers=False, bypass_cloudflare=True, count_retries=0, count_retries_tot=5, random_headers=False, ignore_response_code=False, alfa_s=False, proxy=True, proxy_web=False, forced_proxy=None, proxy_retries=1):
""" """
Abre una url y retorna los datos obtenidos Abre una url y retorna los datos obtenidos
@@ -160,169 +160,263 @@ def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=Tr
url = urllib.quote(url, safe="%/:=&?~#+!$,;'@()*[]") url = urllib.quote(url, safe="%/:=&?~#+!$,;'@()*[]")
# Limitar tiempo de descarga si no se ha pasado timeout y hay un valor establecido en la variable global #Si la descarga requiere que se haga a través de un servicio Proxy o ProxyWeb, se prepara la url
if timeout is None and HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT is not None: timeout = HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT proxy_retries_counter = 0
if timeout == 0: timeout = None url_save = url
post_save = post
while proxy_retries_counter <= proxy_retries:
# Handlers init
handlers = [urllib2.HTTPHandler(debuglevel=False)]
proxy_retries_counter += 1
proxy_stat = ''
proxy_addr = ''
proxy_CF_addr = ''
proxy_web_name = ''
proxy_log = ''
import proxytools
try:
if (proxy or proxy_web) and (forced_proxy or proxytools.channel_proxy_list(url, forced_proxy=forced_proxy)):
proxy_addr, proxy_CF_addr, proxy_web_name, proxy_log = proxytools.get_proxy_addr(url, post=post, forced_proxy=forced_proxy)
if proxy and proxy_addr:
handlers.append(urllib2.ProxyHandler(proxy_addr))
proxy_stat = ', Proxy Direct ' + proxy_log
elif proxy and proxy_CF_addr:
handlers.append(urllib2.ProxyHandler(proxy_CF_addr))
proxy_stat = ', Proxy CF ' + proxy_log
elif proxy and not proxy_addr and not proxy_CF_addr:
proxy = False
if not proxy_web_name:
proxy_addr, proxy_CF_addr, proxy_web_name, proxy_log = proxytools.get_proxy_addr(url, forced_proxy='Total')
if proxy_web_name:
proxy_web = True
else:
proxy_web = False
if proxy_addr:
proxy = True
handlers.append(urllib2.ProxyHandler(proxy_addr))
proxy_stat = ', Proxy Direct ' + proxy_log
if not alfa_s: if proxy_web and proxy_web_name:
logger.info("----------------------------------------------") if post: proxy_log = '(POST) ' + proxy_log
logger.info("downloadpage Alfa: %s" %__version) url, post, headers_proxy, proxy_web_name = proxytools.set_proxy_web(url, proxy_web_name, post=post)
logger.info("----------------------------------------------") if proxy_web_name:
logger.info("Timeout: %s" % timeout) proxy_stat = ', Proxy Web ' + proxy_log
logger.info("URL: " + url) if headers_proxy:
logger.info("Dominio: " + urlparse.urlparse(url)[1]) request_headers.update(dict(headers_proxy))
if post: if proxy_web and not proxy_web_name:
logger.info("Peticion: POST") proxy_web = False
else: proxy_addr, proxy_CF_addr, proxy_web_name, proxy_log = proxytools.get_proxy_addr(url, forced_proxy='Total')
logger.info("Peticion: GET") if proxy_CF_addr:
logger.info("Usar Cookies: %s" % cookies) proxy = True
logger.info("Descargar Pagina: %s" % (not only_headers)) handlers.append(urllib2.ProxyHandler(proxy_CF_addr))
logger.info("Fichero de Cookies: " + ficherocookies) proxy_stat = ', Proxy CF ' + proxy_log
elif proxy_addr:
proxy = True
handlers.append(urllib2.ProxyHandler(proxy_addr))
proxy_stat = ', Proxy Direct ' + proxy_log
except:
import traceback
logger.error(traceback.format_exc())
proxy = ''
proxy_web = ''
proxy_stat = ''
proxy_addr = ''
proxy_CF_addr = ''
proxy_web_name = ''
proxy_log = ''
url = url_save
# Limitar tiempo de descarga si no se ha pasado timeout y hay un valor establecido en la variable global
if timeout is None and HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT is not None: timeout = HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT
if timeout == 0: timeout = None
if not alfa_s:
logger.info("----------------------------------------------")
logger.info("downloadpage Alfa: %s" %__version)
logger.info("----------------------------------------------")
logger.info("Timeout: %s" % timeout)
logger.info("URL: " + url)
logger.info("Dominio: " + urlparse.urlparse(url)[1])
if post:
logger.info("Peticion: POST" + proxy_stat)
else:
logger.info("Peticion: GET" + proxy_stat)
logger.info("Usar Cookies: %s" % cookies)
logger.info("Descargar Pagina: %s" % (not only_headers))
logger.info("Fichero de Cookies: " + ficherocookies)
logger.info("Headers:") logger.info("Headers:")
for header in request_headers: for header in request_headers:
logger.info("- %s: %s" % (header, request_headers[header])) logger.info("- %s: %s" % (header, request_headers[header]))
# Handlers # Handlers
handlers = [urllib2.HTTPHandler(debuglevel=False)] if not follow_redirects:
handlers.append(NoRedirectHandler())
if not follow_redirects: if cookies:
handlers.append(NoRedirectHandler()) handlers.append(urllib2.HTTPCookieProcessor(cj))
if cookies: opener = urllib2.build_opener(*handlers)
handlers.append(urllib2.HTTPCookieProcessor(cj))
opener = urllib2.build_opener(*handlers)
if not alfa_s:
logger.info("Realizando Peticion")
# Contador
inicio = time.time()
req = urllib2.Request(url, post, request_headers)
try:
if urllib2.__version__ == "2.4":
import socket
deftimeout = socket.getdefaulttimeout()
if timeout is not None:
socket.setdefaulttimeout(timeout)
handle = opener.open(req)
socket.setdefaulttimeout(deftimeout)
else:
handle = opener.open(req, timeout=timeout)
except urllib2.HTTPError, handle:
response["sucess"] = False
response["code"] = handle.code
response["error"] = handle.__dict__.get("reason", str(handle))
response["headers"] = handle.headers.dict
if not only_headers:
response["data"] = handle.read()
else:
response["data"] = ""
response["time"] = time.time() - inicio
response["url"] = handle.geturl()
except Exception, e:
response["sucess"] = False
response["code"] = e.__dict__.get("errno", e.__dict__.get("code", str(e)))
response["error"] = e.__dict__.get("reason", str(e))
response["headers"] = {}
response["data"] = ""
response["time"] = time.time() - inicio
response["url"] = url
else:
response["sucess"] = True
response["code"] = handle.code
response["error"] = None
response["headers"] = handle.headers.dict
if not only_headers:
response["data"] = handle.read()
else:
response["data"] = ""
response["time"] = time.time() - inicio
response["url"] = handle.geturl()
if not alfa_s:
logger.info("Terminado en %.2f segundos" % (response["time"]))
logger.info("Response sucess: %s" % (response["sucess"]))
logger.info("Response code: %s" % (response["code"]))
logger.info("Response error: %s" % (response["error"]))
logger.info("Response data length: %s" % (len(response["data"])))
logger.info("Response headers:")
server_cloudflare = ""
for header in response["headers"]:
if not alfa_s: if not alfa_s:
logger.info("- %s: %s" % (header, response["headers"][header])) logger.info("Realizando Peticion")
if "cloudflare" in response["headers"][header]:
server_cloudflare = "cloudflare"
is_channel = inspect.getmodule(inspect.currentframe().f_back) # Contador
# error 4xx o 5xx se lanza excepcion (menos para servidores) inicio = time.time()
# response["code"] = 400 # linea de código para probar
is_channel = str(is_channel).replace("/servers/","\\servers\\") # Para sistemas operativos diferente a Windows la ruta cambia
if type(response["code"]) == int and "\\servers\\" not in str(is_channel) and not ignore_response_code:
if response["code"] > 399 and (server_cloudflare == "cloudflare" and response["code"] != 503):
raise WebErrorException(urlparse.urlparse(url)[1])
if cookies: req = urllib2.Request(url, post, request_headers)
save_cookies()
if not alfa_s:
logger.info("Encoding: %s" % (response["headers"].get('content-encoding')))
if response["headers"].get('content-encoding') == 'gzip':
if not alfa_s:
logger.info("Descomprimiendo...")
data_alt = response["data"]
try: try:
response["data"] = gzip.GzipFile(fileobj=StringIO(response["data"])).read() if urllib2.__version__ == "2.4":
import socket
deftimeout = socket.getdefaulttimeout()
if timeout is not None:
socket.setdefaulttimeout(timeout)
handle = opener.open(req)
socket.setdefaulttimeout(deftimeout)
else:
handle = opener.open(req, timeout=timeout)
except urllib2.HTTPError, handle:
response["sucess"] = False
response["code"] = handle.code
response["error"] = handle.__dict__.get("reason", str(handle))
response["headers"] = handle.headers.dict
if not only_headers:
response["data"] = handle.read()
else:
response["data"] = ""
response["time"] = time.time() - inicio
response["url"] = handle.geturl()
except Exception, e:
response["sucess"] = False
response["code"] = e.__dict__.get("errno", e.__dict__.get("code", str(e)))
response["error"] = e.__dict__.get("reason", str(e))
response["headers"] = {}
response["data"] = ""
response["time"] = time.time() - inicio
response["url"] = url
else:
response["sucess"] = True
response["code"] = handle.code
response["error"] = None
response["headers"] = handle.headers.dict
if not only_headers:
response["data"] = handle.read()
else:
response["data"] = ""
response["time"] = time.time() - inicio
response["url"] = handle.geturl()
if not alfa_s:
logger.info("Terminado en %.2f segundos" % (response["time"]))
logger.info("Response sucess: %s" % (response["sucess"]))
logger.info("Response code: %s" % (response["code"]))
logger.info("Response error: %s" % (response["error"]))
logger.info("Response data length: %s" % (len(response["data"])))
logger.info("Response headers:")
server_cloudflare = ""
for header in response["headers"]:
if not alfa_s: if not alfa_s:
logger.info("Descomprimido") logger.info("- %s: %s" % (header, response["headers"][header]))
except: if "cloudflare" in response["headers"][header]:
server_cloudflare = "cloudflare"
is_channel = inspect.getmodule(inspect.currentframe().f_back)
# error 4xx o 5xx se lanza excepcion (menos para servidores)
# response["code"] = 400 # linea de código para probar
is_channel = str(is_channel).replace("/servers/","\\servers\\") # Para sistemas operativos diferente a Windows la ruta cambia
if type(response["code"]) == int and "\\servers\\" not in str(is_channel) and not ignore_response_code and not proxy_stat:
if response["code"] > 399 and (server_cloudflare == "cloudflare" and response["code"] != 503):
raise WebErrorException(urlparse.urlparse(url)[1])
if cookies:
save_cookies()
if not alfa_s:
logger.info("Encoding: %s" % (response["headers"].get('content-encoding')))
if response["headers"].get('content-encoding') == 'gzip':
if not alfa_s: if not alfa_s:
logger.info("No se ha podido descomprimir con gzip. Intentando con zlib") logger.info("Descomprimiendo...")
response["data"] = data_alt data_alt = response["data"]
try: try:
import zlib response["data"] = gzip.GzipFile(fileobj=StringIO(response["data"])).read()
response["data"] = zlib.decompressobj(16 + zlib.MAX_WBITS).decompress(response["data"]) if not alfa_s:
logger.info("Descomprimido")
except: except:
if not alfa_s: if not alfa_s:
logger.info("No se ha podido descomprimir con zlib") logger.info("No se ha podido descomprimir con gzip. Intentando con zlib")
response["data"] = data_alt response["data"] = data_alt
try:
import zlib
response["data"] = zlib.decompressobj(16 + zlib.MAX_WBITS).decompress(response["data"])
except:
if not alfa_s:
logger.info("No se ha podido descomprimir con zlib")
response["data"] = data_alt
# Anti Cloudflare # Anti Cloudflare
if bypass_cloudflare and count_retries < 5: if bypass_cloudflare and count_retries < count_retries_tot:
cf = Cloudflare(response) cf = Cloudflare(response)
if cf.is_cloudflare: if cf.is_cloudflare:
count_retries += 1 count_retries += 1
if not alfa_s:
logger.info("cloudflare detectado, esperando %s segundos..." % cf.wait_time)
auth_url = cf.get_url()
if not alfa_s:
logger.info("Autorizando... intento %d url: %s" % (count_retries, auth_url))
if downloadpage(auth_url, headers=request_headers, replace_headers=True, count_retries=count_retries).sucess:
if not alfa_s: if not alfa_s:
logger.info("Autorización correcta, descargando página") logger.info("cloudflare detectado, esperando %s segundos..." % cf.wait_time)
resp = downloadpage(url=response["url"], post=post, headers=headers, timeout=timeout, auth_url = cf.get_url()
follow_redirects=follow_redirects, if not alfa_s:
cookies=cookies, replace_headers=replace_headers, add_referer=add_referer) logger.info("Autorizando... intento %d url: %s" % (count_retries, auth_url))
response["sucess"] = resp.sucess tt = downloadpage(auth_url, headers=request_headers, replace_headers=True, count_retries=count_retries, ignore_response_code=True, count_retries_tot=count_retries_tot, proxy=proxy, proxy_web=proxy_web)
response["code"] = resp.code if tt.code == 403:
response["error"] = resp.error tt = downloadpage(url, headers=request_headers, replace_headers=True, count_retries=count_retries, ignore_response_code=True, count_retries_tot=count_retries_tot, proxy=proxy, proxy_web=proxy_web)
response["headers"] = resp.headers if tt.sucess:
response["data"] = resp.data if not alfa_s:
response["time"] = resp.time logger.info("Autorización correcta, descargando página")
response["url"] = resp.url resp = downloadpage(url=response["url"], post=post, headers=headers, timeout=timeout,
follow_redirects=follow_redirects, count_retries=count_retries,
cookies=cookies, replace_headers=replace_headers, add_referer=add_referer, proxy=proxy, proxy_web=proxy_web, count_retries_tot=count_retries_tot)
response["sucess"] = resp.sucess
response["code"] = resp.code
response["error"] = resp.error
response["headers"] = resp.headers
response["data"] = resp.data
response["time"] = resp.time
response["url"] = resp.url
else:
if not alfa_s:
logger.info("No se ha podido autorizar")
# Si hay errores usando un Proxy, se refrescan el Proxy y se reintenta el número de veces indicado en proxy_retries
try:
if ', Proxy Web' in proxy_stat:
response["data"] = proxytools.restore_after_proxy_web(response["data"], proxy_web_name, url_save)
if response["data"] == 'ERROR':
response['sucess'] = False
if proxy_stat and response['sucess'] == False and proxy_retries_counter <= proxy_retries and count_retries_tot > 1:
if ', Proxy Direct' in proxy_stat:
proxytools.get_proxy_list_method(proxy_init='ProxyDirect')
elif ', Proxy CF' in proxy_stat:
proxytools.get_proxy_list_method(proxy_init='ProxyCF')
url = url_save
elif ', Proxy Web' in proxy_stat:
proxytools.get_proxy_list_method(proxy_init='ProxyWeb')
url = url_save
post = post_save
else: else:
if not alfa_s: break
logger.info("No se ha podido autorizar") except:
import traceback
logger.error(traceback.format_exc())
break
return type('HTTPResponse', (), response) return type('HTTPResponse', (), response)
def random_useragent(): def random_useragent():
""" """
Based on code from https://github.com/theriley106/RandomHeaders Based on code from https://github.com/theriley106/RandomHeaders
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -29,8 +29,8 @@ from lib import jsunpack
channel_py = "newpct1" channel_py = "newpct1"
intervenido_judicial = 'Dominio intervenido por la Autoridad Judicial' intervenido_judicial = 'Dominio intervenido por la Autoridad Judicial'
intervenido_policia = '<!--CATEGORY:Judicial_Policia_Nacional' intervenido_policia = 'Judicial_Policia_Nacional'
intervenido_guardia = '<!--CATEGORY:Judicial_Guardia_Civil' intervenido_guardia = 'Judicial_Guardia_Civil'
intervenido_sucuri = 'Access Denied - Sucuri Website Firewall' intervenido_sucuri = 'Access Denied - Sucuri Website Firewall'
@@ -1222,7 +1222,7 @@ def post_tmdb_findvideos(item, itemlist):
return (item, itemlist) return (item, itemlist)
def get_torrent_size(url, referer=None, post=None, data_torrent=False): def get_torrent_size(url, referer=None, post=None, data_torrent=False, timeout=5):
logger.info() logger.info()
from core import videolibrarytools from core import videolibrarytools
@@ -1316,7 +1316,7 @@ def get_torrent_size(url, referer=None, post=None, data_torrent=False):
#urllib.urlretrieve(url, torrents_path + "/generictools.torrent") #desacargamos el .torrent a la carpeta #urllib.urlretrieve(url, torrents_path + "/generictools.torrent") #desacargamos el .torrent a la carpeta
#torrent_file = open(torrents_path + "/generictools.torrent", "rb").read() #leemos el .torrent #torrent_file = open(torrents_path + "/generictools.torrent", "rb").read() #leemos el .torrent
torrents_path, torrent_file = videolibrarytools.caching_torrents(url, referer=referer, post=post, timeout=2, lookup=True, data_torrent=True) torrents_path, torrent_file = videolibrarytools.caching_torrents(url, referer=referer, post=post, timeout=timeout, lookup=True, data_torrent=True)
if not torrent_file: if not torrent_file:
if data_torrent: if data_torrent:
return (size, torrent) return (size, torrent)
File diff suppressed because it is too large Load Diff
+1 -2
View File
@@ -30,11 +30,10 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
header = {'Referer': referer} header = {'Referer': referer}
data = httptools.downloadpage(page_url, cookies=False, headers=header).data data = httptools.downloadpage(page_url, cookies=False, headers=header).data
subtitle = scrapertools.find_single_match(data, '<track kind="captions" src="([^"]+)" srclang="es"') subtitle = scrapertools.find_single_match(data, '<track kind="captions" src="([^"]+)" srclang="es"')
try: try:
code = scrapertools.find_single_match(data, '<p id="[^"]+" style="">(.*?)</p>' ) code = scrapertools.find_single_match(data, '<p style="" id="[^"]+">(.*?)</p>' )
_0x59ce16 = eval(scrapertools.find_single_match(data, '_0x59ce16=([^;]+)').replace('parseInt', 'int')) _0x59ce16 = eval(scrapertools.find_single_match(data, '_0x59ce16=([^;]+)').replace('parseInt', 'int'))
_1x4bfb36 = eval(scrapertools.find_single_match(data, '_1x4bfb36=([^;]+)').replace('parseInt', 'int')) _1x4bfb36 = eval(scrapertools.find_single_match(data, '_1x4bfb36=([^;]+)').replace('parseInt', 'int'))
parseInt = eval(scrapertools.find_single_match(data, '_0x30725e,(\(parseInt.*?)\),').replace('parseInt', 'int')) parseInt = eval(scrapertools.find_single_match(data, '_0x30725e,(\(parseInt.*?)\),').replace('parseInt', 'int'))
+21 -4
View File
@@ -5,14 +5,28 @@
import datetime, imp, math, threading, traceback import datetime, imp, math, threading, traceback
from platformcode import config
try:
import xbmc, os
librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib'))
sys.path.append(librerias)
except:
import os
librerias = os.path.join(config.get_runtime_path(), 'lib')
sys.path.append(librerias)
from core import channeltools, filetools, videolibrarytools from core import channeltools, filetools, videolibrarytools
from platformcode import config, logger from platformcode import logger
from platformcode import platformtools from platformcode import platformtools
from channels import videolibrary from channels import videolibrary
from lib import generictools from lib import generictools
def update(path, p_dialog, i, t, serie, overwrite): def update(path, p_dialog, i, t, serie, overwrite):
logger.info("Actualizando " + path) logger.info("Actualizando " + path)
insertados_total = 0 insertados_total = 0
@@ -332,11 +346,14 @@ if __name__ == "__main__":
# Verificar quick-fixes al abrirse Kodi, y dejarlo corriendo como Thread # Verificar quick-fixes al abrirse Kodi, y dejarlo corriendo como Thread
from platformcode import updater from platformcode import updater
updater.check_addon_init() updater.check_addon_init()
# Copia Custom code a las carpetas de Alfa desde la zona de Userdata # Copia Custom code a las carpetas de Alfa desde la zona de Userdata
from platformcode import custom_code from platformcode import custom_code
custom_code.init() custom_code.init()
# Identifica la dirección Proxy y la lista de alternativas
from core import proxytools
proxytools.get_proxy_list()
if not config.get_setting("update", "videolibrary") == 2: if not config.get_setting("update", "videolibrary") == 2:
check_for_update(overwrite=False) check_for_update(overwrite=False)