Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # ------------------------------------------------------------
- # streamondemand.- XBMC Plugin
- # Canal para filmperevolvere
- # http://www.mimediacenter.info/foro/viewforum.php?f=36
- # ------------------------------------------------------------
- import re
- import urlparse
- from core import config
- from core import logger
- from core import scrapertools
- from core.item import Item
- from core.tmdb import infoSod
- __channel__ = "filmperevolvere"
- __category__ = "F"
- __type__ = "generic"
- __title__ = "filmperevolvere (IT)"
- __language__ = "IT"
- DEBUG = config.get_setting("debug")
- host = "http://filmperevolvere.byethost4.com/"
- headers = [
- ['User-Agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0'],
- ['Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'],
- ['Accept-Encoding', 'gzip, deflate'],
- ['Accept-Language', 'en-US,en;q=0.5'],
- ['Connection', 'keep-alive'],
- ['Referer', host],
- ['DNT', '1'],
- ['Upgrade-Insecure-Requests', '1'],
- ['Cache-Control', 'max-age=0']
- ]
- def isGeneric():
- return True
- def mainlist(item):
- logger.info("streamondemand.filmperevolvere mainlist")
- itemlist = [Item(channel=__channel__,
- title="[COLOR azure]Ultimi Film Inseriti[/COLOR]",
- action="peliculas",
- url=host,
- thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"),
- Item(channel=__channel__,
- title="[COLOR azure]Categorie[/COLOR]",
- action="categorie",
- url=host,
- thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"),
- Item(channel=__channel__,
- title="[COLOR yellow]Cerca...[/COLOR]",
- action="search",
- extra="movie",
- thumbnail="http://dc467.4shared.com/img/fEbJqOum/s7/13feaf0c8c0/Search")]
- return itemlist
- def search(item, texto):
- logger.info("[filmperevolvere.py] " + item.url + " search " + texto)
- item.url = host + "/?s=" + texto
- try:
- return peliculas_src(item)
- except:
- import sys
- for line in sys.exc_info():
- logger.error("%s" % line)
- return []
- def categorie(item):
- itemlist = []
- # Descarga la pagina
- data = scrapertools.cache_page(item.url, headers=headers)
- bloque = scrapertools.get_match(data, '<h3>Categorie</h3>(.*?)</ul>')
- # Extrae las entradas (carpetas)
- patron = '<a href="(.*?)" >(.*?)</a>'
- matches = re.compile(patron, re.DOTALL).findall(bloque)
- for scrapedurl, scrapedtitle in matches:
- if (DEBUG): logger.info("title=[" + scrapedtitle + "], url=[" + scrapedurl + "]")
- itemlist.append(
- Item(channel=__channel__,
- action="peliculas",
- title=scrapedtitle,
- url=scrapedurl,
- thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png",
- folder=True))
- return itemlist
- def peliculas(item):
- logger.info("streamondemand.filmperevolvere peliculas")
- itemlist = []
- # Descarga la pagina
- data = scrapertools.cache_page(item.url, headers=headers)
- #bloque = scrapertools.get_match(data, '<h1>Aggiunti di recente</h1>(.*?)<div class="nav-next alignright"></div>')
- # Extrae las entradas (carpetas)
- patron = '<a href="([^"]+)">\s*<div class="image">\s*<img src="([^"]+)" alt="([^"]+)"[^>]+>'
- matches = re.compile(patron, re.DOTALL).findall(data)
- for scrapedurl, scrapedthumbnail, scrapedtitle in matches:
- scrapedplot = ""
- if DEBUG: logger.info(
- "title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]")
- itemlist.append(infoSod(
- Item(channel=__channel__,
- action="findvideos",
- fulltitle=scrapedtitle,
- show=scrapedtitle,
- title="[COLOR azure]" + scrapedtitle + "[/COLOR]",
- url=scrapedurl,
- thumbnail=scrapedthumbnail,
- plot=scrapedplot,
- folder=True), tipo='movie'))
- # Extrae el paginador
- patronvideos = '<link rel=\'next\' href=\'(.*?)\' />'
- matches = re.compile(patronvideos, re.DOTALL).findall(data)
- if len(matches) > 0:
- scrapedurl = host + scrapedurl
- scrapedurl = urlparse.urljoin(item.url, matches[0])
- itemlist.append(
- Item(channel=__channel__,
- action="HomePage",
- title="[COLOR yellow]Torna Home[/COLOR]",
- folder=True)),
- itemlist.append(
- Item(channel=__channel__,
- action="peliculas",
- title="[COLOR orange]Successivo >>[/COLOR]",
- url=scrapedurl,
- thumbnail="http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png",
- folder=True))
- return itemlist
- def peliculas_src(item):
- logger.info("streamondemand.filmperevolvere peliculas")
- itemlist = []
- # Descarga la pagina
- data = scrapertools.cache_page(item.url, headers=headers)
- #bloque = scrapertools.get_match(data, '<h1>Results:(.*?)<div class="lateral">')
- # Extrae las entradas (carpetas)
- patron = '<a href="([^"]+)">\s*<div class="image">\s*<img src="([^"]+)" alt="([^"]+)"[^>]+>'
- matches = re.compile(patron, re.DOTALL).findall(data)
- for scrapedurl, scrapedthumbnail, scrapedtitle in matches:
- scrapedplot = ""
- if DEBUG: logger.info(
- "title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]")
- itemlist.append(infoSod(
- Item(channel=__channel__,
- action="findvideos",
- fulltitle=scrapedtitle,
- show=scrapedtitle,
- title="[COLOR azure]" + scrapedtitle + "[/COLOR]",
- url=scrapedurl,
- thumbnail=scrapedthumbnail,
- plot=scrapedplot,
- folder=True), tipo='movie'))
- # Extrae el paginador
- patronvideos = '<link rel=\'next\' href=\'(.*?)\' />'
- matches = re.compile(patronvideos, re.DOTALL).findall(data)
- if len(matches) > 0:
- scrapedurl = host + scrapedurl
- scrapedurl = urlparse.urljoin(item.url, matches[0])
- itemlist.append(
- Item(channel=__channel__,
- action="HomePage",
- title="[COLOR yellow]Torna Home[/COLOR]",
- folder=True)),
- itemlist.append(
- Item(channel=__channel__,
- action="peliculas",
- title="[COLOR orange]Successivo >>[/COLOR]",
- url=scrapedurl,
- thumbnail="http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png",
- folder=True))
- return itemlist
- def HomePage(item):
- import xbmc
- xbmc.executebuiltin("ReplaceWindow(10024,plugin://plugin.video.streamondemand)")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement