def play(params,url,category):
	logger.info("[peliculasid.py] play")
	
	
	title = unicode( xbmc.getInfoLabel( "ListItem.Title" ), "utf-8" )
	thumbnail = urllib.unquote_plus( params.get("thumbnail") )
	try:
		plot = unicode( xbmc.getInfoLabel( "ListItem.Plot" ), "utf-8" )
	except:
		plot = xbmc.getInfoLabel( "ListItem.Plot" )
	server = params["server"]
	if "|" in url:
		matches = url.split("|")
		patronvideos = 'file=([^\&]+)\&'
		c = 0
		listdata = []
		for match in matches:
			c += 1
			print match
			data = scrapertools.cachePage(match)
			matches2 = re.compile(patronvideos,re.DOTALL).findall(data)
			listdata.append(["Parte %d" %c,matches2[0]])
		
		url = xmltoplaylist.MakePlaylistFromList(listdata)	
	elif "iframeplayer.php" in url:      #"http://peliculasid.net/iframeplayer.php?url=aHR0cDovL3ZpZGVvLmFrLmZhY2Vib29rLmNvbS9jZnMtYWstc25jNC80MjIxNi82MS8xMjgxMTI4ODgxOTUwXzM5NTAwLm1wNA=="
		data = scrapertools.cachePage(url)
		patronvideos = 'file=([^\&]+)\&'
		matches = re.compile(patronvideos,re.DOTALL).findall(data)
		if len(matches)>0:
			url = matches[0]
			
	elif "iframevk.php" in url:
		data = scrapertools.cachePage(url)
		patronvideos = '<iframe src="(http://vk[^/]+/video_ext.php[^"]+)"'
		matches = re.compile(patronvideos,re.DOTALL).findall(data)
		if len(matches)>0:
			import vk
			server = "Directo"
			url = 	vk.geturl(matches[0])
	elif "iframemv.php" in url:
		data = scrapertools.cachePage(url)
		patronvideos  = 'src="http://www.megavideo.com/mv_player.swf\?v\=([^"]+)"'
		matches = re.compile(patronvideos,re.DOTALL).findall(data)	
		if len(matches)>0:
			server = "Megavideo"
			url = matches[0]
	
	xbmctools.playvideo(CHANNELNAME,server,url,category,title,thumbnail,plot)
Ejemplo n.º 2
0
def play(params, url, category):
    logger.info("[peliculasid.py] play")

    title = unicode(xbmc.getInfoLabel("ListItem.Title"), "utf-8")
    thumbnail = urllib.unquote_plus(params.get("thumbnail"))
    try:
        plot = unicode(xbmc.getInfoLabel("ListItem.Plot"), "utf-8")
    except:
        plot = xbmc.getInfoLabel("ListItem.Plot")
    server = params["server"]
    if "|" in url:
        matches = url.split("|")
        patronvideos = 'file=([^\&]+)\&'
        c = 0
        listdata = []
        for match in matches:
            c += 1
            print match
            data = scrapertools.downloadpageGzip(match)
            matches2 = re.compile(patronvideos, re.DOTALL).findall(data)
            listdata.append(["Parte %d" % c, matches2[0]])

        url = xmltoplaylist.MakePlaylistFromList(listdata)
    elif "iframeplayer.php" in url:  #"http://peliculasid.net/iframeplayer.php?url=aHR0cDovL3ZpZGVvLmFrLmZhY2Vib29rLmNvbS9jZnMtYWstc25jNC80MjIxNi82MS8xMjgxMTI4ODgxOTUwXzM5NTAwLm1wNA=="
        data = scrapertools.downloadpageGzip(url)
        patronvideos = 'file=([^\&]+)\&'
        matches = re.compile(patronvideos, re.DOTALL).findall(data)
        if len(matches) > 0:
            url = matches[0]

    elif "iframevk.php" in url:
        data = scrapertools.downloadpageGzip(url)
        patronvideos = '<iframe src="(http://vk[^/]+/video_ext.php[^"]+)"'
        matches = re.compile(patronvideos, re.DOTALL).findall(data)
        if len(matches) > 0:
            import vk
            server = "Directo"
            url = vk.geturl(matches[0])
    elif "iframemv.php" in url:
        data = scrapertools.downloadpageGzip(url)
        patronvideos = 'src="http://www.megavideo.com/mv_player.swf\?v\=([^"]+)"'
        matches = re.compile(patronvideos, re.DOTALL).findall(data)
        if len(matches) > 0:
            server = "Megavideo"
            url = matches[0]

    xbmctools.playvideo(CHANNELNAME, server, url, category, title, thumbnail,
                        plot)
def detail(params,url,category):
	logger.info("[cineadicto.py] detail")

	title = urllib.unquote_plus( params.get("title") )
	thumbnail = urllib.unquote_plus( params.get("thumbnail") )
	plot = ""
	scrapedurl = ""
	# Descarga la p�gina
	data = scrapertools.cachePage(url)
	#logger.info(data)
    # Extrae el argumento
	patronarg = '</p><p>.*?<strong>([^<]+</strong> <strong>.*?)<p></p>'
	matches   = re.compile(patronarg,re.DOTALL).findall(data)
	if len(matches)>0:
		plot  = re.sub("<[^>]+>"," ",matches[0])
  
	# ------------------------------------------------------------------------------------
	# Busca los enlaces a los videos en los servidores habilitados
	# ------------------------------------------------------------------------------------

   
			
	## --------------------------------------------------------------------------------------##
	#               Busca enlaces a videos .flv o (.mp4 dentro de un xml)                     #
	## --------------------------------------------------------------------------------------##
	patronvideos = 'file=(http\:\/\/[^\&]+)\&'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)
	playWithSubt = "play"
	c = 0
	if len(matches)>0:
		for match in matches:
			subtitle = "[FLV-Directo]"
			c += 1
			if ("playlist" in match):
				data2 = scrapertools.cachePage(match)
				logger.info("data2="+data2)
				patronvideos  = '<track>.*?'
				patronvideos += '<title>([^<]+)</title>[^<]+'
				patronvideos += '<location>([^<]+)</location>(?:[^<]+'
				patronvideos += '<meta rel="type">video</meta>[^<]+|[^<]+)'
				patronvideos += '<meta rel="captions">([^<]+)</meta>[^<]+'
				patronvideos += '</track>'
				matches2 = re.compile(patronvideos,re.DOTALL).findall(data2)
				scrapertools.printMatches(matches)
				
				for match2 in matches2:
					sub = ""
					if match2[2].endswith(".xml"): # Subtitulos con formato xml son incompatibles con XBMC
						sub = "[Subtitulo incompatible con xbmc]"
						playWithSubt = "play"
					if ".mp4" in match2[1]:
						subtitle = "[MP4-Directo]"
					scrapedtitle = '%s (castellano) - %s  %s' %(title,match2[0],subtitle)
					
					scrapedurl = match2[1].strip()
					scrapedthumbnail = thumbnail
					scrapedplot = plot
					if ("cast.xml" or "mirror.xml") not in match:
						scrapedtitle = '%s (V.O.S) - %s  %s %s' %(title,match2[0],subtitle,sub)
						if not match2[2].endswith("cine-adicto2.srt") and (sub == ""): 
							scrapedurl = scrapedurl + "|" + match2[2]
							playWithSubt = "play2"
							
					if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")
							
					# A�ade al listado de XBMC
					xbmctools.addnewvideo( CHANNELNAME , playWithSubt , category , "Directo" , scrapedtitle, scrapedurl , scrapedthumbnail, scrapedplot )
				
			else:
				c +=1
				scrapedurl = match
				if match.endswith(".srt") and not (((c / 2) * 2 - c) == 0) :
					scrapedurl = scrapedurl + "|" + match 
					xbmctools.addnewvideo( CHANNELNAME ,"play2"  , category , "Directo" , title + " (V.O.S) - "+subtitle, scrapedurl , thumbnail , plot )
				elif 	match.endswith(".xml") and not (((c / 2) * 2 - c) == 0):
					sub = "[Subtitulo incompatible con xbmc]"
					xbmctools.addnewvideo( CHANNELNAME ,"play"  , category , "Directo" , title + " (V.O) - %s %s" %(subtitle,sub), scrapedurl , thumbnail , plot )
				elif not match.endswith("srt" or "xml") :
					xbmctools.addnewvideo( CHANNELNAME ,"play"  , category , "Directo" , title + " - [Directo]" , scrapedurl , thumbnail , plot )
				
				print scrapedurl
	
	try:
		matches = url.split("/")
		url2 = "http://www.cine-adicto.com/tab/"+matches[3]
		data2 = scrapertools.cachePage(url2)
	
		
		listavideos = servertools.findvideos(data2)
		c = 0
		for video in listavideos:
			if "stagevu.com/embed" not in video[1]:
				videotitle = video[0]
				url = video[1]
				server = video[2]
				if "facebook" in url:
					c += 1
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip() + " - Parte %d %s" %(c,videotitle) , url , thumbnail , plot )
				else:
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip() + " - " + videotitle , url , thumbnail , plot )
	except:
		pass


	## --------------------------------------------------------------------------------------##
	#            Busca enlaces de videos para el servidor vk.com                             #
	## --------------------------------------------------------------------------------------##
	'''
	var video_host = '447.gt3.vkadre.ru';
	var video_uid = '0';
	var video_vtag = '2638f17ddd39-';
	var video_no_flv = 0;
	var video_max_hd = '0';
	var video_title = 'newCine.NET+-+neWG.Es+%7C+Chicken+Little';

	'''
	patronvideos = '<iframe src="(http://[^\/]+\/video_ext.php[^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		print " encontro VK.COM :%s" %matches[0]
 		videourl = 	vk.geturl(matches[0])
 		xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VK]", videourl , thumbnail , plot )
	
	# Label (top-right)...
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
		
	# Disable sorting...
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )

	# End of directory...
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
Ejemplo n.º 4
0
def play(params,url,category):
	logger.info("[delatv.py] play")
	try:
		title = unicode( xbmc.getInfoLabel( "ListItem.Title" ), "utf-8" )
	except:
		title = urllib.unquote_plus( params.get("title") )
	thumbnail = urllib.unquote_plus( params.get("thumbnail") )
	plot = unicode( xbmc.getInfoLabel( "ListItem.Plot" ), "utf-8" )
	server = params.get("server")

	# Abre dialogo
	dialogWait = xbmcgui.DialogProgress()
	dialogWait.create( 'Accediendo al video...', title , plot )

	# Descarga la página del reproductor
	# http://delatv.com/modulos/player.php?url=dmlkZW8uYWsuZmFjZWJvb2suY29tL2Nmcy1hay1hc2gyLzMzMjM2LzY4NS8xMDU1NTcxNDYxNjI3MjNfMzQ5ODk=
	# http://delatv.com/modulos/embed/playerembed.php?url=dmlkZW8uYWsuZmFjZWJvb2suY29tL2Nmcy1hay1hc2gyLzMzMjM2LzY4NS8xMDU1NTcxNDYxNjI3MjNfMzQ5ODk=
	logger.info("[delatv.py] url="+url)
	
	## --------------------------------------------------------------------------------------##
	#            Busca enlaces de videos para el servidor vkontakte.ru                        #
	## --------------------------------------------------------------------------------------##
	#"http://vkontakte.ru/video_ext.php?oid=89710542&id=147003951&hash=28845bd3be717e11&hd=1
	
	
	if "vkontakteX.php" or "/vk/" in url:
		data = scrapertools.cachePage(url)
		server = "Directo"
		'''
		var video_host = 'http://cs12916.vkontakte.ru/';
		var video_uid = '87155741';
		var video_vtag = 'fc697084d3';
		var video_no_flv = 1;
		var video_max_hd = '1'
		'''
		patronvideos = '<iframe src="(http://vk[^/]+/video_ext.php[^"]+)"'
		matches = re.compile(patronvideos,re.DOTALL).findall(data)
		if len(matches)>0:
			print " encontro VKontakte.ru :%s" %matches[0]
			url = 	vk.geturl(matches[0])
			
			
 		'''
			data2 = scrapertools.cachePage(matches[0])
			print data2
			patron  = "var video_host = '([^']+)'.*?"
			patron += "var video_uid = '([^']+)'.*?"
			patron += "var video_vtag = '([^']+)'.*?"
			patron += "var video_no_flv = ([^;]+);.*?"
			patron += "var video_max_hd = '([^']+)'"
			matches2 = re.compile(patron,re.DOTALL).findall(data2)
			if len(matches2)>0:    #http://cs12385.vkontakte.ru/u88260894/video/d09802a95b.360.mp4
				for match in matches2:
					if match[3].strip() == "0":
						tipo = "flv"
						url = "%su%s/video/%s.%s" % (match[0],match[1],match[2],tipo)
					
					else:
						tipo = "360.mp4"
						url = "%su%s/video/%s.%s" % (match[0],match[1],match[2],tipo)
						
		'''
	
	
	# Cierra dialogo
	dialogWait.close()
	del dialogWait

	if len(url)>0:
		
		logger.info("url="+url)
		xbmctools.playvideo(CHANNELNAME,server,url,category,title,thumbnail,plot)
	else:
		xbmctools.alertnodisponible()
Ejemplo n.º 5
0
def detail(params,url,category):
	logger.info("[pelisflv.py] detail")

	title = urllib.unquote_plus( params.get("title") )
	thumbnail = urllib.unquote_plus( params.get("thumbnail") )
	plot = urllib.unquote_plus( params.get("plot") )
	accion = params.get("accion")

	# Descarga la p�gina
	datafull = scrapertools.cachePage(url)
	#logger.info(data)
	patron = "google_ad_section_start(.*?)google_ad_section_end -->"
	matches = re.compile(patron,re.DOTALL).findall(datafull)

	if len(matches)>0:
		data = matches[0]
	else:
		data = datafull
	patron = '<iframe src="(http://pelisflv.net63.net/player/[^"]+)"'
	matches = re.compile(patron,re.DOTALL).findall(data)
	if len(matches)>0:
		data = scrapertools.cachePage(matches[0])
	ok = False               
          
	# ------------------------------------------------------------------------------------
	# Busca los enlaces a los videos
	# ------------------------------------------------------------------------------------
	
	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 , thumbnail , plot )
	
	# Busca enlaces en el servidor Stagevu - "el modulo servertools.findvideos() no los encuentra"
	
	patronvideos  = "'(http://stagevu.com[^']+)'"
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		logger.info(" Servidor Stagevu")
		for match in matches:
			ok = True
			scrapedurl = match.replace("&amp;","&")
			xbmctools.addnewvideo( CHANNELNAME ,"play"  , category , "Stagevu" , title+" - [Stagevu]", scrapedurl , thumbnail , plot )

	# Busca enlaces en el servidor Movshare - "el modulo servertools.findvideos() no los encuentra"
	
	patronvideos  = "'(http://www.movshare.net[^']+)'"
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		logger.info(" Servidor Movshare")
		for match in matches:
			ok = True
			scrapedurl = match.replace("&amp;","&")
			xbmctools.addnewvideo( CHANNELNAME ,"play"  , category , "Movshare" , title+" - [Movshare]", scrapedurl , thumbnail , plot )


		
	# ------------------------------------------------------------------------------------
        #--- Busca los videos Directos
        
	patronvideos = 'file=(http\:\/\/[^\&]+)\&'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)
	print "link directos encontrados :%s" %matches

	#print data
	if len(matches)>0:
		for match in matches:
			subtitle = "[FLV-Directo]"
			if ("xml" in match):
				data2 = scrapertools.cachePage(match)
				logger.info("data2="+data2)
				patronvideos  = '<track>.*?'
				patronvideos += '<title>([^<]+)</title>[^<]+'
				patronvideos += '<location>([^<]+)</location>(?:[^<]+'
				patronvideos += '<meta rel="type">video</meta>[^<]+|[^<]+)'
				patronvideos += '<meta rel="captions">([^<]+)</meta>[^<]+'
				patronvideos += '</track>'
				matches2 = re.compile(patronvideos,re.DOTALL).findall(data2)
				scrapertools.printMatches(matches)
				
				for match2 in matches2:
					sub = ""
					playWithSubt = "play"
					if match2[2].endswith(".xml"): # Subtitulos con formato xml son incompatibles con XBMC
						sub = "[Subtitulo incompatible con xbmc]"
						
					if ".mp4" in match2[1]:
						subtitle = "[MP4-Directo]"
					scrapedtitle = '%s  - (%s)  %s' %(title,match2[0],subtitle)
					
					scrapedurl = match2[1].strip()
					scrapedthumbnail = thumbnail
					scrapedplot = plot
					
					if match2[2].endswith(".srt"): 
						scrapedurl = scrapedurl + "|" + match2[2]
						playWithSubt = "play2"
							
					if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")
							
					# A�ade al listado de XBMC
					xbmctools.addnewvideo( CHANNELNAME , playWithSubt , category , "Directo" , scrapedtitle, scrapedurl , scrapedthumbnail, scrapedplot )
					ok = True
			else:
				if match.endswith(".srt"):
					scrapedurl = scrapedurl + "|" + match 
					xbmctools.addnewvideo( CHANNELNAME ,"play2"  , category , "Directo" , title + " (V.O.S) - "+subtitle, scrapedurl , thumbnail , plot )
					ok = True
				if 	match.endswith(".xml"):
					sub = "[Subtitulo incompatible con xbmc]"
					xbmctools.addnewvideo( CHANNELNAME ,"play"  , category , "Directo" , title + " (V.O) - %s %s" %(subtitle,sub), scrapedurl , thumbnail , plot )
					ok = True
				scrapedurl = match
				print scrapedurl
	#src="http://pelisflv.net63.net/player/videos.php?x=http://pelisflv.net63.net/player/xmls/The-Lord-Of-The-Ring.xml"			
	patronvideos = '(http\:\/\/[^\/]+\/[^\/]+\/[^\/]+\/[^\.]+\.xml)'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)
	#print data
	
	if len(matches)>0:
		playlistFile = open(FULL_FILENAME_PATH,"w")
		playlistFile.write("[playlist]\n")
		playlistFile.write("\n")
		for match in matches:
			subtitle = "[FLV-Directo]"
					

			data2 = scrapertools.cachePage(match.replace(" ","%20"))
			logger.info("data2="+data2)
			patronvideos  = '<track>.*?'
			patronvideos += '<title>([^<]+)</title>.*?'
			patronvideos += '<location>([^<]+)</location>(?:[^<]+'
			patronvideos += '<meta rel="captions">([^<]+)</meta>[^<]+'
			patronvideos += '|([^<]+))</track>'
			matches2 = re.compile(patronvideos,re.DOTALL).findall(data2)
			scrapertools.printMatches(matches)
			c = 0
			for match2 in matches2:
				c +=1
				sub = ""
				playWithSubt = "play"
				if match2[2].endswith(".xml"): # Subtitulos con formato xml son incompatibles con XBMC
					sub = "[Subtitulo incompatible con xbmc]"
					
				if  match2[1].endswith(".mp4"):
					subtitle = "[MP4-Directo]"
				scrapedtitle = '%s  - (%s)  %s' %(title,match2[0],subtitle)
				
				scrapedurl = match2[1].strip()
				scrapedthumbnail = thumbnail
				scrapedplot = plot
				
				if match2[2].endswith(".srt"): 
					scrapedurl = scrapedurl + "|" + match2[2]
					playWithSubt = "play2"
						
				if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")
						
				# A�ade al listado de XBMC
				xbmctools.addnewvideo( CHANNELNAME , playWithSubt , category , "Directo" , scrapedtitle, scrapedurl , scrapedthumbnail, scrapedplot )					
				ok =True
				
				playlistFile.write("File%d=%s\n"  %(c,match2[1]))
				playlistFile.write("Title%d=%s\n" %(c,match2[0]))
				playlistFile.write("\n")
				
			
			playlistFile.write("NumberOfEntries=%d\n" %c)
			playlistFile.write("Version=2\n")
			playlistFile.flush();
			playlistFile.close()
			xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , "Reproducir Todo a la vez...", FULL_FILENAME_PATH , scrapedthumbnail, scrapedplot )
	
	# Busca enlaces en el servidor Videoweed - "el modulo servertools.findvideos() no los encuentra"
	patronvideos = '(http\:\/\/[^\.]+\.videoweed.com\/[^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)
	if len(matches)>0:
		logger.info(" Servidor Videoweed")
		for match in matches:
			ok = True
			scrapedurl = match.replace("&amp;","&")
			xbmctools.addnewvideo( CHANNELNAME ,"play"  , category , "Videoweed" , title+" - [Videoweed]", scrapedurl , thumbnail , plot )		
	
	# Busca enlaces en el servidor Gigabyteupload # http://cdn-2.gigabyteupload.com/files/207bb7b658d5068650ebabaca8ffc52d/vFuriadeTitanes_newg.es.avi
	patronvideos = '(http\:\/\/[^\.]+\.gigabyteupload.com\/[^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)
	if len(matches)>0:
		logger.info(" Servidor Gigabyteupload")
		for match in matches:
			ok = True
			xbmctools.addnewvideo( CHANNELNAME ,"play"  , category , "Gigabyteupload" , title+" - [Gigabyteupload]",match  , thumbnail , plot )

	## --------------------------------------------------------------------------------------##
	#            Busca enlaces de videos para el servidor vk.com                             #
	## --------------------------------------------------------------------------------------##
	'''
	var video_host = '447.gt3.vkadre.ru';
	var video_uid = '0';
	var video_vtag = '2638f17ddd39-';
	var video_no_flv = 0;
	var video_max_hd = '0';
	var video_title = 'newCine.NET+-+neWG.Es+%7C+Chicken+Little';

	'''
	patronvideos = '<iframe src="(http://[^\/]+\/video_ext.php[^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		ok = True
		print " encontro VK.COM :%s" %matches[0]

 		videourl = 	vk.geturl(matches[0])
 		xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VK]", videourl , thumbnail , plot )		
 	"""	
		data2 = scrapertools.downloadpageGzip(matches[0].replace("amp;",""))
		print data2
		regexp =re.compile(r'vkid=([^\&]+)\&')
		match = regexp.search(data2)
		vkid = ""
		print 'match %s'%str(match)
		if match is not None:
			vkid = match.group(1)
		else:
			print "no encontro vkid"
			
		patron  = "var video_host = '([^']+)'.*?"
		patron += "var video_uid = '([^']+)'.*?"
		patron += "var video_vtag = '([^']+)'.*?"
		patron += "var video_no_flv = ([^;]+);.*?"
		patron += "var video_max_hd = '([^']+)'"
		matches2 = re.compile(patron,re.DOTALL).findall(data2)
		if len(matches2)>0:    
			for match in matches2:
				if match[3].strip() == "0" and match[1] != "0":
					tipo = "flv"

					if "http://" in match[0]:
						videourl = "%s/u%s/video/%s.%s" % (match[0],match[1],match[2],tipo)
					else:
						videourl = "http://%s/u%s/video/%s.%s" % (match[0],match[1],match[2],tipo)
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VK] [%s]" %tipo, videourl , thumbnail , plot )

				elif match[1]== "0" and vkid != "":     #http://447.gt3.vkadre.ru/assets/videos/2638f17ddd39-75081019.vk.flv 
					tipo = "flv"

					if "http://" in match[0]:
						videourl = "%s/assets/videos/%s%s.vk.%s" % (match[0],match[2],vkid,tipo)
					else:
						videourl = "http://%s/assets/videos/%s%s.vk.%s" % (match[0],match[2],vkid,tipo)
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VK] [%s]" %tipo, videourl , thumbnail , plot )
				else:
					tipo = "360.mp4"
					videourl = "%s/u%s/video/%s.%s" % (match[0],match[1],match[2],tipo)
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VK] [%s]" %tipo, videourl , thumbnail , plot )
					tipo = "240.mp4"
					videourl = "%s/u%s/video/%s.%s" % (match[0],match[1],match[2],tipo)
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VK] [%s]" %tipo, videourl , thumbnail , plot )
		
	"""
	if not ok:
		patron = "SeriesPage"
		matches = re.compile(patron,re.DOTALL).findall(datafull)
		if len(matches)>0:
			ListadoCapitulosSeries(params,url,category)
	# Label (top-right)...
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
		
	# Disable sorting...
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )

	# End of directory...
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def detail(params,url,category):
	logger.info("[peliculasonlineflv.py] detail")

	
	thumbnail = urllib.unquote_plus( params.get("thumbnail") )
	plot = urllib.unquote_plus( params.get("plot") )

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

	try:
		title = re.compile("<title>(.+?)</title>").findall(data)[0]
	except:
		title = urllib.unquote_plus( params.get("title") )
	# ------------------------------------------------------------------------------------
	# Busca los enlaces a los videos
	# ------------------------------------------------------------------------------------
	listavideos = servertools.findvideos(data)
	
	for video in listavideos:
		videotitle = video[0]
		
		if "myspacecdn" or "facebook" in video[1]:
			continue
		
		url = video[1].replace("&amp;","&")
		server = video[2]
		xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip() + " - " + videotitle , url , thumbnail , plot )
	# ------------------------------------------------------------------------------------
	## --------------------------------------------------------------------------------------##
	#               Busca enlaces a videos .flv o (.mp4 dentro de un xml)                     #
	## --------------------------------------------------------------------------------------##
	patronvideos = 'file=(http\:\/\/[^\&]+)\&'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	print patronvideos
	c = 0
	if len(matches)>0:
		print matches
		for match in matches:
			subtitle = "[FLV-Directo]"
			if ("xml" in matches[0]):
				data2 = scrapertools.cachePage(matches[0])
				logger.info("data2="+data2)
				patronvideos  = '<track>.*?'
				patronvideos += '<creator>([^<]+)</creator>[^<]+'
				patronvideos += '<location>([^<]+)</location>[^<]+'
				patronvideos += '</track>'
				matches2 = re.compile(patronvideos,re.DOTALL).findall(data2)
				scrapertools.printMatches(matches2)

				for match2 in matches2:
					if ".mp4" in match2[1]:
						subtitle = "[MP4-Directo]"
					scrapedtitle = '%s (%s) - %s' %(title,match2[0].strip(),subtitle)
					scrapedurl = match2[1].strip()
					scrapedthumbnail = thumbnail
					scrapedplot = plot
					if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

					# Añade al listado de XBMC
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , scrapedtitle, scrapedurl , scrapedthumbnail, scrapedplot )
			else:
				
				c +=1	
				xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - Parte %d/%d " %(c,len(matches))+subtitle, match , thumbnail , plot )
	
	
	patronvideos = 'src="(http://vk[^/]+/video_ext.php[^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	long = len(matches)
	
	
	if long>0:
		for match in matches:
			print " encontro VKontakte.ru :%s" %match[0]
			scrapedurl = 	vk.geturl(match.replace("&amp;","&"))
			scrapedtitle = title
			server = "Directo"
			
			
			xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle+" - [VKServer]" , scrapedurl , thumbnail, plot )
			
	
	patronvideos = 'http://www.yaflix.com/.+?key=([^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	
	
	
	if len(matches)>0:
		
		for match in matches:
			link = "http://www.yaflix.com/nuevo/playlist.php?key=" + match
			data2 = scrapertools.cachePage(link)
			#print " encontro yaflix :%s" %match[0]
			patron = "<file>([^<]+)</file>"
			matcheslink = re.compile(patron,re.DOTALL).findall(data2)
			if len (matcheslink)>0:
				scrapedurl = 	matcheslink[0]
			else:scrapedurl = ""
			scrapedtitle = title
			server = "Directo"
			
			
			xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle+" - [YAFLIX]" , scrapedurl , thumbnail, plot )
				
	
	# Label (top-right)...
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
		
	# Disable sorting...
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )

	# End of directory...
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
Ejemplo n.º 7
0
def detail(params,url,category):
	logger.info("[nolomires.py] detail")

	title = acentos(urllib.unquote_plus( params.get("title") ))
	thumbnail = urllib.unquote_plus( params.get("thumbnail") )
	plot = ""
	scrapedurl = ""
	# Descarga la p�gina
	data = scrapertools.cachePage(url)
	#logger.info(data)
    # Extrae el argumento
	patronarg = '<h[2-3]>(<span style.*?)</p>'
	matches   = re.compile(patronarg,re.DOTALL).findall(data)
	if len(matches)>0:
		plot  = re.sub("<[^>]+>"," ",matches[0])
	patronthumb = '<div id="textimg"><img src="([^"]+)"'
	matches   = re.compile(patronthumb,re.DOTALL).findall(data)
	if len(matches)>0:
		thumbnail = matches[0]
	# ------------------------------------------------------------------------------------
	# Busca los enlaces a los videos en los servidores habilitados
	# ------------------------------------------------------------------------------------
	
	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 , thumbnail , plot )
	
   
			
	## --------------------------------------------------------------------------------------##
	#               Busca enlaces a videos .flv o (.mp4 dentro de un xml)                     #
	## --------------------------------------------------------------------------------------##
	patronvideos = 'file=(http\:\/\/[^\&]+)\&'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)
	playWithSubt = "play"
	c = 0
	if len(matches)>0:
		for match in matches:
			print "link xml :%s" %match
			subtitle = "[FLV-Directo]"
			c += 1
			sub = ""
			if ("/xml" in match):
				data2 = scrapertools.cachePage(match)
				logger.info("data2="+data2)
				patronvideos  = '<track>.*?'
				patronvideos += '<title>([^<]+)</title>[^<]+'
				patronvideos += '<location>([^<]+)</location>(?:[^<]+'
				patronvideos += '<meta rel="type">video</meta>[^<]+|[^<]+)'
				patronvideos += '<meta rel="captions">([^<]+)</meta>[^<]+'
				patronvideos += '</track>'
				matches2 = re.compile(patronvideos,re.DOTALL).findall(data2)
				scrapertools.printMatches(matches)
				if len(matches2)==0:
					newpatron = '<title>([^<]+)</title>[^<]+<location>([^<]+)</location>'
					matches2 = re.compile(newpatron,re.DOTALL).findall(data2)
					sub = "None"
				for match2 in matches2:
					
					try:
						if match2[2].endswith(".xml"): # Subtitulos con formato xml son incompatibles con XBMC
							sub = "[Subtitulo incompatible con xbmc]"
							playWithSubt = "play"
					except:
						pass
					if ".mp4" in match2[1]:
						subtitle = "[MP4-Directo]"
					scrapedtitle = '%s (castellano) - %s  %s' %(title,match2[0],subtitle)
					
					scrapedurl = match2[1].strip()
					scrapedthumbnail = thumbnail
					scrapedplot = plot
					if ("cast.xml" or "mirror.xml") not in match and sub == "":
						scrapedtitle = '%s (V.O.S) - %s  %s %s' %(title,match2[0],subtitle,sub)
						try:
							if not match2[2].endswith("cine-adicto2.srt") and (sub == ""): 
								scrapedurl = scrapedurl + "|" + match2[2]
								playWithSubt = "play2"
						except:pass	
					if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")
							
					# A�ade al listado de XBMC
					xbmctools.addnewvideo( CHANNELNAME , playWithSubt , category , "Directo" , scrapedtitle, scrapedurl , scrapedthumbnail, scrapedplot )
				
			else:
				if match.endswith(".srt"):
					scrapedurl = scrapedurl + "|" + match 
					xbmctools.addnewvideo( CHANNELNAME ,"play2"  , category , "Directo" , title + " (V.O.S) - "+subtitle, scrapedurl , thumbnail , plot )
				if 	match.endswith(".xml"):
					sub = "[Subtitulo incompatible con xbmc]"
					xbmctools.addnewvideo( CHANNELNAME ,"play"  , category , "Directo" , title + " (V.O) - %s %s" %(subtitle,sub), scrapedurl , thumbnail , plot )
				scrapedurl = match
				print scrapedurl

	## --------------------------------------------------------------------------------------##
	#            Busca enlaces de videos para el servidor vk.com                             #
	## --------------------------------------------------------------------------------------##
	#http://vkontakte.ru/video_ext.php?oid=93103247&id=149051583&hash=793cde84b05681fa&hd=1
	
	patronvideos = '<iframe src="(http://[^\/]+\/video_ext.php[^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		print " encontro VK.COM :%s" %matches[0]
 		videourl = 	vk.geturl(scrapertools.unescape(matches[0]))
 		xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VK]", videourl , thumbnail , plot )
	
	# Label (top-right)...
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
		
	# Disable sorting...
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )

	# End of directory...
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
Ejemplo n.º 8
0
def listmirrors(params, url, category):
    logger.info("[pelispekes.py] listmirrors")

    title = unicode(xbmc.getInfoLabel("ListItem.Title"), "utf-8")

    thumbnail = urllib.unquote_plus(params.get("thumbnail"))
    plot = unicode(xbmc.getInfoLabel("ListItem.Plot"), "utf-8")

    # Descarga la página de detalle
    # http://pelispekes.com/sorority-row/
    data = scrapertools.cachePage(url)
    #logger.info(data)

    # Extrae el argumento
    patron = '<div class="sinopsis">.*?<li>(.*?)</li>'
    matches = re.compile(patron, re.DOTALL).findall(data)
    if len(matches) > 0:
        plot = matches[0]

    patron = '<div class="page-navigation">(.*?)</table>'
    matches = re.compile(patron, re.DOTALL).findall(data)
    scrapertools.printMatches(matches)
    scrapedtitle = title
    scrapedthumbnail = thumbnail
    scrapedplot = plot

    if len(matches) > 0:
        data = matches[0]
        patron = '<a href="([^"]+)"[^>]+>([^<]+)</a>'
        matches = re.compile(patron, re.DOTALL).findall(data)
        scrapertools.printMatches(matches)

        for match in matches:

            if match[0].endswith(".html"):
                if "/vk/" in match[
                        0]:  #http://pelispekes.com/vk/11223192/674072850/ml3mp2pm9v00nmp2/predators-online.html
                    patron = "http\:\/\/pelispekes.com\/vk\/([^\/]+)\/([^\/]+)\/([^\/]+)\/[^\.]+\.html"
                    matchesvk = re.compile(patron).findall(match[0])
                    scrapedurl = "http://pelispekes.com/modulos/embed/vkontakteX.php?oid=%s&id=%s&hash=%s" % (
                        matchesvk[0][0], matchesvk[0][1], matchesvk[0][2])
                    server = "Directo"
                    xbmctools.addnewvideo(
                        CHANNELNAME, "play", category, server,
                        scrapedtitle + " - %s [VK]" % match[1], scrapedurl,
                        scrapedthumbnail, scrapedplot)

                patron = "http://pelispekes.com/([^/]+)/([^/]+)/[^\.]+.html"  #http://pelispekes.com/playlist/6917/el-equipo-a-online.html
                matches2 = re.compile(patron, re.DOTALL).findall(match[0])

                if matches2[0][0] == "playlist":
                    xmlurl = "http://pelispekes.com/xml/%s.xml" % matches2[0][1]
                    xmldata = scrapertools.cachePage(xmlurl)
                    logger.info("xmldata=" + xmldata)
                    patronvideos = '<track>[^<]+'
                    patronvideos += '<creator>([^<]+)</creator>[^<]+'
                    patronvideos += '<location>([^<]+)</location>.*?'
                    patronvideos += '</track>'
                    matchesxml = re.compile(patronvideos,
                                            re.DOTALL).findall(xmldata)
                    scrapertools.printMatches(matchesxml)
                    for xmlmatch in matchesxml:
                        scrapedurl = xmlmatch[1]
                        #xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , (title.strip() + " (%d) " + videotitle) % j , url , thumbnail , plot )
                        server = "Directo"
                        xbmctools.addnewvideo(
                            CHANNELNAME, "play", category, server,
                            scrapedtitle + " - %s [Directo]" % xmlmatch[0],
                            scrapedurl, scrapedthumbnail, scrapedplot)
                elif matches2[0][0] == "flash":
                    scrapedurl = matches2[0][1]
                    server = "Megavideo"
                    scrapedtitle = scrapedtitle + " - %s" % match[1]
                    scrapedtitle = scrapedtitle.replace("&ntilde;", "ñ")
                    xbmctools.addnewvideo(CHANNELNAME, "play", category,
                                          server, scrapedtitle, scrapedurl,
                                          scrapedthumbnail, scrapedplot)
            elif "vk.php" in match[0]:
                scrapedurl = "http://pelispekes.com/modulos/vkontakteX.php?%s" % match[
                    0].split("?")[1]
                server = "Directo"
                xbmctools.addnewvideo(CHANNELNAME, "play", category, server,
                                      scrapedtitle + " - %s [VK]" % match[1],
                                      scrapedurl, scrapedthumbnail,
                                      scrapedplot)

    patronvideos = '<iframe src="(http://vk[^/]+/video_ext.php[^"]+)"'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    if len(matches) > 0:
        print " encontro VKontakte.ru :%s" % matches[0]
        scrapedurl = vk.geturl(matches[0])
        server = "Directo"
        xbmctools.addnewvideo(CHANNELNAME, "play", category, server,
                              scrapedtitle + " - [VK]", scrapedurl,
                              scrapedthumbnail, scrapedplot)

    patronvideos = '<iframe src="(http://pelispekes.com/modulos/vkontakteX.php[^"]+)"'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    if len(matches) > 0:
        print " encontro VKontakte.ru :%s" % matches[0]
        #scrapedtitle = scrapedtitle.replace("\xf3","ñ")
        scrapedurl = matches[0]
        server = "Directo"
        xbmctools.addnewvideo(CHANNELNAME, "play", category, server,
                              scrapedtitle + " - [VK]", scrapedurl,
                              scrapedthumbnail, scrapedplot)
    # ------------------------------------------------------------------------------------
    # Busca los enlaces a los videos en los servidores habilitados
    # ------------------------------------------------------------------------------------
    listavideos = servertools.findvideos(data)

    for video in listavideos:

        videotitle = video[0]
        url = video[1]
        server = video[2]
        xbmctools.addnewvideo(CHANNELNAME, "play", category, server,
                              scrapedtitle + " - " + videotitle, url,
                              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)
Ejemplo n.º 9
0
def detail(params, url, category):
    logger.info("[peliculasonlineflv.py] detail")

    thumbnail = urllib.unquote_plus(params.get("thumbnail"))
    plot = urllib.unquote_plus(params.get("plot"))
    url1 = url
    # Descarga la página
    data = scrapertools.cachePage(url)
    #logger.info(data)
    patron = 'src="(http://peliculasonlineflvgratis.blogspot.com.+?)"'
    matches = re.compile(patron, re.DOTALL).findall(data)
    if len(matches) > 0:
        data = scrapertools.cachePage(matches[0])
    try:
        title = re.compile("<title>(.+?)</title>").findall(data)[0]
    except:
        title = urllib.unquote_plus(params.get("title"))
    # ------------------------------------------------------------------------------------
    # Busca los enlaces a los videos
    # ------------------------------------------------------------------------------------
    listavideos = servertools.findvideos(data)

    for video in listavideos:
        videotitle = video[0]

        if "myspacecdn" or "facebook" in video[1]:
            continue

        url = video[1].replace("&amp;", "&")
        server = video[2]
        xbmctools.addnewvideo(CHANNELNAME, "play", category, server,
                              title.strip() + " - " + videotitle, url,
                              thumbnail, plot)
    # ------------------------------------------------------------------------------------
    ## --------------------------------------------------------------------------------------##
    #               Busca enlaces a videos .flv o (.mp4 dentro de un xml)                     #
    ## --------------------------------------------------------------------------------------##
    patronvideos = 'file=(http\:\/\/[^\&]+)\&'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    print patronvideos
    c = 0
    if len(matches) > 0:
        print matches
        for match in matches:
            subtitle = "[FLV-Directo]"
            if ("xml" in matches[0]):
                data2 = scrapertools.cachePage(matches[0])
                logger.info("data2=" + data2)
                patronvideos = '<track>.*?'
                patronvideos += '<creator>([^<]+)</creator>[^<]+'
                patronvideos += '<location>([^<]+)</location>[^<]+'
                patronvideos += '</track>'
                matches2 = re.compile(patronvideos, re.DOTALL).findall(data2)
                scrapertools.printMatches(matches2)

                for match2 in matches2:
                    if ".mp4" in match2[1]:
                        subtitle = "[MP4-Directo]"
                    scrapedtitle = '%s (%s) - %s' % (title, match2[0].strip(),
                                                     subtitle)
                    scrapedurl = match2[1].strip()
                    scrapedthumbnail = thumbnail
                    scrapedplot = plot
                    if (DEBUG):
                        logger.info("title=[" + scrapedtitle + "], url=[" +
                                    scrapedurl + "], thumbnail=[" +
                                    scrapedthumbnail + "]")

                    # Añade al listado de XBMC
                    xbmctools.addnewvideo(CHANNELNAME, "play", category,
                                          "Directo", scrapedtitle, scrapedurl,
                                          scrapedthumbnail, scrapedplot)
            else:

                c += 1
                xbmctools.addnewvideo(
                    CHANNELNAME, "play", category, "Directo",
                    title + " - Parte %d/%d " % (c, len(matches)) + subtitle,
                    match, thumbnail, plot)

    patronvideos = 'src="(http://vk[^/]+/video_ext.php[^"]+)"'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    long = len(matches)

    if long > 0:
        for match in matches:
            print " encontro VKontakte.ru :%s" % match[0]
            scrapedurl = vk.geturl(match.replace("&amp;", "&"))
            scrapedtitle = title
            server = "Directo"

            xbmctools.addnewvideo(CHANNELNAME, "play", category, server,
                                  scrapedtitle + " - [VKServer]", scrapedurl,
                                  thumbnail, plot)

    patronvideos = 'http://www.yaflix.com/.+?key=([^"]+)"'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)

    if len(matches) > 0:

        for match in matches:
            link = "http://www.yaflix.com/nuevo/playlist.php?key=" + match
            data2 = scrapertools.cachePage(link)
            #print " encontro yaflix :%s" %match[0]
            patron = "<file>([^<]+)</file>"
            matcheslink = re.compile(patron, re.DOTALL).findall(data2)
            if len(matcheslink) > 0:
                scrapedurl = matcheslink[0]
            else:
                scrapedurl = ""
            scrapedtitle = title
            server = "Directo"

            xbmctools.addnewvideo(CHANNELNAME, "play", category, server,
                                  scrapedtitle + " - [YAFLIX]", scrapedurl,
                                  thumbnail, plot)

    # Label (top-right)...
    xbmcplugin.setPluginCategory(handle=pluginhandle, category=category)

    # Disable sorting...
    xbmcplugin.addSortMethod(handle=pluginhandle,
                             sortMethod=xbmcplugin.SORT_METHOD_NONE)

    # End of directory...
    xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
Ejemplo n.º 10
0
def detail(params,url,category):
	logger.info("[newdivx.py] detail")

	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
	data = scrapertools.cachePage(url)
	#logger.info(data)
	patronvideos = '<p class="Estilo2">([^<]+)</p>'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		title = matches[0]   
	# ------------------------------------------------------------------------------------
	# Busca los enlaces a los videos en los servidores habilitados
	# ------------------------------------------------------------------------------------
	listavideos = servertools.findvideos(data)

	for video in listavideos:
		if "stagevu.com/embed" not in video[1]:
			videotitle = video[0]
			url = video[1]
			server = video[2]
			xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip() + " - " + videotitle , url , thumbnail , plot )
	# ------------------------------------------------------------------------------------
        #--- Busca los videos Directos
    ## ------------------------------------------------------------------------------------##
    #               Busca  enlaces en el servidor  przeklej                                 #
    ## ------------------------------------------------------------------------------------## 
        patronvideos = '<param name="src" value="([^"]+)"'
        matches = re.compile(patronvideos,re.DOTALL).findall(data)
        
        if len(matches)>0:
			if len(matches)==1:
				subtitle = "[Divx-Directo-Przeklej]"
				xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+subtitle, matches[0] , thumbnail , plot )
                 
			else:
				parte = 0
				subtitle = "[Divx-Directo-Przeklej]"
				for match in matches:
					logger.info(" matches = "+match)
					parte = parte + 1
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+subtitle+" "+str(parte), match , thumbnail , plot )
					
   ## --------------------------------------------------------------------------------------##
   #  				 Busca enlaces en el servidor Fishker                                    #
   ## --------------------------------------------------------------------------------------##
	patronvideos = '<a href="(http\:\/\/www.fishker.com\/[^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		data2 = scrapertools.cachePage(matches[0])
		#print data2
		#<param name="flashvars" value="comment=Q&amp;m=video&amp;file=http://fish14.st.fishker.com/videos/1249504.flv?c=3948597662&amp;st=/plstyle.txt?video=1"
		patron = 'file=([^"]+)"'
		matches2 = re.compile(patron,re.DOTALL).findall(data2)
		if len(matches2)>0:
			videourl = matches2[0].replace("&amp;","&")
			subtitle = "[FLV-Directo-Fishker]"
			xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+subtitle, videourl , thumbnail , plot )
			
   ## --------------------------------------------------------------------------------------##
   #  				 Busca enlaces en el servidor Cinshare                                  #
   ## --------------------------------------------------------------------------------------##
	
	patronvideos = '<iframe src="(http://www.cinshare.com/[^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		####
		'''
		data2 = scrapertools.cachePage(matches[0])
		#print data2
		
		patron = '<param name="src" value="([^"]+)"'
		matches2 = re.compile(patron,re.DOTALL).findall(data2)
		if len(matches2)>0:
		'''
		####
		import cinshare
		videourl = matches[0]
		subtitle = "[divx-Directo-Cinshare]"
		xbmctools.addnewvideo( CHANNELNAME , "play" , category ,"Cinshare", title + " - "+subtitle, videourl , thumbnail , plot )
			
	## --------------------------------------------------------------------------------------##
	#               Busca enlaces a videos .flv o (.mp4 dentro de un xml)                     #
	## --------------------------------------------------------------------------------------##
	patronvideos = 'file=(http\:\/\/[^\&]+)\&'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		subtitle = "[FLV-Directo]"
		if ("xml" in matches[0]):
			data2 = scrapertools.cachePage(matches[0])
			logger.info("data2="+data2)
			patronvideos  = '<track>.*?'
			patronvideos += '<title>([^<]+)</title>(?:[^<]+'
			patronvideos += '<annotation>([^<]+)</annotation>[^<]+|[^<]+)'
			patronvideos += '<location>([^<]+)</location>[^<]+'
			patronvideos += '</track>'
			matches = re.compile(patronvideos,re.DOTALL).findall(data2)
			scrapertools.printMatches(matches)

			for match in matches:
				if ".mp4" in match[2]:
					subtitle = "[MP4-Directo]"
				scrapedtitle = '%s (%s) - %s  %s' %(title,match[1].strip(),match[0],subtitle)
				scrapedurl = match[2].strip()
				scrapedthumbnail = thumbnail
				scrapedplot = plot
				if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

				# A�ade al listado de XBMC
				xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , scrapedtitle, scrapedurl , scrapedthumbnail, scrapedplot )
		else:
			
			xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+subtitle, matches[0] , thumbnail , plot )
			
	## --------------------------------------------------------------------------------------##
	#            Busca enlaces a video en el servidor Dailymotion                             #
	## --------------------------------------------------------------------------------------##
	patronvideos = '<param name="movie" value="http://www.dailymotion.com/swf/video/([^\_]+)\_[^"]+"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	playWithSubt = "play"
	if len(matches)>0:
		daily = 'http://www.dailymotion.com/video/%s'%matches[0]
		data2 = scrapertools.cachePage(daily)
		
		# Busca los subtitulos en espa�ol 
		subtitulo = re.compile('%22es%22%3A%22(.+?)%22').findall(data2)
		subtit = urllib.unquote(subtitulo[0])
		subtit = subtit.replace("\/","/")
		#subt_ok = downloadstr(subtit,title)
		#print "subtitulo subt_ok = %s" % str(subt_ok)
				
		# Busca el enlace al video con formato FLV 	
		Lowres=re.compile('%22sdURL%22%3A%22(.+?)%22').findall(data2)
		if len(Lowres)>0:
			videourl = urllib.unquote(Lowres[0])
			videourl = videourl.replace("\/","/")
			if len(subtit)>0:
				videourl = videourl + "|" + subtit
				playWithSubt = "play2"
			subtitle = "[FLV-Directo-Dailymotion]"
			xbmctools.addnewvideo( CHANNELNAME , playWithSubt , category , "Directo" , title + " - "+subtitle, videourl , thumbnail , plot )
		
		# Busca el enlace al video con formato HQ (H264)		
		Highres=re.compile('%22hqURL%22%3A%22(.+?)%22').findall(data2)
		if len(Highres)>0:
			videourl = urllib.unquote(Highres[0])
			videourl = videourl.replace("\/","/")
			if len(subtit)>0:
				videourl = videourl + "|" + subtit
				playWithSubt = "play2"			
			subtitle = "[h264-Directo-Dailymotion-este video no es soportado en versiones antiguas o xbox plataforma]"
			xbmctools.addnewvideo( CHANNELNAME , playWithSubt , category , "Directo" , title + " - "+subtitle, videourl , thumbnail , plot )
	## --------------------------------------------------------------------------------------##
	#            Busca enlaces a video en el servidor Gigabyteupload.com                      #
	## --------------------------------------------------------------------------------------##

	patronvideos = '<a href="(http://www.gigabyteupload.com/[^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		print " encontro: %s" %matches[0]
		import gigabyteupload as giga
		videourl = giga.geturl(matches[0])
		if len(videourl)>0:
			subtitle = "[Divx-Directo-Gigabyteupload]"
			xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+subtitle, videourl , thumbnail , plot )
	## --------------------------------------------------------------------------------------##
	#            Busca enlaces de videos para el servidor vk.com                             #
	## --------------------------------------------------------------------------------------##
	'''
	var video_host = 'http://cs12644.vk.com/';
	var video_uid = '87155741';
	var video_vtag = 'fc697084d3';
	var video_no_flv = 1;
	var video_max_hd = '1'
	'''
	patronvideos = '<iframe src="(http:\/\/vk[^\/]+\/video_ext.php[^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		print " encontro VKServer :%s" %matches[0]
 		videourl = 	vk.geturl(matches[0])
 		xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VKServer]", videourl , thumbnail , plot )
 	"""	
		data2 = scrapertools.cachePage(matches[0])
		print data2
		
		patron  = "var video_host = '([^']+)'.*?"
		patron += "var video_uid = '([^']+)'.*?"
		patron += "var video_vtag = '([^']+)'.*?"
		patron += "var video_no_flv = ([^;]+);.*?"
		patron += "var video_max_hd = '([^']+)'"
		matches2 = re.compile(patron,re.DOTALL).findall(data2)
		if len(matches2)>0:    #http://cs12387.vk.com/u87155741/video/fe5ee11ddb.360.mp4
			for match in matches2:
				if match[3].strip() == "0":
					tipo = "flv"
					videourl = "%s/u%s/video/%s.%s" % (match[0],match[1],match[2],tipo)
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VK] [%s]" %tipo, videourl , thumbnail , plot )
				else:
					tipo = "360.mp4"
					videourl = "%s/u%s/video/%s.%s" % (match[0],match[1],match[2],tipo)
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VK] [%s]" %tipo, videourl , thumbnail , plot )
					tipo = "240.mp4"
					videourl = "%s/u%s/video/%s.%s" % (match[0],match[1],match[2],tipo)
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VK] [%s]" %tipo, videourl , thumbnail , plot )
	"""	
	
	# Label (top-right)...
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
		
	# Disable sorting...
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )

	# End of directory...
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
Ejemplo n.º 11
0
def detail(params, url, category):
    logger.info("[newdivx.py] detail")

    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
    data = scrapertools.cachePage(url)
    #logger.info(data)
    patronvideos = '<p class="Estilo2">([^<]+)</p>'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    if len(matches) > 0:
        title = matches[0]
    # ------------------------------------------------------------------------------------
    # Busca los enlaces a los videos en los servidores habilitados
    # ------------------------------------------------------------------------------------
    listavideos = servertools.findvideos(data)

    for video in listavideos:
        if "stagevu.com/embed" not in video[1]:
            videotitle = video[0]
            url = video[1]
            server = video[2]
            xbmctools.addnewvideo(CHANNELNAME, "play", category, server,
                                  title.strip() + " - " + videotitle, url,
                                  thumbnail, plot)
    # ------------------------------------------------------------------------------------
    #--- Busca los videos Directos
    ## ------------------------------------------------------------------------------------##
    #               Busca  enlaces en el servidor  przeklej                                 #
    ## ------------------------------------------------------------------------------------##
    patronvideos = '<param name="src" value="([^"]+)"'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)

    if len(matches) > 0:
        if len(matches) == 1:
            subtitle = "[Divx-Directo-Przeklej]"
            xbmctools.addnewvideo(CHANNELNAME, "play", category, "Directo",
                                  title + " - " + subtitle, matches[0],
                                  thumbnail, plot)

        else:
            parte = 0
            subtitle = "[Divx-Directo-Przeklej]"
            for match in matches:
                logger.info(" matches = " + match)
                parte = parte + 1
                xbmctools.addnewvideo(
                    CHANNELNAME, "play", category, "Directo",
                    title + " - " + subtitle + " " + str(parte), match,
                    thumbnail, plot)

## --------------------------------------------------------------------------------------##
#  				 Busca enlaces en el servidor Fishker                                    #
## --------------------------------------------------------------------------------------##
    patronvideos = '<a href="(http\:\/\/www.fishker.com\/[^"]+)"'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    if len(matches) > 0:
        data2 = scrapertools.cachePage(matches[0])
        #print data2
        #<param name="flashvars" value="comment=Q&amp;m=video&amp;file=http://fish14.st.fishker.com/videos/1249504.flv?c=3948597662&amp;st=/plstyle.txt?video=1"
        patron = 'file=([^"]+)"'
        matches2 = re.compile(patron, re.DOTALL).findall(data2)
        if len(matches2) > 0:
            videourl = matches2[0].replace("&amp;", "&")
            subtitle = "[FLV-Directo-Fishker]"
            xbmctools.addnewvideo(CHANNELNAME, "play", category, "Directo",
                                  title + " - " + subtitle, videourl,
                                  thumbnail, plot)

## --------------------------------------------------------------------------------------##
#  				 Busca enlaces en el servidor Cinshare                                  #
## --------------------------------------------------------------------------------------##

    patronvideos = '<iframe src="(http://www.cinshare.com/[^"]+)"'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    if len(matches) > 0:
        ####
        '''
		data2 = scrapertools.cachePage(matches[0])
		#print data2
		
		patron = '<param name="src" value="([^"]+)"'
		matches2 = re.compile(patron,re.DOTALL).findall(data2)
		if len(matches2)>0:
		'''
        ####
        import cinshare
        videourl = matches[0]
        subtitle = "[divx-Directo-Cinshare]"
        xbmctools.addnewvideo(CHANNELNAME, "play", category, "Cinshare",
                              title + " - " + subtitle, videourl, thumbnail,
                              plot)

    ## --------------------------------------------------------------------------------------##
    #               Busca enlaces a videos .flv o (.mp4 dentro de un xml)                     #
    ## --------------------------------------------------------------------------------------##
    patronvideos = 'file=(http\:\/\/[^\&]+)\&'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    if len(matches) > 0:
        subtitle = "[FLV-Directo]"
        if ("xml" in matches[0]):
            data2 = scrapertools.cachePage(matches[0])
            logger.info("data2=" + data2)
            patronvideos = '<track>.*?'
            patronvideos += '<title>([^<]+)</title>(?:[^<]+'
            patronvideos += '<annotation>([^<]+)</annotation>[^<]+|[^<]+)'
            patronvideos += '<location>([^<]+)</location>[^<]+'
            patronvideos += '</track>'
            matches = re.compile(patronvideos, re.DOTALL).findall(data2)
            scrapertools.printMatches(matches)

            for match in matches:
                if ".mp4" in match[2]:
                    subtitle = "[MP4-Directo]"
                scrapedtitle = '%s (%s) - %s  %s' % (title, match[1].strip(),
                                                     match[0], subtitle)
                scrapedurl = match[2].strip()
                scrapedthumbnail = thumbnail
                scrapedplot = plot
                if (DEBUG):
                    logger.info("title=[" + scrapedtitle + "], url=[" +
                                scrapedurl + "], thumbnail=[" +
                                scrapedthumbnail + "]")

                # A�ade al listado de XBMC
                xbmctools.addnewvideo(CHANNELNAME, "play", category, "Directo",
                                      scrapedtitle, scrapedurl,
                                      scrapedthumbnail, scrapedplot)
        else:

            xbmctools.addnewvideo(CHANNELNAME, "play", category, "Directo",
                                  title + " - " + subtitle, matches[0],
                                  thumbnail, plot)

    ## --------------------------------------------------------------------------------------##
    #            Busca enlaces a video en el servidor Dailymotion                             #
    ## --------------------------------------------------------------------------------------##
    patronvideos = '<param name="movie" value="http://www.dailymotion.com/swf/video/([^\_]+)\_[^"]+"'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    playWithSubt = "play"
    if len(matches) > 0:
        daily = 'http://www.dailymotion.com/video/%s' % matches[0]
        data2 = scrapertools.cachePage(daily)

        # Busca los subtitulos en espa�ol
        subtitulo = re.compile('%22es%22%3A%22(.+?)%22').findall(data2)
        subtit = urllib.unquote(subtitulo[0])
        subtit = subtit.replace("\/", "/")
        #subt_ok = downloadstr(subtit,title)
        #print "subtitulo subt_ok = %s" % str(subt_ok)

        # Busca el enlace al video con formato FLV
        Lowres = re.compile('%22sdURL%22%3A%22(.+?)%22').findall(data2)
        if len(Lowres) > 0:
            videourl = urllib.unquote(Lowres[0])
            videourl = videourl.replace("\/", "/")
            if len(subtit) > 0:
                videourl = videourl + "|" + subtit
                playWithSubt = "play2"
            subtitle = "[FLV-Directo-Dailymotion]"
            xbmctools.addnewvideo(CHANNELNAME, playWithSubt, category,
                                  "Directo", title + " - " + subtitle,
                                  videourl, thumbnail, plot)

        # Busca el enlace al video con formato HQ (H264)
        Highres = re.compile('%22hqURL%22%3A%22(.+?)%22').findall(data2)
        if len(Highres) > 0:
            videourl = urllib.unquote(Highres[0])
            videourl = videourl.replace("\/", "/")
            if len(subtit) > 0:
                videourl = videourl + "|" + subtit
                playWithSubt = "play2"
            subtitle = "[h264-Directo-Dailymotion-este video no es soportado en versiones antiguas o xbox plataforma]"
            xbmctools.addnewvideo(CHANNELNAME, playWithSubt, category,
                                  "Directo", title + " - " + subtitle,
                                  videourl, thumbnail, plot)
    ## --------------------------------------------------------------------------------------##
    #            Busca enlaces a video en el servidor Gigabyteupload.com                      #
    ## --------------------------------------------------------------------------------------##

    patronvideos = '<a href="(http://www.gigabyteupload.com/[^"]+)"'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    if len(matches) > 0:
        print " encontro: %s" % matches[0]
        import gigabyteupload as giga
        videourl = giga.geturl(matches[0])
        if len(videourl) > 0:
            subtitle = "[Divx-Directo-Gigabyteupload]"
            xbmctools.addnewvideo(CHANNELNAME, "play", category, "Directo",
                                  title + " - " + subtitle, videourl,
                                  thumbnail, plot)
    ## --------------------------------------------------------------------------------------##
    #            Busca enlaces de videos para el servidor vk.com                             #
    ## --------------------------------------------------------------------------------------##
    '''
	var video_host = 'http://cs12644.vk.com/';
	var video_uid = '87155741';
	var video_vtag = 'fc697084d3';
	var video_no_flv = 1;
	var video_max_hd = '1'
	'''
    patronvideos = '<iframe src="(http:\/\/vk[^\/]+\/video_ext.php[^"]+)"'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    if len(matches) > 0:
        print " encontro VKServer :%s" % matches[0]
        videourl = vk.geturl(matches[0])
        xbmctools.addnewvideo(CHANNELNAME, "play", category, "Directo",
                              title + " - " + "[VKServer]", videourl,
                              thumbnail, plot)
    """	
		data2 = scrapertools.cachePage(matches[0])
		print data2
		
		patron  = "var video_host = '([^']+)'.*?"
		patron += "var video_uid = '([^']+)'.*?"
		patron += "var video_vtag = '([^']+)'.*?"
		patron += "var video_no_flv = ([^;]+);.*?"
		patron += "var video_max_hd = '([^']+)'"
		matches2 = re.compile(patron,re.DOTALL).findall(data2)
		if len(matches2)>0:    #http://cs12387.vk.com/u87155741/video/fe5ee11ddb.360.mp4
			for match in matches2:
				if match[3].strip() == "0":
					tipo = "flv"
					videourl = "%s/u%s/video/%s.%s" % (match[0],match[1],match[2],tipo)
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VK] [%s]" %tipo, videourl , thumbnail , plot )
				else:
					tipo = "360.mp4"
					videourl = "%s/u%s/video/%s.%s" % (match[0],match[1],match[2],tipo)
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VK] [%s]" %tipo, videourl , thumbnail , plot )
					tipo = "240.mp4"
					videourl = "%s/u%s/video/%s.%s" % (match[0],match[1],match[2],tipo)
					xbmctools.addnewvideo( CHANNELNAME , "play" , category , "Directo" , title + " - "+"[VK] [%s]" %tipo, videourl , thumbnail , plot )
	"""

    # Label (top-right)...
    xbmcplugin.setPluginCategory(handle=pluginhandle, category=category)

    # Disable sorting...
    xbmcplugin.addSortMethod(handle=pluginhandle,
                             sortMethod=xbmcplugin.SORT_METHOD_NONE)

    # End of directory...
    xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
Ejemplo n.º 12
0
def detail(params, url, category):
    logger.info("[nolomires.py] detail")

    title = acentos(urllib.unquote_plus(params.get("title")))
    thumbnail = urllib.unquote_plus(params.get("thumbnail"))
    plot = ""
    scrapedurl = ""
    # Descarga la p�gina
    data = scrapertools.cachePage(url)
    #logger.info(data)
    # Extrae el argumento
    patronarg = '<h[2-3]>(<span style.*?)</p>'
    matches = re.compile(patronarg, re.DOTALL).findall(data)
    if len(matches) > 0:
        plot = re.sub("<[^>]+>", " ", matches[0])
    patronthumb = '<div id="textimg"><img src="([^"]+)"'
    matches = re.compile(patronthumb, re.DOTALL).findall(data)
    if len(matches) > 0:
        thumbnail = matches[0]
    # ------------------------------------------------------------------------------------
    # Busca los enlaces a los videos en los servidores habilitados
    # ------------------------------------------------------------------------------------

    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,
                              thumbnail, plot)

    ## --------------------------------------------------------------------------------------##
    #               Busca enlaces a videos .flv o (.mp4 dentro de un xml)                     #
    ## --------------------------------------------------------------------------------------##
    patronvideos = 'file=(http\:\/\/[^\&]+)\&'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    scrapertools.printMatches(matches)
    playWithSubt = "play"
    c = 0
    if len(matches) > 0:
        for match in matches:
            print "link xml :%s" % match
            subtitle = "[FLV-Directo]"
            c += 1
            sub = ""
            if ("/xml" in match):
                data2 = scrapertools.cachePage(match)
                logger.info("data2=" + data2)
                patronvideos = '<track>.*?'
                patronvideos += '<title>([^<]+)</title>[^<]+'
                patronvideos += '<location>([^<]+)</location>(?:[^<]+'
                patronvideos += '<meta rel="type">video</meta>[^<]+|[^<]+)'
                patronvideos += '<meta rel="captions">([^<]+)</meta>[^<]+'
                patronvideos += '</track>'
                matches2 = re.compile(patronvideos, re.DOTALL).findall(data2)
                scrapertools.printMatches(matches)
                if len(matches2) == 0:
                    newpatron = '<title>([^<]+)</title>[^<]+<location>([^<]+)</location>'
                    matches2 = re.compile(newpatron, re.DOTALL).findall(data2)
                    sub = "None"
                for match2 in matches2:

                    try:
                        if match2[2].endswith(
                                ".xml"
                        ):  # Subtitulos con formato xml son incompatibles con XBMC
                            sub = "[Subtitulo incompatible con xbmc]"
                            playWithSubt = "play"
                    except:
                        pass
                    if ".mp4" in match2[1]:
                        subtitle = "[MP4-Directo]"
                    scrapedtitle = '%s (castellano) - %s  %s' % (
                        title, match2[0], subtitle)

                    scrapedurl = match2[1].strip()
                    scrapedthumbnail = thumbnail
                    scrapedplot = plot
                    if ("cast.xml" or "mirror.xml") not in match and sub == "":
                        scrapedtitle = '%s (V.O.S) - %s  %s %s' % (
                            title, match2[0], subtitle, sub)
                        try:
                            if not match2[2].endswith("cine-adicto2.srt") and (
                                    sub == ""):
                                scrapedurl = scrapedurl + "|" + match2[2]
                                playWithSubt = "play2"
                        except:
                            pass
                    if (DEBUG):
                        logger.info("title=[" + scrapedtitle + "], url=[" +
                                    scrapedurl + "], thumbnail=[" +
                                    scrapedthumbnail + "]")

                    # A�ade al listado de XBMC
                    xbmctools.addnewvideo(CHANNELNAME, playWithSubt, category,
                                          "Directo", scrapedtitle, scrapedurl,
                                          scrapedthumbnail, scrapedplot)

            else:
                if match.endswith(".srt"):
                    scrapedurl = scrapedurl + "|" + match
                    xbmctools.addnewvideo(CHANNELNAME, "play2", category,
                                          "Directo",
                                          title + " (V.O.S) - " + subtitle,
                                          scrapedurl, thumbnail, plot)
                if match.endswith(".xml"):
                    sub = "[Subtitulo incompatible con xbmc]"
                    xbmctools.addnewvideo(
                        CHANNELNAME, "play", category, "Directo",
                        title + " (V.O) - %s %s" % (subtitle, sub), scrapedurl,
                        thumbnail, plot)
                scrapedurl = match
                print scrapedurl

    ## --------------------------------------------------------------------------------------##
    #            Busca enlaces de videos para el servidor vk.com                             #
    ## --------------------------------------------------------------------------------------##
    #http://vkontakte.ru/video_ext.php?oid=93103247&id=149051583&hash=793cde84b05681fa&hd=1

    patronvideos = '<iframe src="(http://[^\/]+\/video_ext.php[^"]+)"'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    if len(matches) > 0:
        print " encontro VK.COM :%s" % matches[0]
        videourl = vk.geturl(scrapertools.unescape(matches[0]))
        xbmctools.addnewvideo(CHANNELNAME, "play", category, "Directo",
                              title + " - " + "[VK]", videourl, thumbnail,
                              plot)

    # Label (top-right)...
    xbmcplugin.setPluginCategory(handle=pluginhandle, category=category)

    # Disable sorting...
    xbmcplugin.addSortMethod(handle=pluginhandle,
                             sortMethod=xbmcplugin.SORT_METHOD_NONE)

    # End of directory...
    xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
Ejemplo n.º 13
0
def listmirrors(params,url,category):
	logger.info("[pelispekes.py] listmirrors")

	title = unicode( xbmc.getInfoLabel( "ListItem.Title" ), "utf-8" )
	
	thumbnail = urllib.unquote_plus( params.get("thumbnail") )
	plot = unicode( xbmc.getInfoLabel( "ListItem.Plot" ), "utf-8" )
	

	# Descarga la página de detalle
	# http://pelispekes.com/sorority-row/
	data = scrapertools.cachePage(url)
	#logger.info(data)
	
	# Extrae el argumento
	patron = '<div class="sinopsis">.*?<li>(.*?)</li>'
	matches = re.compile(patron,re.DOTALL).findall(data)
	if len(matches)>0:
		plot = matches[0]

	
	

	patron = '<div class="page-navigation">(.*?)</table>'
	matches = re.compile(patron,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)
	scrapedtitle = title
	scrapedthumbnail = thumbnail
	scrapedplot = plot
	
	if len(matches)>0:
		data = matches[0]
		patron  = '<a href="([^"]+)"[^>]+>([^<]+)</a>'
		matches = re.compile(patron,re.DOTALL).findall(data)
		scrapertools.printMatches(matches)
		
		for match in matches:
			
			
			
			if match[0].endswith(".html"):
				if "/vk/" in match[0]:  #http://pelispekes.com/vk/11223192/674072850/ml3mp2pm9v00nmp2/predators-online.html
					patron = "http\:\/\/pelispekes.com\/vk\/([^\/]+)\/([^\/]+)\/([^\/]+)\/[^\.]+\.html"
					matchesvk = re.compile(patron).findall(match[0])
					scrapedurl = "http://pelispekes.com/modulos/embed/vkontakteX.php?oid=%s&id=%s&hash=%s" %(matchesvk[0][0],matchesvk[0][1],matchesvk[0][2])
					server = "Directo"
					xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle+" - %s [VK]" %match[1] , scrapedurl , scrapedthumbnail, scrapedplot )
				  			
			
			
				patron   = "http://pelispekes.com/([^/]+)/([^/]+)/[^\.]+.html"    #http://pelispekes.com/playlist/6917/el-equipo-a-online.html
				matches2 = re.compile(patron,re.DOTALL).findall(match[0])
								
				if matches2[0][0] == "playlist":
					xmlurl = "http://pelispekes.com/xml/%s.xml" %matches2[0][1]
					xmldata = scrapertools.cachePage(xmlurl)
					logger.info("xmldata="+xmldata)
					patronvideos  = '<track>[^<]+'
					patronvideos += '<creator>([^<]+)</creator>[^<]+'
					patronvideos += '<location>([^<]+)</location>.*?'
					patronvideos += '</track>'
					matchesxml = re.compile(patronvideos,re.DOTALL).findall(xmldata)
					scrapertools.printMatches(matchesxml)
					for xmlmatch in matchesxml:
						scrapedurl = xmlmatch[1]
						#xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , (title.strip() + " (%d) " + videotitle) % j , url , thumbnail , plot )
						server = "Directo"
						xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle+" - %s [Directo]" %xmlmatch[0] , scrapedurl , scrapedthumbnail, scrapedplot )
				elif matches2[0][0] == "flash":
					scrapedurl = matches2[0][1]
					server = "Megavideo"
					scrapedtitle = scrapedtitle+" - %s" %match[1]
					scrapedtitle = scrapedtitle.replace("&ntilde;","ñ")
					xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot )
			elif "vk.php" in match[0]:
				scrapedurl = "http://pelispekes.com/modulos/vkontakteX.php?%s" %match[0].split("?")[1]
				server = "Directo"
				xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle+" - %s [VK]" %match[1] , scrapedurl , scrapedthumbnail, scrapedplot )
	
	patronvideos = '<iframe src="(http://vk[^/]+/video_ext.php[^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		print " encontro VKontakte.ru :%s" %matches[0]
		scrapedurl = 	vk.geturl(matches[0])	
		server = "Directo"
		xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle+" - [VK]" , scrapedurl , scrapedthumbnail, scrapedplot )

	patronvideos = '<iframe src="(http://pelispekes.com/modulos/vkontakteX.php[^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		print " encontro VKontakte.ru :%s" %matches[0]
		#scrapedtitle = scrapedtitle.replace("\xf3","ñ")
		scrapedurl = 	matches[0]	
		server = "Directo"
		xbmctools.addnewvideo( CHANNELNAME , "play" , category ,server, scrapedtitle+" - [VK]" , scrapedurl , scrapedthumbnail, scrapedplot )	
	# ------------------------------------------------------------------------------------
	# Busca los enlaces a los videos en los servidores habilitados
	# ------------------------------------------------------------------------------------
	listavideos = servertools.findvideos(data)

	for video in listavideos:
		
		videotitle = video[0]
		url = video[1]
		server = video[2]
		xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , scrapedtitle + " - " + videotitle , url , 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 )