Files
addon/channels/xxxfreeinhd.py
T
2019-04-23 14:32:53 +02:00

94 lines
3.7 KiB
Python

# -*- coding: utf-8 -*-
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os, sys
from platformcode import config, logger
from core import scrapertools
from core.item import Item
from core import servertools
from core import httptools
host = 'https://watchxxxfreeinhd.com'
def mainlist(item):
logger.info()
itemlist = []
itemlist.append( Item(channel=item.channel, title="Nuevos" , action="lista", url=host + "/?filtre=date&cat=0"))
itemlist.append( Item(channel=item.channel, title="Mas vistos" , action="lista", url=host + "/?display=tube&filtre=views"))
itemlist.append( Item(channel=item.channel, title="Mejor valorada" , action="lista", url=host + "/?display=tube&filtre=rate"))
itemlist.append( Item(channel=item.channel, title="Categorias" , action="categorias", url=host + "/categories/"))
itemlist.append( Item(channel=item.channel, title="Buscar", action="search"))
return itemlist
def search(item, texto):
logger.info()
texto = texto.replace(" ", "+")
item.url = host + "search.php?q=%s&language=en&search=Search" % texto
try:
return lista(item)
except:
import sys
for line in sys.exc_info():
logger.error("%s" % line)
return []
def categorias(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|&nbsp;|<br>|<br/>", "", data)
patron = '<noscript>.*?src="([^"]+)".*?'
patron += '<a href="([^"]+)" title="([^"]+)".*?'
patron += '<span class="nb_cat border-radius-5">(\d+) videos</span>'
matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedthumbnail,scrapedurl,scrapedtitle,cantidad in matches:
scrapedplot = ""
title = scrapedtitle + " (" + cantidad + ")"
itemlist.append( Item(channel=item.channel, action="lista", title=title, url=scrapedurl,
thumbnail=scrapedthumbnail , plot=scrapedplot) )
return itemlist
def lista(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|&nbsp;|<br>|<br/>", "", data)
patron = '<li class="border-radius-5 box-shadow">.*?'
patron += '<img width="\d+" height="\d+" src="([^"]+)" class=.*?'
patron += '<a href="([^"]+)" title="([^"]+)">.*?'
matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedthumbnail,scrapedurl,scrapedtitle in matches:
title = scrapedtitle
thumbnail = scrapedthumbnail + "|https://watchxxxfreeinhd.com/"
plot = ""
itemlist.append( Item(channel=item.channel, action="findvideos", title=title, url=scrapedurl,
thumbnail=thumbnail, plot=plot, fanart=scrapedthumbnail, contentTitle = scrapedtitle))
next_page = scrapertools.find_single_match(data, '<link rel="next" href="([^"]+)"')
if next_page:
next_page = urlparse.urljoin(item.url,next_page)
itemlist.append( Item(channel=item.channel, action="lista", title="Página Siguiente >>", text_color="blue",
url=next_page) )
return itemlist
def findvideos(item):
logger.info()
itemlist = []
data = httptools.downloadpage(item.url).data
data = re.sub(r"\n|\r|\t|&nbsp;|<br>", "", data)
data = scrapertools.find_single_match(data,'<div class="video-embed">(.*?)</div>')
patron = '<noscript>.*?<iframe src="([^"]+)"'
matches = scrapertools.find_multiple_matches(data, patron)
for url in matches:
itemlist.append(item.clone(action="play", title = "%s", url=url ))
itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize())
return itemlist