Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.33 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. # ------------------------------------------------------------
  3. # streamondemand.- XBMC Plugin
  4. # Canal para filmperevolvere
  5. # http://www.mimediacenter.info/foro/viewforum.php?f=36
  6. # ------------------------------------------------------------
  7. import re
  8. import urlparse
  9.  
  10. from core import config
  11. from core import logger
  12. from core import scrapertools
  13. from core.item import Item
  14. from core.tmdb import infoSod
  15.  
  16. __channel__ = "filmperevolvere"
  17. __category__ = "F"
  18. __type__ = "generic"
  19. __title__ = "filmperevolvere (IT)"
  20. __language__ = "IT"
  21.  
  22. DEBUG = config.get_setting("debug")
  23.  
  24. host = "http://filmperevolvere.byethost4.com/"
  25.  
  26. headers = [
  27. ['User-Agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0'],
  28. ['Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'],
  29. ['Accept-Encoding', 'gzip, deflate'],
  30. ['Accept-Language', 'en-US,en;q=0.5'],
  31. ['Connection', 'keep-alive'],
  32. ['Referer', host],
  33. ['DNT', '1'],
  34. ['Upgrade-Insecure-Requests', '1'],
  35. ['Cache-Control', 'max-age=0']
  36. ]
  37.  
  38. def isGeneric():
  39. return True
  40.  
  41. def mainlist(item):
  42. logger.info("streamondemand.filmperevolvere mainlist")
  43. itemlist = [Item(channel=__channel__,
  44. title="[COLOR azure]Ultimi Film Inseriti[/COLOR]",
  45. action="peliculas",
  46. url=host,
  47. thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"),
  48. Item(channel=__channel__,
  49. title="[COLOR azure]Categorie[/COLOR]",
  50. action="categorie",
  51. url=host,
  52. thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png"),
  53. Item(channel=__channel__,
  54. title="[COLOR yellow]Cerca...[/COLOR]",
  55. action="search",
  56. extra="movie",
  57. thumbnail="http://dc467.4shared.com/img/fEbJqOum/s7/13feaf0c8c0/Search")]
  58.  
  59. return itemlist
  60.  
  61. def search(item, texto):
  62. logger.info("[filmperevolvere.py] " + item.url + " search " + texto)
  63. item.url = host + "/?s=" + texto
  64.  
  65. try:
  66. return peliculas_src(item)
  67.  
  68. except:
  69. import sys
  70. for line in sys.exc_info():
  71. logger.error("%s" % line)
  72.  
  73. return []
  74.  
  75. def categorie(item):
  76. itemlist = []
  77.  
  78. # Descarga la pagina
  79. data = scrapertools.cache_page(item.url, headers=headers)
  80. bloque = scrapertools.get_match(data, '<h3>Categorie</h3>(.*?)</ul>')
  81.  
  82. # Extrae las entradas (carpetas)
  83. patron = '<a href="(.*?)" >(.*?)</a>'
  84. matches = re.compile(patron, re.DOTALL).findall(bloque)
  85.  
  86. for scrapedurl, scrapedtitle in matches:
  87. if (DEBUG): logger.info("title=[" + scrapedtitle + "], url=[" + scrapedurl + "]")
  88. itemlist.append(
  89. Item(channel=__channel__,
  90. action="peliculas",
  91. title=scrapedtitle,
  92. url=scrapedurl,
  93. thumbnail="http://orig03.deviantart.net/6889/f/2014/079/7/b/movies_and_popcorn_folder_icon_by_matheusgrilo-d7ay4tw.png",
  94. folder=True))
  95.  
  96. return itemlist
  97.  
  98. def peliculas(item):
  99. logger.info("streamondemand.filmperevolvere peliculas")
  100. itemlist = []
  101.  
  102. # Descarga la pagina
  103. data = scrapertools.cache_page(item.url, headers=headers)
  104. #bloque = scrapertools.get_match(data, '<h1>Aggiunti di recente</h1>(.*?)<div class="nav-next alignright"></div>')
  105.  
  106. # Extrae las entradas (carpetas)
  107. patron = '<a href="([^"]+)">\s*<div class="image">\s*<img src="([^"]+)" alt="([^"]+)"[^>]+>'
  108. matches = re.compile(patron, re.DOTALL).findall(data)
  109.  
  110. for scrapedurl, scrapedthumbnail, scrapedtitle in matches:
  111. scrapedplot = ""
  112. if DEBUG: logger.info(
  113. "title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]")
  114. itemlist.append(infoSod(
  115. Item(channel=__channel__,
  116. action="findvideos",
  117. fulltitle=scrapedtitle,
  118. show=scrapedtitle,
  119. title="[COLOR azure]" + scrapedtitle + "[/COLOR]",
  120. url=scrapedurl,
  121. thumbnail=scrapedthumbnail,
  122. plot=scrapedplot,
  123. folder=True), tipo='movie'))
  124.  
  125. # Extrae el paginador
  126. patronvideos = '<link rel=\'next\' href=\'(.*?)\' />'
  127. matches = re.compile(patronvideos, re.DOTALL).findall(data)
  128.  
  129. if len(matches) > 0:
  130. scrapedurl = host + scrapedurl
  131. scrapedurl = urlparse.urljoin(item.url, matches[0])
  132. itemlist.append(
  133. Item(channel=__channel__,
  134. action="HomePage",
  135. title="[COLOR yellow]Torna Home[/COLOR]",
  136. folder=True)),
  137. itemlist.append(
  138. Item(channel=__channel__,
  139. action="peliculas",
  140. title="[COLOR orange]Successivo >>[/COLOR]",
  141. url=scrapedurl,
  142. thumbnail="http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png",
  143. folder=True))
  144.  
  145. return itemlist
  146.  
  147. def peliculas_src(item):
  148. logger.info("streamondemand.filmperevolvere peliculas")
  149. itemlist = []
  150.  
  151. # Descarga la pagina
  152. data = scrapertools.cache_page(item.url, headers=headers)
  153. #bloque = scrapertools.get_match(data, '<h1>Results:(.*?)<div class="lateral">')
  154.  
  155. # Extrae las entradas (carpetas)
  156. patron = '<a href="([^"]+)">\s*<div class="image">\s*<img src="([^"]+)" alt="([^"]+)"[^>]+>'
  157. matches = re.compile(patron, re.DOTALL).findall(data)
  158.  
  159. for scrapedurl, scrapedthumbnail, scrapedtitle in matches:
  160. scrapedplot = ""
  161. if DEBUG: logger.info(
  162. "title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]")
  163. itemlist.append(infoSod(
  164. Item(channel=__channel__,
  165. action="findvideos",
  166. fulltitle=scrapedtitle,
  167. show=scrapedtitle,
  168. title="[COLOR azure]" + scrapedtitle + "[/COLOR]",
  169. url=scrapedurl,
  170. thumbnail=scrapedthumbnail,
  171. plot=scrapedplot,
  172. folder=True), tipo='movie'))
  173.  
  174. # Extrae el paginador
  175. patronvideos = '<link rel=\'next\' href=\'(.*?)\' />'
  176. matches = re.compile(patronvideos, re.DOTALL).findall(data)
  177.  
  178. if len(matches) > 0:
  179. scrapedurl = host + scrapedurl
  180. scrapedurl = urlparse.urljoin(item.url, matches[0])
  181. itemlist.append(
  182. Item(channel=__channel__,
  183. action="HomePage",
  184. title="[COLOR yellow]Torna Home[/COLOR]",
  185. folder=True)),
  186. itemlist.append(
  187. Item(channel=__channel__,
  188. action="peliculas",
  189. title="[COLOR orange]Successivo >>[/COLOR]",
  190. url=scrapedurl,
  191. thumbnail="http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png",
  192. folder=True))
  193.  
  194. return itemlist
  195.  
  196. def HomePage(item):
  197. import xbmc
  198. xbmc.executebuiltin("ReplaceWindow(10024,plugin://plugin.video.streamondemand)")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement