[ff9f0d]: plugin.video.pelisalacarta / channels / cinegratis.py  Maximize  Restore  History

Download this file

265 lines (209 with data), 13.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para cinegratis
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os, sys
import scrapertools
import servertools
import logger
import buscador
from item import Item
CHANNELNAME = "cinegratis"
DEBUG = True
def isGeneric():
return True
def mainlist(item):
logger.info("[cinegratis.py] mainlist")
itemlist = []
itemlist.append( Item(channel=CHANNELNAME, action="listvideos" , title="Películas - Novedades" , url="http://www.cinegratis.net/index.php?module=peliculas"))
itemlist.append( Item(channel=CHANNELNAME, action="listvideos" , title="Películas - Estrenos" , url="http://www.cinegratis.net/index.php?module=estrenos"))
itemlist.append( Item(channel=CHANNELNAME, action="peliscat" , title="Películas - Lista por categorías" , url="http://www.cinegratis.net/index.php?module=generos"))
itemlist.append( Item(channel=CHANNELNAME, action="pelisalfa" , title="Películas - Lista alfabética"))
itemlist.append( Item(channel=CHANNELNAME, action="listvideos" , title="Películas - Alojadas en Veoh" , url="http://www.cinegratis.net/index.php?module=servers&varserver=veoh"))
itemlist.append( Item(channel=CHANNELNAME, action="listvideos" , title="Películas - Alojadas en Megavideo", url="http://www.cinegratis.net/index.php?module=servers&varserver=megavideo"))
itemlist.append( Item(channel=CHANNELNAME, action="listseries" , title="Series - Novedades" , url="http://www.cinegratis.net/index.php?module=series"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple" , title="Series - Todas" , url="http://www.cinegratis.net/index.php?module=serieslist"))
itemlist.append( Item(channel=CHANNELNAME, action="listseries" , title="Dibujos - Novedades" , url="http://www.cinegratis.net/index.php?module=anime"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple" , title="Dibujos - Todos" , url="http://www.cinegratis.net/index.php?module=animelist"))
itemlist.append( Item(channel=CHANNELNAME, action="listvideos" , title="Documentales - Novedades" , url="http://www.cinegratis.net/index.php?module=documentales"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple" , title="Documentales - Todos" , url="http://www.cinegratis.net/index.php?module=documentaleslist"))
#itemlist.append( Item(channel=CHANNELNAME, action="search" , title="Buscar"))
return itemlist
def pelisalfa(item):
logger.info("[cinegratis.py] mainlist")
itemlist = []
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="0-9", url="http://www.cinegratis.net/index.php?module=peliculaslist&init="))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="A", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=a"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="B", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=b"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="C", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=c"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="D", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=d"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="E", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=e"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="F", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=f"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="G", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=g"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="H", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=h"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="I", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=i"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="J", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=j"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="K", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=k"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="L", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=l"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="M", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=m"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="N", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=n"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="O", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=o"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="P", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=p"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="Q", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=q"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="R", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=r"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="S", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=s"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="T", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=t"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="U", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=u"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="V", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=v"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="W", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=w"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="X", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=x"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="Y", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=y"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple", title="Z", url="http://www.cinegratis.net/index.php?module=peliculaslist&init=z"))
return itemlist
# TODO: La búsqueda no funciona en canales genéricos aún
def search(params,url,category):
logger.info("[cinegratis.py] search")
buscador.listar_busquedas(params,url,category)
# TODO: La búsqueda no funciona en canales genéricos aún
def searchresults(params,tecleado,category):
logger.info("[cinegratis.py] search")
buscador.salvar_busquedas(params,tecleado,category)
tecleado = tecleado.replace(" ", "+")
searchUrl = "http://www.cinegratis.net/index.php?module=search&title="+tecleado
listsimple(params,searchUrl,category)
# TODO: La búsqueda no funciona en canales genéricos aún
def performsearch(texto):
logger.info("[cinegratis.py] performsearch")
url = "http://www.cinegratis.net/index.php?module=search&title="+texto
# Descarga la página
data = scrapertools.cachePage(url)
# Extrae los items
patronvideos = "<a href='(index.php\?module\=player[^']+)'[^>]*>(.*?)</a>"
matches = re.compile(patronvideos,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
resultados = []
for match in matches:
# Atributos
scrapedtitle = match[1]
scrapedtitle = scrapedtitle.replace("<span class='style4'>","")
scrapedtitle = scrapedtitle.replace("</span>","")
scrapedurl = urlparse.urljoin(url,match[0])
scrapedthumbnail = ""
scrapedplot = ""
if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")
# Ańade al listado de XBMC
resultados.append( [CHANNELNAME , "findvideos" , "buscador" , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ] )
return resultados
def peliscat(item):
logger.info("[cinegratis.py] peliscat")
url = item.url
itemlist = []
itemlist.append( Item(channel=CHANNELNAME, action="listsimple" , title="Versión original" , url="http://www.cinegratis.net/index.php?module=search&title=subtitulado"))
itemlist.append( Item(channel=CHANNELNAME, action="listsimple" , title="Versión latina" , url="http://www.cinegratis.net/index.php?module=search&title=latino"))
# Descarga la página
data = scrapertools.cachePage(url)
# Extrae los items
patronvideos = "<td align='left'><a href='([^']+)'><img src='([^']+)' border='0'></a></td>"
matches = re.compile(patronvideos,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
for match in matches:
# Atributos
patron2 = "genero/([A-Za-z\-]+)/"
matches2 = re.compile(patron2,re.DOTALL).findall(match[0])
scrapertools.printMatches(matches2)
scrapedtitle = matches2[0]
scrapedurl = urlparse.urljoin(url,match[0])
scrapedthumbnail = urlparse.urljoin(url,match[1])
scrapedplot = ""
if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")
itemlist.append( Item(channel=CHANNELNAME, action="listvideos" , title=scrapedtitle , url=scrapedurl, thumbnail=scrapedthumbnail, plot=scrapedplot))
return itemlist
def listsimple(item):
logger.info("[cinegratis.py] listsimple")
url = item.url
# Descarga la página
data = scrapertools.cachePage(url)
# Extrae los items
patronvideos = "<a href='(index.php\?module\=player[^']+)'[^>]*>(.*?)</a>"
matches = re.compile(patronvideos,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
itemlist = []
for match in matches:
# Atributos
scrapedtitle = match[1]
scrapedtitle = scrapedtitle.replace("<span class='style4'>","")
scrapedtitle = scrapedtitle.replace("</span>","")
scrapedurl = urlparse.urljoin(url,match[0])
scrapedthumbnail = ""
scrapedplot = ""
if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")
itemlist.append( Item(channel=CHANNELNAME, action="findvideos" , title=scrapedtitle , url=scrapedurl, thumbnail=scrapedthumbnail, plot=scrapedplot))
return itemlist
def listvideos(item):
logger.info("[cinegratis.py] listvideos")
url = item.url
# Descarga la página
data = scrapertools.cachePage(url)
#logger.info(data)
# Extrae los items
patronvideos = "<table.*?<td.*?>([^<]+)<span class='style1'>\(Visto.*?"
patronvideos += "<div align='justify'>(.*?)</div>.*?"
patronvideos += "<a href='(.*?)'.*?"
patronvideos += "<img src='(.*?)'"
matches = re.compile(patronvideos,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
itemlist = []
for match in matches:
scrapedtitle = match[0]
if url.startswith('http://www.cinegratis.net/genero'):
url="http://www.cinegratis.net/"
scrapedurl = urlparse.urljoin(url,match[2])
scrapedthumbnail = urlparse.urljoin(url,match[3])
scrapedplot = match[1]
if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")
itemlist.append( Item(channel=CHANNELNAME, action="findvideos" , title=scrapedtitle , url=scrapedurl, thumbnail=scrapedthumbnail, plot=scrapedplot))
# Extrae la marca de siguiente página
patronvideos = "<a href='[^']+'><u>[^<]+</u></a> <a href='([^']+)'>"
matches = re.compile(patronvideos,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
if len(matches)>0:
scrapedtitle = "Página siguiente"
scrapedurl = urlparse.urljoin(url,matches[0])
scrapedthumbnail = ""
scrapedplot = ""
itemlist.append( Item(channel=CHANNELNAME, action="listvideos" , title=scrapedtitle , url=scrapedurl, thumbnail=scrapedthumbnail, plot=scrapedplot))
return itemlist
def listseries(item):
logger.info("[cinegratis.py] listvideos")
url = item.url
# Descarga la página
data = scrapertools.cachePage(url)
# Extrae los items
patronvideos = "<table width='785'[^>]+><tr><td[^>]+>([^<]+)<.*?"
patronvideos += "<div align='justify'>(.*?)</div>.*?"
patronvideos += "<a href='(.*?)'.*?"
patronvideos += "<img src='(.*?)'"
matches = re.compile(patronvideos,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
itemlist = []
for match in matches:
scrapedtitle = match[0]
scrapedurl = urlparse.urljoin(url,match[2])
scrapedthumbnail = urlparse.urljoin(url,match[3])
scrapedplot = match[1]
if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")
itemlist.append( Item(channel=CHANNELNAME, action="findvideos" , title=scrapedtitle , url=scrapedurl, thumbnail=scrapedthumbnail, plot=scrapedplot))
# Extrae la marca de siguiente página
patronvideos = "<a href='[^']+'><u>[^<]+</u></a> <a href='([^']+)'>"
matches = re.compile(patronvideos,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
if len(matches)>0:
scrapedtitle = "Página siguiente"
scrapedurl = urlparse.urljoin(url,matches[0])
scrapedthumbnail = ""
scrapedplot = ""
itemlist.append( Item(channel=CHANNELNAME, action="listseries" , title=scrapedtitle , url=scrapedurl, thumbnail=scrapedthumbnail, plot=scrapedplot))
return itemlist

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks