My favorites | Sign in
Project Home Downloads Issues Source
Checkout   Browse   Changes  
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
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para cuevana
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os, sys

from core import scrapertools
from servers import servertools
from core import logger
from core.item import Item

CHANNELNAME = "cuevana"
DEBUG = True

def isGeneric():
return True

def mainlist(item):
logger.info("[cuevana.py] mainlist")

itemlist = []
itemlist.append( Item(channel=CHANNELNAME, title="Películas" , action="peliculas", url="http://www.cuevana.tv/peliculas/"))
itemlist.append( Item(channel=CHANNELNAME, title="Series" , action="series", url="http://www.cuevana.tv/series/"))

return itemlist

def peliculas(item):
logger.info("[cuevana.py] peliculas")

# Descarga la página
data = scrapertools.cachePage(item.url)

# Extrae las entradas
'''
<tr class='row2'>
<td valign='top'><a href='/peliculas/2933/alpha-and-omega/'><img src='/box/2933.jpg' border='0' height='90' /></a></td>
<td valign='top'><div class='tit'><a href='/peliculas/2933/alpha-and-omega/'>Alpha and Omega</a></div>
<div class='font11'>Dos pequeños carrochos de lobo se ven obligados a convivir por determinadas circunstancias.
<div class='reparto'><b>Reparto:</b> <a href='/buscar/?q=Animación&cat=actor'>Animación</a></div>
</div></td>
'''
patronvideos = "<tr class='row[^<]+"
patronvideos += "<td valign='top'><a href='([^']+)'><img src='([^']+)'[^>]+></a></td>[^<]+"
patronvideos += "<td valign='top'><div class='tit'><a[^>]+>([^<]+)</a></div>[^<]+"
patronvideos += "<div class='font11'>([^<]+)<"

matches = re.compile(patronvideos,re.DOTALL).findall(data)
if DEBUG: scrapertools.printMatches(matches)

itemlist = []
for match in matches:
scrapedtitle = match[2]
scrapedplot = match[3]
scrapedurl = urlparse.urljoin(item.url,match[0])
scrapedthumbnail = urlparse.urljoin(item.url,match[1])
if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

# Añade al listado de XBMC
itemlist.append( Item(channel=CHANNELNAME, action="findvideos", title=scrapedtitle , url=scrapedurl , thumbnail=scrapedthumbnail , plot=scrapedplot , folder=True) )

# Extrae el paginador
patronvideos = "<a class='next' href='([^']+)' title='Siguiente'>"
matches = re.compile(patronvideos,re.DOTALL).findall(data)
scrapertools.printMatches(matches)

if len(matches)>0:
scrapedurl = urlparse.urljoin(item.url,matches[0])
itemlist.append( Item(channel=CHANNELNAME, action="peliculas", title="!Página siguiente" , url=scrapedurl , folder=True) )

return itemlist

def series(item):
logger.info("[cuevana.py] series")

# Descarga la página
data = scrapertools.cachePage(item.url)

# Extrae las entradas
patron = 'serieslist.push\(\{id\:([0-9]+),nombre\:"([^"]+)"\}\);'
matches = re.compile(patron,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
itemlist = []
for match in matches:
scrapedtitle = match[1]
scrapedplot = ""
code = match[0]
scrapedurl = "http://www.cuevana.tv/list_search_id.php?serie="+code
scrapedthumbnail = "http://www.cuevana.tv/box/"+code+".jpg"
if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

itemlist.append( Item(channel=CHANNELNAME, action="temporadas", title=scrapedtitle , url=scrapedurl , thumbnail=scrapedthumbnail , plot=scrapedplot , show=item.title , folder=True) )

return itemlist

def temporadas(item):
logger.info("[cuevana.py] temporadas")

# Descarga la página
data = scrapertools.cachePage(item.url)

# Extrae las entradas
patron = '<li onclick=\'listSeries\(2,"([^"]+)"\)\'>([^<]+)</li>'
matches = re.compile(patron,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
itemlist = []
for match in matches:
scrapedtitle = match[1]
scrapedplot = ""
code = match[0]
scrapedurl = "http://www.cuevana.tv/list_search_id.php?temporada="+code
scrapedthumbnail = item.thumbnail
if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

itemlist.append( Item(channel=CHANNELNAME, action="episodios", title=scrapedtitle , url=scrapedurl , thumbnail=scrapedthumbnail , plot=scrapedplot , show=item.show + " - " + item.title , folder=True) )

return itemlist

def episodios(item):
logger.info("[cuevana.py] episodios")

# Descarga la página
data = scrapertools.cachePage(item.url)

# Extrae las entradas
#<li onclick='listSeries(3,"5099")'><span class='nume'>1</span> Truth Be Told</li>
patron = '<li onclick=\'listSeries\(3,"([^"]+)"\)\'><span class=\'nume\'>([^<]+)</span>([^<]+)</li>'
matches = re.compile(patron,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
itemlist = []
for match in matches:
code = match[0]
scrapedtitle = match[1]+" "+match[2].strip()
scrapedplot = ""
scrapedurl = "http://www.cuevana.tv/list_search_info.php?episodio="+code
scrapedthumbnail = item.thumbnail
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 , show = item.show , folder=True) )

return itemlist

def listalfabetico(item):
logger.info("[cuevana.py] listalfabetico")

itemlist = []
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="0-9", url="http://www.cinetube.es/peliculas/0-9/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="A" , url="http://www.cinetube.es/peliculas/A/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="B" , url="http://www.cinetube.es/peliculas/B/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="C" , url="http://www.cinetube.es/peliculas/C/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="D" , url="http://www.cinetube.es/peliculas/D/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="E" , url="http://www.cinetube.es/peliculas/E/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="F" , url="http://www.cinetube.es/peliculas/F/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="G" , url="http://www.cinetube.es/peliculas/G/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="H" , url="http://www.cinetube.es/peliculas/H/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="I" , url="http://www.cinetube.es/peliculas/I/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="J" , url="http://www.cinetube.es/peliculas/J/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="K" , url="http://www.cinetube.es/peliculas/K/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="L" , url="http://www.cinetube.es/peliculas/L/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="M" , url="http://www.cinetube.es/peliculas/M/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="N" , url="http://www.cinetube.es/peliculas/N/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="O" , url="http://www.cinetube.es/peliculas/O/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="P" , url="http://www.cinetube.es/peliculas/P/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="Q" , url="http://www.cinetube.es/peliculas/Q/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="R" , url="http://www.cinetube.es/peliculas/R/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="S" , url="http://www.cinetube.es/peliculas/S/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="T" , url="http://www.cinetube.es/peliculas/T/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="U" , url="http://www.cinetube.es/peliculas/U/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="V" , url="http://www.cinetube.es/peliculas/V/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="W" , url="http://www.cinetube.es/peliculas/W/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="X" , url="http://www.cinetube.es/peliculas/X/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="Y" , url="http://www.cinetube.es/peliculas/Y/"))
itemlist.append( Item(channel=CHANNELNAME, action="listpeliconcaratula" , title="Z" , url="http://www.cinetube.es/peliculas/Z/"))

return itemlist

def findvideos(item):
logger.info("[cuevana.py] findvideos")

code =""
if (item.url.startswith("http://www.cuevana.tv/list_search_info.php")):
data = scrapertools.cachePage(item.url)
#logger.info("data="+data)
patron = "window.location\='/series/([0-9]+)/"
matches = re.compile(patron,re.DOTALL).findall(data)
if len(matches)>0:
code = matches[0]
logger.info("code="+code)
url = "http://www.cuevana.tv/player/source?id=%s&subs=,ES&onstart=yes&tipo=s&sub_pre=ES" % matches[0]
else:
# http://www.cuevana.tv/peliculas/2553/la-cienaga/
logger.info("url1="+item.url)
patron = "http://www.cuevana.tv/peliculas/([0-9]+)/"
matches = re.compile(patron,re.DOTALL).findall(item.url)
if len(matches)>0:
code = matches[0]
logger.info("code="+code)
url = "http://www.cuevana.tv/player/source?id=%s&subs=,ES&onstart=yes&sub_pre=ES#" % code

logger.info("url2="+url)
data = scrapertools.cachePage(url)
#logger.info("data="+data)

# goSource('ee5533f50eab1ef355661eef3b9b90ec','megaupload')
patron = "goSource\('([^']+)','megaupload'\)"
matches = re.compile(patron,re.DOTALL).findall(data)
if len(matches)>0:
data = scrapertools.cachePagePost("http://www.cuevana.tv/player/source_get","key=%s&host=megaupload&vars=&id=2933&subs=,ES&tipo=&amp;sub_pre=ES" % matches[0])
logger.info("data="+data)

# Subtitulos
suburl = "http://www.cuevana.tv/files/sub/"+code+"_ES.srt"
logger.info("suburl="+suburl)

listavideos = servertools.findvideos(data)

itemlist = []

for video in listavideos:
server = video[2]
scrapedtitle = item.title + " [" + server + "]"
scrapedurl = video[1]

itemlist.append( Item(channel=CHANNELNAME, action="play" , title=scrapedtitle , url=scrapedurl, thumbnail=item.thumbnail, plot=item.plot, server=server, subtitle=suburl, folder=False))

return itemlist

Change log

r594 by tvalacarta on Feb 27, 2011   Diff
Cambios tras pruebas con WiiMC
Go to: 
Project members, sign in to write a code review

Older revisions

r587 by tvalacarta on Feb 26, 2011   Diff
[No log message]
r580 by tvalacarta on Feb 24, 2011   Diff
[No log message]
All revisions of this file

File info

Size: 11597 bytes, 228 lines
Powered by Google Project Hosting