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

Download this file

201 lines (172 with data), 9.2 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
# -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para dibujosanimadosgratis
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
import sys
import xbmc
import xbmcgui
import xbmcplugin
import scrapertools
import megavideo
import servertools
import binascii
import xbmctools
import config
import logger
CHANNELNAME = "dibujosanimadosgratis"
# Esto permite su ejecución en modo emulado
try:
pluginhandle = int( sys.argv[ 1 ] )
except:
pluginhandle = ""
# Traza el inicio del canal
logger.info("[dibujosanimadosgratis.py] init")
DEBUG = True
def mainlist(params,url,category):
logger.info("[dibujosanimadosgratis.py] mainlist")
xbmctools.addnewfolder( CHANNELNAME , "novedades" , CHANNELNAME , "Novedades" , "http://dibujosanimadosgratis.net/" , "", "" )
xbmctools.addnewfolder( CHANNELNAME , "categorias" , CHANNELNAME , "Por categorías" , "http://dibujosanimadosgratis.net/" , "", "" )
# Label (top-right)...
xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def categorias(params,url,category):
logger.info("[dibujosanimadosgratis.py] categorias")
# Descarga la página
data = scrapertools.cachePage(url)
#logger.info(data)
# Extrae las entradas
patron = '<li class="cat-item cat-item[^"]+"><a href="([^"]+)" title="[^"]+">([^"]+)</a>'
matches = re.compile(patron,re.DOTALL).findall(data)
for match in matches:
scrapedtitle = match[1]
scrapedurl = urlparse.urljoin(url,match[0])
scrapedthumbnail = ""
scrapedplot = ""
if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")
xbmctools.addnewfolder( CHANNELNAME , "novedades" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot )
# Cierra el directorio
xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def novedades(params,url,category):
logger.info("[dibujosanimadosgratis.py] novedades")
# Descarga la página
data = scrapertools.cachePage(url)
#logger.info(data)
# Extrae las entradas
'''
<div class="post">
<h2 class="postTitle"><a href="http://dibujosanimadosgratis.net/ranma/ranma-%c2%bd-episodio-141-13-audio-latino-dvdrip-hq.html">Ranma ˝ Episodio 141 1/3 Audio Latino DVDRip HQ</a></h2>
<div class="postMeta">
<span class="date">May.08, 2010</span> en
<span class="filed"><a href="http://dibujosanimadosgratis.net/category/ranma" title="Ver todas las entradas en Ranma" rel="category tag">Ranma</a></span>
<span class="commentcount"><a href="http://dibujosanimadosgratis.net/ranma/ranma-%c2%bd-episodio-141-13-audio-latino-dvdrip-hq.html#respond" title="Comentarios en Ranma ˝ Episodio 141 1/3 Audio Latino DVDRip HQ">Deja tu Comentario</a></span>
</div>
<div class="postContent"><p> <img src="http://i4.ytimg.com/vi/sv4uf5Q0PO4/default.jpg" align="right" border="0" width="120" height="90" vspace="4" hspace="4" />
</p>
<p> Author: <a href="http://youtube.com/profile?user=AlucardReturn08">AlucardReturn08</a><br/> Keywords: <br/> Added: May 8, 2010<br/> </p>
<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/sv4uf5Q0PO4"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/sv4uf5Q0PO4" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object></p>
</div>
</div> <!-- Closes Post -->
'''
patron = '<div class="post">[^<]+'
patron += '<h2 class="postTitle"><a href="([^"]+)">([^<]+)</a></h2>(.*?)</div> <!-- Closes Post -->'
matches = re.compile(patron,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
for match in matches:
scrapedtitle = match[1]
scrapedurl = urlparse.urljoin(url,match[0])
scrapedthumbnail = ""
patronthumb = '<img src="([^"]+)"'
matchesthumb = re.compile(patronthumb,re.DOTALL).findall(match[2])
if len(matchesthumb)>0:
scrapedthumbnail = matchesthumb[0]
scrapedplot = ""
if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")
xbmctools.addnewfolder( CHANNELNAME , "detail" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot )
patron = '<a href="([^"]+)">&laquo; videos anteriores</a>'
matches = re.compile(patron,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
if len(matches)>0:
scrapedtitle = "!Página siguiente"
scrapedurl = urlparse.urljoin(url,matches[0])
scrapedthumbnail = ""
scrapedplot = ""
if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")
xbmctools.addnewfolder( CHANNELNAME , "novedades" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot )
patron = '<a href="([^"]+)">&laquo; previous entries</a>'
matches = re.compile(patron,re.DOTALL).findall(data)
scrapertools.printMatches(matches)
if len(matches)>0:
scrapedtitle = "!Página siguiente"
scrapedurl = urlparse.urljoin(url,matches[0])
scrapedthumbnail = ""
scrapedplot = ""
if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")
xbmctools.addnewfolder( CHANNELNAME , "novedades" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot )
# Cierra el directorio
xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def detail(params,url,category):
logger.info("[dibujosanimadosgratis.py] detail")
# Recupera los parámetros
title = urllib.unquote_plus( params.get("title") )
thumbnail = urllib.unquote_plus( params.get("thumbnail") )
plot = urllib.unquote_plus( params.get("plot") )
# Descarga la página de detalle
'''
<div class="post">
<h2 class="postTitle"><a href="http://dibujosanimadosgratis.net/ranma/ranma-%c2%bd-episodio-142-33-audio-latino-dvdrip-hq.html">Ranma ˝ Episodio 142 3/3 Audio Latino DVDRip HQ</a></h2>
<div class="postMeta">
<span class="date">May.08, 2010</span> en
<span class="filed"><a href="http://dibujosanimadosgratis.net/category/ranma" title="Ver todas las entradas en Ranma" rel="category tag">Ranma</a></span>
</div>
<div class="postContent"><p> <img src="http://i4.ytimg.com/vi/3k4YsDCdfoA/default.jpg" align="right" border="0" width="120" height="90" vspace="4" hspace="4" />
</p>
<p> Author: <a href="http://youtube.com/profile?user=AlucardReturn08">AlucardReturn08</a><br/> Keywords: <br/> Added: May 8, 2010<br/> </p>
<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/3k4YsDCdfoA"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/3k4YsDCdfoA" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object></p>
</div>
'''
data = scrapertools.cachePage(url)
patron = '<div class="post">(.*?<div class="postMeta">.*?<div class="postContent">.*?)</div>'
matches = re.compile(patron,re.DOTALL).findall(data)
if len(matches)>0:
data = matches[0]
logger.info(data)
# Plot
scrapedplot = scrapertools.htmlclean(data)
scrapedplot = scrapedplot.replace("\n"," ")
scrapedplot = scrapedplot.replace("\r"," ")
# Thumbnail
patron = '<img src="([^"]+)"'
matches = re.compile(patron,re.DOTALL).findall(data)
scrapedthumbnail = ""
if len(matches)>0:
scrapedthumbnail = matches[0]
# ------------------------------------------------------------------------------------
# Busca los enlaces a los videos conocidos en el iframe
# ------------------------------------------------------------------------------------
listavideos = servertools.findvideos(data)
for video in listavideos:
videotitle = video[0]
url = video[1]
server = video[2]
xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip() + " - " + videotitle , url , scrapedthumbnail , scrapedplot )
# ------------------------------------------------------------------------------------
# Label (top-right)...
xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def play(params,url,category):
logger.info("[dibujosanimadosgratis.py] play")
title = unicode( xbmc.getInfoLabel( "ListItem.Title" ), "utf-8" )
thumbnail = urllib.unquote_plus( params.get("thumbnail") )
plot = unicode( xbmc.getInfoLabel( "ListItem.Plot" ), "utf-8" )
server = params["server"]
xbmctools.playvideo(CHANNELNAME,server,url,category,title,thumbnail,plot)

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

Sign up for the SourceForge newsletter:





No, thanks